private void LoadFonts() { if (File.Exists(fontsFile)) { XmlTextReader textReader = null; try { XmlSerializer deserializer = new XmlSerializer(typeof(IceChatFontSetting)); textReader = new XmlTextReader(fontsFile); iceChatFonts = (IceChatFontSetting)deserializer.Deserialize(textReader); textReader.Close(); if (iceChatFonts.FontSettings.Length < 9) { LoadDefaultFontSettings(); } } catch (Exception) { textReader.Close(); errorMessages.Add("There was a problem loading IceChatFonts.xml. Default font settings loaded"); iceChatFonts = new IceChatFontSetting(); LoadDefaultFontSettings(); } } else { iceChatFonts = new IceChatFontSetting(); LoadDefaultFontSettings(); } }
public FormSettings(IceChatOptions Options, IceChatFontSetting Fonts, IceChatEmoticon Emoticons, IceChatSounds Sounds) { InitializeComponent(); this.iceChatOptions = Options; this.iceChatFonts = Fonts; this.iceChatEmoticons = Emoticons; this.iceChatSounds = Sounds; LoadSettings(); this.Activated += new EventHandler(OnActivated); this.textNickComplete.KeyDown += new KeyEventHandler(OnKeyDown); pictureTSHelp.Image = StaticMethods.LoadResourceImage("help.png"); pictureTSHelp.Click += new EventHandler(pictureTSHelp_Click); }
public FormSettings(IceChatOptions Options, IceChatFontSetting Fonts, IceChatEmoticon Emoticons, IceChatSounds Sounds, bool showFonts) { InitializeComponent(); this.iceChatOptions = Options; this.iceChatFonts = Fonts; this.iceChatEmoticons = Emoticons; this.iceChatSounds = Sounds; LoadSettings(); this.Activated += new EventHandler(OnActivated); if (showFonts == true) { tabControlOptions.SelectedTab = tabFonts; } }
private void LoadFonts() { if (File.Exists(fontsFile)) { XmlSerializer deserializer = new XmlSerializer(typeof(IceChatFontSetting)); TextReader textReader = new StreamReader(fontsFile); iceChatFonts = (IceChatFontSetting)deserializer.Deserialize(textReader); textReader.Close(); textReader.Dispose(); if (iceChatFonts.FontSettings.Length < 8) LoadDefaultFontSettings(); } else { iceChatFonts = new IceChatFontSetting(); LoadDefaultFontSettings(); } }
private void LoadDefaultFontSettings() { IceChatFontSetting oldFonts = new IceChatFontSetting(); oldFonts.FontSettings = new FontSettingItem[8]; iceChatFonts.FontSettings = new FontSettingItem[8]; if (iceChatFonts.FontSettings != null) iceChatFonts.FontSettings.CopyTo(oldFonts.FontSettings, 0); if (oldFonts.FontSettings[0] == null || iceChatFonts.FontSettings[0].FontName.Length == 0) iceChatFonts.FontSettings[0] = NewFontSetting("Console", "Verdana", 10); else iceChatFonts.FontSettings[0] = oldFonts.FontSettings[0]; if (oldFonts.FontSettings[1] == null || iceChatFonts.FontSettings[1].FontName.Length == 0) iceChatFonts.FontSettings[1] = NewFontSetting("Channel", "Verdana", 10); else iceChatFonts.FontSettings[1] = oldFonts.FontSettings[1]; if (oldFonts.FontSettings[2] == null || iceChatFonts.FontSettings[2].FontName.Length == 0) iceChatFonts.FontSettings[2] = NewFontSetting("Query", "Verdana", 10); else iceChatFonts.FontSettings[2] = oldFonts.FontSettings[2]; if (oldFonts.FontSettings[3] == null || iceChatFonts.FontSettings[3].FontName.Length == 0) iceChatFonts.FontSettings[3] = NewFontSetting("Nicklist", "Verdana", 10); else iceChatFonts.FontSettings[3] = oldFonts.FontSettings[3]; if (oldFonts.FontSettings[4] == null || iceChatFonts.FontSettings[4].FontName.Length == 0) iceChatFonts.FontSettings[4] = NewFontSetting("Serverlist", "Verdana", 10); else iceChatFonts.FontSettings[4] = oldFonts.FontSettings[4]; if (oldFonts.FontSettings[5] == null || iceChatFonts.FontSettings[5].FontName.Length == 0) iceChatFonts.FontSettings[5] = NewFontSetting("InputBox", "Verdana", 10); else iceChatFonts.FontSettings[5] = oldFonts.FontSettings[5]; if (oldFonts.FontSettings[6] == null || iceChatFonts.FontSettings[6].FontName.Length == 0) iceChatFonts.FontSettings[6] = NewFontSetting("DockTabs", "Verdana", 10); else iceChatFonts.FontSettings[6] = oldFonts.FontSettings[6]; if (oldFonts.FontSettings[7] == null || iceChatFonts.FontSettings[7].FontName.Length == 0) iceChatFonts.FontSettings[7] = NewFontSetting("MenuBar", "Verdana", 10); else iceChatFonts.FontSettings[7] = oldFonts.FontSettings[7]; oldFonts = null; SaveFonts(); }
private void LoadDefaultFontSettings() { IceChatFontSetting oldFonts = new IceChatFontSetting(); oldFonts.FontSettings = new FontSettingItem[9]; if (iceChatFonts.FontSettings != null) { iceChatFonts.FontSettings.CopyTo(oldFonts.FontSettings, 0); iceChatFonts.FontSettings = new FontSettingItem[9]; oldFonts.FontSettings.CopyTo(iceChatFonts.FontSettings, 0); } else { iceChatFonts.FontSettings = new FontSettingItem[9]; } if (oldFonts.FontSettings[0] == null || iceChatFonts.FontSettings[0].FontName.Length == 0) { iceChatFonts.FontSettings[0] = NewFontSetting("Console", "Verdana", 10); } else { iceChatFonts.FontSettings[0] = oldFonts.FontSettings[0]; } if (oldFonts.FontSettings[1] == null || iceChatFonts.FontSettings[1].FontName.Length == 0) { iceChatFonts.FontSettings[1] = NewFontSetting("Channel", "Verdana", 10); } else { iceChatFonts.FontSettings[1] = oldFonts.FontSettings[1]; } if (oldFonts.FontSettings[2] == null || iceChatFonts.FontSettings[2].FontName.Length == 0) { iceChatFonts.FontSettings[2] = NewFontSetting("Query", "Verdana", 10); } else { iceChatFonts.FontSettings[2] = oldFonts.FontSettings[2]; } if (oldFonts.FontSettings[3] == null || iceChatFonts.FontSettings[3].FontName.Length == 0) { iceChatFonts.FontSettings[3] = NewFontSetting("Nicklist", "Verdana", 10); } else { iceChatFonts.FontSettings[3] = oldFonts.FontSettings[3]; } if (oldFonts.FontSettings[4] == null || iceChatFonts.FontSettings[4].FontName.Length == 0) { iceChatFonts.FontSettings[4] = NewFontSetting("Serverlist", "Verdana", 10); } else { iceChatFonts.FontSettings[4] = oldFonts.FontSettings[4]; } if (oldFonts.FontSettings[5] == null || iceChatFonts.FontSettings[5].FontName.Length == 0) { iceChatFonts.FontSettings[5] = NewFontSetting("InputBox", "Verdana", 10); } else { iceChatFonts.FontSettings[5] = oldFonts.FontSettings[5]; } if (oldFonts.FontSettings[6] == null || iceChatFonts.FontSettings[6].FontName.Length == 0) { iceChatFonts.FontSettings[6] = NewFontSetting("DockTabs", "Verdana", 10); } else { iceChatFonts.FontSettings[6] = oldFonts.FontSettings[6]; } if (oldFonts.FontSettings[7] == null || iceChatFonts.FontSettings[7].FontName.Length == 0) { iceChatFonts.FontSettings[7] = NewFontSetting("MenuBar", "Verdana", 10); } else { iceChatFonts.FontSettings[7] = oldFonts.FontSettings[7]; } if (oldFonts.FontSettings[8] == null || iceChatFonts.FontSettings[8].FontName.Length == 0) { iceChatFonts.FontSettings[8] = NewFontSetting("ChannelBar", "Verdana", 10); } else { iceChatFonts.FontSettings[8] = oldFonts.FontSettings[8]; } oldFonts = null; SaveFonts(); }
/* private enum FontType { Console = 0, Channel = 1, Query = 2, NickList = 3, ServerList = 4, InputBox = 5, ChannelBar = 6 } */ public FormSettings(IceChatOptions Options, IceChatFontSetting Fonts, IceChatEmoticon Emoticons, IceChatSounds Sounds) { InitializeComponent(); /* listBoxSounds.Items.Add("New Message in Console"); listBoxSounds.Items.Add("New Channel Message"); listBoxSounds.Items.Add("New Private Message"); listBoxSounds.Items.Add("New User Notice"); listBoxSounds.Items.Add("Your Nickname is said in a Channel"); listBoxSounds.Items.Add("Your Nickname is said in a Private Message"); listBoxSounds.Items.Add("A Buddy has come Online"); listBoxSounds.Items.Add("Server Disconnection"); */ foreach(IceChatSounds.SoundEntry x in Sounds.soundList) { listBoxSounds.Items.Add(x.Description); } this.iceChatOptions = Options; this.iceChatFonts = Fonts; this.iceChatEmoticons = Emoticons; this.iceChatSounds = Sounds; this.listViewEmot.MouseDown += new MouseEventHandler(listViewEmot_MouseDown); this.listViewEmot.MouseUp += new MouseEventHandler(listViewEmot_MouseUp); //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(); //populate the settings textTimeStamp.Text = iceChatOptions.TimeStamp; checkSaveWindowPosition.Checked = iceChatOptions.SaveWindowPosition; checkLogConsole.Checked = iceChatOptions.LogConsole; checkLogChannel.Checked = iceChatOptions.LogChannel; checkLogQuery.Checked = iceChatOptions.LogQuery; checkSeperateLogs.Checked = iceChatOptions.SeperateLogs; comboLogFormat.Text = iceChatOptions.LogFormat; checkExternalPlayCommand.Checked = iceChatOptions.SoundUseExternalCommand; textExternalPlayCommand.Text = iceChatOptions.SoundExternalCommand; 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; checkStatusBar.Checked = iceChatOptions.ShowStatusBar; checkDisableQueries.Checked = iceChatOptions.DisableQueries; checkNewQueryForegound.Checked = iceChatOptions.NewQueryForegound; checkWhoisNewQuery.Checked = iceChatOptions.WhoisNewQuery; checkShowUnreadLine.Checked = iceChatOptions.ShowUnreadLine; checkMinimizeTray.Checked = iceChatOptions.MinimizeToTray; textMaximumLines.Text = iceChatOptions.MaximumTextLines.ToString(); checkShowNickHost.Checked = iceChatOptions.ShowNickHost; checkNickShowButtons.Checked = iceChatOptions.ShowNickButtons; checkServerShowButtons.Checked = iceChatOptions.ShowServerButtons; checkKickChannelOpen.Checked = iceChatOptions.ChannelOpenKick; //dcc settings checkAutoDCCChat.Checked = iceChatOptions.DCCChatAutoAccept; checkAutoDCCFile.Checked = iceChatOptions.DCCFileAutoAccept; 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; //load any plugin addons foreach (IPluginIceChat ipc in FormMain.Instance.IceChatPlugins) { if (ipc.Enabled == true) ipc.LoadSettingsForm(this.tabControlOptions); } 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; comboWhoisEvent.SelectedIndex = iceChatOptions.WhoisEventLocation; trackTransparency.Value = Convert.ToInt32(FormMain.Instance.Opacity * 100); ApplyLanguage(); player = new System.Media.SoundPlayer(); }