private static void SetDebugSimulatedError(int errorCode) { if (Enum.IsDefined(typeof(SystemVerificationErrorCode), errorCode)) { SimulatedVerificationError = (SystemVerificationErrorCode)errorCode; } else if (Enum.IsDefined(typeof(FirmwareSetupErrorCode), errorCode)) { SimulatedFirmwareError = (FirmwareSetupErrorCode)errorCode; } }
public static void SetDebugSimulatedError(string error) { if (int.TryParse(error, out int errorCode)) { SetDebugSimulatedError(errorCode); } else if (Enum.TryParse(error, out FirmwareSetupErrorCode firmwareErrorCode)) { SimulatedFirmwareError = firmwareErrorCode; } else if (Enum.TryParse(error, out SystemVerificationErrorCode verificationErrorCode)) { SimulatedVerificationError = verificationErrorCode; } }
public async void VerifyRequirements() { LogHelper.Log("SystemVerificationService:VerifyRequirements:"); SystemVerificationErrorCode errorCode = SystemVerificationErrorCode.NoError; if (Debug.SimulatedVerificationError != SystemVerificationErrorCode.NoError) { errorCode = Debug.SimulatedVerificationError; } else if (!Environment.Is64BitOperatingSystem) { errorCode = SystemVerificationErrorCode.Not64BitSystem; } else if (!VerifyWindowsVersion()) { errorCode = SystemVerificationErrorCode.UnsupportedOS; } else if (!VerifyRAM()) { errorCode = SystemVerificationErrorCode.InsufficientRAM; } else if (!InitializeFrameworkService()) { errorCode = SystemVerificationErrorCode.UnsupportedFirmware; } else { try { if (!await Task.Run(() => CheckCPUCoresCount())) { errorCode = SystemVerificationErrorCode.SingleCoreProcessor; } else { await Task.Run(() => VerifyUSB30()); LogHelper.Log("SystemVerificationService:VerifyRequirements: Success"); } } catch (SystemVerificationException ex) { errorCode = ex.Code; } catch (Exception ex) { LogHelper.Log("SystemVerificationService:VerifyRequirements: Message: {0}", ex.Message); LogHelper.Log("SystemVerificationService:VerifyRequirements: StackTrace: {0}", ex.StackTrace); errorCode = SystemVerificationErrorCode.GenericVerificationError; } } if (errorCode == SystemVerificationErrorCode.NoError) { VerificationPassed?.Invoke(this, null); } else { LogHelper.Log("SystemVerificationService:VerifyRequirements: Error: {0}", errorCode); if (errorCode != SystemVerificationErrorCode.NotUSB30Port) { LogHelper.Flush(); } VerificationFailed?.Invoke(this, new EndlessErrorEventArgs <SystemVerificationErrorCode> { ErrorCode = errorCode }); } }