Exemplo n.º 1
0
 /// <summary>
 /// Create a data archive for the given srcML archive and binary file. It will load data
 /// from the binary archive and then subscribe to the srcML archive.
 /// </summary>
 /// <param name="archive">The srcML archive to monitor for changes. If null, no archive
 /// monitoring will be done.</param>
 /// <param name="fileName">The file to read data from. If null, no previously saved data
 /// will be loaded.</param>
 public DataRepository(ISrcMLArchive archive, string fileName, TaskScheduler scheduler)
 {
     SetupParsers();
     scopeLock         = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
     this.ReadyState   = new ReadyNotifier(this);
     this.Archive      = archive;
     this.FileName     = fileName;
     this._taskFactory = new TaskFactory(scheduler);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new AbstractFileMonitor with the default archive and a collection of
        /// non-default archives that should be registered
        /// </summary>
        /// <param name="baseDirectory">The folder where this monitor stores it archives</param>
        /// <param name="defaultArchive">The default archive</param>
        /// <param name="otherArchives">A list of other archives that should be registered via see
        /// cref="RegisterArchive(IArchive)"/></param>
        protected AbstractFileMonitor(TaskScheduler scheduler, string baseDirectory, IArchive defaultArchive, params IArchive[] otherArchives)
        {
            this.MonitorStoragePath      = baseDirectory;
            this.registeredArchives      = new HashSet <IArchive>();
            this.archiveMap              = new Dictionary <string, IArchive>(StringComparer.InvariantCultureIgnoreCase);
            this.ReadyState              = new ReadyNotifier(this);
            this.numberOfWorkingArchives = 0;
            Factory = new TaskFactory(scheduler);

            RegisterArchive(defaultArchive, true);
            foreach (var archive in otherArchives)
            {
                this.RegisterArchive(archive, false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new AbstractFileMonitor with the default archive and a collection of
        /// non-default archives that should be registered
        /// </summary>
        /// <param name="baseDirectory">The folder where this monitor stores it archives</param>
        /// <param name="defaultArchive">The default archive</param>
        /// <param name="otherArchives">A list of other archives that should be registered via see
        /// cref="RegisterArchive(IArchive)"/></param>
        protected AbstractFileMonitor(string baseDirectory, AbstractArchive defaultArchive, params AbstractArchive[] otherArchives)
        {
            this.MonitorStoragePath      = baseDirectory;
            this.registeredArchives      = new HashSet <AbstractArchive>();
            this.archiveMap              = new Dictionary <string, AbstractArchive>(StringComparer.OrdinalIgnoreCase);
            this.ReadyState              = new ReadyNotifier(this);
            this.numberOfWorkingArchives = 0;
            Factory = Task.Factory;

            if (null != defaultArchive)
            {
                RegisterArchive(defaultArchive, true);
            }

            foreach (var archive in otherArchives)
            {
                this.RegisterArchive(archive, false);
            }
        }