Exemple #1
0
        public static void Decrypt()
        {
            DeadLine   = DateTime.MinValue;
            IsRegister = false;
            string str = "";

            string strIniPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LBTSR.ini");

            if (!File.Exists(strIniPath))
            {
                IsRegister = false;
                return;
            }
            else
            {
                IniClass ini = new IniClass(strIniPath);
                str = ini.ReadValue("TSR", "value");

                if (str == "" || str == null)
                {
                    IsRegister = false;
                    return;
                }
            }

            string strDiskID = GetDiskID();//硬盘ID

            //string strKey = "lin123ru456bin";
            //string strDesKey = strKey + strDiskID;
            try
            {
                string strDecrypt = DecryptAes(str, "linrubin" + strDiskID);

                string[] strSplits = strDecrypt.Split(';');
                foreach (string strSplit in strSplits)
                {
                    if (strSplit.Contains("="))
                    {
                        string[] strKeyValues = strSplit.Split('=');
                        if (strKeyValues.Length == 2)
                        {
                            string key   = strKeyValues[0];
                            string value = strKeyValues[1];

                            if (key.Equals("Register"))
                            {
                                if (value.Equals("1"))
                                {
                                    IsRegister = true;
                                }
                            }
                            else if (key.Equals("DeadLine"))
                            {
                                DateTime.TryParse(value, out DeadLine);
                            }
                            else if (key.Equals("ProductType"))
                            {
                                int.TryParse(value, out ProductType);
                            }
                            //else if (key.Equals("RegisterInfoJson"))
                            //{
                            //    RegisterInfoJson = value;
                            //}
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }