Example #1
0
        static void ValidateVersion()
        {
            var currentVersion = Version.currentInfo;
            var oldVersion     = (SemVer)s_StoredVersionInfo;

            bool isNewVersion = currentVersion != oldVersion;

            if (isNewVersion)
            {
                PreferencesUpdater.CheckEditorPrefsVersion();
                s_StoredVersionInfo.SetValue(currentVersion, true);
            }

            bool assetStoreInstallFound = isNewVersion && PackageImporter.IsPreProBuilder4InProject();
            bool deprecatedGuidsFound   = isNewVersion && PackageImporter.DoesProjectContainDeprecatedGUIDs();

            const string k_AssetStoreUpgradeTitle  = "Old ProBuilder Install Found in Assets";
            const string k_AssetStoreUpgradeDialog = "The Asset Store version of ProBuilder is incompatible with Package Manager. Would you like to convert your project to the Package Manager version of ProBuilder?";
            const string k_DeprecatedGuidsTitle    = "Broken ProBuilder References Found in Project";
            const string k_DeprecatedGuidsDialog   = "ProBuilder has found some mesh components that are missing references. To keep these models editable by ProBuilder, they need to be repaired. Would you like to perform the repair action now?";

            if (isNewVersion && (assetStoreInstallFound || deprecatedGuidsFound))
            {
                if (UnityEditor.EditorUtility.DisplayDialog(assetStoreInstallFound ? k_AssetStoreUpgradeTitle : k_DeprecatedGuidsTitle,
                                                            assetStoreInstallFound ? k_AssetStoreUpgradeDialog : k_DeprecatedGuidsDialog +
                                                            "\n\nIf you choose \"No\" this dialog may be accessed again at any time through the \"Tools/ProBuilder/Repair/Convert to ProBuilder 4\" menu item.",
                                                            "Yes", "No"))
                {
                    EditorApplication.delayCall += AssetIdRemapEditor.OpenConversionEditor;
                }
            }
        }
Example #2
0
        public int Execute(ImportPackageOptions options)
        {
            var directoryName = Path.GetDirectoryName(options.PackagePath);

            if (string.IsNullOrEmpty(directoryName))
            {
                directoryName = ".\\";
            }

            var searchPattern = Path.GetFileName(options.PackagePath);

            if (string.IsNullOrEmpty(searchPattern))
            {
                searchPattern = "*.empkg";
            }

            var packagePaths = Directory.EnumerateFiles(directoryName, searchPattern)
                               .Select(Path.GetFullPath);

            foreach (var path in packagePaths)
            {
                Console.WriteLine($"Importing Package at {path}");

                var importer = new PackageImporter(conn, PackageImportConflictOption.Overwrite);
                var package  = new ExportPackage(path);

                if (!importer.Import(package))
                {
                    throw new InvalidOperationException($"Could not import the package at {path}");
                }
            }

            return(0);
        }
Example #3
0
        public SymbolTable()
        {
            var importer = new PackageImporter();

            importer.ImportPackage(typeof(BuiltIn.Lists), this);
            importer.ImportPackage(typeof(BuiltIn.Arith), this);
            importer.ImportPackage(typeof(BuiltIn.Misc), this);
            Register("PI", (float)Math.PI);
        }
Example #4
0
        private void importZipPackageCommand(CommandLineApplication command)
        {
            var inputPathOption = command.Option("-inputPath", "Zip file to import", CommandOptionType.SingleValue);

            command.OnExecute(() =>
            {
                var importer = new PackageImporter(_imageService, _dealerService, command.Out);
                importer.ImportZipPackageAsync(inputPathOption.Value()).Wait();
                return(0);
            });
        }
Example #5
0
        public void Import_ImportsAllMarkedMethods()
        {
            var st = new SymbolTable();

            st.Symbols.Clear();

            var imp = new PackageImporter();

            imp.ImportPackage(typeof(TestPackage), st);

            Assert.AreEqual(1, st.Symbols.Count);
        }
Example #6
0
        static void CheckForUpgradeableAssets(bool checkForDeprecatedGuids, bool calledFromMenu = false)
        {
            bool pre4PackageFound     = PackageImporter.IsPreProBuilder4InProject();
            bool deprecatedGuidsFound = !pre4PackageFound && checkForDeprecatedGuids && PackageImporter.DoesProjectContainDeprecatedGUIDs();

            if (pre4PackageFound || deprecatedGuidsFound)
            {
                if (UnityEditor.EditorUtility.DisplayDialog(
                        pre4PackageFound ? k_AssetStoreUpgradeTitle : k_DeprecatedGuidsTitle,
                        k_UpgradeDialog + k_UpgradeLaterText,
                        "Yes", "No"))
                {
                    EditorApplication.delayCall += AssetIdRemapEditor.OpenConversionEditor;
                }
            }
            else if (calledFromMenu)
            {
                UnityEditor.EditorUtility.DisplayDialog(
                    "Project is up to date",
                    "No missing or broken references found.",
                    "Okay"
                    );
            }
        }