コード例 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (File.Exists("Option"))
            {
                FileStream   fs = new FileStream("Option", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                while (!sr.EndOfStream)
                {
                    string[] opt = sr.ReadLine().Split('=');
                    if (opt.Length == 2)
                    {
                        Options.Add(opt[0], opt[1]);
                    }
                }
                sr.Close();
            }
            if (Options.ContainsKey("lang"))
            {
                mui = new MUI(Options["lang"]);
            }
            else
            {
                mui = new MUI("cn");
            }
            mui.RefreshLanguage(this);
            if (File.Exists("Account"))
            {
                FileStream   fs = new FileStream("Account", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                while (!sr.EndOfStream)
                {
                    accounts.Add(new TLoginInfo(sr.ReadLine().Split(':')));
                }
                listView1_Refresh();
                sr.Close();
            }
            ReadStatistics();

            if (File.Exists("MOTD"))
            {
                FileStream   fs = new FileStream("MOTD", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                textLog.AppendText(sr.ReadToEnd());
                sr.Close();
            }

            if (!Directory.Exists("style"))
            {
                Directory.CreateDirectory("style");
            }
            if (File.Exists("style\\form!style"))
            {
                var x = File.ReadAllText("style\\form!style").Split(',');
                Width  = Convert.ToInt32(x[0]);
                Height = Convert.ToInt32(x[1]);
                Left   = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2;
                Top    = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2;
            }
            if (Options.ContainsKey("autorun"))              //自动登录
            {
                char opt = Options["autorun"].Trim()[0];
                switch (opt)
                {
                case 'y':
                case 'Y':
                case 't':
                case 'T':
                case '1':
                    for (int i = 0; i < accounts.Count; i++)
                    {
                        newtab(accounts[i]);
                    }
                    break;
                }
            }

            if (Options.ContainsKey("NoRaid2to7"))
            {
                RaidQueue.NoRaid2To7 = true;
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: churchillyik/TravianTool
        private void Form1_Load(object sender, EventArgs e)
        {
            if(File.Exists("Option"))
            {
                FileStream fs = new FileStream("Option", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                while(!sr.EndOfStream)
                {
                    string[] opt = sr.ReadLine().Split('=');
                    if(opt.Length == 2)
                        Options.Add(opt[0], opt[1]);
                }
                sr.Close();
            }
            if(Options.ContainsKey("lang"))
                mui = new MUI(Options["lang"]);
            else
                mui = new MUI("cn");
            mui.RefreshLanguage(this);
            if(File.Exists("Account"))
            {
                FileStream fs = new FileStream("Account", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                while(!sr.EndOfStream)
                {
                    accounts.Add(new TLoginInfo(sr.ReadLine().Split(':')));
                }
                listView1_Refresh();
                sr.Close();
            }
            ReadStatistics();

            if(File.Exists("MOTD"))
            {
                FileStream fs = new FileStream("MOTD", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(fs, Encoding.UTF8);
                textLog.AppendText(sr.ReadToEnd());
                sr.Close();
            }

            if(!Directory.Exists("style"))
                Directory.CreateDirectory("style");
            if(File.Exists("style\\form!style"))
            {
                var x = File.ReadAllText("style\\form!style").Split(',');
                Width = Convert.ToInt32(x[0]);
                Height = Convert.ToInt32(x[1]);
                Left = (Screen.PrimaryScreen.WorkingArea.Width - Width) / 2;
                Top = (Screen.PrimaryScreen.WorkingArea.Height - Height) / 2;

            }
            if (Options.ContainsKey("autorun"))  //自动登录
            {
                char opt = Options["autorun"].Trim()[0];
                switch (opt)
                {
                    case 'y':
                    case 'Y':
                    case 't':
                    case 'T':
                    case '1':
                        for (int i = 0; i < accounts.Count; i++)
                            newtab(accounts[i]);
                        break;
                }
            }

            if (Options.ContainsKey("NoRaid2to7"))
            {
                RaidQueue.NoRaid2To7 = true;
            }
        }