public void removeVar(ConfigVars variable) { if (variable != null) { getStore(variable).Remove(variable.name); } }
public void putVar(ConfigVars variable, string name = "") { if (variable != null) { if (variable.name == null) { variable.name = name; } if (variable.name.Equals("")) { throw new System.Exception("Config variable name is not provided"); } // if(variable is ConfigNumber) // this.varsNumber[variable.name] = (ConfigNumber) variable; // else if(variable is ConfigNumberRanged) // this.varsNumberRanged[variable.name] = (ConfigNumberRanged) variable; // else if(variable is ConfigBoolean) // this.varsBoolean[variable.name] = (ConfigBoolean) variable; // else if(variable is ConfigString) // this.varsString[variable.name] = (ConfigString) variable; getStore(variable)[variable.name] = variable; } }
IDictionary getStore(ConfigVars variable) { if (variable is ConfigNumber) { return(varsNumber); } else if (variable is ConfigNumberRanged) { return(varsNumberRanged); } else if (variable is ConfigNumberRangedInt) { return(varsNumberRangedInt); } else if (variable is ConfigBoolean) { return(varsBoolean); } else if (variable is ConfigString) { return(varsString); } return(null); }