Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new instance of <see cref="ArchiveListSettings"/>
 /// </summary>
 public ArchiveListSettings()
 {
     m_importPaths = new ImmutableList <string>(x =>
     {
         PathHelpers.ValidatePathName(x);
         return(x);
     });
     m_importExtensions = new ImmutableList <string>(PathHelpers.FormatExtension);
     m_logSettings      = new ArchiveListLogSettings();
 }