Example #1
0
        private void ImportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            DialogResult dr = ofd.ShowDialog();

            if (dr == DialogResult.OK && ofd.CheckFileExists)
            {
                try
                {
                    string[] data = File.ReadAllLines(ofd.FileName);
                    if (data[0] == "encrypted")
                    {
                        GetDecryptPwd gp = new GetDecryptPwd();
                        dr = gp.ShowDialog();
                        if (dr != DialogResult.OK)
                        {
                            return;
                        }
                        string newdata = Crypt.Decrypt(data[1], gp.pwd);
                        if (newdata == "")
                        {
                            MessageBox.Show("亲,貌似密码不对哦!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        data = newdata.Split('\n');
                        gp.Close();
                    }
                    sm.Load(data);
                    //MessageBox.Show("导入完毕!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    toolStripStatusLabel1.Text = "导入完毕!";
                }
                catch (Exception excp)
                {
                    Error.RecordLog(excp, "亲,貌似数据不对哦,你确定是从我这里导出的吗?");
                    return;
                }

                outcome.Text = sm.Calculate(CreditToolStripMenuItem.Checked);

                BindData();

                this.CreditToolStripMenuItem.Enabled = true;
                this.GPAToolStripMenuItem.Enabled    = true;
            }
        }
Example #2
0
        public LoginForm(ref Web web)
        {
            InitializeComponent();
            this.web = web;
            web.getPage(refer, Encoding.GetEncoding("GB2312"), null, true);
            codeImg.Image = web.getCodeImg(codeImgUrl, refer);
            stuNum.Text   = INI.ReadIniData("user", "uid", "", @".\helper.ini");
            string password = INI.ReadIniData("user", "pwd", "", @".\helper.ini");

            if (password != "")
            {
                this.remember.Checked = true;
            }
            if (password != "")
            {
                pwd.Text = Crypt.Decrypt(password);
            }
            this.AcceptButton = login;
        }