/// <summary> Loads one or more scripts' information from a 'scripts.ini' file </summary> /// <param name="FullName">Full path to a 'scripts.ini' file</param> /// <returns> /// Number of valid script infos loaded from a single file. <br></br> /// Zero means the file was not parsed correctly. <br></br> /// Under zero means the file could not be read. <br></br> /// </returns> public int LoadScriptsFile(string FullName) { string dir; string text; List <IniSection> ini; int count = 0; if (!File.Exists(FullName) || (text = File.ReadAllText(FullName)) == null) { return(-1); } dir = FullName.Substring(0, FullName.LastIndexOf('\\')); text = text.Replace(System.Environment.NewLine, "\n"); if ((ini = IniParse.FromString(text)) == null) { return(0); } foreach (IniSection sect in ini) { PatcherScript script = PatcherScript.FromIni(sect, dir); if (script != null) { ScriptList.Add(script); count++; } } return(count); }
public QQService() { this.logger = new QQBotLogger(nameof(QQService)); this.botName = IniParse.INIGetValue(SharedInfo.ConfigFile, "GlobalConfig", "BotName"); this.botType = (BotType)IniParse.INIGetValue(SharedInfo.ConfigFile, "BotTypes", IniParse.INIGetValue(SharedInfo.ConfigFile, "GlobalConfig", "BotType")); this.workGroups = new List <string>(IniParse.INIGetValue(SharedInfo.ConfigFile, "GlobalConfig", "WorkGroup").Split(',')); }
public ProcedureService() { Connection = new MySqlConnection(IniParse.GetConnectionString()); }
public RepeatService() : base(nameof(RepeatService)) { this.probability = Int32.Parse(IniParse.INIGetValue(SharedInfo.ConfigFile, "Repeat", "Probability")); }
private void loadConfig() { try { string path = SysConst.configPath(); parser = new IniParse(path); if (!File.Exists(path)) { WindowStartupLocation = WindowStartupLocation.CenterScreen; return; } Left = parser["win"].getInt("x", 100); Top = parser["win"].getInt("y", 100); // language string str = parser["win"]["language"]; Lang.ins.setLang(str); str = parser["config"]["miniMode"]; if (str != "" && str != "0") { setMiniMode(true); } str = parser["config"]["checked"]; string[] arr = str.Split('$'); for (int i = 0; i < arr.Length; ++i) { var tmp = arr[i].Split(','); if (tmp.Length < 2) { continue; } var r = getInt(tmp[0]); var c = getInt(tmp[1]); if (r < 0 || r >= arrCheckBox.Length) { continue; } if (c < 0 || c >= arrCheckBox[r].Length) { continue; } arrCheckBox[r][c].IsChecked = true; } // outType str = parser["config"]["outType"]; int.TryParse(str, out int outType); if (outType < 0 || outType >= cbxOutType.Items.Count) { outType = 0; } cbxOutType.SelectedIndex = outType; lblShowOutType.Content = cbxOutType.Items[outType].ToString(); // operate str = parser["config"]["operate"]; int.TryParse(str, out int operate); if (operate < 0 || operate >= cbxOperate.Items.Count) { operate = 0; } cbxOperate.SelectedIndex = operate; lblShowOperate.Content = cbxOperate.Items[operate].ToString(); // merge output str = parser["config"]["mergeOutput"]; int.TryParse(str, out int mergeOutput); chkMergeOutput.IsChecked = (mergeOutput != 0); stkMergeOutput.Visibility = (chkMergeOutput.IsChecked == true ? Visibility.Visible : Visibility.Collapsed); } catch (Exception ex) { Debug.WriteLine(ex); } }
/// <summary> /// Load initilization variables /// </summary> private void LoadIniVar() { IniParser = new IniParse("Models/Scanner.ini"); }
public TuringService() : base(nameof(TuringService)) { this.turingApi = IniParse.INIGetValue(SharedInfo.ConfigFile, "Turing", "Api"); this.turingKey = IniParse.INIGetValue(SharedInfo.ConfigFile, "Turing", "Key"); this.botName = IniParse.INIGetValue(SharedInfo.ConfigFile, "GlobalConfig", "BotName"); }