コード例 #1
0
 /// <summary>
 /// Creates a new source monitor
 /// </summary>
 /// <param name="solution">The solution to monitor</param>
 /// <param name="foldersToMonitor">A list of folders to monitor</param>
 /// <param name="scanInterval">The interval at which to scan the folders (in
 /// seconds) </param>
 /// <param name="baseDirectory">The base directory for this monitor</param>
 /// <param name="defaultArchive">The default archive to route files to</param>
 /// <param name="otherArchives">Other archives to route files to</param>
 public SourceMonitor(Solution solution, double scanInterval, TaskScheduler scheduler, string baseDirectory, AbstractArchive defaultArchive, SrcMLArchive sourceArchive, params AbstractArchive[] otherArchives)
     : base(DirectoryScanningMonitor.MONITOR_LIST_FILENAME, scanInterval, scheduler, baseDirectory, defaultArchive, otherArchives) {
     if(null != sourceArchive) {
         RegisterArchive(sourceArchive, false);
     }
     this.MonitoredSolution = solution;
 }
コード例 #2
0
 public RestorePoint(int id, DateTime time, long size, AbstractArchive archive, Type type)
 {
     Id           = id;
     BackupSize   = size;
     CreationTime = time;
     Files        = archive;
     PointType    = type;
 }
コード例 #3
0
ファイル: Utility.cs プロジェクト: radiomonter/Tanki_X
 internal static void Extract <TEntry, TVolume>(this TEntry entry, AbstractArchive <TEntry, TVolume> archive, Stream streamToWriteTo) where TEntry : IArchiveEntry where TVolume : IVolume
 {
     if (entry.IsDirectory)
     {
         throw new ExtractionException("Entry is a file directory and cannot be extracted.");
     }
     archive.EnsureEntriesLoaded();
     archive.FireEntryExtractionBegin(entry);
     archive.FireFilePartExtractionBegin(entry.FilePath, entry.Size, entry.CompressedSize);
     using (Stream stream = new ListeningStream(archive, entry.OpenEntryStream()))
     {
         stream.TransferTo(streamToWriteTo);
     }
     archive.FireEntryExtractionEnd(entry);
 }
コード例 #4
0
        public BackupInfo CreateBackup(List <AbstractFile> list, Type type) //бекапим все файлы и не храним инфу про каждый файл в бекапе(совместное хранение)
        {
            FileRestoreCopyInfo newFile;
            List <AbstractFile> files = new List <AbstractFile>(list);
            long size = 0;

            foreach (var t in list)
            {
                size   += t.Filesize;
                newFile = System.CreateRestore(t);
            }
            AbstractArchive archive     = new AbstractArchive(size, DateTime.Now, files);
            BackupInfo      restoreInfo = new BackupInfo(size, type, archive);

            CreateRestorePoint(restoreInfo);
            return(restoreInfo);
        }
コード例 #5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="openSolution"></param>
 /// <param name="baseDirectory"></param>
 /// <param name="defaultArchive"></param>
 /// <param name="otherArchives"></param>
 public SolutionMonitor(SolutionWrapper openSolution, string baseDirectory, AbstractArchive defaultArchive, params AbstractArchive[] otherArchives)
     : base(baseDirectory, defaultArchive, otherArchives)
 {
     this.OpenSolution = openSolution;
 }
コード例 #6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="openSolution"></param>
 /// <param name="baseDirectory"></param>
 /// <param name="defaultArchive"></param>
 /// <param name="otherArchives"></param>
 public SolutionMonitor(SolutionWrapper openSolution, string baseDirectory, AbstractArchive defaultArchive, params AbstractArchive[] otherArchives)
     : base(baseDirectory, defaultArchive, otherArchives) {
     this.OpenSolution = openSolution;
 }
コード例 #7
0
 protected ArchiveDevice(Stream archiveStream)
 {
     _archiveStream = archiveStream;
     _archive       = OpenArchive(archiveStream);
 }
コード例 #8
0
 /// <summary>
 /// Creates a new source monitor
 /// </summary>
 /// <param name="solution">The solution to monitor</param>
 /// <param name="foldersToMonitor">A list of folders to monitor</param>
 /// <param name="baseDirectory">The base directory for this monitor</param>
 /// <param name="defaultArchive">The default archive to route files to</param>
 /// <param name="otherArchives">Other archives to route files to</param>
 public SourceMonitor(Solution solution, string baseDirectory, AbstractArchive defaultArchive, SrcMLArchive sourceArchive, params AbstractArchive[] otherArchives)
     : this(solution, DEFAULT_SCAN_INTERVAL, TaskScheduler.Default, baseDirectory, defaultArchive, sourceArchive, otherArchives) { }
コード例 #9
0
        /// <summary>
        /// Create an instance of solution monitor.
        /// </summary>
        /// <param name="openSolution"></param>
        /// <param name="SrcMLServiceDirectory"></param>
        /// <param name="lastModifiedArchive"></param>
        /// <param name="CurrentSrcMLArchive"></param>
        /// <returns></returns>
        private static SolutionMonitor CreateMonitor(Solution openSolution, string SrcMLServiceDirectory, AbstractArchive lastModifiedArchive, params AbstractArchive[] CurrentSrcMLArchive)
        {
            Contract.Requires(openSolution != null, "A solution must be open");

            var currentMonitor = new SolutionMonitor(SolutionWrapper.Create(openSolution), SrcMLServiceDirectory, lastModifiedArchive, CurrentSrcMLArchive);

            return(currentMonitor);
        }
コード例 #10
0
        /// <summary>
        /// Create an instance of solution monitor.
        /// </summary>
        /// <param name="SrcMLServiceDirectory"></param>
        /// <param name="lastModifiedArchive"></param>
        /// <param name="CurrentSrcMLArchive"></param>
        /// <returns></returns>
        public static SolutionMonitor CreateMonitor(string SrcMLServiceDirectory, AbstractArchive lastModifiedArchive, params AbstractArchive[] CurrentSrcMLArchive)
        {
            var openSolution = GetOpenSolution();

            return(CreateMonitor(openSolution, SrcMLServiceDirectory, lastModifiedArchive, CurrentSrcMLArchive));
        }
コード例 #11
0
        /// <summary>
        /// Create an instance of solution monitor.
        /// </summary>
        /// <param name="openSolution"></param>
        /// <param name="SrcMLServiceDirectory"></param>
        /// <param name="lastModifiedArchive"></param>
        /// <param name="CurrentSrcMLArchive"></param>
        /// <returns></returns>
        private static SolutionMonitor CreateMonitor(Solution openSolution, string SrcMLServiceDirectory, AbstractArchive lastModifiedArchive, params AbstractArchive[] CurrentSrcMLArchive) {
            Contract.Requires(openSolution != null, "A solution must be open");

            var currentMonitor = new SolutionMonitor(SolutionWrapper.Create(openSolution), SrcMLServiceDirectory, lastModifiedArchive, CurrentSrcMLArchive);
            return currentMonitor;
        }
コード例 #12
0
 /// <summary>
 /// Create an instance of solution monitor.
 /// </summary>
 /// <param name="SrcMLServiceDirectory"></param>
 /// <param name="lastModifiedArchive"></param>
 /// <param name="CurrentSrcMLArchive"></param>
 /// <returns></returns>
 public static SolutionMonitor CreateMonitor(string SrcMLServiceDirectory, AbstractArchive lastModifiedArchive, params AbstractArchive[] CurrentSrcMLArchive) {
     var openSolution = GetOpenSolution();
     return CreateMonitor(openSolution, SrcMLServiceDirectory, lastModifiedArchive, CurrentSrcMLArchive);
 }
コード例 #13
0
 /// <summary>
 /// Creates a new source monitor
 /// </summary>
 /// <param name="solution">The solution to monitor</param>
 /// <param name="foldersToMonitor">A list of folders to monitor</param>
 /// <param name="baseDirectory">The base directory for this monitor</param>
 /// <param name="defaultArchive">The default archive to route files to</param>
 /// <param name="otherArchives">Other archives to route files to</param>
 public SourceMonitor(Solution solution, string baseDirectory, AbstractArchive defaultArchive, SrcMLArchive sourceArchive, params AbstractArchive[] otherArchives)
     : this(solution, DEFAULT_SCAN_INTERVAL, TaskScheduler.Default, baseDirectory, defaultArchive, sourceArchive, otherArchives)
 {
 }
コード例 #14
0
 /// <summary>
 /// Creates a new source monitor
 /// </summary>
 /// <param name="solution">The solution to monitor</param>
 /// <param name="foldersToMonitor">A list of folders to monitor</param>
 /// <param name="scanInterval">The interval at which to scan the folders (in
 /// seconds) </param>
 /// <param name="baseDirectory">The base directory for this monitor</param>
 /// <param name="defaultArchive">The default archive to route files to</param>
 /// <param name="otherArchives">Other archives to route files to</param>
 public SourceMonitor(Solution solution, double scanInterval, TaskScheduler scheduler, string baseDirectory, AbstractArchive defaultArchive, SrcMLArchive sourceArchive, params AbstractArchive[] otherArchives)
     : base(DirectoryScanningMonitor.MONITOR_LIST_FILENAME, scanInterval, scheduler, baseDirectory, defaultArchive, otherArchives)
 {
     if (null != sourceArchive)
     {
         RegisterArchive(sourceArchive, false);
     }
     this.MonitoredSolution = solution;
 }