Exemplo n.º 1
0
        public void Backup(string filePath = null)
        {
            string backupFolderPath, backupFilePath;

            if (string.IsNullOrWhiteSpace(filePath))
            {
                IList <string> filePaths = LoadedFilePath.Split('\\');
                string         fileName  = filePaths.LastOrDefault();
                backupFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "DgmlBackups");
                backupFilePath   = Path.Combine(backupFolderPath, fileName);
            }
            else
            {
                IList <string> filePaths = filePath.Split('\\');
                string         fileName  = filePaths.LastOrDefault();
                filePaths        = filePaths.Take(filePaths.Count() - 1).ToArray();
                backupFolderPath = string.Join("\\", filePaths);
                backupFilePath   = Path.Combine(backupFolderPath, fileName);
            }

            if (!Directory.Exists(backupFolderPath))
            {
                Directory.CreateDirectory(backupFolderPath);
            }
            backupFilePath = this.GetNextFileAvailable(backupFilePath);

            XDocument docToSave = XDocument.Parse(_xdoc.ToString().Replace("<DirectedGraph ", "<DirectedGraph xmlns=\"http://schemas.microsoft.com/vs/2009/dgml\" "));

            docToSave.Save(backupFilePath);
        }
Exemplo n.º 2
0
 public int GetRpkgVersion(string filename)
 {
     return(LoadedFilePath.Contains("patch") ? 1 : 0);
 }