static void Main(string[] args)
        {          
            Console.InputEncoding = System.Text.Encoding.UTF8;            
            Console.SetWindowSize(120, 25);

            Utility os = new Utility();
            os.Root();

            if (args.Length == 0)
            {
                Interface category = new Interface();
                ResourceManager lang = category.Lang_Text();
                new Run(lang);                
            }
            else
            {
                new Run(args);
            }
        }
        /// <summary>
        /// retun a list random of string
        /// </summary>
        /// <param name="charsetSelecting"></param>
        /// <param name="numberLine"></param>
        /// <param name="numberOfAllCombination"></param>
        /// <param name="saveFile"></param>
        /// <param name="zip"></param>       
        /// <param name="numberOfChar"></param>
        /// <param name="filePath"></param>
        /// <param name="extension"></param>
        public void GenerateRandomString(List<string> charsetSelecting, BigInteger numberLine, bool saveFile, BigInteger numberOfAllCombination,  bool zip,  int numberOfChar, string pathBackUpFiles, string extension)
        {
            Utility make = new Utility();
            BigInteger cpt = 0;

            if (saveFile)
            {
                BigInteger iMakeFile = 0;

                while  (numberOfAllCombination >= cpt)
                {
                    if (iMakeFile == 0)
                    {
                        make.Setting_UpFile(pathBackUpFiles,extension);
                    }

                    make.WorkFile.WriteLine(Aleatory(charsetSelecting, numberOfChar));
                    ++iMakeFile;
                    ++cpt;

                    if (iMakeFile >= numberLine || cpt >= numberOfAllCombination)
                    {
                        make.WorkFile.Flush();
                        make.WorkFile.Close();
                        extension=make.Zipper(zip, pathBackUpFiles);
                         make.GenerateOut(pathBackUpFiles,extension);
                        iMakeFile = 0;
                    }
                }
            }
            else
            {
                while (cpt <= numberOfAllCombination)
                {
                    if (cpt >= numberLine & numberLine != 0)
                        Environment.Exit(0);

                    Console.WriteLine(Aleatory(charsetSelecting, numberOfChar));
                    cpt++;
                }
            }
        }
        } // End Function

        public void AutoUppercaseLowercase(List<string> charsetSelecting, string pathBackupFiles, string extension, bool zip)
        {
            Interface.PleaseWait();
            Utility make = new Utility();

            make.Setting_UpFile(pathBackupFiles, extension);

            foreach (var item in charsetSelecting)
            {
                make.WorkFile.WriteLine(ConverterInUppercaseLowercase(item.ToString()));                
            }

            make.WorkFile.Close();
            extension = make.Zipper(zip, pathBackupFiles);
            make.GenerateOut(pathBackupFiles, extension);
           
        } // End Function 
예제 #4
0
        public int EndPattern(string[] args)
        {
            Utility tools = new Utility();
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.EndBlock)
            {
                string s = null;
                for (int i = 0; i < args.Length; i++)
                {
                    
                    if (args[i].ToString().ToLower() == "-e" | args[i].ToString().ToLower() == "--end")
                    {
                        s = args[i + 1];
                    }                    
                }

                tools.EndPattern(s, Parameter.NumberOfChar, Parameter.CharsetSelecting);
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
예제 #5
0
        public int StartblockPattern(string[] args)
        {
            Utility obj2 = new Utility();
            CLI options = new CLI();
            CommandLineParser parser = new CommandLineParser(options);
            parser.Parse();

            if (options.Startblock)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (args[i].ToString().ToLower() == "-s" | args[i].ToString().ToLower() == "--startblock")
                    {
                        string s = args[i + 1].ToString();

                        if (s.Length > Parameter.CharsetSelecting.Count)
                        {
                            obj2.DoubleCapacityList(Parameter.CharsetSelecting, Parameter.NumberOfChar);
                        }
                        else
                        {
                            obj2.StartblockPattern(s, Parameter.CharsetSelecting);
                        }
                    }
                }
            }
            else if (parser.HasErrors)
            {
                Console.WriteLine(parser.UsageInfo.ToString(78, true));
                return -1;
            }

            // No errors present and all arguments correct
            // Do work according to arguments
            return 0;
        }
        internal static void PleaseWait()
        {
            Utility objHour = new Utility();

            Console.Write("\n{0} : ", objHour.Hour());
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("This work, please wait !\n");
            Console.ResetColor();            
        }
        } // End Fonction

        internal List<string> ChangeEndblockPattern(List<string> charsetSelecting, byte numberOfChar)
        {
            Utility obj = new Utility();
            bool b = true;

            while (b)
            {
                SetColorThemes();
                Console.Write(lang.GetString("ChangeEndblockPattern"));
                
                SetColorAsk();
                try
                {
                    Console.ForegroundColor = ConsoleColor.DarkGreen;
                    ConsoleKeyInfo info = Console.ReadKey(true);
                    Console.ResetColor();

                    if (info.Key == ConsoleKey.Y)
                    {

                        Console.Write(lang.GetString("ChangeEndblockPattern1"));

                        Console.ForegroundColor = ConsoleColor.DarkGreen;
                        string s = Console.ReadLine();
                        Console.ResetColor();

                        if (s.Length >= 2 | s != null)
                        {
                            obj.EndPattern(s, numberOfChar, charsetSelecting);
                            b = false;
                        }
                    }
                    if (info.Key == ConsoleKey.N)
                    {
                        b = false;
                    }
                }

                catch (Exception e)
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("\n {0} \n", e.Message);
                    Console.ResetColor();
                }
            }

            return charsetSelecting;

        } // End Fonction