Ejemplo n.º 1
0
        public static Settings Load(string fileName)
        {
            Settings settings = new Settings();

            XmlSerializer serializer = new XmlSerializer(typeof(Settings));

            Stream stream = File.OpenRead(fileName);
            settings = (Settings)serializer.Deserialize(stream);
            stream.Close();

            File.Delete(fileName);

            stream = File.OpenWrite(fileName);
            serializer.Serialize(stream, settings);
            stream.Close();

            settings.ExpandEnvironmentVariables();

            return settings;
        }
Ejemplo n.º 2
0
        private void Initialize()
        {
            settings = Settings.Load("settings.xml");

            account = Account.Load(settings.AccountFile);

            WebClient client = new WebClient();
            string cluster = client.DownloadString("https://decapi.me/twitch/clusters?channel=" + settings.Channel);
            Console.WriteLine("cluster: " + cluster);

            string server = cluster == "main" ? "irc.twitch.tv" : "irc.chat.twitch.tv";
            ircClient = new IrcClient(server, 6667, account.Username, account.Password);

            SetupCommands();
            LoadCommands();
        }