示例#1
0
        /// <summary>
        /// Creates a log that monitors pending deletions.
        /// </summary>
        /// <param name="settings">Optional settings for the log. If none are specified, the default will not load the settings.</param>
        public ArchiveListLog(ArchiveListLogSettings settings = null)
            : base(MessageClass.Framework)
        {
            if (settings == null)
            {
                settings = new ArchiveListLogSettings();
            }

            m_settings = settings.CloneReadonly();
            m_settings.Validate();

            m_syncRoot    = new object();
            m_pendingFile = new ArchiveListLogFile();

            if (m_settings.IsFileBacked)
            {
                foreach (var file in Directory.GetFiles(m_settings.LogPath, m_settings.SearchPattern))
                {
                    var logFile = new ArchiveListLogFile();
                    logFile.Load(file);
                    if (logFile.IsValid)
                    {
                        m_files.Add(logFile);
                    }
                }
            }

            m_allFilesToDelete = new HashSet <Guid>(GetAllFilesToDelete());
        }
 public override void Validate()
 {
     if (m_importPaths.Count > 0 && m_importExtensions.Count == 0)
     {
         throw new Exception("Path specified but no extension specified.");
     }
     m_logSettings.Validate();
 }