Пример #1
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));
        }
Пример #2
0
 public static string GetJobRunOutputDirectory(string definitionName)
 {
     if (!string.IsNullOrEmpty(definitionName))
     {
         return(Path.Combine(ScheduledJobStore.GetJobDefinitionPath(definitionName), "Output"));
     }
     else
     {
         throw new PSArgumentException("definitionName");
     }
 }
Пример #3
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");
     }
 }
Пример #4
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");
     }
 }
Пример #5
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;
            }
        }