private static string GetRunFilePathName(string definitionName, ScheduledJobStore.JobRunItem runItem, DateTime runStart) { string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName); object[] jobRunName = new object[2]; jobRunName[0] = jobRunOutputDirectory; jobRunName[1] = ScheduledJobStore.ConvertDateTimeToJobRunName(runStart); string str = string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}" : "{0}\\{1}", jobRunName); object[] objArray = new object[2]; objArray[0] = str; objArray[1] = runItem.ToString(); return(string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}.xml" : "{0}\\{1}.xml", objArray)); }
private static string GetRunFilePathNameFromPath(string outputPath, ScheduledJobStore.JobRunItem runItem, DateTime runStart) { object[] jobRunName = new object[2]; jobRunName[0] = outputPath; jobRunName[1] = ScheduledJobStore.ConvertDateTimeToJobRunName(runStart); string str = string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}" : "{0}\\{1}", jobRunName); if (!Directory.Exists(str)) { Directory.CreateDirectory(str); } object[] objArray = new object[2]; objArray[0] = str; objArray[1] = runItem.ToString(); return(string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}.xml" : "{0}\\{1}.xml", objArray)); }
public static FileStream GetFileForJobRunItem(string definitionName, DateTime runStart, ScheduledJobStore.JobRunItem runItem, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) { if (!string.IsNullOrEmpty(definitionName)) { string runFilePathName = ScheduledJobStore.GetRunFilePathName(definitionName, runItem, runStart); return(File.Open(runFilePathName, fileMode, fileAccess, fileShare)); } else { throw new PSArgumentException("definitionName"); } }
public static FileStream CreateFileForJobRunItem(string definitionOutputPath, DateTime runStart, ScheduledJobStore.JobRunItem runItem) { if (!string.IsNullOrEmpty(definitionOutputPath)) { string runFilePathNameFromPath = ScheduledJobStore.GetRunFilePathNameFromPath(definitionOutputPath, runItem, runStart); return(File.Create(runFilePathNameFromPath)); } else { throw new PSArgumentException("definitionOutputPath"); } }