public void ReadData(cLicenseInfo cinfo)
 {
     try
     {
         cinfo.D_start   = (string)Registry.GetValue(this.m_keyName, "VerInfo1", null);
         cinfo.D_end     = (string)Registry.GetValue(this.m_keyName, "VerInfo2", null);
         cinfo.C_reqCode = (string)Registry.GetValue(this.m_keyName, "VerInfo3", null);
         cinfo.C_licCode = (string)Registry.GetValue(this.m_keyName, "VerInfo4", null);
         cinfo.D_current = (string)Registry.GetValue(this.m_keyName, "VerInfo5", null);
         if (!this.CheckData(cinfo))
         {
             throw new Exception("errr 1122 4544");
         }
     }
     catch (InvalidOperationException exception)
     {
         cGlobalRef.writefileLine("오류11");
         cGlobalRef.writefileLine(exception.Message);
         MessageBox.Show(exception.Message.ToString(), "오류11", MessageBoxButtons.OK);
         throw;
     }
     catch (Exception exception2)
     {
         cGlobalRef.writefileLine("오류14");
         cGlobalRef.writefileLine(exception2.Message);
         throw;
     }
 }
 public void InsertData(cLicenseInfo data)
 {
     Registry.SetValue(this.m_keyName, "VerInfo1", data.D_start);
     Registry.SetValue(this.m_keyName, "VerInfo2", data.D_end);
     Registry.SetValue(this.m_keyName, "VerInfo3", data.C_reqCode);
     Registry.SetValue(this.m_keyName, "VerInfo4", data.C_licCode);
     Registry.SetValue(this.m_keyName, "VerInfo5", data.D_current);
 }
        public void RecoveryMdb()
        {
            cGlobalRef.writefileLine("RecoveryMdb");
            this.m_keyName = this.m_keyName_backup;
            cLicenseInfo cinfo = new cLicenseInfo();

            try
            {
                this.ReadData(cinfo);
            }
            catch (Exception exception)
            {
                cGlobalRef.writefileLine("err 61609994");
                cGlobalRef.writefileLine(exception.Message);
                throw;
            }
            this.MakeOri(cinfo);
        }
Ejemplo n.º 4
0
        public int GameStart()
        {
            int num = 0;

            try
            {
                num = this.CheckGameStart();
            }
            catch (Exception exception)
            {
                cGlobalRef.writefileLine("err 8970052");
                cGlobalRef.writefileLine(exception.Message);
            }
            DateTime.Now.ToString("u");
            if (num != 0)
            {
                return(num);
            }
            DateTime now        = DateTime.Now;
            string   date       = now.ToString("u");
            string   clientCode = this.c_aes.GetClientCode(date);
            FormLic  lic        = new FormLic(clientCode, this.c_aes);

            if (lic.ShowDialog() == DialogResult.OK)
            {
                this.c_licinfo           = new cLicenseInfo();
                this.c_licinfo.D_end     = now.AddDays((double)cGlobalRef.a_Period[lic.Term]).ToString("u");
                this.c_licinfo.D_start   = date;
                this.c_licinfo.D_current = DateTime.Now.ToString("u");
                this.c_licinfo.C_reqCode = clientCode;
                this.c_licinfo.C_licCode = lic.Licensekey;
                this.EncodeLicInfo();
                this.c_db.MakeOri(this.c_licinfo);
                this.c_db.MakeBackup(this.c_licinfo);
                return(1);
            }
            return(0);
        }
 private bool CheckData(cLicenseInfo cinfo)
 {
     if (cinfo.D_start == null)
     {
         throw new Exception(" err 5781201 ");
     }
     if (cinfo.D_end == null)
     {
         throw new Exception(" err 5781202 ");
     }
     if (cinfo.C_reqCode == null)
     {
         throw new Exception(" err 5781203 ");
     }
     if (cinfo.C_licCode == null)
     {
         throw new Exception(" err 5781204 ");
     }
     if (cinfo.D_current == null)
     {
         throw new Exception(" err 5781205 ");
     }
     return(true);
 }
Ejemplo n.º 6
0
        private int CheckGameStart()
        {
            this.c_licinfo = new cLicenseInfo();
            try
            {
                this.c_db.ReadData(this.c_licinfo);
            }
            catch (Exception)
            {
                this.c_db.RecoveryMdb();
                try
                {
                    this.c_db.ReadData(this.c_licinfo);
                }
                catch (Exception exception)
                {
                    cGlobalRef.writefileLine("라이센스정보가 손상됬습니다. 라이센스키를 새로 등록해야 합니다.");
                    cGlobalRef.writefileLine(exception.Message);
                    MessageBox.Show("라이센스정보가 손상됬습니다. 라이센스키를 새로 등록해야 합니다.");
                    throw;
                }
            }
            try
            {
                this.DecodeLicInfo();
            }
            catch (Exception exception2)
            {
                cGlobalRef.writefileLine("err 142549 ");
                cGlobalRef.writefileLine(exception2.Message);
                return(0);
            }
            DateTime now  = DateTime.Now;
            string   date = this.c_licinfo.D_end.Replace("Z", "");

            if (!this.CheckDate(now, date))
            {
                cGlobalRef.writefileLine("인증기간 만료. 연장 또는 정식 등록이 필요합니다.   ");
                MessageBox.Show("인증기간 만료. 연장 또는 정식 등록이 필요합니다.");
                return(0);
            }
            string str2 = this.c_licinfo.D_current.Replace("Z", "");

            if (this.CheckDate(now, str2))
            {
                cGlobalRef.writefileLine(" err 9457812 ");
                return(0);
            }
            string clientCode = this.c_aes.GetClientCode(this.c_licinfo.D_start);

            if (clientCode != this.c_licinfo.C_reqCode)
            {
                cGlobalRef.writefileLine(" err 140547 ");
                return(0);
            }
            int num   = this.c_aes.TestLicenseKey(clientCode, this.c_licinfo.C_licCode);
            int index = num;

            if (num == -1)
            {
                cGlobalRef.writefileLine(" err 2014102 ");
                return(0);
            }
            string str5 = Convert.ToDateTime(this.c_licinfo.D_start.Replace("Z", "")).AddDays((double)cGlobalRef.a_Period[index]).ToString("u");

            if (this.c_licinfo.D_end != str5)
            {
                cGlobalRef.writefileLine(" err710211 ");
                return(0);
            }
            this.c_licinfo.D_current = DateTime.Now.ToString("u");
            this.EncodeLicInfo();
            this.c_db.UpdateData(this.c_licinfo.D_current);
            this.c_db.MakeBackup(this.c_licinfo);
            return(1);
        }
 public void MakeOri(cLicenseInfo cinfo)
 {
     cGlobalRef.writefileLine("MakeOri");
     this.m_keyName = this.m_keyName_ori;
     this.InsertData(cinfo);
 }
 public void MakeBackup(cLicenseInfo cinfo)
 {
     this.m_keyName = this.m_keyName_backup;
     this.InsertData(cinfo);
     this.m_keyName = this.m_keyName_ori;
 }