public static bool PrepareForSave(MediaCenterLibraryCache cache) { bool flag = true; foreach (string path2 in cache.LoadedFiles) { string str = Path.Combine(cache.SearchPath, path2); if (File.Exists(str)) { VmcStudioUtil.BackupFile(str); if (!VmcStudioUtil.TakeOwnership(str)) { throw new VmcStudioException(string.Format("Could not take ownership of {0}.", (object)str)); } } else { Trace.TraceWarning("File not found: {0}", new object[1] { (object)str }); } } if (!VmcStudioUtil.EnsureMediaCenterClosed(true)) { flag = false; } return(flag); }
public static bool RestoreModifiedFiles() { if (!VmcStudioUtil.EnsureMediaCenterClosed(true)) { return(false); } VmcStudioUtil.Application.CommonResources.CloseResources(); try { foreach (string str in Directory.GetFiles(MediaCenterUtil.MediaCenterPath)) { string backupFile = VmcStudioUtil.GetBackupFile(str); if (File.Exists(backupFile)) { File.Copy(backupFile, str, true); } } } finally { VmcStudioUtil.Application.CommonResources.ResetResources(); } return(true); }