Exemple #1
0
 private KeyErrorType ValidImportToolReportKey(OA3ToolReportKeyInfo.Key key, KeyInfo keyinfo)
 {
     if (key.ProductKeyID <= 0)
         return KeyErrorType.Invalid;
     else if (key.ProductKeyState != (byte)KeyState.Bound)
         return KeyErrorType.FileStateInvalid;
     else if (keyinfo == null)
         return KeyErrorType.NotFound;
     else if (keyinfo.KeyInfoEx.KeyType != KeyType.Standard)
         return KeyErrorType.KeyTypeInvalid;
     else if (!ValidateKeyState(() => keyinfo.FactoryFloorBoundKey(true)))
         return KeyErrorType.StateInvalid;
     else
         return KeyErrorType.None;
 }
Exemple #2
0
 private List<KeyOperationResult> UpdateImportToolKey(OA3ToolReportKeyInfo.Key key)
 {
     List<KeyOperationResult> results = new List<KeyOperationResult>();
     KeyInfo keyinfo = keyRepository.GetKey(key.ProductKeyID);
     KeyErrorType FailedType = ValidImportToolReportKey(key, keyinfo);
     if (FailedType == KeyErrorType.None)
     {
         OemOptionalInfo oemOptionInfo = null;
         oemOptionInfo = (key.OEMOptionalInfo.Count <= 0 ? new OemOptionalInfo() : new OemOptionalInfo(key.OEMOptionalInfo));
         keyRepository.UpdateKey(keyinfo, null, null, key.HardwareHash, oemOptionInfo, key.TrackingInfo, true);
     }
     results.Add(new KeyOperationResult()
         {
             Failed = FailedType != KeyErrorType.None,
             FailedType = FailedType,
             Key = new KeyInfo()
             {
                 KeyId = key.ProductKeyID,
                 ProductKey = (keyinfo != null ? keyinfo.ProductKey : string.Empty),
                 KeyState = (KeyState)key.ProductKeyState,
                 HardwareHash = key.HardwareHash
             },
             KeyInDb = keyinfo
         });
     return results;
 }