ImportPackageAssets() private method

private ImportPackageAssets ( string packageName, ImportPackageItem items, bool performReInstall ) : void
packageName string
items ImportPackageItem
performReInstall bool
return void
        public static void ImportPackage(string packagePath, bool interactive)
        {
            if (string.IsNullOrEmpty(packagePath))
            {
                throw new ArgumentException("Path can not be empty or null", "packagePath");
            }

            string packageIconPath;
            bool   canPerformReInstall;

            ImportPackageItem[] items = PackageUtility.ExtractAndPrepareAssetList(packagePath, out packageIconPath, out canPerformReInstall);

            if (items == null)
            {
                return;
            }

            if (interactive)
            {
                PackageImport.ShowImportPackage(packagePath, items, packageIconPath, canPerformReInstall);
            }
            else
            {
                string packageName = System.IO.Path.GetFileNameWithoutExtension(packagePath);
                PackageUtility.ImportPackageAssets(packageName, items, false);
            }
        }
示例#2
0
        private void FinishImport()
        {
            var completeItemList = IsMultiStepWizard ? m_AssetContentItems.Concat(m_ProjectSettingItems) : m_AssetContentItems;

            PackageUtility.ImportPackageAssets(m_PackageName, completeItemList.ToArray());
            CloseImportWindow();
        }
        void BottomArea()
        {
            // Background
            GUILayout.BeginVertical(ms_Constants.bottomBarBg);

            GUILayout.Space(8);
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            if (GUILayout.Button(EditorGUIUtility.TrTextContent("All"), GUILayout.Width(50)))
            {
                m_Tree.SetAllEnabled(PackageImportTreeView.EnabledState.All);
            }

            if (GUILayout.Button(EditorGUIUtility.TrTextContent("None"), GUILayout.Width(50)))
            {
                m_Tree.SetAllEnabled(PackageImportTreeView.EnabledState.None);
            }

            ReInstallToggle();

            GUILayout.FlexibleSpace();
            if (GUILayout.Button(EditorGUIUtility.TrTextContent("Cancel")))
            {
                PackageUtility.ImportPackageAssetsCancelledFromGUI(m_PackageName, m_ImportPackageItems);

                PopupWindowWithoutFocus.Hide();
                Close();
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button(EditorGUIUtility.TrTextContent("Import")))
            {
                bool doImport = true;
                if (doReInstall)
                {
                    doImport = EditorUtility.DisplayDialog("Re-Install?", "Highlighted folders will be completely deleted first! Recommend backing up your project first. Are you sure?", "Do It", "Cancel");
                }

                if (doImport)
                {
                    if (m_ImportPackageItems != null)
                    {
                        PackageUtility.ImportPackageAssets(m_PackageName, m_ImportPackageItems, doReInstall);
                    }

                    PopupWindowWithoutFocus.Hide();
                    Close();
                    GUIUtility.ExitGUI();
                }
            }

            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            GUILayout.EndVertical();
        }
示例#4
0
 private void BottomArea()
 {
     GUILayout.BeginVertical(PackageImport.ms_Constants.bottomBarBg, new GUILayoutOption[0]);
     GUILayout.Space(8f);
     GUILayout.BeginHorizontal(new GUILayoutOption[0]);
     GUILayout.Space(10f);
     if (GUILayout.Button(EditorGUIUtility.TextContent("All"), new GUILayoutOption[]
     {
         GUILayout.Width(50f)
     }))
     {
         this.m_Tree.SetAllEnabled(PackageImportTreeView.EnabledState.All);
     }
     if (GUILayout.Button(EditorGUIUtility.TextContent("None"), new GUILayoutOption[]
     {
         GUILayout.Width(50f)
     }))
     {
         this.m_Tree.SetAllEnabled(PackageImportTreeView.EnabledState.None);
     }
     this.ReInstallToggle();
     GUILayout.FlexibleSpace();
     if (GUILayout.Button(EditorGUIUtility.TextContent("Cancel"), new GUILayoutOption[0]))
     {
         PopupWindowWithoutFocus.Hide();
         base.Close();
         GUIUtility.ExitGUI();
     }
     if (GUILayout.Button(EditorGUIUtility.TextContent("Import"), new GUILayoutOption[0]))
     {
         bool flag = true;
         if (this.doReInstall)
         {
             flag = EditorUtility.DisplayDialog("Re-Install?", "Highlighted folders will be completely deleted first! Recommend backing up your project first. Are you sure?", "Do It", "Cancel");
         }
         if (flag)
         {
             if (this.m_ImportPackageItems != null)
             {
                 PackageUtility.ImportPackageAssets(this.m_ImportPackageItems, this.doReInstall);
             }
             PopupWindowWithoutFocus.Hide();
             base.Close();
             GUIUtility.ExitGUI();
         }
     }
     GUILayout.Space(10f);
     GUILayout.EndHorizontal();
     GUILayout.Space(5f);
     GUILayout.EndVertical();
 }
示例#5
0
        public static void ImportPackage(string packagePath, bool interactive)
        {
            string str;
            bool   flag;

            ImportPackageItem[] items = PackageUtility.ExtractAndPrepareAssetList(packagePath, out str, out flag);
            if (items != null)
            {
                if (interactive)
                {
                    PackageImport.ShowImportPackage(packagePath, items, str, flag);
                }
                else
                {
                    PackageUtility.ImportPackageAssets(items, false);
                }
            }
        }
示例#6
0
        void BottomArea()
        {
            // Background
            GUILayout.BeginVertical(ms_Constants.bottomBarBg);

            GUILayout.Space(8);
            GUILayout.BeginHorizontal();
            GUILayout.Space(10);
            if (GUILayout.Button(EditorGUIUtility.TrTextContent("All"), GUILayout.Width(50)))
            {
                m_Tree.SetAllEnabled(PackageImportTreeView.EnabledState.All);
            }

            if (GUILayout.Button(EditorGUIUtility.TrTextContent("None"), GUILayout.Width(50)))
            {
                m_Tree.SetAllEnabled(PackageImportTreeView.EnabledState.None);
            }

            GUILayout.FlexibleSpace();
            if (GUILayout.Button(EditorGUIUtility.TrTextContent("Cancel")))
            {
                PackageUtility.ImportPackageAssetsCancelledFromGUI(m_PackageName, m_ImportPackageItems);

                PopupWindowWithoutFocus.Hide();
                Close();
                GUIUtility.ExitGUI();
            }
            if (GUILayout.Button(EditorGUIUtility.TrTextContent("Import")))
            {
                if (m_ImportPackageItems != null)
                {
                    PackageUtility.ImportPackageAssets(m_PackageName, m_ImportPackageItems);
                }

                PopupWindowWithoutFocus.Hide();
                Close();
                GUIUtility.ExitGUI();
            }

            GUILayout.Space(10);
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            GUILayout.EndVertical();
        }
示例#7
0
        /// <summary>
        ///   <para>Imports package at packagePath into the current project.</para>
        /// </summary>
        /// <param name="packagePath"></param>
        /// <param name="interactive"></param>
        public static void ImportPackage(string packagePath, bool interactive)
        {
            string packageIconPath;
            bool   canPerformReInstall;

            ImportPackageItem[] prepareAssetList = PackageUtility.ExtractAndPrepareAssetList(packagePath, out packageIconPath, out canPerformReInstall);
            if (prepareAssetList == null)
            {
                return;
            }
            if (interactive)
            {
                PackageImport.ShowImportPackage(packagePath, prepareAssetList, packageIconPath, canPerformReInstall);
            }
            else
            {
                PackageUtility.ImportPackageAssets(prepareAssetList, false);
            }
        }
示例#8
0
        public static void ImportPackage(string packagePath, bool interactive)
        {
            string packageIconPath;
            bool   allowReInstall;

            ImportPackageItem[] array = PackageUtility.ExtractAndPrepareAssetList(packagePath, out packageIconPath, out allowReInstall);
            if (array == null)
            {
                return;
            }
            if (interactive)
            {
                PackageImport.ShowImportPackage(packagePath, array, packageIconPath, allowReInstall);
            }
            else
            {
                PackageUtility.ImportPackageAssets(array, false);
            }
        }
示例#9
0
        /// <summary>
        /// <para>Imports package at packagePath into the current project.</para>
        /// </summary>
        /// <param name="packagePath"></param>
        /// <param name="interactive"></param>
        public static void ImportPackage(string packagePath, bool interactive)
        {
            string str;
            bool   flag;

            if (string.IsNullOrEmpty(packagePath))
            {
                throw new ArgumentException("Path can not be empty or null", "packagePath");
            }
            ImportPackageItem[] items = PackageUtility.ExtractAndPrepareAssetList(packagePath, out str, out flag);
            if (items != null)
            {
                if (interactive)
                {
                    PackageImport.ShowImportPackage(packagePath, items, str, flag);
                }
                else
                {
                    PackageUtility.ImportPackageAssets(Path.GetFileNameWithoutExtension(packagePath), items, false);
                }
            }
        }
示例#10
0
        public static void ImportPackage(string packagePath, bool interactive)
        {
            if (string.IsNullOrEmpty(packagePath))
            {
                throw new ArgumentException("Path can not be empty or null", "packagePath");
            }
            string packageIconPath;
            bool   allowReInstall;

            ImportPackageItem[] array = PackageUtility.ExtractAndPrepareAssetList(packagePath, out packageIconPath, out allowReInstall);
            if (array != null)
            {
                if (interactive)
                {
                    PackageImport.ShowImportPackage(packagePath, array, packageIconPath, allowReInstall);
                }
                else
                {
                    string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(packagePath);
                    PackageUtility.ImportPackageAssets(fileNameWithoutExtension, array, false);
                }
            }
        }