Exemplo n.º 1
0
        public static async void startCounter(string code)
        {
            try
            {
                code = new SymmetryEncrypt().Decrypto(code);
                var t    = long.Parse(code.Substring(0, LEN));
                var diff = new DateTime(t) - await GetNow();

                if (diff.TotalMilliseconds <= int.MaxValue)
                {
                    await Task.Delay(diff);
                }
                else
                {
                    await Task.Delay(int.MaxValue);

                    startCounter(code);
                    return;
                }
            }
            catch (Exception)
            {
            }
            MessageBox.Show("授权已过期,请重新登录");
            Application.Current.Shutdown();
        }
Exemplo n.º 2
0
        public static bool validate(string code)
        {
            code = new SymmetryEncrypt().Decrypto(code);
            var t = long.Parse(code.Substring(0, LEN));

            if (DateTime.Now > new DateTime(t))
            {
                return(false);
            }
            code = code.Substring(LEN);
            return(code == McCode);
        }