Beispiel #1
0
        private void LoadData()
        {
            IniSection section = m_iniReader.GetSectionByName("stream");

            if (section == null)
            {
                throw new InvalidOperationException("Options file missing [Stream] section.");
            }

            m_stream     = section.GetValue("stream");
            m_twitchName = section.GetValue("twitchname") ?? section.GetValue("user") ?? section.GetValue("username");
            m_oauthPass  = section.GetValue("oauth") ?? section.GetValue("pass") ?? section.GetValue("password");
            section.GetValue("DataDirectory", ref m_dataDirectory);
            section.GetValue("passive", ref m_passive);

            // Set defaults

            m_regulars = true;

            section = m_iniReader.GetSectionByName("Regulars");
            if (section != null)
            {
                section.GetValue("Enabled", ref m_regulars);
            }

            m_urlOptions         = new UrlTimeoutOptions(m_iniReader);
            m_capsOptions        = new CapsTimeoutOptions(m_iniReader);
            m_lengthOptions      = new LengthTimeoutOptions(m_iniReader);
            m_symbolOptions      = new SymbolTimeoutOptions(m_iniReader);
            m_emoteOptions       = new EmoteTimeoutOptions(m_iniReader);
            m_chatOptions        = new ChatOptions(m_iniReader);
            m_autoMessageOptions = new AutoMessageOptions(m_iniReader);
            m_banWordOptions     = new BanWordOptions(m_iniReader);
            m_autoPollOptions    = new AutoPollOptions(m_iniReader);
        }
Beispiel #2
0
        public Options()
        {
            m_dataDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "WinterBot").Replace("\\\\", "\\");
            if (!Directory.Exists(m_dataDirectory))
            {
                Directory.CreateDirectory(m_dataDirectory);
            }

            m_iniReader          = new Winter.IniReader();
            m_urlOptions         = new UrlTimeoutOptions(m_iniReader);
            m_capsOptions        = new CapsTimeoutOptions(m_iniReader);
            m_lengthOptions      = new LengthTimeoutOptions(m_iniReader);
            m_symbolOptions      = new SymbolTimeoutOptions(m_iniReader);
            m_emoteOptions       = new EmoteTimeoutOptions(m_iniReader);
            m_chatOptions        = new ChatOptions(m_iniReader);
            m_autoMessageOptions = new AutoMessageOptions(m_iniReader);
            m_banWordOptions     = new BanWordOptions(m_iniReader);
            m_autoPollOptions    = new AutoPollOptions(m_iniReader);
        }
Beispiel #3
0
        void LoadOptions(WinterBot bot)
        {
            Options options = bot.Options;

            m_options        = options;
            m_chatOptions    = options.ChatOptions;
            m_urlOptions     = options.UrlOptions;
            m_capsOptions    = options.CapsOptions;
            m_lengthOptions  = options.LengthOptions;
            m_symbolOptions  = options.SymbolOptions;
            m_emoteOptions   = options.EmoteOptions;
            m_banWordOptions = options.BanWordOptions;

            // Load url lists
            m_urlWhitelist = new List <RegexMatch>(m_urlOptions.Whitelist.Select(s => new UrlMatch(bot, s)));
            m_urlBlacklist = new List <RegexMatch>(m_urlOptions.Blacklist.Select(s => new UrlMatch(bot, s)));
            m_urlBanlist   = new List <RegexMatch>(m_urlOptions.Banlist.Select(s => new UrlMatch(bot, s)));
            m_wordBanlist  = new List <RegexMatch>(m_banWordOptions.BanList.Select(s => new WordMatch(bot, s)));
        }