public virtual bool Loading() { ConfigureManager cfg = new ConfigureManager(this); bool isChange = false; if (cfg.IsConfigKeyExists("Address")) { this.DatabaseAddr = cfg ["Address"]; } else { cfg ["Address"] = "127.0.0.1"; isChange = true; } if (cfg.IsConfigKeyExists("Ports")) { this.DatabasePorts = cfg ["Ports"]; } else { cfg ["Ports"] = "3306"; isChange = true; } if (cfg.IsConfigKeyExists("User")) { this.DatabaseUser = cfg ["User"]; } else { cfg ["User"] = "******"; isChange = true; } if (cfg.IsConfigKeyExists("Password")) { this.DatabasePassword = cfg ["Password"]; } else { cfg ["Password"] = "******"; isChange = true; } if (cfg.IsConfigKeyExists("Database")) { this.DefaultDatabse = cfg ["Database"]; } else { cfg ["Database"] = "Default"; isChange = true; } if (isChange) { cfg.SaveAllConfig(); } return(true); }
public override bool Loading() { //the version field is the Plugin GUID this.date.VersionHash = this.GetGUID(); ConfigureManager cfg = new ConfigureManager(this); int min = 100; int max = 200; if (cfg.IsConfigKeyExists("MinCount") && cfg.IsConfigKeyExists("MaxCount")) { min = Convert.ToInt32(cfg ["MinCount"]); max = Convert.ToInt32(cfg ["MaxCount"]); } else { cfg ["MinCount"] = 100.ToString (); cfg ["MaxCount"] = 200.ToString (); cfg.SaveAllConfig(); } this.setOtherArgs(min, max); return(true); }
/// <summary> /// we should add all regex to the list /// from a config file /// </summary> public override bool Loading() { ConfigureManager cfg = new ConfigureManager(this); if (!cfg.IsConfigKeyExists("RegexFile")) { cfg ["RegexFile"] = "Regex.xml"; cfg.SaveAllConfig(); } this.RegexConfigFile = cfg.ConfigDirectory + "/" + cfg ["RegexFile"]; this.LoadRules(); return(base.Loading()); }