Beispiel #1
0
        public static List <AccountInfo> GetAccountInfoCollection()
        {
            try
            {
                _accountInfoCollection = new List <AccountInfo>();
                IniFile iniFile          = new IniFile(SystemDefine.SYSTEM_DATA_FOLDER_PATH, "AccountInfo");
                int     accountInfoCount = iniFile.GetInt32("General", "Count");
                if (accountInfoCount > 0)
                {
                    string key = iniFile.GetString("General", "Key");
                    for (int i = 0; i < accountInfoCount; i++)
                    {
                        _accountInfoCollection.Add(new AccountInfo()
                        {
                            Name     = AESEncryption.AESDecoder(iniFile.GetString("User" + (i + 1).ToString(), "Name", ""), key),
                            Password = AESEncryption.AESDecoder(iniFile.GetString("User" + (i + 1).ToString(), "Password", "0"), key),
                            Level    = (AccountLevel)Enum.Parse(typeof(AccountLevel), AESEncryption.AESDecoder(iniFile.GetString("User" + (i + 1).ToString(), "Level", "0"), key))
                        });
                    }
                }
                else
                {
                    //v1.0.0.6 新增預設開發者帳號密碼
                    _accountInfoCollection.Add(new AccountInfo()
                    {
                        Name     = SystemDefine.DEVELOPER_USER_NAME,
                        Password = SystemDefine.DEVELOPER_USER_PASSWORD,
                        Level    = AccountLevel.Developer
                    });

                    AccountInfoManager.SetAccountInfoCollection(_accountInfoCollection);
                    GetAccountInfoCollection();
                }

                return(_accountInfoCollection);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
                return(_accountInfoCollection);
            }
        }