Example #1
0
 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;
 }
Example #2
0
        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;
        }
Example #3
0
        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);
        }
Example #4
0
 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;
 }
Example #5
0
        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;
        }
Example #6
0
        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));
        }
Example #7
0
 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;
 }
Example #8
0
 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;
 }
Example #9
0
        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);
        }
Example #10
0
 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;
 }
Example #11
0
 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;
 }
Example #12
0
 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;
 }
Example #13
0
 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;
 }
Example #14
0
 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;
 }
Example #15
0
        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);
        }
Example #16
0
        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);
        }
Example #17
0
        private void ShutdownMap(IDictionary<YamlNode, YamlNode> nodes)
        {
            int MaxMemory = (!nodes.IsNull() && nodes.ContainsKey("MaxMemory")) ? nodes["MaxMemory".ToYamlNode()].ToString().ToInt32() : d_shutdownmaxmemory;

            new ShutdownConfig(MaxMemory);
        }
Example #18
0
        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);
        }
Example #19
0
        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);
        }
Example #20
0
        private void LocalizationMap(IDictionary<YamlNode, YamlNode> nodes)
        {
            string Locale = (!nodes.IsNull() && nodes.ContainsKey("Locale")) ? nodes["Locale".ToYamlNode()].ToString() : d_locale;

            new LocalizationConfig(Locale);
        }
Example #21
0
 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);
 }
Example #22
0
        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);
        }
Example #23
0
 private void RssMap(IDictionary<YamlNode, YamlNode> nodes)
 {
     int QueryTime = (!nodes.IsNull() && nodes.ContainsKey("QueryTime")) ? nodes["QueryTime".ToYamlNode()].ToString().ToInt32() : d_querytime;
     new RssConfig(QueryTime);
 }
Example #24
0
        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);
        }
Example #25
0
        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;
        }
Example #26
0
        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));
        }
Example #27
0
        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);
        }
Example #28
0
        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);
        }
Example #29
0
        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);
        }
Example #30
0
 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;
 }