/// <summary> /// Attempts to correct any error in the HammingObject. /// </summary> /// <param name="report">Report will indicate the status and syndrome of this HammingObject</param> /// <returns>Returns true if the HammingObject has no errors and that is successfully corrected any errors. Returns false /// if errors were detected, but unable to fix. </returns> protected virtual bool CorrectError(int syndrome, ErrorTypesEnum status) { if (HammingBytes == null) { throw new EmptyHammingObjectException("Hamming Object is empty"); } bool success = false; switch (status) { case ErrorTypesEnum.NoError: success = true; break; case ErrorTypesEnum.MasterParityBitError: case ErrorTypesEnum.ParityBitError: case ErrorTypesEnum.DataBitError: FlipBitAt(syndrome); success = true; break; case ErrorTypesEnum.MultiBitError: success = false; break; } return(success); }
public HammingReport(int errorLocation, ErrorTypesEnum typeOfError, bool errorFixed) { Status = typeOfError; Syndrome = errorLocation; Corrected = errorFixed; }
public void LogError(string message, ErrorTypesEnum errorType, string imagePath) { using (var writer = new StreamWriter(Path.Combine(ERROR_LOG_LOCATION, ERROR_LOG_FILE_NAME), true, Encoding.UTF8, 0x1000)) { writer.WriteLine(string.Concat(new object[] { "\r\n", DateTime.Now, ",", errorType, ",", message, ",", imagePath })); } }
public void AddError(string error, ErrorTypesEnum errorType) { _errors.Add(error); Type = errorType; }
public Result(string error, ErrorTypesEnum errorType) { AddError(error, errorType); }
public void LogError(string message, ErrorTypesEnum errorType, string imagePath) { using (var writer = new StreamWriter(Path.Combine(ERROR_LOG_LOCATION,ERROR_LOG_FILE_NAME), true,Encoding.UTF8,0x1000)) { writer.WriteLine(string.Concat(new object[]{"\r\n",DateTime.Now,",",errorType,",",message,",",imagePath})); } }