Beispiel #1
0
        public SCenter()
        {
            try
            {
                DateTime now                 = DateTime.Now;
                string   fileLog             = "sCenter_" + now.Year.ToString() + now.Month.ToString() + now.Day.ToString() + this.ExtensioLog;
                string   completePathFileLog = System.IO.Path.Combine(_logPathSettings, fileLog);

                // prepare the setting folders
                FileCenter.CheckPath(_settingsPath);
                FileCenter.CheckPath(_tskPathSettings);
                FileCenter.CheckPath(_logPathSettings);

                _allFilesInTskPath = new System.Collections.Generic.List <FileCenter>();
                _allTheTaskers     = new System.Collections.Generic.List <Tasker>();
                _filesToExecute    = new System.Collections.Generic.List <string>();
                _filesName         = new System.Collections.Generic.List <string>();
                _fileLog           = new FileCenter(completePathFileLog);
            }
            catch (System.IO.DirectoryNotFoundException ex) { throw new System.IO.IOException(ex.ToString() + " - Constructor SCenter"); }
            catch (System.IO.PathTooLongException ex) { throw new System.IO.PathTooLongException(ex.ToString() + " - Constructor SCenter"); }
            catch (System.IO.IOException ex) { throw new System.IO.IOException(ex.ToString() + " - Constructor SCenter"); }
            catch (UnauthorizedAccessException ex) { throw new UnauthorizedAccessException(ex.ToString() + " - Constructor SCenter"); }
            catch (ArgumentNullException ex) { throw new ArgumentNullException(ex.ToString() + " - Constructor SCenter"); }
            catch (NotSupportedException ex) { throw new NotSupportedException(ex.ToString() + " - Constructor SCenter"); }
        }
Beispiel #2
0
        public FileCenter(string filename)
        {
            string path = System.IO.Path.GetDirectoryName(filename);

            try
            {
                FileCenter.CheckPath(path);
                FileCenter.CheckFile(filename);

                _pathFile = new System.IO.DirectoryInfo(path);
                _fileName = new System.IO.FileInfo(filename);

                _extension            = _fileName.Extension;
                _extensionUsedToWrite = new System.Collections.Generic.List <string> {
                    ".txt", ".log"
                };
            }
            catch (System.IO.DirectoryNotFoundException ex) { throw new System.IO.IOException(ex.Message + " - FileCenter"); }
            catch (System.IO.PathTooLongException ex) { throw new System.IO.PathTooLongException(ex.Message + " - FileCenter"); }
            catch (System.IO.IOException ex) { throw new System.IO.IOException(ex.Message + " - FileCenter"); }
            catch (UnauthorizedAccessException ex) { throw new UnauthorizedAccessException(ex.Message + " - FileCenter"); }
            catch (ArgumentNullException ex) { throw new ArgumentNullException(ex.Message + " - FileCenter"); }
            catch (ArgumentException ex) { throw new ArgumentException(ex.Message + " - FileCenter"); }
            catch (NotSupportedException ex) { throw new NotSupportedException(ex.Message + " - FileCenter"); }
            catch (System.Security.SecurityException ex) { throw new System.Security.SecurityException(ex.Message + " - FileCenter"); }
        }