예제 #1
0
        public string RenderJson(ManifestIdentity identity, ThunderstoreData manifest)
        {
            var dependencies = identity.Dependencies.Select(man =>
            {
                if (man.Identity)
                {
                    return($"{man.Identity.Author}-{man.Identity.Name}-{man.Identity.Version}");
                }
                else
                {
                    var errorMessage = $"Cannot locate ManifestIdentity on Manifest Asset \"{Path.Combine(AssetDatabase.GetAssetPath(man), man.name)}\"";
                    throw new ArgumentException(errorMessage);
                }
            });
            var stub = new ThunderstoreManifestStub
            {
                author         = identity.Author,
                dependencies   = dependencies.ToArray(),
                description    = identity.Description,
                name           = identity.Name,
                version_number = identity.Version,
                website_url    = manifest.url
            };

            return(JsonUtility.ToJson(stub));
        }
        public string RenderJson(ManifestIdentity identity, ThunderstoreData manifest, string name)
        {
            var dependencies = identity.Dependencies.Select(man => {
                var id = man.Data.OfType <ManifestIdentity>().First();
                return($"{id.Author}-{id.Name}-{id.Version}");
            });
            var stub = new ThunderstoreManifestStub
            {
                author         = identity.Author,
                dependencies   = dependencies.ToArray(),
                description    = identity.Description,
                name           = identity.Name,
                version_number = identity.Version,
                website_url    = manifest.url
            };

            return(JsonUtility.ToJson(stub));
        }