Beispiel #1
0
        public FormEditor()
        {
            InitializeComponent();

            this.Load += new EventHandler(FormEditor_Load);
            popupTypeToolStripMenuItem.Visible = false;

            tabControlEditor.SelectedIndexChanged += new EventHandler(TabControlEditor_SelectedIndexChanged);
            textAliases.KeyDown += new KeyEventHandler(OnKeyDown);
            textPopups.KeyDown  += new KeyEventHandler(OnKeyDown);

            //load the aliases
            aliasList = FormMain.Instance.IceChatAliases;
            LoadAliases();

            //load the popups
            popupList     = FormMain.Instance.IceChatPopupMenus;
            nickListPopup = LoadPopupMenu("NickList");
            consolePopup  = LoadPopupMenu("Console");
            channelPopup  = LoadPopupMenu("Channel");
            queryPopup    = LoadPopupMenu("Query");

            //load the nicklist by default into popup editor
            LoadPopups(nickListPopup);
            nickListToolStripMenuItem.Checked = true;
            currentPopup     = "NickList";
            currentPopupMenu = nickListToolStripMenuItem;

            this.Activated += new EventHandler(FormEditor_Activated);

            ApplyLanguage();
        }
Beispiel #2
0
        private void LoadPopups()
        {
            if (File.Exists(popupsFile))
            {
                XmlTextReader textReader   = null;
                XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPopupMenus));

                try
                {
                    textReader    = new XmlTextReader(popupsFile);
                    iceChatPopups = (IceChatPopupMenus)deserializer.Deserialize(textReader);
                    textReader.Close();
                }
                catch (Exception)
                {
                    if (textReader != null)
                    {
                        textReader.Close();
                    }

                    try
                    {
                        string backupFile = CurrentFolder + Path.DirectorySeparatorChar + "Backups" + Path.DirectorySeparatorChar + "IceChatPopups.xml";
                        if (File.Exists(backupFile))
                        {
                            textReader    = new XmlTextReader(backupFile);
                            iceChatPopups = (IceChatPopupMenus)deserializer.Deserialize(textReader);
                            textReader.Close();

                            loadErrors.Add("There was a problem with IceChatPopups.xml, restored from backup");

                            File.Copy(backupFile, popupsFile, true);
                        }
                        else
                        {
                            errorMessages.Add("There was a problem loading IceChatPopups.xml. No popup menus loaded");
                            iceChatPopups = new IceChatPopupMenus();
                        }
                    }
                    catch (InvalidOperationException)
                    {
                        errorMessages.Add("There was a problem loading IceChatPopups.xml. No backup to restore");
                        iceChatPopups = new IceChatPopupMenus();
                    }
                }
            }
            else
            {
                iceChatPopups = new IceChatPopupMenus();
            }
        }
Beispiel #3
0
 private void ReLoadPopups()
 {
     if (File.Exists(FormMain.Instance.PopupsFile))
     {
         XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPopupMenus));
         TextReader    textReader   = new StreamReader(FormMain.Instance.PopupsFile);
         popupList = (IceChatPopupMenus)deserializer.Deserialize(textReader);
         textReader.Close();
         textReader.Dispose();
     }
     else
     {
         popupList = new IceChatPopupMenus();
     }
 }
Beispiel #4
0
        public FormEditor()
        {
            InitializeComponent();
            popupTypeToolStripMenuItem.Visible = false;

            tabControlEditor.SelectedIndexChanged += new EventHandler(tabControlEditor_SelectedIndexChanged);
            textAliases.KeyDown += new KeyEventHandler(OnKeyDown);
            textPopups.KeyDown += new KeyEventHandler(OnKeyDown);

            //load the aliases
            aliasList = FormMain.Instance.IceChatAliases;
            LoadAliases();

            //load the popups
            popupList = FormMain.Instance.IceChatPopupMenus;
            nickListPopup = LoadPopupMenu("NickList");
            consolePopup = LoadPopupMenu("Console");
            channelPopup = LoadPopupMenu("Channel");
            queryPopup = LoadPopupMenu("Query");

            //load the nicklist by default into popup editor
            LoadPopups(nickListPopup);
            nickListToolStripMenuItem.Checked = true;
            currentPopup = "NickList";
            currentPopupMenu = nickListToolStripMenuItem;

            //change the menu bat font
            menuStripMain.Font = new Font(FormMain.Instance.IceChatFonts.FontSettings[7].FontName, FormMain.Instance.IceChatFonts.FontSettings[7].FontSize);

            //load any plugin addons
            foreach (IPluginIceChat ipc in FormMain.Instance.IceChatPlugins)
            {
                if (ipc.Enabled == true)
                    ipc.LoadEditorForm(this.tabControlEditor, this.menuStripMain);
            }

            ApplyLanguage();
        }
Beispiel #5
0
 private void LoadPopups()
 {
     if (File.Exists(popupsFile))
     {
         XmlTextReader textReader = null;
         try
         {
             XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPopupMenus));
             textReader    = new XmlTextReader(popupsFile);
             iceChatPopups = (IceChatPopupMenus)deserializer.Deserialize(textReader);
             textReader.Close();
         }
         catch (Exception)
         {
             textReader.Close();
             errorMessages.Add("There was a problem loading IceChatPopups.xml. No popup menus loaded");
             iceChatPopups = new IceChatPopupMenus();
         }
     }
     else
     {
         iceChatPopups = new IceChatPopupMenus();
     }
 }
Beispiel #6
0
 private void LoadPopups()
 {
     if (File.Exists(popupsFile))
     {
         XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPopupMenus));
         TextReader textReader = new StreamReader(popupsFile);
         iceChatPopups = (IceChatPopupMenus)deserializer.Deserialize(textReader);
         textReader.Close();
         textReader.Dispose();
     }
     else
         iceChatPopups = new IceChatPopupMenus();
 }
Beispiel #7
0
 private void ReLoadPopups()
 {
     if (File.Exists(FormMain.Instance.PopupsFile))
     {
         XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPopupMenus));
         TextReader textReader = new StreamReader(FormMain.Instance.PopupsFile);
         popupList = (IceChatPopupMenus)deserializer.Deserialize(textReader);
         textReader.Close();
         textReader.Dispose();
     }
     else
         popupList = new IceChatPopupMenus();
 }
Beispiel #8
0
        private void MakeDefaultFiles()
        {
            //make the server file
            string serversFile = _currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatServer.xml";

            IceChatServers servers = new IceChatServers();

            int ID = 1;

            _nickName = _nickName.Replace(" ", "");
            _nickName = _nickName.Replace("#", "");
            _nickName = _nickName.Replace(",", "");
            _nickName = _nickName.Replace("`", "");

            FormMain.Instance.IceChatOptions.DefaultNick = _nickName;

            if (comboData.Text.Length > 0)
            {
                ServerSetting s = new ServerSetting();
                s.ID = ID;
                s.ServerName = comboData.Text;
                s.NickName = _nickName;
                s.AltNickName = _nickName + "_";
                s.ServerPort = "6667";
                s.FullName = FormMain.Instance.IceChatOptions.DefaultFullName;
                s.IdentName = FormMain.Instance.IceChatOptions.DefaultIdent;
                s.QuitMessage = FormMain.Instance.IceChatOptions.DefaultQuitMessage;
                s.SetModeI = true;

                if (comboData.Text.ToLower() == "irc.quakenet.org")
                {
                    s.AutoJoinChannels = new string[] { "#icechat" };
                    s.AutoJoinEnable = true;
                }

                ID++;

                servers.AddServer(s);
            }

            foreach (string server in comboData.Items)
            {
                if (server != comboData.Text && server.Length > 0)
                {
                    ServerSetting ss = new ServerSetting();
                    ss.ID = ID;
                    ss.ServerName = server;
                    ss.NickName = _nickName;
                    ss.AltNickName = _nickName + "_";
                    ss.ServerPort = "6667";
                    ss.SetModeI = true;
                    ss.FullName = FormMain.Instance.IceChatOptions.DefaultFullName;
                    ss.IdentName = FormMain.Instance.IceChatOptions.DefaultIdent;
                    ss.QuitMessage = FormMain.Instance.IceChatOptions.DefaultQuitMessage;

                    if (server.ToLower() == "irc.quakenet.org")
                    {
                        ss.AutoJoinChannels = new string[] { "#icechat" };
                        ss.AutoJoinEnable = true;
                    }

                    ID++;

                    servers.AddServer(ss);
                }
            }

            XmlSerializer serializer = new XmlSerializer(typeof(IceChatServers));
            TextWriter textWriter = new StreamWriter(FormMain.Instance.ServersFile);
            serializer.Serialize(textWriter, servers);
            textWriter.Close();
            textWriter.Dispose();

            //make the default aliases file
            string aliasesFile = _currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatAliases.xml";
            IceChatAliases aliasList = new IceChatAliases();

            foreach (string alias in Default_Aliases)
            {
                AliasItem a = new AliasItem();
                string name = alias.Substring(0,alias.IndexOf(" ")).Trim();
                string command = alias.Substring(alias.IndexOf(" ") + 1);
                a.AliasName = name;
                a.Command = new String[] { command };

                aliasList.AddAlias(a);
            }

            XmlSerializer serializerA = new XmlSerializer(typeof(IceChatAliases));
            TextWriter textWriterA = new StreamWriter(aliasesFile);
            serializerA.Serialize(textWriterA, aliasList);
            textWriterA.Close();
            textWriterA.Dispose();

            //make the default popups file
            string popupsFile = _currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatPopups.xml";
            IceChatPopupMenus popupList = new IceChatPopupMenus();

            popupList.AddPopup(newPopupMenu("NickList", Nicklist_Popup));
            popupList.AddPopup(newPopupMenu("Console", Console_Popup));
            popupList.AddPopup(newPopupMenu("Channel", Channel_Popup));
            popupList.AddPopup(newPopupMenu("Query", Query_Popup));

            XmlSerializer serializerP = new XmlSerializer(typeof(IceChatPopupMenus));
            TextWriter textWriterP = new StreamWriter(popupsFile);
            serializerP.Serialize(textWriterP, popupList);
            textWriterP.Close();
            textWriterP.Dispose();
        }