예제 #1
0
        public ProjectSnapshot NewSnapshot(string projFullPath)
        {
            ProjectSnapshot ps = GetSnapshot(projFullPath);
            if (ps != null)
            {
                return ps;
            }

            string saveFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                @"AutoProjectFiles\Snapshots\" + Guid.NewGuid().ToString() + ".xml");
            ps = new ProjectSnapshot(saveFile);
            ps.ProjectFile = projFullPath;
            ps.Save();
            Snapshots().Add(ps);
            return ps;
        }
예제 #2
0
        private void LoadSnapshots()
        {
            string appDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "AutoProjectFiles");
            if (!Directory.Exists(appDir))
            {
                Directory.CreateDirectory(appDir);
            }

            string snapshotDir = Path.Combine(appDir, "Snapshots");
            if (!Directory.Exists(snapshotDir))
            {
                Directory.CreateDirectory(snapshotDir);
            }

            snapshots = new List<ProjectSnapshot>();
            foreach (string f in Directory.GetFiles(snapshotDir, "*.xml"))
            {
                ProjectSnapshot ps = new ProjectSnapshot(f);
                ps.Load();
                snapshots.Add(ps);
            }
        }
예제 #3
0
        private void GetOperableFiles(ProjectSnapshot ps, out List<string> newFiles, out List<string> delFiles)
        {
            List<string> currentSet = VsUtil.DirectoryTraversal(Path.GetDirectoryName(ps.ProjectFile), ps.Folders);

            HashSet<string> newSet = new HashSet<string>(currentSet);
            newSet.ExceptWith(ps.Entries);
            newFiles = new List<string>(newSet);

            HashSet<string> delSet = new HashSet<string>(ps.Entries);
            delSet.ExceptWith(currentSet);
            delFiles = new List<string>(delSet);
        }