public void InitializeModuleImporting(string excludeModuleName)
        {
            excludeIndex     = -1;
            modulesInProject = AssetTools.FindAssetsByType <Module>(false, null);

            unityPackagePaths = ProjectTools.GetFilesInDirectory(ModuleWorkFlow.defaultTargetExportDirectory, ProjectTools.packageExtension, out unityPackageNames);


            int l = unityPackagePaths.Length;

            importWarnings = "";

            for (int i = 0; i < l; i++)
            {
                string unVersionedName;
                int    unimportedVersion = ModuleWorkFlow.VersionFromFilePath(unityPackageNames[i], out unVersionedName);

                if (unVersionedName != null)
                {
                    unityPackageNames[i] = unVersionedName;
                }

                if (unityPackageNames[i] == excludeModuleName)
                {
                    excludeIndex = i;
                }


                // check for modules alraedy imported...
                for (int j = 0; j < modulesInProject.Count; j++)
                {
                    Module importedModule = modulesInProject[j];

                    // if package in project already
                    if (unityPackageNames[i] == importedModule.moduleName)
                    {
                        // check if our package version is higher than our already imported version
                        if (unimportedVersion > importedModule.currentVersion)
                        {
                            importWarnings += "\n" + unityPackageNames[i] + " Upgrade available! Version: " + unimportedVersion + ", Current: " + importedModule.currentVersion;

                            // mark as already imported but updateable
                            unityPackageNames[i] = "[...] " + unityPackageNames[i];
                        }
                        else
                        {
                            // mark as already imported
                            unityPackageNames[i] = "[ X ] " + unityPackageNames[i];
                        }
                        break;
                    }
                }
                // add version to name as readable
                unityPackageNames[i] = unityPackageNames[i] + " [v" + unimportedVersion + "]";
            }
        }
Beispiel #2
0
        bool DoExport(bool upgrade)
        {
            if (projectSpecifier.workingModule == null)
            {
                Debug.LogWarning("ModuleProjectSpecifier: working module is null, at path: " + AssetDatabase.GetAssetPath(projectSpecifier));
                return(false);
            }

            ModuleWorkFlow.ExportModulePackage(projectSpecifier.workingModule, ModuleWorkFlow.defaultTargetExportDirectory, upgrade);
            return(true);
        }