Beispiel #1
0
 public void openSettings()
 {
     try
     {
         sw.loadSettings();
         cw.getPanel().Content = sw;
     }
     catch (InvalidOperationException e)
     {
         sw = new D2SettingsWindow(cw, this);
         cw.getPanel().Content = sw;
     }
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="nick"></param>
        /// <param name="server"></param>
        /// <param name="chan"></param>
        /// <param name="game"></param>
        /// <param name="mainWin"></param>
        /// <param name="identify"></param>
        /// <param name="pass">used to indetify with NickServ</param>
        /// <param name="bot">Name of NickServ bot</param>
        public D2ChatClient(String nick, String server, String chan, int game, MainWindow mainWin, bool identify, string pass, string bot)
        {
            mw                 = mainWin;
            this.nick          = nick;
            this.server        = server;
            this.chan          = chan;
            clientId           = game;
            identifyToNickServ = identify;
            userpass           = pass;
            nickservbot        = bot;
            bp                 = new D2BlankPanel();
            ini                = new IniFile(System.IO.Path.Combine(Environment.CurrentDirectory, @"config.ini"));
            rnd                = new Random();
            users              = new List <d2avatar>();

            try
            {
                firstRun = (Boolean.Parse(ini.IniReadValue("Settings", "firstrun")));
            }
            catch (FormatException e)
            {
                firstRun = false;
            }
            try
            {
                secondRun = (Boolean.Parse(ini.IniReadValue("Settings", "2ndrun")));
            }
            catch (FormatException e)
            {
                secondRun = false;
            }
            try
            {
                elnotif = (Boolean.Parse(ini.IniReadValue("Settings", "enterleave")));
            }
            catch (FormatException e)
            {
                elnotif = false;
            }
            try
            {
                avChar = int.Parse(ini.IniReadValue(gameID, "char"));
            }
            catch (FormatException e)
            {
                avChar = 0;
            }
            try
            {
                avArmor = int.Parse(ini.IniReadValue(gameID, "armor"));
            }
            catch (FormatException e)
            {
                avArmor = 0;
            }
            cw = new D2ChatWindow(nick, chan, mw, this);
            closeSettings();
            sm = new SpawnMaster(nick, server, chan, cw.getBanner());
            sw = new D2SettingsWindow(cw, this);
            cb = new D2CharBuilder(this);
            //soundsettings = new D2SoundSettings(this);

            DoConnect();
            if (firstRun)
            {
                cw.AddToChatWindow(8, null, sm.clientMsg[0]);
                ini.IniWriteValue("Settings", "2ndrun", true.ToString());
                ini.IniWriteValue("Settings", "firstrun", false.ToString());
            }
            if (secondRun)
            {
                cw.AddToChatWindow(8, null, sm.clientMsg[1]);
                ini.IniWriteValue("Settings", "2ndrun", false.ToString());
            }
        }