Example #1
0
        private void LoadSettings()
        {
            this.Load += new EventHandler(OnLoad);
            foreach (IceChatSounds.SoundEntry x in this.iceChatSounds.soundList)
            {
                listBoxSounds.Items.Add(x.Description);
            }

            this.listViewEmot.MouseDown += new MouseEventHandler(listViewEmot_MouseDown);
            this.listViewEmot.MouseUp += new MouseEventHandler(listViewEmot_MouseUp);
            this.textNickComplete.KeyDown += new KeyEventHandler(OnKeyDown);

            //populate the font settings
            textConsoleFont.Font = new Font(iceChatFonts.FontSettings[0].FontName, 10);
            textConsoleFont.Text = iceChatFonts.FontSettings[0].FontName;
            textConsoleFontSize.Text = iceChatFonts.FontSettings[0].FontSize.ToString();

            textChannelFont.Font = new Font(iceChatFonts.FontSettings[1].FontName, 10);
            textChannelFont.Text = iceChatFonts.FontSettings[1].FontName;
            textChannelFontSize.Text = iceChatFonts.FontSettings[1].FontSize.ToString();

            textQueryFont.Font = new Font(iceChatFonts.FontSettings[2].FontName, 10);
            textQueryFont.Text = iceChatFonts.FontSettings[2].FontName;
            textQueryFontSize.Text = iceChatFonts.FontSettings[2].FontSize.ToString();

            textNickListFont.Font = new Font(iceChatFonts.FontSettings[3].FontName, 10);
            textNickListFont.Text = iceChatFonts.FontSettings[3].FontName;
            textNickListFontSize.Text = iceChatFonts.FontSettings[3].FontSize.ToString();

            textServerListFont.Font = new Font(iceChatFonts.FontSettings[4].FontName, 10);
            textServerListFont.Text = iceChatFonts.FontSettings[4].FontName;
            textServerListFontSize.Text = iceChatFonts.FontSettings[4].FontSize.ToString();

            textInputFont.Font = new Font(iceChatFonts.FontSettings[5].FontName, 10);
            textInputFont.Text = iceChatFonts.FontSettings[5].FontName;
            textInputFontSize.Text = iceChatFonts.FontSettings[5].FontSize.ToString();

            textDockTabFont.Font = new Font(iceChatFonts.FontSettings[6].FontName, 10);
            textDockTabFont.Text = iceChatFonts.FontSettings[6].FontName;
            textDockTabSize.Text = iceChatFonts.FontSettings[6].FontSize.ToString();

            textMenuBarFont.Font = new Font(iceChatFonts.FontSettings[7].FontName, 10);
            textMenuBarFont.Text = iceChatFonts.FontSettings[7].FontName;
            textMenuBarSize.Text = iceChatFonts.FontSettings[7].FontSize.ToString();

            textChannelBarFont.Font = new Font(iceChatFonts.FontSettings[8].FontName, 10);
            textChannelBarFont.Text = iceChatFonts.FontSettings[8].FontName;
            textChannelBarSize.Text = iceChatFonts.FontSettings[8].FontSize.ToString();

            //populate the settings
            textTimeStamp.Text = iceChatOptions.TimeStamp.Replace("", ((char)3).ToString()).Replace("", ((char)2).ToString()); ;

            checkTimeStamp.Checked = iceChatOptions.ShowTimeStamp;
            checkSaveWindowPosition.Checked = iceChatOptions.SaveWindowPosition;
            checkWindowedMode.Checked = iceChatOptions.WindowedMode;

            checkFlashChannelMessage.Checked = iceChatOptions.FlashTaskBarChannel;
            checkFlashChannelAction.Checked = iceChatOptions.FlashTaskBarChannelAction;

            checkFlashPrivateMessage.Checked = iceChatOptions.FlashTaskBarPrivate;
            checkFlashPrivateAction.Checked = iceChatOptions.FlashTaskBarPrivateAction;

            checkFlashChannel.Checked = iceChatOptions.FlashServerTreeIcons;
            checkFlashPrivate.Checked = iceChatOptions.FlashServerTreeIconsPrivate;

            textFlashTaskbarNumber.Text = iceChatOptions.FlashTaskBarNumber.ToString();
            checkJoinInvite.Checked = iceChatOptions.AutoJoinInvite;

            checkLogConsole.Checked = iceChatOptions.LogConsole;
            checkLogChannel.Checked = iceChatOptions.LogChannel;
            checkLogQuery.Checked = iceChatOptions.LogQuery;
            checkLogWindow.Checked = iceChatOptions.LogWindow;
            checkSeperateLogs.Checked = iceChatOptions.SeperateLogs;
            comboLogFormat.Text = iceChatOptions.LogFormat;
            labelCurrentLogFolder.Text = iceChatOptions.LogFolder;
            checkReloadLogs.Checked = iceChatOptions.LogReload;

            checkExternalPlayCommand.Checked = iceChatOptions.SoundUseExternalCommand;
            textExternalPlayCommand.Text = iceChatOptions.SoundExternalCommand;
            checkPlayActive.Checked = iceChatOptions.SoundPlayActive;

            if (iceChatEmoticons != null)
            {
                //load in the emoticons
                foreach (EmoticonItem emot in iceChatEmoticons.listEmoticons)
                {
                    Bitmap bm = new Bitmap(FormMain.Instance.EmoticonsFolder + System.IO.Path.DirectorySeparatorChar + emot.EmoticonImage);
                    int i = imageListEmoticons.Images.Add(bm, Color.Fuchsia);
                    ListViewItem lvi = new ListViewItem(emot.Trigger, i);
                    lvi.SubItems.Add(emot.EmoticonImage);
                    listViewEmot.Items.Add(lvi);
                }
            }

            checkEmoticons.Checked = iceChatOptions.ShowEmoticons;
            checkEmoticonPicker.Checked = iceChatOptions.ShowEmoticonPicker;
            checkColorPicker.Checked = iceChatOptions.ShowColorPicker;
            checkBasicCommands.Checked = iceChatOptions.ShowBasicCommands;
            checkStatusBar.Checked = iceChatOptions.ShowStatusBar;
            checkDisableQueries.Checked = iceChatOptions.DisableQueries;
            checkNewQueryForegound.Checked = iceChatOptions.NewQueryForegound;
            checkWhoisNewQuery.Checked = iceChatOptions.WhoisNewQuery;
            checkShowUnreadLine.Checked = iceChatOptions.ShowUnreadLine;
            checkMinimizeTray.Checked = iceChatOptions.MinimizeToTray;
            checkShowTrayIcon.Checked = iceChatOptions.ShowSytemTrayIcon;
            checkShowTrayNotifications.Checked = iceChatOptions.ShowSytemTrayNotifications;
            checkTrayServerMessage.Checked = iceChatOptions.SystemTrayServerMessage;
            checkTrayBuddyOnline.Checked = iceChatOptions.SystemTrayBuddyOnline;
            checkNickChan.Checked = iceChatOptions.SystemTrayChannelMention;
            checkNewQuery.Checked = iceChatOptions.SystemTrayQueryMessage;
            textSystemTrayText.Text = iceChatOptions.SystemTrayText;
            textSystemTrayIcon.Text = iceChatOptions.SystemTrayIcon;

            checkShowSend.Checked = iceChatOptions.ShowSendButton;

            checkAskQuit.Checked = iceChatOptions.AskQuit;
            textMaximumLines.Text = iceChatOptions.MaximumTextLines.ToString();
            textNickComplete.Text = iceChatOptions.NickCompleteAfter.Replace("", ((char)3).ToString()).Replace("", ((char)2).ToString());

            checkShowNickHost.Checked = iceChatOptions.ShowNickHost;
            checkNickShowButtons.Checked = iceChatOptions.ShowNickButtons;
            checkServerShowButtons.Checked = iceChatOptions.ShowServerButtons;
            checkKickChannelOpen.Checked = iceChatOptions.ChannelOpenKick;
            checkTopicBar.Checked = iceChatOptions.ShowTopic;
            checkSingleRowCB.Checked = iceChatOptions.SingleRowTabBar;

            //dcc settings
            checkAutoDCCChat.Checked = iceChatOptions.DCCChatAutoAccept;
            checkAutoDCCFile.Checked = iceChatOptions.DCCFileAutoAccept;
            checkAutoDCCChatBuddy.Checked = iceChatOptions.DCCChatAutoAcceptBuddyOnly;
            checkAutoDCCFileBuddy.Checked = iceChatOptions.DCCFileAutoAcceptBuddyOnly;
            checkIgnoreDCCChat.Checked = iceChatOptions.DCCChatIgnore;
            checkIgnoreDCCFile.Checked = iceChatOptions.DCCFileIgnore;
            textDCCChatTimeout.Text = iceChatOptions.DCCChatTimeOut.ToString();
            textDCCPortLow.Text = iceChatOptions.DCCPortLower.ToString();
            textDCCPortHigh.Text = iceChatOptions.DCCPortUpper.ToString();
            textDCCReceiveFolder.Text = iceChatOptions.DCCReceiveFolder;
            textDCCSendFolder.Text = iceChatOptions.DCCSendFolder;
            textDCCLocalIP.Text = iceChatOptions.DCCLocalIP;
            comboBufferSize.Text = iceChatOptions.DCCBufferSize.ToString();
            checkAutoGetLocalIP.Checked = iceChatOptions.DCCAutogetRouterIP;

            comboBoxLanguage.DataSource = FormMain.Instance.IceChatLanguageFiles;
            comboBoxLanguage.SelectedItem = FormMain.Instance.IceChatCurrentLanguageFile;

            //Event Settings
            comboJoinEvent.SelectedIndex = iceChatOptions.JoinEventLocation;
            comboPartEvent.SelectedIndex = iceChatOptions.PartEventLocation;
            comboQuitEvent.SelectedIndex = iceChatOptions.QuitEventLocation;
            comboModeEvent.SelectedIndex = iceChatOptions.ModeEventLocation;
            comboKickEvent.SelectedIndex = iceChatOptions.KickEventLocation;
            comboTopicEvent.SelectedIndex = iceChatOptions.TopicEventLocation;
            comboChannelMessageEvent.SelectedIndex = iceChatOptions.ChannelMessageEventLocation;
            comboChannelActionEvent.SelectedIndex = iceChatOptions.ChannelActionEventLocation;
            comboChannelNoticeEvent.SelectedIndex = iceChatOptions.ChannelNoticeEventLocation;
            comboWhoisEvent.SelectedIndex = iceChatOptions.WhoisEventLocation;
            comboNickEvent.SelectedIndex = iceChatOptions.NickChangeEventLocation;

            comboServerMessageEvent.SelectedIndex = iceChatOptions.ServerMessageEventLocation;
            comboServerNoticeEvent.SelectedIndex = iceChatOptions.ServerNoticeEventLocation;
            comboServerErrorEvent.SelectedIndex = iceChatOptions.ServerErrorEventLocation;
            comboUserNoticeEvent.SelectedIndex = iceChatOptions.UserNoticeEventLocation;

            //away settings
            textAwayCommand.Text = iceChatOptions.AwayCommand;
            textReturnCommand.Text = iceChatOptions.ReturnCommand;
            checkSendAwayReturn.Checked = iceChatOptions.SendAwayCommands;
            checkAwayMessagePrivate.Checked = iceChatOptions.SendAwayPrivateMessage;
            textAwayPrivateMessage.Text = iceChatOptions.PrivateAwayMessage;
            checkAutoAway.Checked = iceChatOptions.AutoAway;
            checkAutoReturn.Checked = iceChatOptions.AutoReturn;
            textAutoAwayMinutes.Text = iceChatOptions.AutoAwayTime.ToString();
            checkAutoAwayTray.Checked = iceChatOptions.AutoAwaySystemTray;
            textAutoAwayMessage.Text = iceChatOptions.AutoAwayMessage;

            checkAutoPerformStartup.Checked = iceChatOptions.AutoPerformStartupEnable;
            if (iceChatOptions.AutoPerformStartup != null)
            {
                foreach (string command in iceChatOptions.AutoPerformStartup)
                    textAutoPerformStartup.AppendText(command + Environment.NewLine);
            }

            trackTransparency.Value = Convert.ToInt32(FormMain.Instance.Opacity * 100);

            ApplyLanguage();

            if (!StaticMethods.IsRunningOnMono())
                mp3Player = new MP3Player();
            else
                player = new System.Media.SoundPlayer();
        }
Example #2
0
        public FormMain(string[] args, Form splash)
        {
            FormMain.Instance = this;

            System.Diagnostics.FileVersionInfo fv = System.Diagnostics.FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
            BuildNumber = fv.FileVersion;

            if (StaticMethods.IsRunningOnMono())
                player = new System.Media.SoundPlayer();
            else
                mp3Player = new MP3Player();

            bool forceCurrentFolder = false;
            errorMessages = new List<string>();

            _variables = new Variables();
            _globalTimers = new List<IrcTimer>();

            if (args.Length > 0)
            {
                string prevArg = "";
                foreach (string arg in args)
                {
                    if (prevArg.Length == 0)
                    {
                        prevArg = arg;
                        if (arg.ToLower().StartsWith("irc://"))
                        {
                            //parse out the server name and channel name
                            string server = arg.Substring(6).TrimEnd();
                            if (server.IndexOf("/") != -1)
                            {
                                string host = server.Split('/')[0];
                                string channel = server.Split('/')[1];
                                if (channel.StartsWith("#"))
                                    autoStartCommand = "/joinserv " + host + " " + channel;
                                else
                                    autoStartCommand = "/joinserv " + host + " #" + channel;

                            }
                            else
                                autoStartCommand = "/server " + arg.Substring(6).TrimEnd();

                        }
                        if (arg.ToLower() == "-disableauto")
                        {
                            disableAutoStart = true;
                        }
                    }
                    else
                    {
                        switch (prevArg.ToLower())
                        {
                            case "-profile":
                                currentFolder = arg;
                                //check if the folder exists, ir not, create it
                                if (!Directory.Exists(currentFolder))
                                    Directory.CreateDirectory(currentFolder);

                                forceCurrentFolder = true;
                                break;
                            case "-disableauto":
                                disableAutoStart = true;
                                break;
                        }

                        prevArg = "";
                    }
                }
            }

            //mutex = new System.Threading.Mutex(true, "IceChatMutex");

            #region Settings Files

            //check if the xml settings files exist in current folder
            if (currentFolder == null)
                currentFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            //check for IceChatPackage.xml in Assembly Folder

            if (File.Exists(currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatPackage.xml"))
            {
                //read the package file
                //create the IceChatServer.xml file from the package, if it doesnt exist

                serversFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "Settings" + System.IO.Path.DirectorySeparatorChar + "IceChatServer.xml";
                optionsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "Settings" + System.IO.Path.DirectorySeparatorChar + "IceChatOptions.xml";

                if (!File.Exists(serversFile))
                {
                    if (!Directory.Exists(currentFolder + System.IO.Path.DirectorySeparatorChar + "Settings"))
                        Directory.CreateDirectory(currentFolder + System.IO.Path.DirectorySeparatorChar + "Settings");

                    //ask for a Default Nickname
                    InputBoxDialog i = new InputBoxDialog();
                    i.FormCaption = "Enter Default Nickname";
                    i.FormPrompt = "Please enter your Nick name";

                    i.ShowDialog();
                    if (i.InputResponse.Length > 0)
                    {
                        //changedData[count] = i.InputResponse;

                        System.Diagnostics.Debug.WriteLine("Package Exists - Create Defaults");
                        XmlSerializer deserializer = new XmlSerializer(typeof(IceChatPackage));
                        TextReader textReader = new StreamReader(currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatPackage.xml");
                        IceChatPackage package = (IceChatPackage)deserializer.Deserialize(textReader);
                        textReader.Close();
                        textReader.Dispose();

                        IceChatServers servers = new IceChatServers();
                        foreach (ServerSetting s in package.Servers)
                        {
                            s.NickName = i.InputResponse;
                            s.AltNickName = s.NickName + "_";
                            s.AwayNickName = s.NickName + "[A]";

                            servers.AddServer(s);
                        }

                        //save the server(s) to IceChatServer.xml
                        XmlSerializer serializer = new XmlSerializer(typeof(IceChatServers));
                        TextWriter textWriter = new StreamWriter(serversFile);
                        serializer.Serialize(textWriter, servers);
                        textWriter.Close();
                        textWriter.Dispose();

                        servers.listServers.Clear();
                        serializer = null;
                        textWriter = null;

                        //load the options and save
                        IceChatOptions options = package.Options;

                        serializer = new XmlSerializer(typeof(IceChatOptions));
                        textWriter = new StreamWriter(optionsFile);
                        serializer.Serialize(textWriter, options);
                        textWriter.Close();
                        textWriter.Dispose();

                        currentFolder += System.IO.Path.DirectorySeparatorChar + "Settings";

                    }
                    i.Dispose();

                    //change the currentFolder
                }
            }
            //check for Settings/IceChatServer.xml
            if (File.Exists(currentFolder + System.IO.Path.DirectorySeparatorChar + "Settings" + System.IO.Path.DirectorySeparatorChar + "IceChatServer.xml"))
            {
                currentFolder += System.IO.Path.DirectorySeparatorChar + "Settings";
            }
            else if (!File.Exists(currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatServer.xml") && !forceCurrentFolder)
            {
                if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "Monody Networks" + Path.DirectorySeparatorChar + "Monody"))
                    Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "Monody Networks" + Path.DirectorySeparatorChar + "Monody");

                currentFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + Path.DirectorySeparatorChar + "Monody Networks" + Path.DirectorySeparatorChar + "Monody";
            }

            //load all files from the Local AppData folder, unless it exist in the current folder
            serversFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatServer.xml";
            optionsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatOptions.xml";
            messagesFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatMessages.xml";
            fontsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatFonts.xml";
            colorsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatColors.xml";
            soundsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatSounds.xml";
            favoriteChannelsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatChannels.xml";
            aliasesFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatAliases.xml";
            popupsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatPopups.xml";
            pluginsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "IceChatPlugins.xml";
            emoticonsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "Emoticons" + System.IO.Path.DirectorySeparatorChar + "IceChatEmoticons.xml";
            channelSettingsFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "ChannelSetting.xml";
            colorPaletteFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "ColorPalette.xml";

            //set a new logs folder
            logsFolder = currentFolder + System.IO.Path.DirectorySeparatorChar + "Logs";
            scriptsFolder = currentFolder + System.IO.Path.DirectorySeparatorChar + "Scripts";
            soundsFolder = currentFolder + System.IO.Path.DirectorySeparatorChar + "Sounds";
            picturesFolder = currentFolder + System.IO.Path.DirectorySeparatorChar + "Pictures";

            pluginsFolder = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + System.IO.Path.DirectorySeparatorChar + "Plugins";

            if (!Directory.Exists(pluginsFolder))
                Directory.CreateDirectory(pluginsFolder);

            if (!Directory.Exists(scriptsFolder))
                Directory.CreateDirectory(scriptsFolder);

            if (!Directory.Exists(soundsFolder))
                Directory.CreateDirectory(soundsFolder);

            if (!Directory.Exists(picturesFolder))
                Directory.CreateDirectory(picturesFolder);

            if (!Directory.Exists(currentFolder + Path.DirectorySeparatorChar + "Update"))
                Directory.CreateDirectory(currentFolder + Path.DirectorySeparatorChar + "Update");

            #endregion

            languageFiles = new List<LanguageItem>();

            DirectoryInfo languageDirectory = null;

            languageDirectory = new DirectoryInfo(currentFolder + System.IO.Path.DirectorySeparatorChar + "Languages");
            if (!Directory.Exists(currentFolder + System.IO.Path.DirectorySeparatorChar + "Languages"))
                Directory.CreateDirectory(currentFolder + System.IO.Path.DirectorySeparatorChar + "Languages");

            if (languageDirectory != null)
            {
                // scan the language directory for xml files and make LanguageItems for each file
                FileInfo[] langFiles = languageDirectory.GetFiles("*.xml");
                foreach (FileInfo fi in langFiles)
                {
                    string langFile = languageDirectory.FullName + System.IO.Path.DirectorySeparatorChar + fi.Name;
                    LanguageItem languageItem = LoadLanguageItem(langFile);
                    if (languageItem != null) languageFiles.Add(languageItem);
                }

                if (languageFiles.Count == 0)
                {
                    currentLanguageFile = new LanguageItem();
                    languageFiles.Add(currentLanguageFile);     // default language English
                }
            }

            //load the color palette
            LoadColorPalette();

            LoadOptions();
            LoadColors();
            LoadSounds();

            // use the language saved in options if available,
            // if not (e.g. user deleted xml file) default is used
            foreach (LanguageItem li in languageFiles)
            {
                if (li.LanguageName == iceChatOptions.Language)
                {
                    currentLanguageFile = li;
                    break;
                }
            }

            LoadLanguage(); // The language class MUST be loaded before any GUI component is created

            //set the new log folder
            if (iceChatOptions.LogFolder.Length > 0)
            {
                logsFolder = iceChatOptions.LogFolder;
            }
            else
            {
                iceChatOptions.LogFolder = logsFolder;
            }

            //check if we have any servers/settings saved, if not, load firstrun
            if (!File.Exists(serversFile))
            {
                FormFirstRun firstRun = new FormFirstRun(currentFolder);
                firstRun.SaveOptions += new FormFirstRun.SaveOptionsDelegate(FirstRunSaveOptions);
                firstRun.ShowDialog(this);
            }

            InitializeComponent();

            //load icons from Embedded Resources or Pictures Image
            this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("new-tray-icon.ico").GetHicon());
            if (iceChatOptions.SystemTrayIcon == null || iceChatOptions.SystemTrayIcon.Trim().Length == 0)
            {
                this.notifyIcon.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("new-tray-icon.ico").GetHicon());
            }
            else
            {
                //make sure the image exists and is an ICO file
                if (File.Exists(iceChatOptions.SystemTrayIcon))
                    this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(iceChatOptions.SystemTrayIcon);
                else
                    this.notifyIcon.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("new-tray-icon.ico").GetHicon());
            }
            //this.notifyIcon.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("new-tray-icon.ico").GetHicon());
            this.notifyIcon.Visible = iceChatOptions.ShowSytemTrayIcon;

            //disable this by default
            this.toolStripUpdate.Visible = false;
            this.updateAvailableToolStripMenuItem1.Visible = false;

            serverListToolStripMenuItem.Checked = iceChatOptions.ShowServerTree;
            panelDockLeft.Visible = serverListToolStripMenuItem.Checked;
            splitterLeft.Visible = serverListToolStripMenuItem.Checked;

            nickListToolStripMenuItem.Checked = iceChatOptions.ShowNickList;
            panelDockRight.Visible = nickListToolStripMenuItem.Checked;
            panelDockRight.TabControl.Alignment = TabAlignment.Right;
            splitterRight.Visible = nickListToolStripMenuItem.Checked;

            statusBarToolStripMenuItem.Checked = iceChatOptions.ShowStatusBar;
            statusStripMain.Visible = statusBarToolStripMenuItem.Checked;

            toolBarToolStripMenuItem.Checked = iceChatOptions.ShowToolBar;
            toolStripMain.Visible = toolBarToolStripMenuItem.Checked;

            viewChannelBarToolStripMenuItem.Checked = iceChatOptions.ShowTabBar;
            mainChannelBar.Visible = iceChatOptions.ShowTabBar;
            mainChannelBar.SingleRow = iceChatOptions.SingleRowTabBar;

            this.Text = ProgramID + " " + VersionID;

            //this can be customized
            if (iceChatOptions.SystemTrayText == null || iceChatOptions.SystemTrayText.Trim().Length == 0)
                this.notifyIcon.Text = ProgramID + " " + VersionID;
            else
                this.notifyIcon.Text = iceChatOptions.SystemTrayText;

            if (!Directory.Exists(logsFolder))
                Directory.CreateDirectory(logsFolder);

            try
            {
                errorFile = new StreamWriter(logsFolder + System.IO.Path.DirectorySeparatorChar + "errors.log", true);
            }
            catch (IOException io)
            {
                System.Diagnostics.Debug.WriteLine("Can not create errors.log:" + io.Message);
            }
            catch (Exception eo)
            {
                System.Diagnostics.Debug.WriteLine("Can not create errors.log:" + eo.Message);
            }

            if (iceChatOptions.WindowSize != null)
            {
                if (iceChatOptions.WindowSize.Width > 100 && iceChatOptions.WindowSize.Height > 100)
                {
                    this.Size = iceChatOptions.WindowSize;
                    this.WindowState = iceChatOptions.WindowState;
                }
                else
                {
                    this.Width = Screen.PrimaryScreen.WorkingArea.Width;
                    this.Height = Screen.PrimaryScreen.WorkingArea.Height;
                }
            }
            else
            {
                this.Width = Screen.PrimaryScreen.WorkingArea.Width;
                this.Height = Screen.PrimaryScreen.WorkingArea.Height;
            }

            if (iceChatOptions.WindowLocation != null)
            {
                //check if the location is valid, could try and place it on a 2nd screen that no longer exists
                if (Screen.AllScreens.Length == 1)
                {
                   if (Screen.PrimaryScreen.Bounds.Contains(iceChatOptions.WindowLocation))
                        this.Location = iceChatOptions.WindowLocation;

                }
                else
                {
                    //check if we are in the bounds of the screen location
                    foreach (Screen screen in Screen.AllScreens)
                        if (screen.Bounds.Contains(iceChatOptions.WindowLocation))
                            this.Location = iceChatOptions.WindowLocation;
                }
            }

            statusStripMain.Visible = iceChatOptions.ShowStatusBar;

            LoadAliases();
            LoadPopups();
            LoadEmoticons();
            LoadMessageFormat();
            LoadFonts();

            bool fileThemeFound = true;

            if (iceChatOptions.CurrentTheme == null)
            {
                iceChatOptions.CurrentTheme = "Default";
                defaultToolStripMenuItem.Checked = true;

                //reload all the theme files

            }
            else
            {
                //load in the new color theme, if it not Default
                if (iceChatOptions.CurrentTheme != "Default")
                {
                    string themeFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "Colors-" + iceChatOptions.CurrentTheme + ".xml";
                    if (File.Exists(themeFile))
                    {
                        XmlSerializer deserializer = new XmlSerializer(typeof(IceChatColors));
                        TextReader textReader = new StreamReader(themeFile);
                        iceChatColors = (IceChatColors)deserializer.Deserialize(textReader);
                        textReader.Close();
                        textReader.Dispose();

                        colorsFile = themeFile;
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Color Theme File not found:" + themeFile);
                        fileThemeFound = false;
                    }

                    themeFile = currentFolder + System.IO.Path.DirectorySeparatorChar + "Messages-" + iceChatOptions.CurrentTheme + ".xml";
                    if (File.Exists(themeFile))
                    {
                        XmlSerializer deserializer = new XmlSerializer(typeof(IceChatMessageFormat));
                        TextReader textReader = new StreamReader(themeFile);
                        iceChatMessages = (IceChatMessageFormat)deserializer.Deserialize(textReader);
                        textReader.Close();
                        textReader.Dispose();

                        messagesFile = themeFile;
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("Messages Theme File not found:" + themeFile);
                        fileThemeFound = false;
                    }
                }
                else
                    defaultToolStripMenuItem.Checked = true;

            }

            if (iceChatOptions.Theme == null)
            {
                defaultToolStripMenuItem.Checked = true;
                iceChatOptions.CurrentTheme = "Default";

                DirectoryInfo _currentFolder = new DirectoryInfo(currentFolder);
                FileInfo[] xmlFiles = _currentFolder.GetFiles("*.xml");

                int totalThemes = 1;
                foreach (FileInfo fi in xmlFiles)
                {
                    if (fi.Name.StartsWith("Colors-"))
                    {
                        totalThemes++;
                    }
                }

                iceChatOptions.Theme = new ThemeItem[totalThemes];

                iceChatOptions.Theme[0] = new ThemeItem();
                iceChatOptions.Theme[0].ThemeName = "Default";
                iceChatOptions.Theme[0].ThemeType = "XML";

                int t = 1;
                foreach (FileInfo fi in xmlFiles)
                {
                    if (fi.Name.StartsWith("Colors-"))
                    {
                        string themeName = fi.Name.Replace("Colors-", "").Replace(".xml", ""); ;
                        iceChatOptions.Theme[t] = new ThemeItem();
                        iceChatOptions.Theme[t].ThemeName = themeName;
                        iceChatOptions.Theme[t].ThemeType = "XML";
                        t++;
                    }
                }
            }

            channelList = new ChannelList(this);
            channelList.Dock = DockStyle.Fill;
            buddyList = new BuddyList(this);
            buddyList.Dock = DockStyle.Fill;

            toolStripMain.BackColor = IrcColor.colors[iceChatColors.ToolbarBackColor];
            statusStripMain.BackColor = IrcColor.colors[iceChatColors.StatusbarBackColor];
            toolStripStatus.ForeColor = IrcColor.colors[iceChatColors.StatusbarForeColor];
            menuMainStrip.BackColor = IrcColor.colors[iceChatColors.MenubarBackColor];

            inputPanel.SetInputBoxColors();
            channelList.SetListColors();
            buddyList.SetListColors();
            serverTree.SetListColors();
            nickList.SetListColors();

            this.nickList.Header = iceChatLanguage.consoleTabTitle;

            nickListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
            nickListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];

            serverListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
            serverListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];

            channelListTab = new TabPage("Favorite Channels");
            Panel channelPanel = new Panel();
            channelPanel.Dock = DockStyle.Fill;
            channelPanel.Controls.Add(channelList);
            channelListTab.Controls.Add(channelPanel);
            channelListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
            channelListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];

            buddyListTab = new TabPage("Buddy List");
            Panel buddyPanel = new Panel();
            buddyPanel.Dock = DockStyle.Fill;
            buddyPanel.Controls.Add(buddyList);
            buddyListTab.Controls.Add(buddyPanel);
            buddyListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
            buddyListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];

            panelDockLeft.Width = iceChatOptions.LeftPanelWidth;
            panelDockRight.Width = iceChatOptions.RightPanelWidth;

            //Load the panel items in order
            if (iceChatOptions.LeftPanels != null)
            {
                foreach (string arrayitem in iceChatOptions.LeftPanels)
                {
                    if (arrayitem == serverListTab.Text)
                        this.panelDockLeft.TabControl.TabPages.Add(serverListTab);
                    else if (arrayitem == channelListTab.Text)
                        this.panelDockLeft.TabControl.TabPages.Add(channelListTab);
                    else if (arrayitem == nickListTab.Text)
                        this.panelDockLeft.TabControl.TabPages.Add(nickListTab);
                    else if (arrayitem == buddyListTab.Text)
                        this.panelDockLeft.TabControl.TabPages.Add(buddyListTab);
                }
            }
            if (iceChatOptions.RightPanels != null)
            {
                foreach (string arrayitem in iceChatOptions.RightPanels)
                {
                    if (arrayitem == serverListTab.Text)
                        this.panelDockRight.TabControl.TabPages.Add(serverListTab);
                    else if (arrayitem == nickListTab.Text)
                        this.panelDockRight.TabControl.TabPages.Add(nickListTab);
                    else if (arrayitem == channelListTab.Text)
                        this.panelDockRight.TabControl.TabPages.Add(channelListTab);
                    else if (arrayitem == buddyListTab.Text)
                        this.panelDockRight.TabControl.TabPages.Add(buddyListTab);
                }
            }

            //If any panels are missing
            if (!panelDockLeft.TabControl.TabPages.Contains(serverListTab) && !panelDockRight.TabControl.TabPages.Contains(serverListTab))
                this.panelDockLeft.TabControl.TabPages.Add(serverListTab);
            if (!panelDockLeft.TabControl.TabPages.Contains(nickListTab) && !panelDockRight.TabControl.TabPages.Contains(nickListTab))
                this.panelDockRight.TabControl.TabPages.Add(nickListTab);
            if (!panelDockLeft.TabControl.TabPages.Contains(channelListTab) && !panelDockRight.TabControl.TabPages.Contains(channelListTab))
                this.panelDockRight.TabControl.TabPages.Add(channelListTab);
            if (!panelDockLeft.TabControl.TabPages.Contains(buddyListTab) && !panelDockRight.TabControl.TabPages.Contains(buddyListTab))
                this.panelDockRight.TabControl.TabPages.Add(buddyListTab);

            this.MinimumSize = new Size(panelDockLeft.Width + panelDockRight.Width + 300, 300);

            //hide the left or right panel if it is empty
            if (panelDockLeft.TabControl.TabPages.Count == 0)
            {
                this.splitterLeft.Visible = false;
                panelDockLeft.Visible = false;
                this.MinimumSize = new Size(panelDockRight.Width + 300, 300);
            }
            if (panelDockRight.TabControl.TabPages.Count == 0)
            {
                this.splitterRight.Visible = false;
                panelDockRight.Visible = false;
                if (panelDockLeft.Visible)
                    this.MinimumSize = new Size(panelDockLeft.Width + 300, 300);
                else
                    this.MinimumSize = new Size(300, 300);
            }

            if (iceChatOptions.LockWindowSize)
            {
                fixWindowSizeToolStripMenuItem.Checked = true;
                this.FormBorderStyle = FormBorderStyle.FixedSingle;
            }

            nickList.Font = new Font(iceChatFonts.FontSettings[3].FontName, iceChatFonts.FontSettings[3].FontSize);
            serverTree.Font = new Font(iceChatFonts.FontSettings[4].FontName, iceChatFonts.FontSettings[4].FontSize);
            mainChannelBar.TabFont = new Font(iceChatFonts.FontSettings[8].FontName, iceChatFonts.FontSettings[8].FontSize);
            menuMainStrip.Font = new Font(iceChatFonts.FontSettings[7].FontName, iceChatFonts.FontSettings[7].FontSize);
            toolStripMain.Font = new Font(iceChatFonts.FontSettings[7].FontName, iceChatFonts.FontSettings[7].FontSize);

            inputPanel.OnCommand +=new InputPanel.OnCommandDelegate(inputPanel_OnCommand);
            inputPanel.InputBoxFont = new Font(iceChatFonts.FontSettings[5].FontName, iceChatFonts.FontSettings[5].FontSize);

            inputPanel.ShowColorPicker = iceChatOptions.ShowColorPicker;
            inputPanel.ShowEmoticonPicker = iceChatOptions.ShowEmoticonPicker;
            inputPanel.ShowBasicCommands = iceChatOptions.ShowBasicCommands;
            inputPanel.ShowSendButton = iceChatOptions.ShowSendButton;

            inputPanel.ShowWideTextPanel = iceChatOptions.ShowMultilineEditbox;

            if (iceChatOptions.ShowEmoticons == false)
                inputPanel.ShowEmoticonPicker = false;

            mainChannelBar.OnTabClosed += new ChannelBar.TabClosedDelegate(OnTabClosed);
            mainChannelBar.SelectedIndexChanged += new ChannelBar.TabEventHandler(OnTabSelectedIndexChanged);

            panelDockLeft.Initialize();
            panelDockRight.Initialize();

            if (iceChatOptions.DockLeftPanel == true)
                panelDockLeft.DockControl();

            if (iceChatOptions.DockRightPanel == true)
                panelDockRight.DockControl();

            LoadChannelSettings();

            CreateDefaultConsoleWindow();

            //****
            WindowMessage(null, "Console", "\x000304Data Folder: " + currentFolder, "", true);
            WindowMessage(null, "Console", "\x000304Plugins Folder: " + pluginsFolder, "", true);
            WindowMessage(null, "Console", "\x000304Logs Folder: " + logsFolder, "", true);

            serverTree.NewServerConnection += new NewServerConnectionDelegate(NewServerConnection);
            serverTree.SaveDefault += new ServerTree.SaveDefaultDelegate(OnDefaultServerSettings);

            loadedPluginThemes = new List<IThemeIceChat>();
            loadedPlugins = new List<Plugin>();

            //load the plugin settings file
            LoadPluginFiles();

            //load any plugin addons
            LoadPlugins();

            //****
            WindowMessage(null, "Console", "\x00034Using Theme - " + iceChatOptions.CurrentTheme, "", true);

            //set any plugins as disabled
            //add any items to the pluginsFile if they do not exist, or remove any that do not

            foreach (Plugin p in loadedPlugins)
            {
                IceChatPlugin ipc = p as IceChatPlugin;
                if (ipc != null)
                {
                    bool found = false;
                    for (int i = 0; i < iceChatPlugins.listPlugins.Count; i++)
                    {
                        if (iceChatPlugins.listPlugins[i].PluginFile.Equals(ipc.plugin.FileName))
                        {
                            found = true;

                            if (iceChatPlugins.listPlugins[i].Enabled == false)
                            {
                                WindowMessage(null, "Console", "\x000304Disabled Plugin - " + ipc.plugin.Name + " v" + ipc.plugin.Version, "", true);

                                foreach (ToolStripMenuItem t in pluginsToolStripMenuItem.DropDownItems)
                                    if (t.ToolTipText.ToLower() == ipc.plugin.FileName.ToLower())
                                        t.Image = StaticMethods.LoadResourceImage("CloseButton.png");

                                ipc.plugin.Enabled = false;
                            }

                        }
                    }
                    if (found == false)
                    {
                        //plugin file not found in plugin Items file, add it
                        PluginItem item = new PluginItem();
                        item.Enabled = true;
                        item.PluginFile = ipc.plugin.FileName;
                        iceChatPlugins.AddPlugin(item);
                        SavePluginFiles();
                    }
                }
            }

            if (iceChatPlugins.listPlugins.Count != loadedPlugins.Count)
            {
                //find the file that is missing
                List<int> removeItems = new List<int>();
                for (int i = 0; i < iceChatPlugins.listPlugins.Count; i++)
                {
                    bool found = false;
                    foreach (Plugin p in loadedPlugins)
                    {
                        IceChatPlugin ipc = p as IceChatPlugin;
                        if (ipc != null)
                        {

                            if (iceChatPlugins.listPlugins[i].PluginFile.Equals(ipc.plugin.FileName))
                                found = true;
                        }
                    }

                    if (found == false)
                        removeItems.Add(i);
                }

                if (removeItems.Count > 0)
                {
                    try
                    {
                        foreach (int i in removeItems)
                            iceChatPlugins.listPlugins.Remove(iceChatPlugins.listPlugins[i]);
                    }
                    catch { }

                    SavePluginFiles();
                }
            }

            //initialize each of the plugins on its own thread
            foreach (Plugin p in loadedPlugins)
            {
                IceChatPlugin ipc = p as IceChatPlugin;
                if (ipc != null)
                {
                    if (ipc.plugin.Enabled == true)
                    {
                        System.Threading.Thread initPlugin = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(InitializePlugin));
                        initPlugin.Start(ipc.plugin);
                    }
                }
            }

            foreach (string s in errorMessages)
            {
                WindowMessage(null, "Console", "\x000304Error: " + s,"", true);
            }
            errorMessages.Clear();

            pluginsToolStripMenuItem.DropDownOpening += new EventHandler(pluginsToolStripMenuItem_DropDownOpening);

            if (fileThemeFound == false)
            {
                //check for the Plugin File theme
                foreach (IThemeIceChat theme in IceChatPluginThemes)
                {
                    if (theme.Name == iceChatOptions.CurrentTheme)
                    {
                        //update, this is the match
                        iceChatColors.ChannelAdminColor = theme.ChannelAdminColor;
                        iceChatColors.ChannelBackColor = theme.ChannelBackColor;
                        iceChatColors.ChannelHalfOpColor = theme.ChannelHalfOpColor;
                        iceChatColors.ChannelJoinColorChange = theme.ChannelJoinColorChange;
                        iceChatColors.ChannelListBackColor = theme.ChannelListBackColor;
                        iceChatColors.ChannelListForeColor = theme.ChannelListForeColor;
                        iceChatColors.ChannelOpColor = theme.ChannelOpColor;
                        iceChatColors.ChannelOwnerColor = theme.ChannelOwnerColor;
                        iceChatColors.ChannelPartColorChange = theme.ChannelPartColorChange;
                        iceChatColors.ChannelRegularColor = theme.ChannelRegularColor;
                        iceChatColors.ChannelVoiceColor = theme.ChannelVoiceColor;
                        iceChatColors.ConsoleBackColor = theme.ConsoleBackColor;
                        iceChatColors.InputboxBackColor = theme.InputboxBackColor;
                        iceChatColors.InputboxForeColor = theme.InputboxForeColor;
                        iceChatColors.MenubarBackColor = theme.MenubarBackColor;
                        iceChatColors.NewMessageColorChange = theme.NewMessageColorChange;
                        iceChatColors.NickListBackColor = theme.NickListBackColor;
                        iceChatColors.OtherMessageColorChange = theme.OtherMessageColorChange;
                        iceChatColors.PanelHeaderBG1 = theme.PanelHeaderBG1;
                        iceChatColors.PanelHeaderBG2 = theme.PanelHeaderBG2;
                        iceChatColors.PanelHeaderForeColor = theme.PanelHeaderForeColor;
                        iceChatColors.QueryBackColor = theme.QueryBackColor;
                        iceChatColors.RandomizeNickColors = theme.RandomizeNickColors;
                        iceChatColors.ServerListBackColor = theme.ServerListBackColor;
                        iceChatColors.ServerMessageColorChange = theme.ServerMessageColorChange;
                        iceChatColors.ServerQuitColorChange = theme.ServerQuitColorChange;
                        iceChatColors.StatusbarBackColor = theme.StatusbarBackColor;
                        iceChatColors.StatusbarForeColor = theme.StatusbarForeColor;
                        iceChatColors.TabBarChannelJoin = theme.TabBarChannelJoin;
                        iceChatColors.TabBarChannelPart = theme.TabBarChannelPart;
                        iceChatColors.TabBarCurrent = theme.TabBarCurrent;
                        iceChatColors.TabBarDefault = theme.TabBarDefault;
                        iceChatColors.TabBarNewMessage = theme.TabBarNewMessage;
                        iceChatColors.TabBarOtherMessage = theme.TabBarOtherMessage;
                        iceChatColors.TabBarServerMessage = theme.TabBarServerMessage;
                        iceChatColors.TabBarServerQuit = theme.TabBarServerQuit;
                        iceChatColors.ToolbarBackColor = theme.ToolbarBackColor;
                        iceChatColors.UnreadTextMarkerColor = theme.UnreadTextMarkerColor;

                        inputPanel.SetInputBoxColors();

                        toolStripMain.BackColor = IrcColor.colors[iceChatColors.ToolbarBackColor];
                        menuMainStrip.BackColor = IrcColor.colors[iceChatColors.MenubarBackColor];
                        statusStripMain.BackColor = IrcColor.colors[iceChatColors.StatusbarBackColor];
                        toolStripStatus.ForeColor = IrcColor.colors[iceChatColors.StatusbarForeColor];

                        serverListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
                        serverListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];
                        nickListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
                        nickListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];
                        channelListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
                        channelListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];
                        buddyListTab.BackColor = IrcColor.colors[iceChatColors.PanelHeaderBG1];
                        buddyListTab.ForeColor = IrcColor.colors[iceChatColors.PanelHeaderForeColor];

                        inputPanel.SetInputBoxColors();
                        channelList.SetListColors();
                        buddyList.SetListColors();
                        nickList.SetListColors();
                        serverTree.SetListColors();

                        nickList.Invalidate();
                        mainChannelBar.Invalidate();
                        serverTree.Invalidate();
                    }
                }
            }

            //add the themes to the view menu
            if (iceChatOptions.Theme != null)
            {
                foreach (ThemeItem theme in iceChatOptions.Theme)
                {
                    if (!theme.ThemeName.Equals("Default"))
                    {
                        ToolStripMenuItem t = new ToolStripMenuItem(theme.ThemeName);
                        if (iceChatOptions.CurrentTheme == theme.ThemeName)
                            t.Checked = true;

                        t.Click += new EventHandler(themeChoice_Click);
                        themesToolStripMenuItem.DropDownItems.Add(t);
                    }
                }
            }

            this.FormClosing += new FormClosingEventHandler(FormMainClosing);
            this.Resize += new EventHandler(FormMainResize);

            if (iceChatOptions.IdentServer && !System.Diagnostics.Debugger.IsAttached)
                identServer = new IdentServer();

            if (iceChatLanguage.LanguageName != "English") ApplyLanguage(); // ApplyLanguage can first be called after all child controls are created

            //get a new router ip
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                if (iceChatOptions.DCCAutogetRouterIP == true)
                {
                    System.Threading.Thread dccThread = new System.Threading.Thread(getLocalIPAddress);
                    dccThread.Name = "DCCIPAutoUpdate";
                    dccThread.Start();
                }
            }

            splash.Close();
            splash.Dispose();

            this.Activated += new EventHandler(FormMainActivated);

            nickList.ShowNickButtons = iceChatOptions.ShowNickButtons;
            serverTree.ShowServerButtons = iceChatOptions.ShowServerButtons;

            showButtonsNickListToolStripMenuItem.Checked = iceChatOptions.ShowNickButtons;
            showButtonsServerTreeToolStripMenuItem1.Checked = iceChatOptions.ShowServerButtons;

            // check for background images for nicklist and server tree
            if (iceChatOptions.NickListImage != null && iceChatOptions.NickListImage.Length > 0)
            {
                if (File.Exists(picturesFolder + System.IO.Path.DirectorySeparatorChar + iceChatOptions.NickListImage))
                    this.nickList.BackGroundImage = picturesFolder + System.IO.Path.DirectorySeparatorChar + iceChatOptions.NickListImage;
                else if (File.Exists(iceChatOptions.NickListImage))
                    this.nickList.BackGroundImage = iceChatOptions.NickListImage;

            }
            if (iceChatOptions.ServerTreeImage != null && iceChatOptions.ServerTreeImage.Length > 0)
            {
                if (File.Exists(picturesFolder + System.IO.Path.DirectorySeparatorChar + iceChatOptions.ServerTreeImage))
                    this.serverTree.BackGroundImage = picturesFolder + System.IO.Path.DirectorySeparatorChar + iceChatOptions.ServerTreeImage;
                else if (File.Exists(iceChatOptions.NickListImage))
                    this.serverTree.BackGroundImage = iceChatOptions.ServerTreeImage;
            }

            this.flashTrayIconTimer = new System.Timers.Timer(2000);
            this.flashTrayIconTimer.Enabled = false;
            this.flashTrayIconTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTrayIconTimer_Elapsed);
            this.notifyIcon.Tag = "off";
            this.flashTrayCount = 0;

            this.flashTaskBarIconTimer = new System.Timers.Timer(2000);
            this.flashTaskBarIconTimer.Enabled = false;
            this.flashTaskBarIconTimer.Elapsed += new System.Timers.ElapsedEventHandler(flashTaskBarIconTimer_Elapsed);
            this.Tag = "off";
            this.flashTrayCount = 0;

            //new toolstrip renderer for the main menu strip
            menuMainStrip.RenderMode = ToolStripRenderMode.System;
            toolStripMain.RenderMode = ToolStripRenderMode.System;

            //setup windowed mode if saved
            if (iceChatOptions.WindowedMode)
            {
                resizeWindowToolStripMenuItem.PerformClick();
            }

            if (!System.Diagnostics.Debugger.IsAttached)
            {
                //check for an update and setup DDE, if NOT in debugger
                System.Threading.Thread checkThread = new System.Threading.Thread(checkForUpdate);
                checkThread.Start();
            }

            System.Diagnostics.Debug.WriteLine(mainChannelBar.Height + ":" + mainChannelBar.Location.Y + ":" + mainChannelBar.Visible + ":" + mainChannelBar.Parent.Name);

            foreach (string s in args)
            {
                if (s.IndexOf(' ') > -1)
                    _args += " \"" + s + "\"";
                else
                    _args += " " + s;
            }
        }