예제 #1
0
 private static string GetRunDirectoryFromPath(string definitionOutputPath, DateTime runStart)
 {
     object[] jobRunName = new object[2];
     jobRunName[0] = definitionOutputPath;
     jobRunName[1] = ScheduledJobStore.ConvertDateTimeToJobRunName(runStart);
     return(string.Format(CultureInfo.InvariantCulture, OSHelper.IsUnix ? "{0}/{1}" : "{0}\\{1}", jobRunName));
 }
예제 #2
0
        /// <summary>
        /// Check the job store results and if maximum number of results exist
        /// remove the oldest results folder to make room for these new results.
        /// </summary>
        /// <param name="outputPath">Output path</param>
        /// <param name="executionHistoryLength">Maximum size of stored job results</param>
        private static void CheckJobStoreResults(string outputPath, int executionHistoryLength)
        {
            // Get current results for this job definition.
            Collection <DateTime> jobRuns = ScheduledJobStore.GetJobRunsForDefinitionPath(outputPath);

            if (jobRuns.Count <= executionHistoryLength)
            {
                // There is room for another job run in the store.
                return;
            }

            // Remove the oldest job run from the store.
            DateTime jobRunToRemove = DateTime.MaxValue;

            foreach (DateTime jobRun in jobRuns)
            {
                jobRunToRemove = (jobRun < jobRunToRemove) ? jobRun : jobRunToRemove;
            }

            try
            {
                ScheduledJobStore.RemoveJobRunFromOutputPath(outputPath, jobRunToRemove);
            }
            catch (UnauthorizedAccessException)
            { }
        }
        public override void RemoveJob(Job2 job)
        {
            DateTime valueOrDefault;

            if (job != null)
            {
                this.RefreshRepository();
                try
                {
                    ScheduledJobSourceAdapter.JobRepository.Remove(job);
                    string   name        = job.Name;
                    DateTime?pSBeginTime = job.PSBeginTime;
                    if (pSBeginTime.HasValue)
                    {
                        valueOrDefault = pSBeginTime.GetValueOrDefault();
                    }
                    else
                    {
                        valueOrDefault = DateTime.MinValue;
                    }
                    ScheduledJobStore.RemoveJobRun(name, valueOrDefault);
                }
                catch (DirectoryNotFoundException directoryNotFoundException)
                {
                }
                catch (FileNotFoundException fileNotFoundException)
                {
                }
                return;
            }
            else
            {
                throw new PSArgumentNullException("job");
            }
        }
        private void RefreshRepository()
        {
            Collection <DateTime> jobRuns = null;
            Job2 job2;

            this.CreateFileSystemWatcher();
            IEnumerable <string> jobDefinitions = ScheduledJobStore.GetJobDefinitions();

            foreach (string str in jobDefinitions)
            {
                jobRuns = ScheduledJobSourceAdapter.GetJobRuns(str);
                if (jobRuns == null)
                {
                    continue;
                }
                ScheduledJobDefinition scheduledJobDefinition = null;
                IEnumerator <DateTime> enumerator             = jobRuns.GetEnumerator();
                using (enumerator)
                {
                    while (enumerator.MoveNext())
                    {
                        DateTime dateTime = enumerator.Current;
                        if (dateTime <= ScheduledJobSourceAdapter.JobRepository.GetLatestJobRun(str))
                        {
                            continue;
                        }
                        try
                        {
                            if (scheduledJobDefinition == null)
                            {
                                scheduledJobDefinition = ScheduledJobDefinition.LoadFromStore(str, null);
                            }
                            job2 = ScheduledJobSourceAdapter.LoadJobFromStore(scheduledJobDefinition.Name, dateTime);
                        }
                        catch (ScheduledJobException scheduledJobException)
                        {
                            continue;
                        }
                        catch (DirectoryNotFoundException directoryNotFoundException)
                        {
                            continue;
                        }
                        catch (FileNotFoundException fileNotFoundException)
                        {
                            continue;
                        }
                        catch (UnauthorizedAccessException unauthorizedAccessException)
                        {
                            continue;
                        }
                        catch (IOException oException)
                        {
                            continue;
                        }
                        ScheduledJobSourceAdapter.JobRepository.AddOrReplace(job2);
                        ScheduledJobSourceAdapter.JobRepository.SetLatestJobRun(str, dateTime);
                    }
                }
            }
        }
        private static void CheckJobStoreResults(string outputPath, int executionHistoryLength)
        {
            DateTime dateTime;
            Collection <DateTime> jobRunsForDefinitionPath = ScheduledJobStore.GetJobRunsForDefinitionPath(outputPath);

            if (jobRunsForDefinitionPath.Count > executionHistoryLength)
            {
                DateTime maxValue = DateTime.MaxValue;
                foreach (DateTime dateTime1 in jobRunsForDefinitionPath)
                {
                    if (dateTime1 < maxValue)
                    {
                        dateTime = dateTime1;
                    }
                    else
                    {
                        dateTime = maxValue;
                    }
                    maxValue = dateTime;
                }
                try
                {
                    ScheduledJobStore.RemoveJobRunFromOutputPath(outputPath, maxValue);
                }
                catch (UnauthorizedAccessException unauthorizedAccessException)
                {
                }
                return;
            }
            else
            {
                return;
            }
        }
예제 #6
0
        private void RefreshRepository()
        {
            ScheduledJobStore.CreateDirectoryIfNotExists();
            CreateFileSystemWatcher();

            IEnumerable <string> jobDefinitions = ScheduledJobStore.GetJobDefinitions();

            foreach (string definitionName in jobDefinitions)
            {
                // Create Job2 objects for each job run in store.
                Collection <DateTime> jobRuns = GetJobRuns(definitionName);
                if (jobRuns == null)
                {
                    continue;
                }

                ScheduledJobDefinition definition = null;
                foreach (DateTime jobRun in jobRuns)
                {
                    if (jobRun > JobRepository.GetLatestJobRun(definitionName))
                    {
                        Job2 job;
                        try
                        {
                            if (definition == null)
                            {
                                definition = ScheduledJobDefinition.LoadFromStore(definitionName, null);
                            }

                            job = LoadJobFromStore(definition.Name, jobRun);
                        }
                        catch (ScheduledJobException)
                        {
                            continue;
                        }
                        catch (DirectoryNotFoundException)
                        {
                            continue;
                        }
                        catch (FileNotFoundException)
                        {
                            continue;
                        }
                        catch (UnauthorizedAccessException)
                        {
                            continue;
                        }
                        catch (IOException)
                        {
                            continue;
                        }

                        JobRepository.AddOrReplace(job);
                        JobRepository.SetLatestJobRun(definitionName, jobRun);
                    }
                }
            }
        }
예제 #7
0
        public static void SetReadAccessOnDefinitionFile(string definitionName, string user)
        {
            string               filePathName         = ScheduledJobStore.GetFilePathName(definitionName, "ScheduledJobDefinition");
            FileSecurity         fileSecurity         = new FileSecurity(filePathName, AccessControlSections.Access);
            FileSystemAccessRule fileSystemAccessRule = new FileSystemAccessRule(user, FileSystemRights.Read, AccessControlType.Allow);

            fileSecurity.AddAccessRule(fileSystemAccessRule);
            File.SetAccessControl(filePathName, fileSecurity);
        }
예제 #8
0
        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));
        }
        internal static void SaveJobToStore(ScheduledJob job)
        {
            DateTime valueOrDefault;
            DateTime minValue;
            string   outputPath = job.Definition.OutputPath;

            if (!string.IsNullOrEmpty(outputPath))
            {
                FileStream fileStream  = null;
                FileStream fileStream1 = null;
                try
                {
                    ScheduledJobSourceAdapter.CheckJobStoreResults(outputPath, job.Definition.ExecutionHistoryLength);
                    string   str         = outputPath;
                    DateTime?pSBeginTime = job.PSBeginTime;
                    if (pSBeginTime.HasValue)
                    {
                        valueOrDefault = pSBeginTime.GetValueOrDefault();
                    }
                    else
                    {
                        valueOrDefault = DateTime.MinValue;
                    }
                    fileStream = ScheduledJobStore.CreateFileForJobRunItem(str, valueOrDefault, ScheduledJobStore.JobRunItem.Status);
                    ScheduledJobSourceAdapter.SaveStatusToFile(job, fileStream);
                    string   str1     = outputPath;
                    DateTime?nullable = job.PSBeginTime;
                    if (nullable.HasValue)
                    {
                        minValue = nullable.GetValueOrDefault();
                    }
                    else
                    {
                        minValue = DateTime.MinValue;
                    }
                    fileStream1 = ScheduledJobStore.CreateFileForJobRunItem(str1, minValue, ScheduledJobStore.JobRunItem.Results);
                    ScheduledJobSourceAdapter.SaveResultsToFile(job, fileStream1);
                }
                finally
                {
                    if (fileStream != null)
                    {
                        fileStream.Close();
                    }
                    if (fileStream1 != null)
                    {
                        fileStream1.Close();
                    }
                }
                return;
            }
            else
            {
                string str2 = StringUtil.Format(ScheduledJobErrorStrings.CantSaveJobNoFilePathSpecified, job.Name);
                throw new ScheduledJobException(str2);
            }
        }
예제 #10
0
 public static string GetJobRunOutputDirectory(string definitionName)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         return(Path.Combine(ScheduledJobStore.GetJobDefinitionPath(definitionName), "Output"));
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
예제 #11
0
 public static Collection <DateTime> GetJobRunsForDefinition(string definitionName)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         string jobRunOutputDirectory = ScheduledJobStore.GetJobRunOutputDirectory(definitionName);
         return(ScheduledJobStore.GetJobRunsForDefinitionPath(jobRunOutputDirectory));
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
예제 #12
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");
     }
 }
예제 #13
0
 public static FileStream GetFileForJobDefinition(string definitionName, FileMode fileMode, FileAccess fileAccess, FileShare fileShare)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         string filePathName = ScheduledJobStore.GetFilePathName(definitionName, "ScheduledJobDefinition");
         return(File.Open(filePathName, fileMode, fileAccess, fileShare));
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
예제 #14
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");
     }
 }
예제 #15
0
 public static FileStream CreateFileForJobDefinition(string definitionName)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         string str = ScheduledJobStore.CreateFilePathName(definitionName, "ScheduledJobDefinition");
         return(File.Create(str));
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
예제 #16
0
 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");
     }
 }
예제 #17
0
 public static void RemoveJobRunFromOutputPath(string definitionOutputPath, DateTime runStart)
 {
     if (!string.IsNullOrEmpty(definitionOutputPath))
     {
         string runDirectoryFromPath = ScheduledJobStore.GetRunDirectoryFromPath(definitionOutputPath, runStart);
         Directory.Delete(runDirectoryFromPath, true);
         return;
     }
     else
     {
         throw new PSArgumentException("definitionOutputPath");
     }
 }
예제 #18
0
 public static void RemoveJobRun(string definitionName, DateTime runStart)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         string runDirectory = ScheduledJobStore.GetRunDirectory(definitionName, runStart);
         Directory.Delete(runDirectory, true);
         return;
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
예제 #19
0
        public static IEnumerable <string> GetJobDefinitions()
        {
            string directoryPath      = ScheduledJobStore.GetDirectoryPath();
            IEnumerable <string> strs = Directory.EnumerateDirectories(directoryPath);

            if (strs != null)
            {
                return(strs);
            }
            else
            {
                return(new Collection <string>());
            }
        }
예제 #20
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));
        }
예제 #21
0
        /// <summary>
        /// Serializes a ScheduledJob and saves it to store.
        /// </summary>
        /// <param name="job">ScheduledJob</param>
        internal static void SaveJobToStore(ScheduledJob job)
        {
            string outputPath = job.Definition.OutputPath;

            if (string.IsNullOrEmpty(outputPath))
            {
                string msg = StringUtil.Format(ScheduledJobErrorStrings.CantSaveJobNoFilePathSpecified,
                                               job.Name);
                throw new ScheduledJobException(msg);
            }

            FileStream fsStatus  = null;
            FileStream fsResults = null;

            try
            {
                // Check the job store results and if maximum number of results exist
                // remove the oldest results folder to make room for these new results.
                CheckJobStoreResults(outputPath, job.Definition.ExecutionHistoryLength);

                fsStatus = ScheduledJobStore.CreateFileForJobRunItem(
                    outputPath,
                    job.PSBeginTime ?? DateTime.MinValue,
                    ScheduledJobStore.JobRunItem.Status);

                // Save status only in status file stream.
                SaveStatusToFile(job, fsStatus);

                fsResults = ScheduledJobStore.CreateFileForJobRunItem(
                    outputPath,
                    job.PSBeginTime ?? DateTime.MinValue,
                    ScheduledJobStore.JobRunItem.Results);

                // Save entire job in results file stream.
                SaveResultsToFile(job, fsResults);
            }
            finally
            {
                if (fsStatus != null)
                {
                    fsStatus.Close();
                }

                if (fsResults != null)
                {
                    fsResults.Close();
                }
            }
        }
예제 #22
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));
        }
예제 #23
0
 public static void RemoveAllJobRuns(string definitionName)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         Collection <DateTime> jobRunsForDefinition = ScheduledJobStore.GetJobRunsForDefinition(definitionName);
         foreach (DateTime dateTime in jobRunsForDefinition)
         {
             string runDirectory = ScheduledJobStore.GetRunDirectory(definitionName, dateTime);
             Directory.Delete(runDirectory, true);
         }
         return;
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
 private static bool GetJobRunInfo(string path, out string definitionName, out DateTime jobRunReturn)
 {
     char[] directorySeparatorChar = new char[1];
     directorySeparatorChar[0] = Path.DirectorySeparatorChar;
     string[] strArrays = path.Split(directorySeparatorChar);
     if ((int)strArrays.Length != 4)
     {
         definitionName = null;
         jobRunReturn   = DateTime.MinValue;
         return(false);
     }
     else
     {
         definitionName = strArrays[0];
         return(ScheduledJobStore.ConvertJobRunNameToDateTime(strArrays[2], out jobRunReturn));
     }
 }
예제 #25
0
        /// <summary>
        /// Parses job definition name and job run DateTime from provided path string.
        /// Example:
        ///   path = "ScheduledJob1\\Output\\20111219-200921-369\\Results.xml"
        ///      'ScheduledJob1' is the definition name.
        ///      '20111219-200921-369' is the jobRun DateTime.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="definitionName"></param>
        /// <param name="jobRunReturn"></param>
        /// <returns></returns>
        private static bool GetJobRunInfo(
            string path,
            out string definitionName,
            out DateTime jobRunReturn)
        {
            // Parse definition name from path.
            string[] pathItems = path.Split(System.IO.Path.DirectorySeparatorChar);
            if (pathItems.Length == 4)
            {
                definitionName = pathItems[0];
                return(ScheduledJobStore.ConvertJobRunNameToDateTime(pathItems[2], out jobRunReturn));
            }

            definitionName = null;
            jobRunReturn   = DateTime.MinValue;
            return(false);
        }
예제 #26
0
        internal static Collection <DateTime> GetJobRuns(string definitionName)
        {
            Collection <DateTime> jobRuns = null;

            try
            {
                jobRuns = ScheduledJobStore.GetJobRunsForDefinition(definitionName);
            }
            catch (DirectoryNotFoundException)
            { }
            catch (FileNotFoundException)
            { }
            catch (UnauthorizedAccessException)
            { }
            catch (IOException)
            { }

            return(jobRuns);
        }
예제 #27
0
 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");
     }
 }
예제 #28
0
        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;
            }
        }
예제 #29
0
 private void CreateFileSystemWatcher()
 {
     // Lazily create the static file system watcher
     // on first use.
     if (StoreWatcher == null)
     {
         lock (SyncObject)
         {
             if (StoreWatcher == null)
             {
                 StoreWatcher = new FileSystemWatcher(ScheduledJobStore.GetJobDefinitionLocation());
                 StoreWatcher.IncludeSubdirectories = true;
                 StoreWatcher.NotifyFilter          = NotifyFilters.LastWrite;
                 StoreWatcher.Filter = "Results.xml";
                 StoreWatcher.EnableRaisingEvents = true;
                 StoreWatcher.Changed            += (object sender, FileSystemEventArgs e) =>
                 {
                     UpdateRepositoryObjects(e);
                 };
             }
         }
     }
 }
예제 #30
0
        /// <summary>
        /// Remove a job from the store
        /// </summary>
        /// <param name="job">job object to remove</param>
        public override void RemoveJob(Job2 job)
        {
            if (job == null)
            {
                throw new PSArgumentNullException("job");
            }

            RefreshRepository();

            try
            {
                JobRepository.Remove(job);
                ScheduledJobStore.RemoveJobRun(
                    job.Name,
                    job.PSBeginTime ?? DateTime.MinValue);
            }
            catch (DirectoryNotFoundException)
            {
            }
            catch (FileNotFoundException)
            {
            }
        }
예제 #31
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");
			}
		}
예제 #32
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);
		}
예제 #33
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);
		}
예제 #34
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");
			}
		}