Exemplo n.º 1
0
        private void BuildTree()
        {
            // default all packages to being roots
            roots = new List <NugetPackage>(installedPackages);

            // remove a package as a root if another package is dependent on it
            foreach (var package in installedPackages)
            {
                var frameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(package);
                foreach (var dependency in frameworkGroup.Dependencies)
                {
                    roots.RemoveAll(p => p.Id == dependency.Id);
                }
            }
        }
Exemplo n.º 2
0
        private void DrawPackage(NugetPackage package)
        {
            if (package.Dependencies != null && package.Dependencies.Count > 0)
            {
                expanded[package] = EditorGUILayout.Foldout(expanded[package], $"{package.Id} {package.Version}");

                if (expanded[package])
                {
                    EditorGUI.indentLevel++;

                    var frameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(package);
                    foreach (var dependency in frameworkGroup.Dependencies)
                    {
                        DrawDepencency(dependency);
                    }
                    EditorGUI.indentLevel--;
                }
            }
            else
            {
                EditorGUILayout.LabelField($"{package.Id} {package.Version}");
            }
        }
        private void DrawPackage(NugetPackage package)
        {
            if (package.Dependencies != null && package.Dependencies.Count > 0)
            {
                expanded[package] = EditorGUILayout.Foldout(expanded[package], string.Format("{0} {1}", package.Id, package.Version));

                if (expanded[package])
                {
                    EditorGUI.indentLevel++;

                    NugetFrameworkGroup frameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(package);
                    foreach (NugetPackageIdentifier dependency in frameworkGroup.Dependencies)
                    {
                        DrawDepencency(dependency);
                    }
                    EditorGUI.indentLevel--;
                }
            }
            else
            {
                EditorGUILayout.LabelField(string.Format("{0} {1}", package.Id, package.Version));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Automatically called by Unity to draw the GUI.
        /// </summary>
        protected void OnGUI()
        {
            currentTab = GUILayout.Toolbar(currentTab, tabTitles);

            switch (currentTab)
            {
            case 0:
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
                foreach (var package in roots)
                {
                    DrawPackage(package);
                }
                EditorGUILayout.EndScrollView();
                break;

            case 1:
                EditorStyles.label.fontStyle = FontStyle.Bold;
                EditorStyles.label.fontSize  = 14;
                EditorGUILayout.LabelField("Select Dependency:", GUILayout.Height(20));
                EditorStyles.label.fontStyle = FontStyle.Normal;
                EditorStyles.label.fontSize  = 10;
                EditorGUI.indentLevel++;
                var newIndex = EditorGUILayout.Popup(selectedPackageIndex, installedPackageIds);
                EditorGUI.indentLevel--;

                if (newIndex != selectedPackageIndex)
                {
                    selectedPackageIndex = newIndex;

                    parentPackages.Clear();
                    var selectedPackage = installedPackages[selectedPackageIndex];
                    foreach (var package in installedPackages)
                    {
                        var frameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(package);
                        foreach (var dependency in frameworkGroup.Dependencies)
                        {
                            if (dependency.Id == selectedPackage.Id)
                            {
                                parentPackages.Add(package);
                            }
                        }
                    }
                }

                EditorGUILayout.Space();
                EditorStyles.label.fontStyle = FontStyle.Bold;
                EditorStyles.label.fontSize  = 14;
                EditorGUILayout.LabelField("Packages That Depend on Above:", GUILayout.Height(20));
                EditorStyles.label.fontStyle = FontStyle.Normal;
                EditorStyles.label.fontSize  = 10;

                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
                EditorGUI.indentLevel++;
                if (parentPackages.Count <= 0)
                {
                    EditorGUILayout.LabelField("NONE");
                }
                else
                {
                    foreach (var parent in parentPackages)
                    {
                        //EditorGUILayout.LabelField(string.Format("{0} {1}", parent.Id, parent.Version));
                        DrawPackage(parent);
                    }
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.EndScrollView();
                break;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Draws the given <see cref="NugetPackage"/>.
        /// </summary>
        /// <param name="package">The <see cref="NugetPackage"/> to draw.</param>
        private void DrawPackage(NugetPackage package, GUIStyle packageStyle, GUIStyle contrastStyle)
        {
            IEnumerable <NugetPackage> installedPackages = NugetHelper.InstalledPackages;
            var installed = installedPackages.FirstOrDefault(p => p.Id == package.Id);

            EditorGUILayout.BeginHorizontal();
            {
                // The Unity GUI system (in the Editor) is terrible.  This probably requires some explanation.
                // Every time you use a Horizontal block, Unity appears to divide the space evenly.
                // (i.e. 2 components have half of the window width, 3 components have a third of the window width, etc)
                // GUILayoutUtility.GetRect is SUPPOSED to return a rect with the given height and width, but in the GUI layout.  It doesn't.
                // We have to use GUILayoutUtility to get SOME rect properties, but then manually calculate others.
                EditorGUILayout.BeginHorizontal();
                {
                    const int iconSize = 32;
                    int       padding  = EditorStyles.label.padding.vertical;
                    Rect      rect     = GUILayoutUtility.GetRect(iconSize, iconSize);
                    // only use GetRect's Y position.  It doesn't correctly set the width, height or X position.

                    rect.x      = padding;
                    rect.y     += padding;
                    rect.width  = iconSize;
                    rect.height = iconSize;

                    if (package.Icon != null)
                    {
                        GUI.DrawTexture(rect, package.Icon, ScaleMode.StretchToFill);
                    }
                    else
                    {
                        GUI.DrawTexture(rect, defaultIcon, ScaleMode.StretchToFill);
                    }

                    rect.x     = iconSize + 2 * padding;
                    rect.width = position.width / 2 - (iconSize + padding);
                    rect.y    -= padding; // This will leave the text aligned with the top of the image


                    EditorStyles.label.fontStyle = FontStyle.Bold;
                    EditorStyles.label.fontSize  = 16;

                    Vector2 idSize = EditorStyles.label.CalcSize(new GUIContent(package.Id));
                    rect.y += (iconSize / 2 - idSize.y / 2) + padding;
                    GUI.Label(rect, package.Id, EditorStyles.label);
                    rect.x += idSize.x;

                    EditorStyles.label.fontSize  = 10;
                    EditorStyles.label.fontStyle = FontStyle.Normal;

                    Vector2 versionSize = EditorStyles.label.CalcSize(new GUIContent(package.Version));
                    rect.y += (idSize.y - versionSize.y - padding / 2);

                    if (!string.IsNullOrEmpty(package.Authors))
                    {
                        string  authorLabel = string.Format("by {0}", package.Authors);
                        Vector2 size        = EditorStyles.label.CalcSize(new GUIContent(authorLabel));
                        GUI.Label(rect, authorLabel, EditorStyles.label);
                        rect.x += size.x;
                    }

                    if (package.DownloadCount > 0)
                    {
                        string  downloadLabel = string.Format("{0} downloads", package.DownloadCount.ToString("#,#"));
                        Vector2 size          = EditorStyles.label.CalcSize(new GUIContent(downloadLabel));
                        GUI.Label(rect, downloadLabel, EditorStyles.label);
                        rect.x += size.x;
                    }
                }

                GUILayout.FlexibleSpace();
                if (installed != null && installed.Version != package.Version)
                {
                    GUILayout.Label(string.Format("Current Version {0}", installed.Version));
                }
                GUILayout.Label(string.Format("Version {0}", package.Version));


                if (installedPackages.Contains(package))
                {
                    // This specific version is installed
                    if (GUILayout.Button("Uninstall"))
                    {
                        // TODO: Perhaps use a "mark as dirty" system instead of updating all of the data all the time?
                        NugetHelper.Uninstall(package);
                        NugetHelper.UpdateInstalledPackages();
                        UpdateUpdatePackages();
                    }
                }
                else
                {
                    if (installed != null)
                    {
                        if (installed < package)
                        {
                            // An older version is installed
                            if (GUILayout.Button("Update"))
                            {
                                NugetHelper.Update(installed, package);
                                NugetHelper.UpdateInstalledPackages();
                                UpdateUpdatePackages();
                            }
                        }
                        else if (installed > package)
                        {
                            // A newer version is installed
                            if (GUILayout.Button("Downgrade"))
                            {
                                NugetHelper.Update(installed, package);
                                NugetHelper.UpdateInstalledPackages();
                                UpdateUpdatePackages();
                            }
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("Install"))
                        {
                            NugetHelper.InstallIdentifier(package);
                            AssetDatabase.Refresh();
                            NugetHelper.UpdateInstalledPackages();
                            UpdateUpdatePackages();
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.BeginVertical();
                {
                    // Show the package details
                    EditorStyles.label.wordWrap  = true;
                    EditorStyles.label.fontStyle = FontStyle.Normal;

                    string summary = package.Summary;
                    if (string.IsNullOrEmpty(summary))
                    {
                        summary = package.Description;
                    }

                    if (!package.Title.Equals(package.Id, StringComparison.InvariantCultureIgnoreCase))
                    {
                        summary = string.Format("{0} - {1}", package.Title, summary);
                    }

                    if (summary.Length >= 240)
                    {
                        summary = string.Format("{0}...", summary.Substring(0, 237));
                    }

                    EditorGUILayout.LabelField(summary);

                    bool   detailsFoldout;
                    string detailsFoldoutId = string.Format("{0}.{1}", package.Id, "Details");
                    if (!foldouts.TryGetValue(detailsFoldoutId, out detailsFoldout))
                    {
                        foldouts[detailsFoldoutId] = detailsFoldout;
                    }
                    detailsFoldout             = EditorGUILayout.Foldout(detailsFoldout, "Details");
                    foldouts[detailsFoldoutId] = detailsFoldout;

                    if (detailsFoldout)
                    {
                        EditorGUI.indentLevel++;
                        if (!string.IsNullOrEmpty(package.Description))
                        {
                            EditorGUILayout.LabelField("Description", EditorStyles.boldLabel);
                            EditorGUILayout.LabelField(package.Description);
                        }

                        if (!string.IsNullOrEmpty(package.ReleaseNotes))
                        {
                            EditorGUILayout.LabelField("Release Notes", EditorStyles.boldLabel);
                            EditorGUILayout.LabelField(package.ReleaseNotes);
                        }

                        // Show project URL link
                        if (!string.IsNullOrEmpty(package.ProjectUrl))
                        {
                            EditorGUILayout.LabelField("Project Url", EditorStyles.boldLabel);
                            GUILayoutLink(package.ProjectUrl);
                            GUILayout.Space(4f);
                        }


                        // Show the dependencies
                        if (package.Dependencies.Count > 0)
                        {
                            EditorStyles.label.wordWrap  = true;
                            EditorStyles.label.fontStyle = FontStyle.Italic;
                            StringBuilder builder = new StringBuilder();

                            NugetFrameworkGroup frameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(package);
                            foreach (var dependency in frameworkGroup.Dependencies)
                            {
                                builder.Append(string.Format(" {0} {1};", dependency.Id, dependency.Version));
                            }
                            EditorGUILayout.Space();
                            EditorGUILayout.LabelField(string.Format("Depends on:{0}", builder.ToString()));
                            EditorStyles.label.fontStyle = FontStyle.Normal;
                        }

                        // Create the style for putting a box around the 'Clone' button
                        var cloneButtonBoxStyle = new GUIStyle("box");
                        cloneButtonBoxStyle.stretchWidth   = false;
                        cloneButtonBoxStyle.margin.top     = 0;
                        cloneButtonBoxStyle.margin.bottom  = 0;
                        cloneButtonBoxStyle.padding.bottom = 4;

                        var normalButtonBoxStyle = new GUIStyle(cloneButtonBoxStyle);
                        normalButtonBoxStyle.normal.background = packageStyle.normal.background;

                        bool showCloneWindow = openCloneWindows.Contains(package);
                        cloneButtonBoxStyle.normal.background = showCloneWindow ? contrastStyle.normal.background : packageStyle.normal.background;

                        // Create a simillar style for the 'Clone' window
                        var cloneWindowStyle = new GUIStyle(cloneButtonBoxStyle);
                        cloneWindowStyle.padding = new RectOffset(6, 6, 2, 6);

                        // Show button bar
                        EditorGUILayout.BeginHorizontal();
                        {
                            if (package.RepositoryType == RepositoryType.Git || package.RepositoryType == RepositoryType.TfsGit)
                            {
                                if (!string.IsNullOrEmpty(package.RepositoryUrl))
                                {
                                    EditorGUILayout.BeginHorizontal(cloneButtonBoxStyle);
                                    {
                                        var cloneButtonStyle = new GUIStyle(GUI.skin.button);
                                        cloneButtonStyle.normal = showCloneWindow ? cloneButtonStyle.active : cloneButtonStyle.normal;
                                        if (GUILayout.Button("Clone", cloneButtonStyle, GUILayout.ExpandWidth(false)))
                                        {
                                            showCloneWindow = !showCloneWindow;
                                        }

                                        if (showCloneWindow)
                                        {
                                            openCloneWindows.Add(package);
                                        }
                                        else
                                        {
                                            openCloneWindows.Remove(package);
                                        }
                                    }
                                    EditorGUILayout.EndHorizontal();
                                }
                            }

                            if (!string.IsNullOrEmpty(package.LicenseUrl) && package.LicenseUrl != "http://your_license_url_here")
                            {
                                // Creaete a box around the license button to keep it alligned with Clone button
                                EditorGUILayout.BeginHorizontal(normalButtonBoxStyle);
                                // Show the license button
                                if (GUILayout.Button("View License", GUILayout.ExpandWidth(false)))
                                {
                                    Application.OpenURL(package.LicenseUrl);
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                        }
                        EditorGUILayout.EndHorizontal();

                        if (showCloneWindow)
                        {
                            EditorGUILayout.BeginVertical(cloneWindowStyle);
                            {
                                // Clone latest label
                                EditorGUILayout.BeginHorizontal();
                                GUILayout.Space(20f);
                                EditorGUILayout.LabelField("clone latest");
                                EditorGUILayout.EndHorizontal();

                                // Clone latest row
                                EditorGUILayout.BeginHorizontal();
                                {
                                    if (GUILayout.Button("Copy", GUILayout.ExpandWidth(false)))
                                    {
                                        GUI.FocusControl(package.Id + package.Version + "repoUrl");
                                        GUIUtility.systemCopyBuffer = package.RepositoryUrl;
                                    }

                                    GUI.SetNextControlName(package.Id + package.Version + "repoUrl");
                                    EditorGUILayout.TextField(package.RepositoryUrl);
                                }
                                EditorGUILayout.EndHorizontal();

                                // Clone @ commit label
                                GUILayout.Space(4f);
                                EditorGUILayout.BeginHorizontal();
                                GUILayout.Space(20f);
                                EditorGUILayout.LabelField("clone @ commit");
                                EditorGUILayout.EndHorizontal();

                                // Clone @ commit row
                                EditorGUILayout.BeginHorizontal();
                                {
                                    // Create the three commands a user will need to run to get the repo @ the commit. Intentionally leave off the last newline for better UI appearance
                                    string commands = string.Format("git clone {0} {1} --no-checkout{2}cd {1}{2}git checkout {3}", package.RepositoryUrl, package.Id, Environment.NewLine, package.RepositoryCommit);

                                    if (GUILayout.Button("Copy", GUILayout.ExpandWidth(false)))
                                    {
                                        GUI.FocusControl(package.Id + package.Version + "commands");

                                        // Add a newline so the last command will execute when pasted to the CL
                                        GUIUtility.systemCopyBuffer = (commands + Environment.NewLine);
                                    }

                                    EditorGUILayout.BeginVertical();
                                    GUI.SetNextControlName(package.Id + package.Version + "commands");
                                    EditorGUILayout.TextArea(commands);
                                    EditorGUILayout.EndVertical();
                                }
                                EditorGUILayout.EndHorizontal();
                            }
                            EditorGUILayout.EndVertical();
                        }
                        EditorGUI.indentLevel--;
                    }

                    EditorGUILayout.Separator();
                    EditorGUILayout.Separator();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Use the Unity GUI to draw the controls.
        /// </summary>
        protected void OnGUI()
        {
            if (nuspec == null)
            {
                Reload();
            }

            if (nuspec == null)
            {
                titleContent = new GUIContent("[NO NUSPEC]");
                EditorGUILayout.LabelField("There is no .nuspec file selected.");
            }
            else
            {
                EditorGUIUtility.labelWidth = 100;
                nuspec.Id         = EditorGUILayout.TextField(new GUIContent("ID", "The name of the package."), nuspec.Id);
                nuspec.Version    = EditorGUILayout.TextField(new GUIContent("Version", "The semantic version of the package."), nuspec.Version);
                nuspec.Authors    = EditorGUILayout.TextField(new GUIContent("Authors", "The authors of the package."), nuspec.Authors);
                nuspec.Owners     = EditorGUILayout.TextField(new GUIContent("Owners", "The owners of the package."), nuspec.Owners);
                nuspec.LicenseUrl = EditorGUILayout.TextField(new GUIContent("License URL", "The URL for the license of the package."), nuspec.LicenseUrl);
                nuspec.ProjectUrl = EditorGUILayout.TextField(new GUIContent("Project URL", "The URL of the package project."), nuspec.ProjectUrl);
                nuspec.IconUrl    = EditorGUILayout.TextField(new GUIContent("Icon URL", "The URL for the icon of the package."), nuspec.IconUrl);
                nuspec.RequireLicenseAcceptance = EditorGUILayout.Toggle(new GUIContent("Require License Acceptance", "Does the package license need to be accepted before use?"), nuspec.RequireLicenseAcceptance);
                nuspec.Description  = EditorGUILayout.TextField(new GUIContent("Description", "The description of the package."), nuspec.Description);
                nuspec.Summary      = EditorGUILayout.TextField(new GUIContent("Summary", "The brief description of the package."), nuspec.Summary);
                nuspec.ReleaseNotes = EditorGUILayout.TextField(new GUIContent("Release Notes", "The release notes for this specific version of the package."), nuspec.ReleaseNotes);
                nuspec.Copyright    = EditorGUILayout.TextField(new GUIContent("Copyright", "The copyright details for the package."), nuspec.Copyright);
                nuspec.Tags         = EditorGUILayout.TextField(new GUIContent("Tags", "The space-delimited list of tags and keywords that describe the package and aid discoverability of packages through search and filtering."), nuspec.Tags);

                dependenciesExpanded = EditorGUILayout.Foldout(dependenciesExpanded, new GUIContent("Dependencies", "The list of NuGet packages that this packages depends on."));

                if (dependenciesExpanded)
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(50);

                        // automatically fill in the dependencies based upon the "root" packages currently installed in the project
                        if (GUILayout.Button(new GUIContent("Automatically Fill Dependencies", "Populates the list of dependencies with the \"root\" NuGet packages currently installed in the project.")))
                        {
                            NugetHelper.UpdateInstalledPackages();
                            List <NugetPackage> installedPackages = NugetHelper.InstalledPackages.ToList();

                            // default all packages to being roots
                            List <NugetPackage> roots = new List <NugetPackage>(installedPackages);

                            // remove a package as a root if another package is dependent on it
                            foreach (NugetPackage package in installedPackages)
                            {
                                NugetFrameworkGroup packageFrameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(package);
                                foreach (NugetPackageIdentifier dependency in packageFrameworkGroup.Dependencies)
                                {
                                    roots.RemoveAll(p => p.Id == dependency.Id);
                                }
                            }

                            // remove all existing dependencies from the .nuspec
                            nuspec.Dependencies.Clear();

                            nuspec.Dependencies.Add(new NugetFrameworkGroup());
                            nuspec.Dependencies[0].Dependencies = roots.Cast <NugetPackageIdentifier>().ToList();
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    // display the dependencies
                    NugetPackageIdentifier toDelete             = null;
                    NugetFrameworkGroup    nuspecFrameworkGroup = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(nuspec);
                    foreach (var dependency in nuspecFrameworkGroup.Dependencies)
                    {
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Space(75);
                        float prevLabelWidth = EditorGUIUtility.labelWidth;
                        EditorGUIUtility.labelWidth = 50;
                        dependency.Id = EditorGUILayout.TextField(new GUIContent("ID", "The ID of the dependency package."), dependency.Id);
                        EditorGUILayout.EndHorizontal();

                        //int oldSeletedIndex = IndexOf(ref existingComponents, dependency.Id);
                        //int newSelectIndex = EditorGUILayout.Popup("Name", oldSeletedIndex, existingComponents);
                        //if (oldSeletedIndex != newSelectIndex)
                        //{
                        //    dependency.Name = existingComponents[newSelectIndex];
                        //}

                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Space(75);
                        dependency.Version = EditorGUILayout.TextField(new GUIContent("Version", "The version number of the dependency package. (specify ranges with =><)"), dependency.Version);
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.BeginHorizontal();
                        {
                            GUILayout.Space(75);

                            if (GUILayout.Button("Remove " + dependency.Id))
                            {
                                toDelete = dependency;
                            }
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.Separator();

                        EditorGUIUtility.labelWidth = prevLabelWidth;
                    }

                    if (toDelete != null)
                    {
                        nuspecFrameworkGroup.Dependencies.Remove(toDelete);
                    }

                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(50);

                        if (GUILayout.Button("Add Dependency"))
                        {
                            nuspecFrameworkGroup.Dependencies.Add(new NugetPackageIdentifier());
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.Separator();

                if (GUILayout.Button(string.Format("Save {0}", Path.GetFileName(filepath))))
                {
                    nuspec.Save(filepath);
                }

                EditorGUILayout.Separator();

                if (GUILayout.Button(string.Format("Pack {0}.nupkg", Path.GetFileNameWithoutExtension(filepath))))
                {
                    NugetHelper.Pack(filepath);
                }

                EditorGUILayout.Separator();

                apiKey = EditorGUILayout.TextField(new GUIContent("API Key", "The API key to use when pushing the package to the server"), apiKey);

                if (GUILayout.Button(string.Format("Push to Server")))
                {
                    NugetHelper.Push(nuspec, filepath, apiKey);
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Use the Unity GUI to draw the controls.
        /// </summary>
        protected void OnGUI()
        {
            if (nuspec == null)
            {
                Reload();
            }

            if (nuspec == null)
            {
                titleContent = new GUIContent("[NO NUSPEC]");
                EditorGUILayout.LabelField("There is no .nuspec file selected.");
                return;
            }

            {
                EditorGUIUtility.labelWidth = 100;
                nuspec.Id         = EditorGUILayout.TextField(new GUIContent("ID", "The id of the package."), nuspec.Id);
                nuspec.Title      = EditorGUILayout.TextField(new GUIContent("Title", "The name of the package."), nuspec.Title);
                nuspec.Version    = EditorGUILayout.TextField(new GUIContent("Version", "The semantic version of the package."), nuspec.Version);
                nuspec.Authors    = EditorGUILayout.TextField(new GUIContent("Authors", "The authors of the package."), nuspec.Authors);
                nuspec.Owners     = EditorGUILayout.TextField(new GUIContent("Owners", "The owners of the package."), nuspec.Owners);
                nuspec.LicenseUrl = EditorGUILayout.TextField(new GUIContent("License URL", "The URL for the license of the package."), nuspec.LicenseUrl);
                nuspec.ProjectUrl = EditorGUILayout.TextField(new GUIContent("Project URL", "The URL of the package project."), nuspec.ProjectUrl);
                nuspec.IconUrl    = EditorGUILayout.TextField(new GUIContent("Icon URL", "The URL for the icon of the package."), nuspec.IconUrl);
                nuspec.RequireLicenseAcceptance = EditorGUILayout.Toggle(new GUIContent("Require License Acceptance", "Does the package license need to be accepted before use?"), nuspec.RequireLicenseAcceptance);
                nuspec.Description  = EditorGUILayout.TextField(new GUIContent("Description", "The description of the package."), nuspec.Description);
                nuspec.ReleaseNotes = EditorGUILayout.TextField(new GUIContent("Release Notes", "The release notes for this specific version of the package."), nuspec.ReleaseNotes);
                nuspec.Copyright    = EditorGUILayout.TextField(new GUIContent("Copyright", "The copyright details for the package."), nuspec.Copyright);
                nuspec.Tags         = EditorGUILayout.TextField(new GUIContent("Tags", "The space-delimited list of tags and keywords that describe the package and aid discoverability of packages through search and filtering."), nuspec.Tags);

                using (new EditorGUILayout.HorizontalScope())
                {
                    dependenciesExpanded = EditorGUILayout.Foldout(dependenciesExpanded, new GUIContent("Dependencies", "The list of NuGet packages that this packages depends on."));

                    if (dependenciesExpanded)
                    {
                        GUILayout.FlexibleSpace();

                        // automatically fill in the dependencies based upon packages currently installed in the project
                        if (GUILayout.Button(new GUIContent("Automatically Fill Dependencies", "Populates the list of dependencies with all NuGet packages currently installed in the project.")))
                        {
                            NugetHelper.UpdateInstalledPackages();
                            var installedPackages = NugetHelper.InstalledPackages.ToList();

                            // exclude yourself from the list
                            installedPackages.RemoveAll(p => p.Id == nuspec.Id);

                            // remove all existing dependencies from the .nuspec
                            nuspec.Dependencies.Clear();

                            nuspec.Dependencies.Add(new NugetFrameworkGroup());
                            nuspec.Dependencies[0].Dependencies = installedPackages.Cast <NugetPackageIdentifier>().ToList();
                        }
                    }
                }

                if (dependenciesExpanded)
                {
                    EditorGUILayout.Space();
                    // display the dependencies
                    NugetPackageIdentifier toDelete = null;
                    var nuspecFrameworkGroup        = NugetHelper.GetBestDependencyFrameworkGroupForCurrentSettings(nuspec);
                    foreach (var dependency in nuspecFrameworkGroup.Dependencies)
                    {
                        EditorGUILayout.BeginHorizontal();
                        GUILayout.Space(25);
                        GUILayout.Label("ID", GUILayout.Width(25), GUILayout.Height(20));
                        dependency.Id = GUILayout.TextField(dependency.Id, GUILayout.Height(20));
                        GUILayout.Label("Version ", GUILayout.Width(50), GUILayout.Height(20));
                        dependency.Version = GUILayout.TextField(dependency.Version, GUILayout.Width(150), GUILayout.Height(20));
                        GUILayout.Space(5);

                        if (GUILayout.Button("X", GUILayout.Width(20)))
                        {
                            toDelete = dependency;
                        }
                        EditorGUILayout.EndHorizontal();

                        EditorGUILayout.Separator();
                    }

                    if (toDelete != null)
                    {
                        nuspecFrameworkGroup.Dependencies.Remove(toDelete);
                    }

                    EditorGUILayout.BeginHorizontal();
                    {
                        GUILayout.Space(25);

                        if (GUILayout.Button("Add Dependency"))
                        {
                            nuspecFrameworkGroup.Dependencies.Add(new NugetPackageIdentifier());
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }

                GUILayout.Space(10);

                packingExpanded = EditorGUILayout.Foldout(packingExpanded, new GUIContent("Pack and Push to Server"));

                if (packingExpanded)
                {
                    if (GUILayout.Button($"Pack {Path.GetFileNameWithoutExtension(filepath)}.nupkg"))
                    {
                        NugetHelper.Pack(filepath);
                    }

                    EditorGUILayout.Separator();

                    apiKey =
                        EditorGUILayout.TextField(new GUIContent("API Key", "The API key to use when pushing the package to the server"),
                                                  apiKey);

                    if (GUILayout.Button("Push to Server"))
                    {
                        NugetHelper.Push(nuspec, filepath, apiKey);
                    }
                }

                GUILayout.FlexibleSpace();

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.FlexibleSpace();
                    var style = new GUIStyle(GUI.skin.button)
                    {
                        normal = { textColor = Color.green }
                    };

                    if (GUILayout.Button($"Save {Path.GetFileName(filepath)}", style, GUILayout.Width(400), GUILayout.Height(50)))
                    {
                        nuspec.Save(filepath);
                    }
                    GUILayout.FlexibleSpace();
                }

                GUILayout.Space(20);
            }
        }