Ejemplo n.º 1
0
        /// <inheritdoc />
        public void ProjectFinishedGenerating(Project project)
        {
            // Visual Studio sometimes generates invalid paths. This is an attempt to work around that problem.
            // If we detect any failure, we simply ignore it - the probability is negligible, and the
            // result is merely an inconvenience.
            // ReSharper disable once SuspiciousTypeConversion.Global
            var serviceProvider = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)project.DTE);

            if (!TryGetProperties(serviceProvider, out Properties props))
            {
                return;
            }

            if (!TryGetFinalBinPath(serviceProvider, props, out string binPath))
            {
                return;
            }

            if (!TryGetFinalInstallPath(serviceProvider, out string installPath))
            {
                return;
            }

            var scriptUpgrades = new ScriptUpgrades();
            var result         = scriptUpgrades.Analyze(project, new ScriptUpgradeAnalysisOptions
            {
                DefaultGameBinPath   = binPath,
                InstallPath          = installPath,
                TargetVersion        = MDKPackage.Version,
                GameAssemblyNames    = MDKPackage.GameAssemblyNames,
                GameFiles            = MDKPackage.GameFiles,
                UtilityAssemblyNames = MDKPackage.UtilityAssemblyNames,
                UtilityFiles         = MDKPackage.UtilityFiles
            });

            if (result.IsValid)
            {
                return;
            }
            scriptUpgrades.Upgrade(result);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Creates a new instance of <see cref="MDKPackage" />
 /// </summary>
 public MDKPackage()
 {
     ScriptUpgrades = new ScriptUpgrades();
 }