9 Eylül 2015 Çarşamba

c# matrix title yapımı

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace MatrixConsole
{
    class Program
    {
        public static Random random = new Random();
        public static String appname = "Matrix Console";
        public static bool animated = true;

        static void Main(string[] args)
        {
            Thread mThread = new Thread(MatrixConsole);
            mThread.Start();
            while(mThread.IsAlive)
            {
                Thread.Sleep(500);
            }
        }


       private static void MatrixConsole()
       {
            while (animated)
            {
                int i = 0, j = 0, k = 0, r = 0, s = 0, t = 0, u = 300, umin = 8, umax = 10,
                    smin = 20, smax = 40, lmin = 1, lmax = 100, rmin = 5, rmax = 8, hmin = 1,
                    hmax = 8, mmin = 500, mmax = 900;
                String cl = "", rl = "", mt = "", ct = "", h = "";
                char[] titleArr = appname.ToCharArray();
                while (i < appname.Length)
                {
                    cl = titleArr[i].ToString();
                    r = random.Next(rmin, rmax);
                    j = 0;
                    while (j <= r)
                    {
                        s = random.Next(lmin, lmax);
                        rl = GenLetter(s);
                        s = random.Next(hmin, hmax);
                        if (s > (hmax / 2))
                        {
                            h = "";
                            t = 0;
                            while (t <= s)
                            {
                                h += " ";
                                t++;
                            }
                        }
                        else { h = ""; }
                        mt = ct + h + rl;
                        if (h != "")
                        {
                            k = 0;
                            while (k < h.Length)
                            {
                                h = h.Substring(k, h.Length - k - 1);
                                mt = ct + h + rl;
                                Console.Title = mt;
                                k++;
                                s = random.Next(smin, smax);
                                Thread.Sleep(s);
                                s = random.Next(lmin, lmax);
                                rl = GenLetter(s);
                            }
                        }
                        else { Console.Title = mt; }
                        j++;
                        s = random.Next(1, 3);
                        if (s > 1) { u -= r; }
                        if (u < umin) { u = umax; }
                        s = random.Next(umin, u);
                        Thread.Sleep(s);
                    }
                    ct += cl;
                    Console.Title = ct;
                    i++;
                }
                r = random.Next(mmin, mmax);
                Thread.Sleep(r);
            }
        }

        private static String GenLetter(int r)
        {
            return ((char)('a' + (r - 1))).ToString();
        }
    }
}