Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 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");
     }
 }
Ejemplo n.º 4
0
 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");
     }
 }