public override void Apply(HealthAnalysis analysis, FixStatus status) { status.Description = "Fixing bad install path"; analysis.Properties.Paths.InstallPath = analysis.AnalysisOptions.InstallPath; analysis.Properties.Paths.Save(); status.Description = "Fixed bad install path"; }
public override void Apply(HealthAnalysis analysis, FixStatus status) { status.Description = "Upgrading outdated project format"; if (analysis.Properties.Options.Version < new Version(1, 2)) { var upgrader = new UpgradeFrom_1_1(); upgrader.Upgrade(analysis); status.Description = "Project format updated"; return; } throw new InvalidOperationException(string.Format(Text.ProjectHealthDialogModel_Upgrade_BadUpgradeVersion, analysis.Properties.Options.Version)); }
public override void Apply(HealthAnalysis analysis, FixStatus status) { status.Description = "Restoring whitelist cache"; var sourceFileName = Path.Combine(analysis.Properties.Paths.InstallPath, "Analyzers\\whitelist.cache"); if (!File.Exists(sourceFileName)) { throw new InvalidOperationException("Cannot find the source whitelist cache"); } var targetFileName = Path.Combine(Path.GetDirectoryName(analysis.FileName), "mdk\\whitelist.cache"); File.Copy(sourceFileName, targetFileName, true); Include(analysis, targetFileName); status.Description = "Restored whitelist cache"; }
public override void Apply(HealthAnalysis analysis, FixStatus status) { status.Description = "Fixing bad output path"; var path = analysis.AnalysisOptions.DefaultOutputPath; if (string.IsNullOrEmpty(path) || !Directory.Exists(path)) { status.Description = "Cannot find output path"; status.Failed = true; return; } analysis.Properties.Paths.OutputPath = path; analysis.Properties.Paths.Save(); status.Description = "Fixed bad output path"; }
public override void Apply(HealthAnalysis analysis, FixStatus status) { status.Description = "Restoring missing paths file"; analysis.Properties.Paths.InstallPath = analysis.AnalysisOptions.InstallPath; analysis.Properties.Paths.GameBinPath = analysis.AnalysisOptions.DefaultGameBinPath; analysis.Properties.Paths.OutputPath = analysis.AnalysisOptions.DefaultOutputPath; foreach (var reference in MDKProjectPaths.DefaultAssemblyReferences) { analysis.Properties.Paths.AssemblyReferences.Add(reference); } foreach (var reference in MDKProjectPaths.DefaultAnalyzerReferences) { analysis.Properties.Paths.AnalyzerReferences.Add(reference); } analysis.Properties.Paths.Save(); status.Description = "Restored missing paths file"; }
public override void Apply(HealthAnalysis analysis, FixStatus status) { status.Description = "Creating a backup in the parent folder..."; var directory = Path.GetDirectoryName(analysis.FileName) ?? ".\\"; if (!directory.EndsWith("\\")) { directory += "\\"; } var zipFileName = $"{Path.GetFileNameWithoutExtension(analysis.FileName)}_Backup_{DateTime.Now:yyyy-MM-dd-HHmmssfff}.zip"; var tmpZipName = Path.Combine(Path.GetTempPath(), zipFileName); ZipHelper.CreateFromDirectory(directory, tmpZipName, CompressionLevel.Fastest, false, path => OnlyInterestingFiles(directory, path)); var backupDirectory = new DirectoryInfo(Path.Combine(directory, "..\\")); File.Copy(tmpZipName, Path.Combine(backupDirectory.FullName, zipFileName)); File.Delete(tmpZipName); status.Description = "Backup created"; }
public abstract void Apply(HealthAnalysis analysis, FixStatus status);