Ejemplo n.º 1
0
		public static CommandToProcessingDefinition ConvertUnknownObjectToResultWithRequestedType(Object DeSerializedObjectWithDifferentTyp)
			{
			if (DeSerializedObjectWithDifferentTyp == null)
				{
				throw new Exception("\"ConvertUnknownObjectToResultWithRequestedType\" Input Object == null");
				return null;
				}
			try
				{
				Type DesrializedObject = DeSerializedObjectWithDifferentTyp.GetType();
				CommandToProcessingDefinition Result = new CommandToProcessingDefinition();

				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;
					}


				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;
					}
				throw new Exception("ConvertUnknownObjectToTypeSaveResult"
					+ "Error in \"ConvertUnknownObjectToTypeSaveResult\":\r\n" + "Neither Properties nor Members are found");
				return null;
				}
			catch (Exception Excp)
				{
				throw new Exception("ConvertUnknownObjectToTypeSaveResult"
					+ "Error in \"ConvertUnknownObjectToTypeSaveResult\":\r\n" + Excp.ToString());
				return null;
				}

			}
Ejemplo n.º 2
0
		public static void WriteMeOutAsCommandsResults(String RootDirectory, CommandToProcessingDefinition InstanceToSerialize)
			{
			SerializeObjectToFile(DataBaseCommandsResultsFileName(RootDirectory), InstanceToSerialize, true);
			}
Ejemplo n.º 3
0
		public static void WriteMeOutAsCommandsToProcess(String RootDirectory, CommandToProcessingDefinition InstanceToSerialize)
			{
			try
				{
				SerializeObjectToFile(DataBaseCommandsToProcessFileName(RootDirectory), InstanceToSerialize, true);
				}
			catch (Exception Excp)
				{
				throw new Exception("Error in \"WriteMeOutAsCommandsToProcess\":\r\n" + Excp.ToString());
				}
			}