コード例 #1
0
ファイル: License.cs プロジェクト: webtrialFormvp/License
        private static bool VerifyLicense(License lic)
        {
            Security security = new Security();
            string   hash     = security.GetHash(lic.GetHashString());
            bool     flag     = security.SignatureDeformatter(hash, lic.Signature);
            bool     result;

            if (flag)
            {
                if (lic.DaysLeftInTrial == 0)
                {
                    throw new LicenseInvalidException(Resource.LicenseExpired);
                }
                if (!string.IsNullOrEmpty(lic.MachineHash))
                {
                    Computer hWHelper = new Computer();
                    if (hWHelper.GetMachineHash() != lic.MachineHash)
                    {
                        throw new LicenseInvalidException(Resource.LicenseHardwardError);
                    }
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
コード例 #2
0
        private bool VerifyLicense(License.Base.License lic)
        {
            Security security = new Security();
            string   hash     = security.GetHash(lic.GetHashString());
            bool     flag     = security.SignatureDeformatter(hash, lic.Signature);

            return(flag);
        }