private void Write(OmaReaderSingleResult OmaReaderSingleResult, computeLensResponseDTO response, OmaEvent OmaEvent) { AbstractSurfaceOmaWriter <threeDimensionalPointDTO> surfaceOmaWriter; OutputFormat outputFormat; outputFormat = Enum.TryParse(configuration.AppSettings.Settings[OUTPUT_FORMAT].Value, out outputFormat) ? outputFormat : OutputFormat.sdf; switch (outputFormat) { case OutputFormat.sdf: surfaceOmaWriter = SDFWriter; break; case OutputFormat.hmf: surfaceOmaWriter = HMFWriter; break; default: surfaceOmaWriter = XYZWriter; break; } surfaceOmaWriter.Write(OmaReaderSingleResult, response); string surfaceFilePath = surfaceOmaWriter.SurfaceFilePath(OmaReaderSingleResult); IFilePathOmaBuilder filePathOmaBuilder; switch (outputFormat) { case OutputFormat.sdf: filePathOmaBuilder = new SingleFilePathOmaBuilder(surfaceFilePath); break; default: switch (OmaReaderSingleResult) { case OmaReaderLeftResult OmaReaderLeftResult: filePathOmaBuilder = new DoubleFilePathOmaBuilder(null, surfaceFilePath); break; default: filePathOmaBuilder = new DoubleFilePathOmaBuilder(surfaceFilePath, null); break; } break; } AnalysisWriter.Write(OmaReaderSingleResult, response); OmaWriter.Write(OmaReaderSingleResult, response, surfaceFilePath, filePathOmaBuilder); Logger.LogEvent(OmaEvent, EventLogEntryType.Information, EventTypes.Result); }
private void Write(OmaReaderDoubleResult OmaReaderDoubleResult, computeLensResponseDTO left, computeLensResponseDTO right, OmaEvent OmaEvent) { AbstractSurfaceOmaWriter <threeDimensionalPointDTO> surfaceOmaWriter; switch (Enum.TryParse(configuration.AppSettings.Settings[OUTPUT_FORMAT].Value, out OutputFormat outputFormat) ? outputFormat : OutputFormat.sdf) { case OutputFormat.sdf: surfaceOmaWriter = SDFWriter; break; case OutputFormat.hmf: surfaceOmaWriter = HMFWriter; break; default: surfaceOmaWriter = XYZWriter; break; } surfaceOmaWriter.Write(OmaReaderDoubleResult, left, right); SurfaceFiles surfaceFiles = surfaceOmaWriter.SurfaceFilesPath(OmaReaderDoubleResult); IFilePathOmaBuilder filePathOmaBuilder; if (surfaceFiles.LeftSurfaceFile.Equals(surfaceFiles.RightSurfaceFile)) { filePathOmaBuilder = new SingleFilePathOmaBuilder(surfaceFiles.LeftSurfaceFile); } else { filePathOmaBuilder = new DoubleFilePathOmaBuilder(surfaceFiles.RightSurfaceFile, surfaceFiles.LeftSurfaceFile); } AnalysisWriter.Write(OmaReaderDoubleResult, left, right); OmaWriter.Write(OmaReaderDoubleResult, left, right, surfaceFiles.LeftSurfaceFile, surfaceFiles.RightSurfaceFile, filePathOmaBuilder); Logger.LogEvent(OmaEvent, EventLogEntryType.Information, EventTypes.Result); }
private void WriteError(string fullPath, string error, Org.Visiontech.Compute.side side, OmaStatusCode omaStatusCode, OmaEvent OmaEvent) { try { if (!File.Exists(fullPath)) { return; } File.Delete(Path.Combine(configuration.AppSettings.Settings[ERROR_PATH].Value, Path.GetFileName(fullPath))); string tempErrorPath = Path.Combine(configuration.AppSettings.Settings[ERROR_PATH].Value, Path.GetFileNameWithoutExtension(fullPath)); File.Move(fullPath, tempErrorPath); if (string.IsNullOrWhiteSpace(error)) { File.AppendAllText(tempErrorPath, "STATUS=" + Convert.ToInt32(OmaStatusCode.General) + Environment.NewLine, System.Text.Encoding.UTF8); } else if (Org.Visiontech.Compute.side.UNKNOWN.Equals(side)) { File.AppendAllText(tempErrorPath, "STATUS=" + Convert.ToInt32(OmaStatusCode.General) + ";" + error + Environment.NewLine, System.Text.Encoding.UTF8); } else { File.AppendAllText(tempErrorPath, "STATUS=" + Convert.ToInt32(OmaStatusCode.General) + Environment.NewLine, System.Text.Encoding.UTF8); File.AppendAllText(tempErrorPath, "XSTATUS=" + (Org.Visiontech.Compute.side.LEFT.Equals(side) ? "L" : "R") + ";" + Convert.ToInt32(omaStatusCode) + ";" + error + ";E" + Environment.NewLine, System.Text.Encoding.UTF8); } File.Move(tempErrorPath, String.Concat(tempErrorPath, LmsFileExtension)); Logger.LogEvent(OmaEvent, EventLogEntryType.Information, EventTypes.Result); } catch (Exception exception) { Logger.LogEvent("Exception " + exception.Message, EventLogEntryType.Error); Logger.LogEvent("StackTrace " + exception.StackTrace, EventLogEntryType.Error); } }