예제 #1
0
 public void MathExpressionTest8GraterEqualLess()
 {
     Assert.That(SemVer.ToMathExpression("[1.0,2.0)"), Is.EqualTo("1.0 <= v < 2.0"));
 }
예제 #2
0
 public void MathExpressionTest5Less()
 {
     Assert.That(SemVer.ToMathExpression("(,1.0)"), Is.EqualTo("v < 1.0"));
 }
예제 #3
0
 public void MathExpressionTest7GraterLess()
 {
     Assert.That(SemVer.ToMathExpression("(1.0,2.0)"), Is.EqualTo("1.0 < v < 2.0"));
 }
예제 #4
0
 public void MathExpressionTest4LessEqual()
 {
     Assert.That(SemVer.ToMathExpression("(,1.0]"), Is.EqualTo("v <= 1.0"));
 }
예제 #5
0
 public void MathExpressionTest3Equal()
 {
     Assert.That(SemVer.ToMathExpression("[1.0]"), Is.EqualTo("v = 1.0"));
 }
예제 #6
0
 public void MathExpressionTest2Grater()
 {
     Assert.That(SemVer.ToMathExpression("(1.0,)"), Is.EqualTo("1.0 < v"));
 }
예제 #7
0
 public void MathExpressionTest1GraterEqual()
 {
     Assert.That(SemVer.ToMathExpression("1.0"), Is.EqualTo("1.0 <= v"));
 }
예제 #8
0
        /// <summary>
        /// <para>Display the package information details as a GUI.</para>
        /// <para>パッケージ情報の詳細をGUIとして表示する。</para>
        /// </summary>
        /// <param name="data">
        /// <para>Package infomation.</para>
        /// <para>ッケージ情報。</para>
        /// </param>
        /// <param name="bold">
        /// <para>Bold GUIStyle.</para>
        /// <para>太字のGUIStyle。</para>
        /// </param>
        /// <param name="selectedVersion">
        /// <para>Selected version.</para>
        /// <para>選択されているバージョン。</para>
        /// </param>
        internal static void ToDetailGUI(this Catalog data, GUIStyle bold, string selectedVersion)
        {
            IEnumerable <Catalogentry> catalogEntrys = data.GetAllCatalogEntry().Where(catalog => catalog.version == selectedVersion);

            if (!catalogEntrys.Any())
            {
                return;
            }
            Catalogentry catalogEntry = catalogEntrys.First();

            using (new EditorGUILayout.VerticalScope("Box"))
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Description", bold);
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayoutExtention.WrapedLabel(catalogEntry.description == "" ? catalogEntry.summary : catalogEntry.description);
                }
            }

            using (new EditorGUILayout.VerticalScope("Box"))
            {
                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Version : ", bold);
                    GUILayoutExtention.WrapedLabel(selectedVersion);
                    GUILayout.FlexibleSpace();
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Auther :", bold);
                    GUILayoutExtention.WrapedLabel(string.Join(", ", catalogEntry.authors));
                    GUILayout.FlexibleSpace();
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("License : ", bold);
                    GUILayoutExtention.UrlLabel(catalogEntry.licenseExpression == "" ? catalogEntry.licenseUrl : catalogEntry.licenseExpression, catalogEntry.licenseUrl);
                    GUILayout.FlexibleSpace();
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Publish date : ", bold);
                    GUILayoutExtention.WrapedLabel(catalogEntry.published);
                    GUILayout.FlexibleSpace();
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Project url : ", bold);
                    GUILayoutExtention.UrlLabel(catalogEntry.projectUrl, catalogEntry.projectUrl);
                    GUILayout.FlexibleSpace();
                }

                using (new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Tag : ", bold);
                    GUILayoutExtention.WrapedLabel(string.Join(", ", catalogEntry.tags));
                    GUILayout.FlexibleSpace();
                }
            }

            using (new EditorGUILayout.VerticalScope("Box"))
            {
                GUILayout.Label("Dependency", bold);

                var framework = new List <string>();
                switch (PlayerSettings.GetApiCompatibilityLevel(EditorUserBuildSettings.selectedBuildTargetGroup))
                {
                case ApiCompatibilityLevel.NET_4_6:
                    framework = FrameworkName.NET;
                    break;

                case ApiCompatibilityLevel.NET_Standard_2_0:
                    framework = FrameworkName.STANDARD;
                    break;
                }

                IEnumerable <Dependencygroup> dependencyGroups = catalogEntry.dependencyGroups.Where(group => framework.Contains(group.targetFramework));
                if (dependencyGroups == null || !dependencyGroups.Any())
                {
                    GUILayout.Label("    None");
                }
                else
                {
                    Dependencygroup dependencyGroup = dependencyGroups.OrderBy(group => framework.IndexOf(group.targetFramework)).First();
                    GUILayout.Label("    " + dependencyGroup.targetFramework, bold);
                    if (dependencyGroup.dependencies == null || dependencyGroup.dependencies.Length == 0)
                    {
                        GUILayout.Label("        None");
                    }
                    else
                    {
                        try
                        {
                            foreach (Dependency dependency in dependencyGroup.dependencies)
                            {
                                GUILayout.Label("        " + dependency.id + "  (" + SemVer.ToMathExpression(dependency.range) + ")");
                            }
                        }
                        catch (Exception)
                        {
                            // During execution, the number of dependencies changes and an exception occurs, so I grip it. (because it's not a problem.)
                        }
                    }
                }
            }

            GUILayout.FlexibleSpace();
        }