Exemple #1
0
        public static void Main()
        {
            const string confFileName = "robokins.conf";

            if (!File.Exists(confFileName))
                throw new FileNotFoundException("Configuration file not found.", confFileName);
            var conf = ConfRead(new StreamReader(confFileName));

            string usernm = "";
            var passwd = new SecureString();
            string chanls = "";

            usernm = GetKeyValue(conf, "username");
            passwd = GetKeySecureValue(conf, "password");
            chanls = GetKeyValue(conf, "channels");

            Tests(passwd);

            var bot = new Bot(usernm, passwd, chanls);
            bot.Server = GetKeyValue(conf, "server");
            bot.Port = GetKeyIntValue(conf, "port");
            bot.Website = GetKeyValue(conf, "website");

            bot.Start();
        }
Exemple #2
0
        public static void Main()
        {
            #region Keys

            const string conf = Bot.Username + ".conf";
            var table = ConfRead(new StreamReader(conf));

            #region Password

            if (!File.Exists(conf))
                throw new FileNotFoundException("Configuration file not found.", conf);

            var passwd = new SecureString();
            const string key = "password";

            if (table.ContainsKey(key) && !string.IsNullOrEmpty(table[key]))
            {
                foreach (char letter in table[key])
                    passwd.AppendChar(letter);
                passwd.MakeReadOnly();
                table.Remove(key);
            }

            if (passwd.Length == 0)
                throw new ArgumentNullException("Password is blank.");

            #endregion

            #region Others

            const string bitlyauth = "bitlyauth", bitlykey = "bitlykey";

            if (table.ContainsKey(bitlyauth))
                Links.BitlyAuth = table[bitlyauth];
            if (table.ContainsKey(bitlykey))
                Links.BitlyKey = table[bitlykey];

            const string pastesync = "pastesync", pasteurl = "pasteurl";

            if (table.ContainsKey(pastesync))
                Bot.PasteSync = table[pastesync];
            if (table.ContainsKey(pasteurl))
                Bot.PasteURL = table[pasteurl];

            #endregion

            #endregion

            Tests(passwd);

            var bot = new Bot { Password = passwd };
            bot.Connect();
        }