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); }
public AutoMessage(WinterBot bot) { m_bot = bot; var options = bot.Options; m_msgOptions = options.AutoMessageOptions; m_chatOptions = options.ChatOptions; if (ShouldEnable) { Enable(); } if (!string.IsNullOrEmpty(m_chatOptions.SubscribeMessage)) { bot.UserSubscribed += bot_UserSubscribed; } if (!string.IsNullOrEmpty(m_chatOptions.FollowMessage)) { bot.UserFollowed += bot_UserFollowed; } bot.StreamOnline += bot_StreamOnline; bot.StreamOffline += bot_StreamOffline; }
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); }