public static TaskXmlModify CreateNewFromLegacyTask(PrestoCommon.Entities.LegacyPresto.LegacyTaskBase legacyTaskBase) { if (legacyTaskBase == null) { throw new ArgumentNullException("legacyTaskBase"); } PrestoCommon.Entities.LegacyPresto.LegacyTaskXmlModify legacyTask = legacyTaskBase as PrestoCommon.Entities.LegacyPresto.LegacyTaskXmlModify; TaskXmlModify newTask = new TaskXmlModify(); // Base class newTask.Description = legacyTask.Description; newTask.FailureCausesAllStop = legacyTask.FailureCausesAllStop; newTask.Sequence = 0; newTask.TaskSucceeded = false; newTask.PrestoTaskType = TaskType.XmlModify; // Subclass newTask.AttributeKey = legacyTask.AttributeKey; newTask.AttributeKeyValue = legacyTask.AttributeKeyValue; newTask.AttributeToChange = legacyTask.AttributeToChange; newTask.AttributeToChangeValue = legacyTask.AttributeToChangeValue; newTask.NodeToChange = legacyTask.NodeToChange; newTask.XmlPathAndFileName = legacyTask.XmlPathAndFileName; newTask.AddNode = false; // there is no legacy option for this return(newTask); }
/// <summary> /// Creates the new from legacy task. /// </summary> /// <param name="legacyTaskBase">The legacy task base.</param> /// <returns></returns> public static TaskCopyFile CreateNewFromLegacyTask(PrestoCommon.Entities.LegacyPresto.LegacyTaskBase legacyTaskBase) { if (legacyTaskBase == null) { throw new ArgumentNullException("legacyTaskBase"); } PrestoCommon.Entities.LegacyPresto.LegacyTaskCopyFile legacyTask = legacyTaskBase as PrestoCommon.Entities.LegacyPresto.LegacyTaskCopyFile; TaskCopyFile newTask = new TaskCopyFile(); // Base class newTask.Description = legacyTask.Description; newTask.FailureCausesAllStop = legacyTask.FailureCausesAllStop; newTask.Sequence = 0; newTask.TaskSucceeded = false; newTask.PrestoTaskType = TaskType.CopyFile; // Subclass newTask.DestinationPath = legacyTask.DestinationPath; newTask.SourceFileName = legacyTask.SourceFileName; newTask.SourcePath = legacyTask.SourcePath; return(newTask); }
/// <summary> /// Creates the new from legacy task. /// </summary> /// <param name="legacyTaskBase">The legacy task base.</param> /// <returns></returns> public static TaskDosCommand CreateNewFromLegacyTask(PrestoCommon.Entities.LegacyPresto.LegacyTaskBase legacyTaskBase) { if (legacyTaskBase == null) { throw new ArgumentNullException("legacyTaskBase"); } PrestoCommon.Entities.LegacyPresto.LegacyTaskDosCommand legacyTask = legacyTaskBase as PrestoCommon.Entities.LegacyPresto.LegacyTaskDosCommand; TaskDosCommand newTask = new TaskDosCommand(); // Base class newTask.Description = legacyTask.Description; newTask.FailureCausesAllStop = legacyTask.FailureCausesAllStop; newTask.Sequence = 0; newTask.TaskSucceeded = false; newTask.PrestoTaskType = TaskType.DosCommand; // Subclass newTask.DosExecutable = legacyTask.DosExecutable; newTask.Parameters = legacyTask.Parameters; newTask.RunAsUser = null; newTask.RunAsPassword = null; return(newTask); }