Пример #1
0
 private void InitMyComponents()
 {
     try
     {
         string[] args = Environment.GetCommandLineArgs();
         if (args.Length<=1)
             IniHlp = new IniHlpClass("config.ini");
         else
         {
             IniHlp = new IniHlpClass(args[1]);
         }
         LSTEasyNumber = IniHlp.GetIntFromLine(EasyQuestionString);
         LSTMiddleNumber = IniHlp.GetIntFromLine(MiddleQuestionString);
         LSTHardNumber = IniHlp.GetIntFromLine(HardQuestionString);
         switch (IniHlp.GetIntFromLine(ModeString))
         {
             case 1:
             {
                 CurrentWorkEnum = WorkLikeEnum.OnlyGenerator;
                 break;
             }
             case 2:
             {
                 CurrentWorkEnum = WorkLikeEnum.GeneratorAndConst;
                 break;
             }
             case 3:
             {
                 CurrentWorkEnum = WorkLikeEnum.GeneratorAndLST;
                 break;
             }
             default:
                 Error.OnErrorHappen("Не указан режим работы");
                 break;
         }
     }
     catch (Exception exception)
     {
         Error.OnErrorHappen(exception.Message);
         Environment.Exit(0);
     }
 }
Пример #2
0
        private void InitMyComponents()
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                ConfigIniFileName = args[1];
            }
            if (!File.Exists(ConfigIniFileName))
            {
                OnErrorHappen("Файл "+ ConfigIniFileName + " не найден. Запуск невозможен");
                Environment.Exit(0);
            }
            IniHlp = new IniHlpClass(ConfigIniFileName);

            var newLine = IniHlp.GetDateTimeFromLine(DateThenAllowPrintPickerString);
            if (newLine.Year == 1) newLine = Convert.ToDateTime("2015-01-01");
            dateThenAllowPrintPicker.Value = newLine;

            string tempStr = string.Empty;
            tempStr = IniHlp.GetStringFromLine(NumberOfListsString);
            NumberOfLists.Text = tempStr;
            if (string.IsNullOrEmpty(tempStr)) tempStr = "1";
            MaxLists = Convert.ToUInt32(tempStr);

            tempStr = IniHlp.GetStringFromLine(MaxQuestionOnListString);
            MaxQuestionOnListText.Text = tempStr;
            if (string.IsNullOrEmpty(tempStr)) tempStr = "1";
            MaxQuestionOnListUint = Convert.ToUInt32(tempStr);

            tempStr = IniHlp.GetStringFromLine(MaxQuestionRepeatString);
            MaxQuestionRepeatText.Text = tempStr;
            if (string.IsNullOrEmpty(tempStr)) tempStr = "1";
            MaxQuestonRepeatUint= Convert.ToUInt32(tempStr);

            var bannedSymbols = IniHlp.GetStringFromLine(BannedSymbolsString);
            NewBannedSymbols1 = new BannedSymbolsClass(bannedSymbols.Split('|'));

            LSTEasyNumber = IniHlp.GetIntFromLine(EasyQuestionString);
            LSTMiddleNumber = IniHlp.GetIntFromLine(MiddleQuestionString);
            LSTHardNumber = IniHlp.GetIntFromLine(HardQuestionString);
            {
                switch (IniHlp.GetIntFromLine(ModeString))
                {
                    case 1:
                    {
                        CurrentWorkEnum = WorkLikeEnum.OnlyGenerator;
                        break;
                    }
                    case 2:
                    {
                        CurrentWorkEnum = WorkLikeEnum.GeneratorAndConst;
                        break;
                    }
                    case 3:
                    {
                        CurrentWorkEnum = WorkLikeEnum.GeneratorAndLST;
                        break;
                    }
                    default:
                        OnErrorHappen("Не указан режим работы");
                        break;
                }
            }
            ReCreateDT();
        }