コード例 #1
0
 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";
 }
コード例 #2
0
ファイル: OutdatedFix.cs プロジェクト: zkkorion/MDK-SE
        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));
        }
コード例 #3
0
        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";
        }
コード例 #4
0
ファイル: BadOutputPathFix.cs プロジェクト: zkkorion/MDK-SE
        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";
        }
コード例 #5
0
 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";
 }
コード例 #6
0
ファイル: BackupFix.cs プロジェクト: zkkorion/MDK-SE
        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";
        }
コード例 #7
0
 public abstract void Apply(HealthAnalysis analysis, FixStatus status);