static void Main(string[] args)
        {
            Console.Title = $"YTBot | {gitRepo}";

            logo(ConsoleColor.Cyan);

            ThreadPool.GetMaxThreads(out int _uselessStuff, out int ioThreadsCount);

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Max Thread Count: ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine(ioThreadsCount);
            Console.WriteLine();

            logo(ConsoleColor.Cyan);

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Enter Video ID: ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            id = Console.ReadLine().Trim();

            logo(ConsoleColor.Cyan);

            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Enter Threads Count: ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            threadsCount            = Convert.ToInt32(Console.ReadLine().Trim());

            while (true)
            {
                logo(ConsoleColor.Cyan);

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Select proxy type:\r\n0. Public (Socks4 autoscrape)\r\n1. Http/s\r\n2. Socks4\r\n3. Socks5");

                Console.Write("Your choice: ");
                Console.ForegroundColor = ConsoleColor.Cyan;

                char k = Console.ReadKey().KeyChar;

                try
                {
                    int key = int.Parse(k.ToString());

                    if (key < 0 || key > 3)
                    {
                        throw new NotImplementedException();
                    }

                    proxyType = (UsedProxyType)key;
                }
                catch
                {
                    continue;
                }

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine($"\r\nSelected {proxyType} proxy");

                break;
            }

            if (proxyType != Public)
            {
                Console.Write("Path to proxy list");
                scraper = new ProxyScraper(Console.ReadLine().Trim());
            }

            else
            {
                scraper = new ProxyScraper();
            }

            logo(ConsoleColor.Green);

            List <Thread> threads = new List <Thread>();

            for (int i = 0; i < threadsCount; i++)
            {
                Thread t = new Thread(worker);
                t.Start();
                threads.Add(t);
            }
            Console.ReadKey();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.Title = $"YTBot | {gitRepo}";
            Logo(ConsoleColor.Cyan);

            id           = dialog("Enter Video ID");
            threadsCount = Convert.ToInt32(dialog("Enter Threads Count"));

            while (true)
            {
                Logo(ConsoleColor.Cyan);

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine("Select proxy type:\r\n0. Public (Socks4 autoscrape)\r\n1. Http/s\r\n2. Socks4\r\n3. Socks5");

                Console.Write("Your choice: ");
                Console.ForegroundColor = ConsoleColor.Cyan;

                char k = Console.ReadKey().KeyChar;

                try
                {
                    int key = int.Parse(k.ToString());

                    if (key < 0 || key > 3)
                    {
                        throw new NotImplementedException();
                    }

                    proxyType = (UsedProxyType)key;
                }
                catch
                {
                    continue;
                }

                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine($"\r\nSelected {proxyType} proxy");

                break;
            }

            if (proxyType != Public)
            {
                Console.Write("Path to proxy list");

                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "Proxy list|*.txt";
                ofd.ShowDialog();

                scraper = new ProxyScraper(ofd.FileName);
            }

            else
            {
                scraper = new ProxyScraper();
            }

            Logo(ConsoleColor.Green);

            List <Thread> threads = new List <Thread>();

            Thread logWorker = new Thread(Log);

            logWorker.Start();
            threads.Add(logWorker);

            for (int i = 0; i < threadsCount; i++)
            {
                Thread t = new Thread(Worker);
                t.Start();
                threads.Add(t);
            }

            foreach (Thread t in threads)
            {
                t.Join();
            }

            Console.ReadKey();
        }