private static string GetFilePathName(string definitionName, string fileName) { string jobDefinitionPath = ScheduledJobStore.GetJobDefinitionPath(definitionName); object[] objArray = new object[2]; objArray[0] = jobDefinitionPath; objArray[1] = fileName; return(string.Format(CultureInfo.InvariantCulture, (OSHelper.IsUnix ? "{0}/{1}.xml" : "{0}\\{1}.xml"), objArray)); }
public static string GetJobRunOutputDirectory(string definitionName) { if (!string.IsNullOrEmpty(definitionName)) { return(Path.Combine(ScheduledJobStore.GetJobDefinitionPath(definitionName), "Output")); } else { throw new PSArgumentException("definitionName"); } }
public static void RemoveJobDefinition(string definitionName) { if (!string.IsNullOrEmpty(definitionName)) { string jobDefinitionPath = ScheduledJobStore.GetJobDefinitionPath(definitionName); Directory.Delete(jobDefinitionPath, true); return; } else { throw new PSArgumentException("definitionName"); } }
public static void RenameScheduledJobDefDir(string oldDefName, string newDefName) { if (!string.IsNullOrEmpty(oldDefName)) { if (!string.IsNullOrEmpty(newDefName)) { string jobDefinitionPath = ScheduledJobStore.GetJobDefinitionPath(oldDefName); string str = ScheduledJobStore.GetJobDefinitionPath(newDefName); Directory.Move(jobDefinitionPath, str); return; } else { throw new PSArgumentException("newDefName"); } } else { throw new PSArgumentException("oldDefName"); } }
private static string CreateFilePathName(string definitionName, string fileName) { string jobDefinitionPath = ScheduledJobStore.GetJobDefinitionPath(definitionName); string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName); if (!Directory.Exists(jobDefinitionPath)) { Directory.CreateDirectory(jobDefinitionPath); Directory.CreateDirectory(jobRunOutputDirectory); object[] objArray = new object[2]; objArray[0] = jobDefinitionPath; objArray[1] = fileName; return(string.Format(CultureInfo.InstalledUICulture, (OSHelper.IsUnix ? "{0}/{1}.xml" : "{0}\\{1}.xml"), objArray)); } else { ScheduledJobException scheduledJobException = new ScheduledJobException(StringUtil.Format(ScheduledJobErrorStrings.JobDefFileAlreadyExists, definitionName)); scheduledJobException.FQEID = "ScheduledJobDefExists"; throw scheduledJobException; } }