private void CleanMap(IDictionary <YamlNode, YamlNode> nodes) { bool Config = (!nodes.IsNull() && nodes.ContainsKey("Config")) ? nodes["Config".ToYamlNode()].ToString().ToBoolean() : d_cleanconfig; bool Database = (!nodes.IsNull() && nodes.ContainsKey("Database")) ? nodes["Database".ToYamlNode()].ToString().ToBoolean() : d_cleandatabase; new CleanConfig(Config, Database); }
private void SQLiteMap(IDictionary <YamlNode, YamlNode> nodes) { bool Enabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_sqliteenabled; string FileName = (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_sqlitefilename; new SQLiteConfig(Enabled, sUtilities.GetSpecialDirectory(FileName)); }
private void ShortUrlMap(IDictionary <YamlNode, YamlNode> nodes) { string Name = (!nodes.IsNull() && nodes.ContainsKey("Name")) ? nodes["Name".ToYamlNode()].ToString() : d_shorturlname; string ApiKey = (!nodes.IsNull() && nodes.ContainsKey("ApiKey")) ? nodes["ApiKey".ToYamlNode()].ToString() : d_shorturlapikey; new ShortUrlConfig(Name, ApiKey); }
private void FloodingMap(IDictionary <YamlNode, YamlNode> nodes) { int Seconds = (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString().ToInt32() : d_floodingseconds; int NumberOfCommands = (!nodes.IsNull() && nodes.ContainsKey("NumberOfCommands")) ? nodes["NumberOfCommands".ToYamlNode()].ToString().ToInt32() : d_floodingnumberofcommands; new FloodingConfig(Seconds, NumberOfCommands); }
private void AddonsMap(IDictionary <YamlNode, YamlNode> nodes) { bool Enabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_addonenabled; string Ignore = (!nodes.IsNull() && nodes.ContainsKey("Ignore")) ? nodes["Ignore".ToYamlNode()].ToString() : d_addonignore; string Directory = (!nodes.IsNull() && nodes.ContainsKey("Directory")) ? nodes["Directory".ToYamlNode()].ToString() : d_addondirectory; new AddonsConfig(Enabled, Ignore, sUtilities.GetSpecialDirectory(Directory)); }
private void ListenerMap(IDictionary <YamlNode, YamlNode> nodes) { bool ListenerEnabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_listenerenabled; int ListenerPort = (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString().ToInt32() : d_listenerport; string ListenerPassword = (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_listenerpassword; new ListenerConfig(ListenerEnabled, ListenerPort, ListenerPassword); }
private void FloodingMap(IDictionary <YamlNode, YamlNode> nodes) { int Seconds = (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString().ToInt32() : _seconds; int NumberOfMessages = (!nodes.IsNull() && nodes.ContainsKey("NumberOfMessages")) ? nodes["NumberOfMessages".ToYamlNode()].ToString().ToInt32() : _numberofmessages; int NumberOfFlooding = (!nodes.IsNull() && nodes.ContainsKey("NumberOfFlooding")) ? nodes["NumberOfFlooding".ToYamlNode()].ToString().ToInt32() : _numberofflooding; new CalendarConfig(Seconds, NumberOfMessages, NumberOfFlooding); }
private void ScriptsMap(IDictionary <YamlNode, YamlNode> nodes) { bool Lua = (!nodes.IsNull() && nodes.ContainsKey("Lua")) ? nodes["Lua".ToYamlNode()].ToString().ToBoolean() : d_scriptsluaenabled; bool Python = (!nodes.IsNull() && nodes.ContainsKey("Python")) ? nodes["Python".ToYamlNode()].ToString().ToBoolean() : d_scriptspythonenabled; string Directory = (!nodes.IsNull() && nodes.ContainsKey("Directory")) ? nodes["Directory".ToYamlNode()].ToString() : d_scriptsdirectory; new ScriptsConfig(Lua, Python, sUtilities.GetSpecialDirectory(Directory)); }
private YamlMappingNode CreateCleanMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Config", (!nodes.IsNull() && nodes.ContainsKey("Config")) ? nodes["Config".ToYamlNode()].ToString() : d_cleanconfig.ToString()); map.Add("Database", (!nodes.IsNull() && nodes.ContainsKey("Database")) ? nodes["Database".ToYamlNode()].ToString() : d_cleandatabase.ToString()); return(map); }
private YamlMappingNode CreateSQLiteMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_sqliteenabled.ToString()); map.Add("FileName", (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_sqlitefilename); return(map); }
private YamlMappingNode CreateShortUrlMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Name", (!nodes.IsNull() && nodes.ContainsKey("Name")) ? nodes["Name".ToYamlNode()].ToString() : d_shorturlname); map.Add("ApiKey", (!nodes.IsNull() && nodes.ContainsKey("ApiKey")) ? nodes["ApiKey".ToYamlNode()].ToString() : d_shorturlapikey); return(map); }
private YamlMappingNode CreateFloodingMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Seconds", (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString() : d_floodingseconds.ToString()); map.Add("NumberOfCommands", (!nodes.IsNull() && nodes.ContainsKey("NumberOfCommands")) ? nodes["NumberOfCommands".ToYamlNode()].ToString() : d_floodingnumberofcommands.ToString()); return(map); }
private YamlMappingNode CreateFloodingMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Seconds", (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString() : _seconds.ToString()); map.Add("NumberOfMessages", (!nodes.IsNull() && nodes.ContainsKey("NumberOfMessages")) ? nodes["NumberOfMessages".ToYamlNode()].ToString() : _numberofmessages.ToString()); map.Add("NumberOfFlooding", (!nodes.IsNull() && nodes.ContainsKey("NumberOfFlooding")) ? nodes["NumberOfFlooding".ToYamlNode()].ToString() : _numberofflooding.ToString()); return(map); }
private YamlMappingNode CreateScriptsMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Lua", (!nodes.IsNull() && nodes.ContainsKey("Lua")) ? nodes["Lua".ToYamlNode()].ToString() : d_scriptsluaenabled.ToString()); map.Add("Python", (!nodes.IsNull() && nodes.ContainsKey("Python")) ? nodes["Python".ToYamlNode()].ToString() : d_scriptspythonenabled.ToString()); map.Add("Directory", (!nodes.IsNull() && nodes.ContainsKey("Directory")) ? nodes["Directory".ToYamlNode()].ToString() : d_scriptsdirectory); return(map); }
private YamlMappingNode CreateAddonsMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_addonenabled.ToString()); map.Add("Ignore", (!nodes.IsNull() && nodes.ContainsKey("Ignore")) ? nodes["Ignore".ToYamlNode()].ToString() : d_addonignore); map.Add("Directory", (!nodes.IsNull() && nodes.ContainsKey("Directory")) ? nodes["Directory".ToYamlNode()].ToString() : d_addondirectory); return(map); }
private YamlMappingNode CreateListenerMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_listenerenabled.ToString()); map.Add("Port", (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString() : d_listenerport.ToString()); map.Add("Password", (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_listenerpassword); return(map); }
private void ServerMap(IDictionary <YamlNode, YamlNode> nodes) { bool ServerEnabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_serverenabled; string ServerHost = (!nodes.IsNull() && nodes.ContainsKey("Host")) ? nodes["Host".ToYamlNode()].ToString() : d_serverhost; int ServerPort = (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString().ToInt32() : d_serverport; string ServerPassword = (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_serverpassword; new ServerConfig(ServerEnabled, ServerHost, ServerPort, ServerPassword); }
private void UpdateMap(IDictionary <YamlNode, YamlNode> nodes) { bool Enabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_updateenabled; string Version = (!nodes.IsNull() && nodes.ContainsKey("Version")) ? nodes["Version".ToYamlNode()].ToString() : d_updateversion; string Branch = (!nodes.IsNull() && nodes.ContainsKey("Branch")) ? nodes["Branch".ToYamlNode()].ToString() : d_updatebranch; string WebPage = (!nodes.IsNull() && nodes.ContainsKey("WebPage")) ? nodes["WebPage".ToYamlNode()].ToString() : d_updatewebpage; new UpdateConfig(Enabled, Version.ToLower(), Branch, WebPage); }
private YamlMappingNode CreateUpdateMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_updateenabled.ToString()); map.Add("Version", (!nodes.IsNull() && nodes.ContainsKey("Version")) ? nodes["Version".ToYamlNode()].ToString() : d_updateversion); map.Add("Branch", (!nodes.IsNull() && nodes.ContainsKey("Branch")) ? nodes["Branch".ToYamlNode()].ToString() : d_updatebranch); map.Add("WebPage", (!nodes.IsNull() && nodes.ContainsKey("WebPage")) ? nodes["WebPage".ToYamlNode()].ToString() : d_updatewebpage); return(map); }
private void LogMap(IDictionary <YamlNode, YamlNode> nodes) { string LogFileName = (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_logfilename; bool LogDateFileName = (!nodes.IsNull() && nodes.ContainsKey("DateFileName")) ? nodes["DateFileName".ToYamlNode()].ToString().ToBoolean() : d_logdatefilename; int LogMaxFileSize = (!nodes.IsNull() && nodes.ContainsKey("MaxFileSize")) ? nodes["MaxFileSize".ToYamlNode()].ToString().ToInt32() : d_logmaxfilesize; int LogLevel = (!nodes.IsNull() && nodes.ContainsKey("LogLevel")) ? nodes["LogLevel".ToYamlNode()].ToString().ToInt32() : d_loglevel; string LogDirectory = (!nodes.IsNull() && nodes.ContainsKey("LogDirectory")) ? nodes["LogDirectory".ToYamlNode()].ToString() : d_logdirectory; new Framework.Config.LogConfig(LogFileName, LogDateFileName, LogMaxFileSize, LogLevel, sUtilities.GetSpecialDirectory(LogDirectory), string.Empty, false); }
private YamlMappingNode CreateCompilerMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_compilerenabled.ToString()); var map2 = new YamlMappingNode(); if (!nodes.IsNull() && nodes.ContainsKey("MaxAllocating")) { var node2 = ((YamlMappingNode)nodes["MaxAllocating".ToYamlNode()]).Children; map2.Add("Enabled", (!node2.IsNull() && node2.ContainsKey("Enabled")) ? node2["Enabled".ToYamlNode()].ToString() : d_enabled.ToString()); map2.Add("Memory", (!node2.IsNull() && node2.ContainsKey("Memory")) ? node2["Memory".ToYamlNode()].ToString() : d_memory.ToString()); } else { map2.Add("Enabled", d_enabled.ToString()); map2.Add("Memory", d_memory.ToString()); } map.Add("MaxAllocating", map2); map.Add("CompilerOptions", (!nodes.IsNull() && nodes.ContainsKey("CompilerOptions")) ? nodes["CompilerOptions".ToYamlNode()].ToString() : d_compileroptions); map.Add("WarningLevel", (!nodes.IsNull() && nodes.ContainsKey("WarningLevel")) ? nodes["WarningLevel".ToYamlNode()].ToString() : d_warninglevel.ToString()); map.Add("TreatWarningsAsErrors", (!nodes.IsNull() && nodes.ContainsKey("TreatWarningsAsErrors")) ? nodes["TreatWarningsAsErrors".ToYamlNode()].ToString() : d_treatwarningsaserrors.ToString()); map.Add("Referenced", (!nodes.IsNull() && nodes.ContainsKey("Referenced")) ? nodes["Referenced".ToYamlNode()].ToString() : d_referenced); map.Add("ReferencedAssemblies", (!nodes.IsNull() && nodes.ContainsKey("ReferencedAssemblies")) ? nodes["ReferencedAssemblies".ToYamlNode()].ToString() : d_referencedassemblies); map.Add("MainClass", (!nodes.IsNull() && nodes.ContainsKey("MainClass")) ? nodes["MainClass".ToYamlNode()].ToString() : d_mainclass); map.Add("MainConstructor", (!nodes.IsNull() && nodes.ContainsKey("MainConstructor")) ? nodes["MainConstructor".ToYamlNode()].ToString() : d_mainconstructor); return(map); }
/// <summary> /// 注册枚举值类型 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="en"></param> /// <returns></returns> public static void Reg <T>(T en) { listType = listType.IsNull() ? new Dictionary <string, Type>() : listType; Type type = typeof(T); string name = type.Name; if (!listType.ContainsKey(name)) { listType.Add(name, type); } }
private YamlMappingNode CreateLogMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("FileName", (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_logfilename); map.Add("DateFileName", (!nodes.IsNull() && nodes.ContainsKey("DateFileName")) ? nodes["DateFileName".ToYamlNode()].ToString() : d_logdatefilename.ToString()); map.Add("MaxFileSize", (!nodes.IsNull() && nodes.ContainsKey("MaxFileSize")) ? nodes["MaxFileSize".ToYamlNode()].ToString() : d_logmaxfilesize.ToString()); map.Add("LogLevel", (!nodes.IsNull() && nodes.ContainsKey("LogLevel")) ? nodes["LogLevel".ToYamlNode()].ToString() : d_loglevel.ToString()); map.Add("LogDirectory", (!nodes.IsNull() && nodes.ContainsKey("LogDirectory")) ? nodes["LogDirectory".ToYamlNode()].ToString() : d_logdirectory); return(map); }
private void ServerMap(IDictionary <YamlNode, YamlNode> nodes) { int ListenerPort = d_listenerport; if (!nodes.IsNull() && nodes.ContainsKey("Listener")) { var node = ((YamlMappingNode)nodes["Listener".ToYamlNode()]).Children; ListenerPort = (!node.IsNull() && node.ContainsKey("Port")) ? node["Port".ToYamlNode()].ToString().ToInt32() : d_listenerport; } string Password = (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_password; new ServerConfigs(ListenerPort, Password); }
public bool addToConnectionList(SqlConnection connection) { if (connection.IsNull()) { return(false); } if (connectionList.IsNull()) { return(false); } connectionList.Add($"{Guid.NewGuid()}", connection); return(true); }
private IEnumerable <KeyValuePair <string, string> > SerializeJobRequest(string userName, JobCreateParameters details, string jobName, ICollection <string> arguments, IDictionary <string, string> defines) { var values = new List <KeyValuePair <string, string> >(); if (defines.IsNotNull()) { if (jobName.IsNotNullOrEmpty() && !defines.ContainsKey(WebHCatConstants.DefineJobName)) { defines.Add(WebHCatConstants.DefineJobName, jobName); } values.AddRange(this.BuildNameValueList(WebHCatConstants.Define, defines)); } if (arguments.IsNotNull()) { if (jobName.IsNotNullOrEmpty() && defines.IsNull()) { arguments.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}", WebHCatConstants.DefineJobName, jobName)); } values.AddRange(this.BuildList(WebHCatConstants.Arg, arguments)); } values.Add(new KeyValuePair <string, string>(WebHCatConstants.StatusDirectory, details.StatusFolder)); values.Add(new KeyValuePair <string, string>(WebHCatConstants.Files, this.BuildCommaSeparatedList(details.Files))); values.Add(new KeyValuePair <string, string>(WebHCatConstants.UserName, userName)); values.Add(new KeyValuePair <string, string>(WebHCatConstants.Callback, details.Callback)); values.Add(new KeyValuePair <string, string>(HadoopRemoteRestConstants.EnableLogging, details.EnableTaskLogs.ToString().ToLowerInvariant())); return(values); }
public static object Deserialize(Type type, IDictionary dicData) { if (dicData.IsNull()) { return(null); } object response = Activator.CreateInstance(type); foreach (var property in response.GetType().GetProperties()) { string propertyName = GetPropertyName(property); if (!dicData.Contains(propertyName)) { continue; } Type propertyType = property.PropertyType; object propertyValue = DeserializeProperty(propertyType, dicData[propertyName]); property.SetValue(response, propertyValue); } return(response); }
private YamlMappingNode CreateShutdownMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("MaxMemory", (!nodes.IsNull() && nodes.ContainsKey("MaxMemory")) ? nodes["MaxMemory".ToYamlNode()].ToString() : d_shutdownmaxmemory.ToString()); return(map); }
private YamlMappingNode CreateRssMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("QueryTime", (!nodes.IsNull() && nodes.ContainsKey("QueryTime")) ? nodes["QueryTime".ToYamlNode()].ToString() : d_querytime.ToString()); return(map); }
private YamlMappingNode CreateLocalizationMap(IDictionary <YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Locale", (!nodes.IsNull() && nodes.ContainsKey("Locale")) ? nodes["Locale".ToYamlNode()].ToString() : d_locale); return(map); }
private YamlMappingNode CreateFloodingMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Seconds", (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString() : _seconds.ToString()); map.Add("NumberOfMessages", (!nodes.IsNull() && nodes.ContainsKey("NumberOfMessages")) ? nodes["NumberOfMessages".ToYamlNode()].ToString() : _numberofmessages.ToString()); map.Add("NumberOfFlooding", (!nodes.IsNull() && nodes.ContainsKey("NumberOfFlooding")) ? nodes["NumberOfFlooding".ToYamlNode()].ToString() : _numberofflooding.ToString()); return map; }
private YamlMappingNode CreateShortUrlMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Name", (!nodes.IsNull() && nodes.ContainsKey("Name")) ? nodes["Name".ToYamlNode()].ToString() : d_shorturlname); map.Add("ApiKey", (!nodes.IsNull() && nodes.ContainsKey("ApiKey")) ? nodes["ApiKey".ToYamlNode()].ToString() : d_shorturlapikey); return map; }
private void UpdateMap(IDictionary<YamlNode, YamlNode> nodes) { bool Enabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_updateenabled; string Version = (!nodes.IsNull() && nodes.ContainsKey("Version")) ? nodes["Version".ToYamlNode()].ToString() : d_updateversion; string Branch = (!nodes.IsNull() && nodes.ContainsKey("Branch")) ? nodes["Branch".ToYamlNode()].ToString() : d_updatebranch; string WebPage = (!nodes.IsNull() && nodes.ContainsKey("WebPage")) ? nodes["WebPage".ToYamlNode()].ToString() : d_updatewebpage; new UpdateConfig(Enabled, Version.ToLower(), Branch, WebPage); }
private void ModeMap(IDictionary<YamlNode, YamlNode> nodes) { bool Enabled = d_enabled; string Type = d_type; if(!nodes.IsNull() && nodes.ContainsKey("Remove")) { var node2 = ((YamlMappingNode)nodes["Remove".ToYamlNode()]).Children; Enabled = (!node2.IsNull() && node2.ContainsKey("Enabled")) ? node2["Enabled".ToYamlNode()].ToString().ToBoolean() : d_enabled; Type = (!node2.IsNull() && node2.ContainsKey("Type")) ? node2["Type".ToYamlNode()].ToString() : d_type; } new ModeConfig(Enabled, Type); }
private void WolframAlphaMap(IDictionary<YamlNode, YamlNode> nodes) { string Key = d_wolframalphaapikey; if(!nodes.IsNull() && nodes.ContainsKey("Api")) { var node2 = ((YamlMappingNode)nodes["Api".ToYamlNode()]).Children; Key = (!node2.IsNull() && node2.ContainsKey("Key")) ? node2["Key".ToYamlNode()].ToString() : d_wolframalphaapikey; } new WolframAlphaConfig(Key); }
private YamlMappingNode CreateSQLiteMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_sqliteenabled.ToString()); map.Add("FileName", (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_sqlitefilename); return map; }
private YamlMappingNode CreateWeatherMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); var map2 = new YamlMappingNode(); if(!nodes.IsNull() && nodes.ContainsKey("Home")) { var node2 = ((YamlMappingNode)nodes["Home".ToYamlNode()]).Children; map2.Add("Country", (!node2.IsNull() && node2.ContainsKey("Country")) ? node2["Country".ToYamlNode()].ToString() : d_weatherhomecountry); map2.Add("City", (!node2.IsNull() && node2.ContainsKey("City")) ? node2["City".ToYamlNode()].ToString() : d_weatherhomecity); } else { map2.Add("Country", d_weatherhomecountry); map2.Add("City", d_weatherhomecity); } map.Add("Home", map2); map2 = new YamlMappingNode(); if(!nodes.IsNull() && nodes.ContainsKey("Wunderground")) { var node2 = ((YamlMappingNode)nodes["Wunderground".ToYamlNode()]).Children; map2.Add("Key", (!node2.IsNull() && node2.ContainsKey("Key")) ? node2["Key".ToYamlNode()].ToString() : d_wundergroundapikey); } else map2.Add("Key", d_wundergroundapikey); map.Add("Wunderground", map2); return map; }
private void LogMap(IDictionary<YamlNode, YamlNode> nodes) { string LogFileName = (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_logfilename; bool LogDateFileName = (!nodes.IsNull() && nodes.ContainsKey("DateFileName")) ? nodes["DateFileName".ToYamlNode()].ToString().ToBoolean() : d_logdatefilename; int LogMaxFileSize = (!nodes.IsNull() && nodes.ContainsKey("MaxFileSize")) ? nodes["MaxFileSize".ToYamlNode()].ToString().ToInt32() : d_logmaxfilesize; int LogLevel = (!nodes.IsNull() && nodes.ContainsKey("LogLevel")) ? nodes["LogLevel".ToYamlNode()].ToString().ToInt32() : d_loglevel; string LogDirectory = (!nodes.IsNull() && nodes.ContainsKey("LogDirectory")) ? nodes["LogDirectory".ToYamlNode()].ToString() : d_logdirectory; string IrcLogDirectory = (!nodes.IsNull() && nodes.ContainsKey("IrcLogDirectory")) ? nodes["IrcLogDirectory".ToYamlNode()].ToString() : d_irclogdirectory; bool IrcLog = (!nodes.IsNull() && nodes.ContainsKey("IrcLog")) ? nodes["IrcLog".ToYamlNode()].ToString().ToBoolean() : d_irclog; #if DEBUG LogLevel = 3; // Maximális log szint #endif new LogConfig(LogFileName, LogDateFileName, LogMaxFileSize, LogLevel, sUtilities.GetSpecialDirectory(LogDirectory), sUtilities.GetSpecialDirectory(IrcLogDirectory), IrcLog); }
private YamlMappingNode CreateRssMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("QueryTime", (!nodes.IsNull() && nodes.ContainsKey("QueryTime")) ? nodes["QueryTime".ToYamlNode()].ToString() : d_querytime.ToString()); return map; }
private void ListenerMap(IDictionary<YamlNode, YamlNode> nodes) { bool ListenerEnabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_listenerenabled; int ListenerPort = (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString().ToInt32() : d_listenerport; string ListenerPassword = (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_listenerpassword; new ListenerConfig(ListenerEnabled, ListenerPort, ListenerPassword); }
private void LocalizationMap(IDictionary<YamlNode, YamlNode> nodes) { string Locale = (!nodes.IsNull() && nodes.ContainsKey("Locale")) ? nodes["Locale".ToYamlNode()].ToString() : d_locale; new LocalizationConfig(Locale); }
private void IrcMap(IDictionary<YamlNode, YamlNode> nodes) { int ServerId = 1; var IrcList = new Dictionary<string, IRCConfigBase>(); if(nodes.IsNull()) { string ServerName = d_servername; string Server = d_server; string ServerPass = d_ircserverpassword; int Port = d_port; int ModeMask = d_modemask; bool Ssl = d_ssl; string NickName = d_nickname; string NickName2 = d_nickname2; string NickName3 = d_nickname3; string UserName = d_username; string UserInfo = d_userinfo; string MasterChannel = d_masterchannel; string MasterChannelPassword = d_masterchannelpassword; string IgnoreChannels = d_ignorechannels; string IgnoreNames = d_ignorenames; bool UseNickServ = d_usenickserv; string NickServPassword = d_nickservpassword; bool UseHostServ = d_usehostserv; bool HostServStatus = d_hostservstatus; int MessageSending = d_messagesending; string CommandPrefix = d_commandprefix; string MessageType = d_messagetype; IrcList.Add(ServerName.ToLower(), new IRCConfigBase(ServerId, Server, ServerPass.Trim(), Port, ModeMask, Ssl, NickName, NickName2, NickName3, UserName, UserInfo, MasterChannel, MasterChannelPassword.Trim(), IgnoreChannels, IgnoreNames, UseNickServ, NickServPassword, UseHostServ, HostServStatus, MessageSending, CommandPrefix, MessageType)); } else { foreach(var irc in nodes) { var node = ((YamlMappingNode)irc.Value).Children; string ServerName = (!node.IsNull() && node.ContainsKey("ServerName")) ? node["ServerName".ToYamlNode()].ToString() : d_servername; string Server = (!node.IsNull() && node.ContainsKey("Server")) ? node["Server".ToYamlNode()].ToString() : d_server; string ServerPass = (!node.IsNull() && node.ContainsKey("Password")) ? node["Password".ToYamlNode()].ToString() : d_ircserverpassword; int Port = (!node.IsNull() && node.ContainsKey("Port")) ? node["Port".ToYamlNode()].ToString().ToInt32() : d_port; int ModeMask = (!node.IsNull() && node.ContainsKey("ModeMask")) ? node["ModeMask".ToYamlNode()].ToString().ToInt32() : d_modemask; bool Ssl = (!node.IsNull() && node.ContainsKey("Ssl")) ? node["Ssl".ToYamlNode()].ToString().ToBoolean() : d_ssl; string NickName = (!node.IsNull() && node.ContainsKey("NickName")) ? node["NickName".ToYamlNode()].ToString() : d_nickname; string NickName2 = (!node.IsNull() && node.ContainsKey("NickName2")) ? node["NickName2".ToYamlNode()].ToString() : d_nickname2; string NickName3 = (!node.IsNull() && node.ContainsKey("NickName3")) ? node["NickName3".ToYamlNode()].ToString() : d_nickname3; string UserName = (!node.IsNull() && node.ContainsKey("UserName")) ? node["UserName".ToYamlNode()].ToString() : d_username; string UserInfo = (!node.IsNull() && node.ContainsKey("UserInfo")) ? node["UserInfo".ToYamlNode()].ToString() : d_userinfo; string MasterChannel = d_masterchannel; string MasterChannelPassword = d_masterchannelpassword; if(!node.IsNull() && node.ContainsKey("MasterChannel")) { var node2 = ((YamlMappingNode)node["MasterChannel".ToYamlNode()]).Children; MasterChannel = (!node2.IsNull() && node2.ContainsKey("Name")) ? node2["Name".ToYamlNode()].ToString() : d_masterchannel; MasterChannelPassword = (!node2.IsNull() && node2.ContainsKey("Password")) ? node2["Password".ToYamlNode()].ToString() : d_masterchannelpassword; } string IgnoreChannels = (!node.IsNull() && node.ContainsKey("IgnoreChannels")) ? node["IgnoreChannels".ToYamlNode()].ToString() : d_ignorechannels; string IgnoreNames = (!node.IsNull() && node.ContainsKey("IgnoreNames")) ? node["IgnoreNames".ToYamlNode()].ToString() : d_ignorenames; bool UseNickServ = d_usenickserv; string NickServPassword = d_nickservpassword; if(!node.IsNull() && node.ContainsKey("NickServ")) { var node2 = ((YamlMappingNode)node["NickServ".ToYamlNode()]).Children; UseNickServ = (!node2.IsNull() && node2.ContainsKey("Enabled")) ? node2["Enabled".ToYamlNode()].ToString().ToBoolean() : d_usenickserv; NickServPassword = (!node2.IsNull() && node2.ContainsKey("Password")) ? node2["Password".ToYamlNode()].ToString() : d_nickservpassword; } bool UseHostServ = d_usehostserv; bool HostServStatus = d_hostservstatus; if(!node.IsNull() && node.ContainsKey("HostServ")) { var node2 = ((YamlMappingNode)node["HostServ".ToYamlNode()]).Children; UseHostServ = (!node2.IsNull() && node2.ContainsKey("Enabled")) ? node2["Enabled".ToYamlNode()].ToString().ToBoolean() : d_usehostserv; HostServStatus = (!node2.IsNull() && node2.ContainsKey("Vhost")) ? node2["Vhost".ToYamlNode()].ToString().ToBoolean() : d_hostservstatus; } int MessageSending = d_messagesending; if(!node.IsNull() && node.ContainsKey("Wait")) { var node2 = ((YamlMappingNode)node["Wait".ToYamlNode()]).Children; MessageSending = (!node2.IsNull() && node2.ContainsKey("MessageSending")) ? node2["MessageSending".ToYamlNode()].ToString().ToInt32() : d_messagesending; } string CommandPrefix = d_commandprefix; if(!node.IsNull() && node.ContainsKey("Command")) { var node2 = ((YamlMappingNode)node["Command".ToYamlNode()]).Children; CommandPrefix = (!node2.IsNull() && node2.ContainsKey("Prefix")) ? node2["Prefix".ToYamlNode()].ToString() : d_commandprefix; } string MessageType = (!node.IsNull() && node.ContainsKey("MessageType")) ? node["MessageType".ToYamlNode()].ToString() : d_messagetype; if(MasterChannel.Length >= 2 && MasterChannel.Trim().Length > 1 && MasterChannel.Substring(0, 1) != "#") { Log.Warning("YamlConfig", sLConsole.GetString("The master channel's format is wrong. \"#\" is missing. Corrected.")); MasterChannel = "#" + MasterChannel; } else if(MasterChannel.Length < 2 && MasterChannel.Trim().Length <= 1) { Log.Warning("YamlConfig", sLConsole.GetString("The master channel is not given so the default will be used. ({0})"), d_masterchannel); MasterChannel = d_masterchannel; } if(!IsValidNick(NickName)) { Log.Warning("YamlConfig", sLConsole.GetString("The primary nick's format is wrong. The default will be used: {0}"), d_nickname); NickName = d_nickname; } if(!IsValidNick(NickName2)) { Log.Warning("YamlConfig", sLConsole.GetString("The secondary nick's format is wrong. The default will be used: {0}"), d_nickname2); NickName2 = d_nickname2; } if(!IsValidNick(NickName3)) { Log.Warning("YamlConfig", sLConsole.GetString("The tertiary nick's format is wrong. The default will be used: {0}"), d_nickname3); NickName3 = d_nickname3; } if(NickName.ToLower() == NickName2.ToLower() || NickName.ToLower() == NickName3.ToLower() || NickName2.ToLower() == NickName3.ToLower()) { Log.Error("YamlConfig", sLConsole.GetString("{0}: In the three nickname there are atleast two identical, please modify those."), ServerName); Log.Warning("YamlConfig", sLConsole.GetString("Program shutting down!")); Thread.Sleep(5*1000); Environment.Exit(1); } if(IrcList.ContainsKey(ServerName.ToLower())) Log.Error("YamlConfig", sLConsole.GetString("The {0} server is already in use so not loaded!"), ServerName); else { IrcList.Add(ServerName.ToLower(), new IRCConfigBase(ServerId, Server, ServerPass.Trim(), Port, ModeMask, Ssl, NickName, NickName2, NickName3, UserName, UserInfo, MasterChannel, MasterChannelPassword.Trim(), IgnoreChannels, IgnoreNames, UseNickServ, NickServPassword, UseHostServ, HostServStatus, MessageSending, CommandPrefix, MessageType)); ServerId++; } } } new IRCConfig(IrcList); }
private void FloodingMap(IDictionary<YamlNode, YamlNode> nodes) { int Seconds = (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString().ToInt32() : d_floodingseconds; int NumberOfCommands = (!nodes.IsNull() && nodes.ContainsKey("NumberOfCommands")) ? nodes["NumberOfCommands".ToYamlNode()].ToString().ToInt32() : d_floodingnumberofcommands; new FloodingConfig(Seconds, NumberOfCommands); }
private YamlMappingNode CreateUpdateMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_updateenabled.ToString()); map.Add("Version", (!nodes.IsNull() && nodes.ContainsKey("Version")) ? nodes["Version".ToYamlNode()].ToString() : d_updateversion); map.Add("Branch", (!nodes.IsNull() && nodes.ContainsKey("Branch")) ? nodes["Branch".ToYamlNode()].ToString() : d_updatebranch); map.Add("WebPage", (!nodes.IsNull() && nodes.ContainsKey("WebPage")) ? nodes["WebPage".ToYamlNode()].ToString() : d_updatewebpage); return map; }
private void FloodingMap(IDictionary<YamlNode, YamlNode> nodes) { int Seconds = (!nodes.IsNull() && nodes.ContainsKey("Seconds")) ? nodes["Seconds".ToYamlNode()].ToString().ToInt32() : _seconds; int NumberOfMessages = (!nodes.IsNull() && nodes.ContainsKey("NumberOfMessages")) ? nodes["NumberOfMessages".ToYamlNode()].ToString().ToInt32() : _numberofmessages; int NumberOfFlooding = (!nodes.IsNull() && nodes.ContainsKey("NumberOfFlooding")) ? nodes["NumberOfFlooding".ToYamlNode()].ToString().ToInt32() : _numberofflooding; new CalendarConfig(Seconds, NumberOfMessages, NumberOfFlooding); }
private YamlMappingNode CreateLogMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("FileName", (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_logfilename); map.Add("DateFileName", (!nodes.IsNull() && nodes.ContainsKey("DateFileName")) ? nodes["DateFileName".ToYamlNode()].ToString() : d_logdatefilename.ToString()); map.Add("MaxFileSize", (!nodes.IsNull() && nodes.ContainsKey("MaxFileSize")) ? nodes["MaxFileSize".ToYamlNode()].ToString() : d_logmaxfilesize.ToString()); map.Add("LogLevel", (!nodes.IsNull() && nodes.ContainsKey("LogLevel")) ? nodes["LogLevel".ToYamlNode()].ToString() : d_loglevel.ToString()); map.Add("LogDirectory", (!nodes.IsNull() && nodes.ContainsKey("LogDirectory")) ? nodes["LogDirectory".ToYamlNode()].ToString() : d_logdirectory); map.Add("IrcLogDirectory", (!nodes.IsNull() && nodes.ContainsKey("IrcLogDirectory")) ? nodes["IrcLogDirectory".ToYamlNode()].ToString() : d_irclogdirectory); map.Add("IrcLog", (!nodes.IsNull() && nodes.ContainsKey("IrcLog")) ? nodes["IrcLog".ToYamlNode()].ToString() : d_irclog.ToString()); return map; }
private void MySqlMap(IDictionary<YamlNode, YamlNode> nodes) { bool Enabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_mysqlenabled; string Host = (!nodes.IsNull() && nodes.ContainsKey("Host")) ? nodes["Host".ToYamlNode()].ToString() : d_mysqlhost; int Port = (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString().ToInt32() : d_mysqlport; string User = (!nodes.IsNull() && nodes.ContainsKey("User")) ? nodes["User".ToYamlNode()].ToString() : d_mysqluser; string Password = (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_mysqlpassword; string Database = (!nodes.IsNull() && nodes.ContainsKey("Database")) ? nodes["Database".ToYamlNode()].ToString() : d_mysqldatabase; string Charset = (!nodes.IsNull() && nodes.ContainsKey("Charset")) ? nodes["Charset".ToYamlNode()].ToString() : d_mysqlcharset; new MySqlConfig(Enabled, Host, Port, User, Password, Database, Charset); }
private YamlMappingNode CreateScriptsMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Lua", (!nodes.IsNull() && nodes.ContainsKey("Lua")) ? nodes["Lua".ToYamlNode()].ToString() : d_scriptsluaenabled.ToString()); map.Add("Python", (!nodes.IsNull() && nodes.ContainsKey("Python")) ? nodes["Python".ToYamlNode()].ToString() : d_scriptspythonenabled.ToString()); map.Add("Directory", (!nodes.IsNull() && nodes.ContainsKey("Directory")) ? nodes["Directory".ToYamlNode()].ToString() : d_scriptsdirectory); return map; }
private void RssMap(IDictionary<YamlNode, YamlNode> nodes) { int QueryTime = (!nodes.IsNull() && nodes.ContainsKey("QueryTime")) ? nodes["QueryTime".ToYamlNode()].ToString().ToInt32() : d_querytime; new RssConfig(QueryTime); }
private YamlMappingNode CreateMySqlMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_mysqlenabled.ToString()); map.Add("Host", (!nodes.IsNull() && nodes.ContainsKey("Host")) ? nodes["Host".ToYamlNode()].ToString() : d_mysqlhost); map.Add("Port", (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString() : d_mysqlport.ToString()); map.Add("User", (!nodes.IsNull() && nodes.ContainsKey("User")) ? nodes["User".ToYamlNode()].ToString() : d_mysqluser); map.Add("Password", (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_mysqlpassword); map.Add("Database", (!nodes.IsNull() && nodes.ContainsKey("Database")) ? nodes["Database".ToYamlNode()].ToString() : d_mysqldatabase); map.Add("Charset", (!nodes.IsNull() && nodes.ContainsKey("Charset")) ? nodes["Charset".ToYamlNode()].ToString() : d_mysqlcharset); return map; }
private YamlMappingNode CreateModeMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); var map2 = new YamlMappingNode(); if(!nodes.IsNull() && nodes.ContainsKey("Remove")) { var node2 = ((YamlMappingNode)nodes["Remove".ToYamlNode()]).Children; map2.Add("Enabled", (!node2.IsNull() && node2.ContainsKey("Enabled")) ? node2["Enabled".ToYamlNode()].ToString() : d_enabled.ToString()); map2.Add("Type", (!node2.IsNull() && node2.ContainsKey("Type")) ? node2["Type".ToYamlNode()].ToString() : d_type); } else { map2.Add("Enabled", d_enabled.ToString()); map2.Add("Type", d_type); } map.Add("Remove", map2); return map; }
private void ShortUrlMap(IDictionary<YamlNode, YamlNode> nodes) { string Name = (!nodes.IsNull() && nodes.ContainsKey("Name")) ? nodes["Name".ToYamlNode()].ToString() : d_shorturlname; string ApiKey = (!nodes.IsNull() && nodes.ContainsKey("ApiKey")) ? nodes["ApiKey".ToYamlNode()].ToString() : d_shorturlapikey; new ShortUrlConfig(Name, ApiKey); }
private YamlMappingNode CreateWolframAlphaMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); var map2 = new YamlMappingNode(); if(!nodes.IsNull() && nodes.ContainsKey("Api")) { var node2 = ((YamlMappingNode)nodes["Api".ToYamlNode()]).Children; map2.Add("Key", (!node2.IsNull() && node2.ContainsKey("Key")) ? node2["Key".ToYamlNode()].ToString() : d_wolframalphaapikey); } else map2.Add("Key", d_wolframalphaapikey); map.Add("Api", map2); return map; }
private void ShutdownMap(IDictionary<YamlNode, YamlNode> nodes) { int MaxMemory = (!nodes.IsNull() && nodes.ContainsKey("MaxMemory")) ? nodes["MaxMemory".ToYamlNode()].ToString().ToInt32() : d_shutdownmaxmemory; new ShutdownConfig(MaxMemory); }
private void WeatherMap(IDictionary<YamlNode, YamlNode> nodes) { string Country = d_weatherhomecountry; string City = d_weatherhomecity; string Key = d_wundergroundapikey; if(!nodes.IsNull() && nodes.ContainsKey("Home")) { var node2 = ((YamlMappingNode)nodes["Home".ToYamlNode()]).Children; Country = (!node2.IsNull() && node2.ContainsKey("Country")) ? node2["Country".ToYamlNode()].ToString() : d_weatherhomecountry; City = (!node2.IsNull() && node2.ContainsKey("City")) ? node2["City".ToYamlNode()].ToString() : d_weatherhomecity; } if(!nodes.IsNull() && nodes.ContainsKey("Wunderground")) { var node2 = ((YamlMappingNode)nodes["Wunderground".ToYamlNode()]).Children; Key = (!node2.IsNull() && node2.ContainsKey("Key")) ? node2["Key".ToYamlNode()].ToString() : d_wundergroundapikey; } new WeatherConfig(Country, City, Key); }
private void SQLiteMap(IDictionary<YamlNode, YamlNode> nodes) { bool Enabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_sqliteenabled; string FileName = (!nodes.IsNull() && nodes.ContainsKey("FileName")) ? nodes["FileName".ToYamlNode()].ToString() : d_sqlitefilename; new SQLiteConfig(Enabled, sUtilities.GetSpecialDirectory(FileName)); }
private void ScriptsMap(IDictionary<YamlNode, YamlNode> nodes) { bool Lua = (!nodes.IsNull() && nodes.ContainsKey("Lua")) ? nodes["Lua".ToYamlNode()].ToString().ToBoolean() : d_scriptsluaenabled; bool Python = (!nodes.IsNull() && nodes.ContainsKey("Python")) ? nodes["Python".ToYamlNode()].ToString().ToBoolean() : d_scriptspythonenabled; string Directory = (!nodes.IsNull() && nodes.ContainsKey("Directory")) ? nodes["Directory".ToYamlNode()].ToString() : d_scriptsdirectory; new ScriptsConfig(Lua, Python, sUtilities.GetSpecialDirectory(Directory)); }
private YamlMappingNode CreateServerMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("Enabled", (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString() : d_serverenabled.ToString()); map.Add("Host", (!nodes.IsNull() && nodes.ContainsKey("Host")) ? nodes["Host".ToYamlNode()].ToString() : d_serverhost); map.Add("Port", (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString() : d_serverport.ToString()); map.Add("Password", (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_serverpassword); return map; }
private YamlMappingNode CreateShutdownMap(IDictionary<YamlNode, YamlNode> nodes) { var map = new YamlMappingNode(); map.Add("MaxMemory", (!nodes.IsNull() && nodes.ContainsKey("MaxMemory")) ? nodes["MaxMemory".ToYamlNode()].ToString() : d_shutdownmaxmemory.ToString()); return map; }
private void ServerMap(IDictionary<YamlNode, YamlNode> nodes) { bool ServerEnabled = (!nodes.IsNull() && nodes.ContainsKey("Enabled")) ? nodes["Enabled".ToYamlNode()].ToString().ToBoolean() : d_serverenabled; string ServerHost = (!nodes.IsNull() && nodes.ContainsKey("Host")) ? nodes["Host".ToYamlNode()].ToString() : d_serverhost; int ServerPort = (!nodes.IsNull() && nodes.ContainsKey("Port")) ? nodes["Port".ToYamlNode()].ToString().ToInt32() : d_serverport; string ServerPassword = (!nodes.IsNull() && nodes.ContainsKey("Password")) ? nodes["Password".ToYamlNode()].ToString() : d_serverpassword; new ServerConfig(ServerEnabled, ServerHost, ServerPort, ServerPassword); }