Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="path">Full file path</param>
        /// <param name="filter">{0} - filer word
        /// {1} - target Dir</param>
        public QFile(string path, List <CONSTS.Filter> filters, List <string> exceptions)
        {
            if (!File.Exists(path))
            {
                FileName       = "";
                FilePath       = "";
                DestinationDir = "";
                DateEvent      = new DateTime(0);
                Copy           = false;
                Score          = -1;
            }

            FilePath  = path;
            FileName  = path.Split('\\').Last();
            Copy      = false;
            DateEvent = CONSTS.ParseDate(FileName);
            if (DateEvent != new DateTime(0) && DateEvent < DateTime.Today)           //DateEvent filter
            {
                Copy = true;
            }
            DestinationDir = Filter(FileName, filters);
            if (String.IsNullOrWhiteSpace(DestinationDir))
            {
                Copy = false;
            }
            if (exceptions.Contains(FilePath))
            {
                Copy = false;
            }
            Score = -1;
        }
Пример #2
0
        public QFile(string path, string dest, List <string> exceptions, float score)
        {
            if (!File.Exists(path))
            {
                FileName       = "";
                FilePath       = "";
                DestinationDir = "";
                DateEvent      = new DateTime(0);
                Copy           = false;
            }

            FilePath  = path;
            FileName  = path.Split('\\').Last();
            Copy      = false;
            DateEvent = CONSTS.ParseDate(FileName);
            if (DateEvent != new DateTime(0) && DateEvent < DateTime.Today)             //DateEvent filter
            {
                Copy = true;
            }
            if (Directory.Exists(dest))
            {
                DestinationDir = dest;
            }
            else
            {
                DestinationDir = "";
            }
            if (String.IsNullOrWhiteSpace(DestinationDir))
            {
                Copy = false;
            }
            if (exceptions.Contains(FilePath))
            {
                Copy = false;
            }
            Score = (float)Math.Round(score * 100, 2);
        }