예제 #1
0
        private void loadSkin()
        {
            string filePath = Application.StartupPath + @"\config.lsf";

            if (File.Exists(filePath))
            {
                KBFile kbFile = new KBFile();
                kbFile.path = filePath;
                SysConfig config = kbFile.readObjectFromFile() as SysConfig;

                if (!string.IsNullOrEmpty(config.SkinFile))
                {
                    this.skin.SkinFile    = config.SkinFile; //使用第三方皮肤控件
                    this.skin.SkinAllForm = true;
                    this.skin.Active      = true;
                }
                else
                {
                    this.skin.SkinFile    = null; //使用第三方皮肤控件
                    this.skin.SkinAllForm = true;
                    this.skin.Active      = false;
                }
            }
            else
            {
                this.skin.SkinFile    = null;; //使用第三方皮肤控件
                this.skin.SkinAllForm = true;
                this.skin.Active      = false;
            }
        }
예제 #2
0
        /// <summary>
        /// 获取配置信息
        /// </summary>
        /// <returns></returns>
        public DBConfig getConfig()
        {
            try
            {
                KBFile file = new KBFile();
                file.path = System.Windows.Forms.Application.StartupPath + "\\dbConfig.kb";
                CrypToFile cy    = new CrypToFile();
                int        count = file.path.Split('.').Length;

                string fileExt  = file.path.Split('.')[count - 1];
                string fileName = file.path.Substring(0, file.path.Length - fileExt.Length - 1);

                if (cy.DecryptData(file.path, fileName + "pwd." + fileExt, "KingBoy"))
                {
                    file.path = fileName + "pwd." + fileExt;
                    DBConfig con = (DBConfig)file.readObjectFromFile();
                    System.IO.File.Delete(file.path);
                    return(con);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
예제 #3
0
        private void Init()
        {
            try
            {
                if (File.Exists(Application.StartupPath + @"\\WorkShop.txt"))
                {
                    using (StreamReader sr = File.OpenText(Application.StartupPath + @"\\WorkShop.txt"))
                    {
                        string strTemp = sr.ReadLine();
                        Globels.strWorkShop  = Data(strTemp);
                        strTemp              = sr.ReadLine();
                        Globels.strTeam      = Data(strTemp);
                        strTemp              = sr.ReadLine();
                        Globels.strStockCode = Data(strTemp);
                        strTemp              = sr.ReadLine();
                        Globels.strProce     = Data(strTemp);
                        strTemp              = sr.ReadLine();
                        Globels.strCom       = Data(strTemp);
                        sr.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }

            try
            {
                if (File.Exists(Application.StartupPath + @"\\loginConfig.lsf"))
                {
                    KBFile kbFile = new KBFile();
                    kbFile.path = Application.StartupPath + @"\\loginConfig.lsf";
                    LoginInfo loginInfo = kbFile.readObjectFromFile() as LoginInfo;
                    txtUser.Text       = loginInfo.Number;
                    txtPass.Text       = loginInfo.Pwd;
                    cbRemember.Checked = loginInfo.Remember;

                    txtPass.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("用户登陆模块出现异常:" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }