public static CommandToProcessingDefinitionActuall ConvertUnknownObjectToResultWithRequestedType(Object DeSerializedObjectWithDifferentTyp) { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer ("Starting"); if (DeSerializedObjectWithDifferentTyp == null) { WMB.Basics.ReportErrorToEventViewer("\"ConvertUnknownObjectToResultWithRequestedType\" Input Object == null"); return null; } try { Type DesrializedObject = DeSerializedObjectWithDifferentTyp.GetType(); CommandToProcessingDefinitionActuall Result = new CommandToProcessingDefinitionActuall(); if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer("Type of DesrializedObject = \"" + DesrializedObject.ToString ()); PropertyInfo CommandsToRunProp = DesrializedObject.GetProperty("CommandsToRun"); PropertyInfo ResultsOfCommandsToRunProp = DesrializedObject.GetProperty("ResultsOfCommandsToRun"); if ((CommandsToRunProp != null) && (ResultsOfCommandsToRunProp != null)) { Result.CommandsToRun = (Dictionary<String, String>) CommandsToRunProp .GetValue (DeSerializedObjectWithDifferentTyp, null); Result.ResultsOfCommandsToRun = (Dictionary<String, DataSet>) ResultsOfCommandsToRunProp .GetValue (DeSerializedObjectWithDifferentTyp, null); return Result; } else { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer (((CommandsToRunProp != null) ? "CommandsToRun != null" : "CommandsToRun == null") + "\r\n" + ((ResultsOfCommandsToRunProp != null) ? "ResultsOfCommandsToRunProp != null" : "ResultsOfCommandsToRunProp == null")); } MemberInfo [] CommandsToRunMembers = DesrializedObject.GetMember("CommandsToRun"); MemberInfo [] ResultsOfCommandsToRunMembers = DesrializedObject.GetMember("ResultsOfCommandsToRun"); if ((CommandsToRunMembers.Length > 0) && (ResultsOfCommandsToRunMembers.Length > 0)) { Result.CommandsToRun = (Dictionary<String, String>)((System.Reflection.FieldInfo)CommandsToRunMembers [0]) .GetValue(DeSerializedObjectWithDifferentTyp); Result.ResultsOfCommandsToRun = (Dictionary<String, DataSet>)((System.Reflection.FieldInfo)ResultsOfCommandsToRunMembers [0]) .GetValue(DeSerializedObjectWithDifferentTyp); return Result; } else { if (WMB.Basics.IsTestRun) WMB.Basics.ReportInformationToEventViewer( ((CommandsToRunMembers.Length != 0) ? "CommandsToRunMembers.Length != 0" : "CommandsToRunMembers.Length == 0") + "\r\n" + ((ResultsOfCommandsToRunMembers.Length != 0) ? "ResultsOfCommandsToRunMembers.Length != 0" : "ResultsOfCommandsToRunMembers.Length == 0")); } WMB.Basics.ReportErrorToEventViewer("ConvertUnknownObjectToTypeSaveResult" + "Error in \"ConvertUnknownObjectToTypeSaveResult\":\r\n" + "Neither Properties nor Members are found"); return null; } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer ("ConvertUnknownObjectToTypeSaveResult" + "Error in \"ConvertUnknownObjectToTypeSaveResult\":\r\n" + Excp.ToString()); return null; } }
public static void WriteMeOutAsCommandsResults(String RootDirectory, CommandToProcessingDefinitionActuall InstanceToSerialize) { SerializeObjectToFile(DataBaseCommandsResultsFileName(RootDirectory), InstanceToSerialize, true); }
public static void WriteMeOutAsCommandsToProcess(String RootDirectory, CommandToProcessingDefinitionActuall InstanceToSerialize) { try { SerializeObjectToFile(DataBaseCommandsToProcessFileName(RootDirectory), InstanceToSerialize, true); } catch (Exception Excp) { WMB.Basics.ReportErrorToEventViewer ("Error in \"WriteMeOutAsCommandsToProcess\":\r\n" + Excp.ToString()); } }