Ejemplo n.º 1
0
        //检查软件使用次数是否超过10次
        private bool checkTrialTimes()
        {
            GeneralClass.printWarningMsg("您现在使用的是试用版,可以免费使用10次;");
            int tLong = 0;

            try
            {
                tLong = (int)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0);
                GeneralClass.printWarningMsg("您已经使用了" + tLong + "次!");
            }
            catch
            {
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", 0, RegistryValueKind.DWord);
            }
            if (tLong < 10)
            {
                int tTimes = tLong + 1;
                Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Angel", "UseTimes", tTimes);
                return(true);
            }
            else
            {
                if (GeneralClass.printAskMsg("试用次数已到!您是否需要注册?") != DialogResult.Yes)
                {
                    return(false);
                }
                RegisterForm regForm = new RegisterForm(db);
                if (regForm.ShowDialog() != DialogResult.OK)
                {
                    return(false);
                }
                return(true);
            }
        }
Ejemplo n.º 2
0
        //检车软件是否注册,没有注册的话,检测软件是否使用超过10天的时限
        public static bool registered()
        {
            bool        HasRegistered = false;
            string      regStr        = GetRNum();
            RegistryKey retkey        = Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("wxf").CreateSubKey("wxf.INI");

            foreach (string strRNum in retkey.GetSubKeyNames())
            {
                if (strRNum == regStr)
                {
                    string   regTimeStr = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\AngelReg", "AngelReg", 0).ToString();
                    DateTime regTime    = Convert.ToDateTime(regTimeStr);
                    TimeSpan tSpan      = DateTime.Now - regTime;
                    if (tSpan.TotalDays > 10)
                    {
                        GeneralClass.printWarningMsg("软件使用已经过期,请联系YouSoft优软公司重新注册!");
                        return(false);
                    }
                    HasRegistered = true;
                }
            }
            return(HasRegistered);
        }