示例#1
0
 /// =======================================================================================================
 private static bool CopyFolderContents(string from, string to)
 {
     // Ensure paths end with a '\' character.
     from = from.EndsWith(@"\") ? from : from + @"\";
     to   = to.EndsWith(@"\") ? to : to + @"\";
     if (Directory.Exists(from))
     {
         if (!Directory.Exists(to))
         {
             DISK.CreateFolder(to);
         }
         foreach (string files in Directory.GetFiles(from))
         {
             FileInfo fileInfo = new FileInfo(files);
             fileInfo.CopyTo(string.Format(@"{0}\{1}", to, fileInfo.Name), true);
         }
         foreach (string drs in Directory.GetDirectories(from))
         {
             DirectoryInfo directoryInfo = new DirectoryInfo(drs);
             if (CopyFolderContents(drs, to + directoryInfo.Name) == false)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
示例#2
0
 /// =======================================================================================================
 public static Return AbuFolder(string from, string to, string timestamp_on)
 {
     from = DISK.AutoAddBaseDirectory(from);
     to   = DISK.AutoAddBaseDirectory(to);
     DISK.CreateFolder(to);
     if (Directory.Exists(from))
     {
         string newto = to + "\\" + DISK.GetDirName(from) + (Convert.ToBoolean(timestamp_on) ? Timer.TimeStamp() : "");
         CopyFolderContents(from, newto);
         return(new Return(from + " copied to " + newto));
     }
     return(new Return(from + " does not exist"));
 }
示例#3
0
文件: EDIT.cs 项目: BrettJohn/CAT
 /// =======================================================================================================
 public static void EDIT_COPY_AUTO(string folder, string to)
 {
     if (Directory.Exists(folder))
     {
         string from      = new DirectoryInfo(folder).Name;
         string newfolder = new DirectoryInfo(folder).Parent.FullName + "\\" + to;
         DISK.CreateFolder(newfolder);
         foreach (string file in Directory.GetFiles(folder))
         {
             string newfile = newfolder + "\\" + (new FileInfo(file).Name);
             File.Copy(file, newfile);
         }
         EDIT_ALL(newfolder, from, to);
     }
 }
示例#4
0
 /// =======================================================================================================
 public static Return AbuFile(string from, string to, string timestamp_on)
 {
     from = DISK.AutoAddBaseDirectory(from);
     to   = DISK.AutoAddBaseDirectory(to);
     if (File.Exists(from))
     {
         DISK.CreateFolder(to);
         string path = Path.GetFileNameWithoutExtension(from);
         path += (Convert.ToBoolean(timestamp_on) ? Timer.TimeStamp() : "");
         path += Path.GetExtension(from);
         path  = to + path;
         File.Copy(from, path, true);
         return(new Return(from + " copied to " + path));
     }
     return(new Return(from + " does not exist"));
 }
示例#5
0
 /// =======================================================================================================
 public void AutoComplete()
 {
     EndTime = DateTime.Now;
     if (BatchReports.Count > 0)
     {
         string reportfolder = DISK.AutoAddBaseDirectory(Alias) + @"\Reports\";
         DISK.CreateFolder(reportfolder);
         string reportpath            = reportfolder + "AutoReport.bin";
         string timestampedreportpath = reportfolder + "AutoReport" + Timer.TimeStamp() + ".bin";
         Save(reportpath);
         Save(timestampedreportpath);
         CAT.FormAccess(CAT.FormDelegates.UpdateNamedOverlay, new object[] { Alias, Alias + " complete (" + AutoDuration() + ")", CalculatedAutoResult() }, Alias);
     }
     else
     {
         CAT.FormAccess(CAT.FormDelegates.UpdateNamedOverlay, new object[] { Alias, "No report for" + Alias, CAT.Status.ABORT }, Alias);
         Enabled = false;
     }
 }