Exemplo n.º 1
0
        public ChatOptions()
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);
            m_reg = key.CreateSubKey("TwitchChatClient");

            m_iniReader = new IniReader("options.ini");

            IniSection section = m_iniReader.GetSectionByName("stream");
            if (section == null)
                throw new InvalidOperationException("Options file missing [Stream] section.");

            m_stream = section.GetValue("stream");
            m_user = section.GetValue("twitchname") ?? section.GetValue("user") ?? section.GetValue("username");
            m_oath = section.GetValue("oauth") ?? section.GetValue("pass") ?? section.GetValue("password");

            section = m_iniReader.GetSectionByName("highlight");
            List<string> highlights = new List<string>();
            if (section != null)
                foreach (string line in section.EnumerateRawStrings())
                    highlights.Add(DoReplacements(line.ToLower()));

            m_highlightList = highlights.ToArray();

            section = m_iniReader.GetSectionByName("ignore");
            if (section != null)
            
            m_ignore = new HashSet<string>((from s in section.EnumerateRawStrings()
                                            where !string.IsNullOrWhiteSpace(s)
                                            select s.ToLower()));
        }
Exemplo n.º 2
0
        public ChatOptions()
        {
            RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);

            m_reg = key.CreateSubKey("TwitchChatClient");

            m_iniReader = new IniReader("options.ini");

            IniSection section = m_iniReader.GetSectionByName("stream");

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

            m_stream = section.GetValue("stream");
            m_user   = section.GetValue("twitchname") ?? section.GetValue("user") ?? section.GetValue("username");
            m_oath   = section.GetValue("oauth") ?? section.GetValue("pass") ?? section.GetValue("password");

            section = m_iniReader.GetSectionByName("highlight");
            List <string> highlights = new List <string>();

            if (section != null)
            {
                foreach (string line in section.EnumerateRawStrings())
                {
                    highlights.Add(DoReplacements(line.ToLower()));
                }
            }

            m_highlightList = highlights.ToArray();

            section = m_iniReader.GetSectionByName("ignore");
            if (section != null)
            {
                m_ignore = new HashSet <string>((from s in section.EnumerateRawStrings()
                                                 where !string.IsNullOrWhiteSpace(s)
                                                 select s.ToLower()));
            }
        }