Пример #1
0
 private void updateLocalFilenames(Folders localFilesList)
 {
     foreach (MyFile f in localFilesList.Xmlfiles)
     {
         string[] aa = f.Filename.Split('_');
     }
 }
Пример #2
0
        private Folders getLocalFilesList()
        {
            this.form.addToLog("get local files list");
            Folders result = new Folders();
            string[] xmlFiles = Directory.GetFiles(this.settings.ResultsDataFolder);

            foreach (string fileName in xmlFiles)
            {
                MyFile f = new MyFile(fileName);
                result.Xmlfiles.Add(f);
            }

            string[] pdfFiles = Directory.GetFiles(this.settings.ResultsReportsFolder);

            foreach (string fileName in pdfFiles)
            {
                MyFile f = new MyFile(fileName);
                result.Pdffiles.Add(f);
            }

            string[] workFiles = Directory.GetFiles(this.settings.RequestsFolder);

            foreach (string fileName in workFiles)
            {
                MyFile f = new MyFile(fileName);
                result.Workfiles.Add(f);
            }

            return result;
        }
Пример #3
0
 private void removeOldFiles(Folders localFilesList)
 {
     foreach (MyFile f in localFilesList.Xmlfiles)
     {
         if (File.Exists(f.FullPath))
         {
             FileInfo i = new FileInfo(f.FullPath);
             double res = (DateTime.Now - i.CreationTime).TotalDays;
             if (res > 3)
             {
                 File.Delete(f.FullPath);
                 this.form.addToLog("delete old file: " + f.Filename);
             }
         }
     }
     foreach (MyFile f in localFilesList.Pdffiles)
     {
         if (File.Exists(f.FullPath))
         {
             FileInfo i = new FileInfo(f.FullPath);
             double res = (DateTime.Now - i.CreationTime).TotalDays;
             if (res > 3)
             {
                 File.Delete(f.FullPath);
                 this.form.addToLog("delete old file: " + f.Filename);
             }
         }
     }
 }
Пример #4
0
        private Folders getDiffFiles(Folders localFilesList, Folders remoteFilesList)
        {
            this.form.addToLog("get different files list");
            Folders result = new Folders();

            foreach (MyFile file in localFilesList.Xmlfiles)
            {
                if (remoteFilesList.isFileExists(file) == false)
                {
                    result.Xmlfiles.Add(file);
                }
            }

            foreach (MyFile file in localFilesList.Pdffiles)
            {
                if (remoteFilesList.isFileExists(file) == false)
                {
                    result.Pdffiles.Add(file);
                }
            }

            foreach (MyFile file in remoteFilesList.Workfiles)
            {
                if (localFilesList.isFileExists(file) == false)
                {
                    result.Workfiles.Add(file);
                }
            }

            return result;
        }