コード例 #1
0
ファイル: PackageLeaf.cs プロジェクト: P1nkL1on/VisualLoader
        void Recursive(Edge where, Random rnd)
        {
            Console.Clear();
            deep++;
            path.Add(where.to.GetName);
            status.Add("processing");
            Namegen.Stat("\nDeep:", deep);
            Namegen.Stat("Loaded packages:", loaded);
            Console.WriteLine("\n");
            if (path.Count > MaxVisiblePath)
            {
                Console.WriteLine("...");
            }
            for (int i = Math.Max(0, path.Count - MaxVisiblePath); i < path.Count; i++)
            {
                Namegen.Stat("-> " + path[i], status[i]);
            }
            where.to.Info();


            Loader.MakeLoader();
            int bytesLoaded = 0, bytesNeed = where.to.GetBytes;

            while (where.to.GetBytes > 0)
            {
                Thread.Sleep(10);//(rnd.Next(2 * deep, 10 * deep) / 10 + 5);
                Loader.ChangeLoader(bytesLoaded, bytesNeed);
                int geted = where.StealBytes(10000, rnd);
                if (geted >= 0)
                {
                    bytesLoaded += geted;
                }
                else
                {
                    Namegen.Stat("\n\n\nError:", where.err.ToString());
                    Thread.Sleep(1500);
                    return;
                }
            }
            Loader.ClearLoader();
            Console.WriteLine("\n\n" + where.to.GetName + " loaded!");
            loaded++;
            status[status.Count - 1] = "loaded";

            Thread.Sleep(2);
            for (int i = 0; i < where.to.files.Count; i++)
            {
                if (where.to.files[i].to.GetBytes > 0)
                {
                    Recursive(where.to.files[i], rnd);
                }
            }
            path.RemoveAt(path.Count - 1);
            status.RemoveAt(status.Count - 1);
            deep--;
            Thread.Sleep(50);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.Black;
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();

            Console.SetWindowSize(Console.LargestWindowWidth * 7 / 8, Console.LargestWindowHeight * 7 / 8);
            Console.SetWindowPosition(0, 0);
            Console.ReadKey();

            Namegen.makeTree(3000).StartLoading(new Random());
            Console.ReadKey();
        }
コード例 #3
0
ファイル: PackageLeaf.cs プロジェクト: P1nkL1on/VisualLoader
        public void StartLoading(Random rnd)
        {
            Console.Clear();
            Console.WriteLine("Initialising root;");
            Loader.MakeLoader();
            for (int i = 0; i < 1000; i++)
            {
                Thread.Sleep(rnd.Next(2, 10));
                Loader.ChangeLoader(i / 10, 100);
                i += rnd.Next(4);
            }
            Loader.ClearLoader();
            Console.WriteLine("\n\nRoot initialised;\nPress any key to start downloading ALL the shit...");

            deep = 0;
            Recursive(userroot.files[0], rnd);
            Console.Clear();
            Console.WriteLine("\tOperation finished!");
            Namegen.Stat("Deep:", deep);
            Namegen.Stat("Loaded packages:", loaded);
        }