Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Contains("license", StringComparer.OrdinalIgnoreCase))
            {
                License();
                return;
            }

            Icebot host = new Icebot();

            Console.WriteLine(Icebot._asm.GetName().Name);
            Console.WriteLine("\tVersion " + Icebot._asm.GetName().Version.ToString());
            Console.WriteLine("\tCopyright (C) 2012 Carl Kittelberger");
            Console.WriteLine();

            Console.WriteLine("This program comes with ABSOLUTELY NO WARRANTY.");
            Console.WriteLine("This is free software, and you are welcome to redistribute it under certain conditions.");
            Console.WriteLine("To read the whole license, start this program with the 'license' parameter.");
            Console.WriteLine();

            if (!File.Exists("Icebot.xml"))
            {
                Console.WriteLine("Creating configuration file...");

                IcebotConfiguration conf = new IcebotConfiguration();
                IcebotServerConfiguration server = new IcebotServerConfiguration();
                IcebotChannelConfiguration channel = new IcebotChannelConfiguration();
                IcebotChannelPluginConfiguration plugin1 = new IcebotChannelPluginConfiguration();

                plugin1.PluginName = "pluginlist";
                plugin1.Enable = true;

                channel.ChannelName = "#icebot";
                channel.Plugins.Add(plugin1);

                server.Nickname = "Icebot";
                server.Channels.Add(channel);

                conf.CommandPrefix = "!";
                conf.Servers.Add(server);

                /*XmlWriter w = XmlWriter.Create("Icebot.xml");
                w.WriteStartElement("configuration");
                w.WriteRaw(Properties.Resources.l4nStandardConfiguration);
                IcebotConfiguration.Serialize(w, conf);
                w.WriteEndElement();
                w.Close();*/

                conf.Save("Icebot.xml");

                Console.WriteLine("Config created, edit it to your needs and restart the bot!");
                return;
            }

            host.LoadConfig("Icebot.xml");
            host.Connect();

            System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
        }
Exemplo n.º 2
0
 internal IcebotServer(Icebot host, IcebotServerConfiguration c)
 {
     Host = host;
     Configuration = c;
     PrivateCommands = new IcebotCommandsContainer();
     RfcDefinitions.Add(new Irc.Rfc2812.Commands());
     Registered = false;
 }