Exemplo n.º 1
0
        public static void Check(JsonNode vrm0, UniGLTF.Extensions.VRMC_vrm.Meta vrm1)
        {
            if (vrm0["title"].GetString() != vrm1.Name)
            {
                throw new MigrationException("meta.title", vrm1.Name);
            }
            if (vrm0["version"].GetString() != vrm1.Version)
            {
                throw new MigrationException("meta.version", vrm1.Version);
            }
            if (!IsSingleList("meta.author", vrm0["author"].GetString(), vrm1.Authors))
            {
                throw new MigrationException("meta.author", $"{vrm1.Authors}");
            }
            if (vrm0["contactInformation"].GetString() != vrm1.ContactInformation)
            {
                throw new MigrationException("meta.contactInformation", vrm1.ContactInformation);
            }
            if (!IsSingleList("meta.reference", vrm0["reference"].GetString(), vrm1.References))
            {
                throw new MigrationException("meta.reference", $"{vrm1.References}");
            }
            if (vrm0["texture"].GetInt32() != vrm1.ThumbnailImage)
            {
                throw new MigrationException("meta.texture", $"{vrm1.ThumbnailImage}");
            }

            if (vrm0["allowedUserName"].GetString() != AvatarPermission("meta.allowedUserName", vrm1.AvatarPermission))
            {
                throw new MigrationException("meta.allowedUserName", $"{vrm1.AvatarPermission}");
            }
            if (vrm0["violentUssageName"].GetString() == "Allow" != vrm1.AllowExcessivelyViolentUsage)
            {
                throw new MigrationException("meta.violentUssageName", $"{vrm1.AllowExcessivelyViolentUsage}");
            }
            if (vrm0["sexualUssageName"].GetString() == "Allow" != vrm1.AllowExcessivelySexualUsage)
            {
                throw new MigrationException("meta.sexualUssageName", $"{vrm1.AllowExcessivelyViolentUsage}");
            }

            if (vrm0["commercialUssageName"].GetString() == "Allow")
            {
                if (vrm1.CommercialUsage == UniGLTF.Extensions.VRMC_vrm.CommercialUsageType.personalNonProfit)
                {
                    throw new MigrationException("meta.commercialUssageName", $"{vrm1.CommercialUsage}");
                }
            }
            else
            {
                if (vrm1.CommercialUsage == UniGLTF.Extensions.VRMC_vrm.CommercialUsageType.corporation ||
                    vrm1.CommercialUsage == UniGLTF.Extensions.VRMC_vrm.CommercialUsageType.personalProfit)
                {
                    throw new MigrationException("meta.commercialUssageName", $"{vrm1.CommercialUsage}");
                }
            }

            if (MigrationVrmMeta.GetLicenseUrl(vrm0) != vrm1.OtherLicenseUrl)
            {
                throw new MigrationException("meta.otherLicenseUrl", vrm1.OtherLicenseUrl);
            }

            switch (vrm0["licenseName"].GetString())
            {
            case "Other":
            {
                if (vrm1.Modification != UniGLTF.Extensions.VRMC_vrm.ModificationType.prohibited)
                {
                    throw new MigrationException("meta.licenceName", $"{vrm1.Modification}");
                }
                if (vrm1.AllowRedistribution.Value)
                {
                    throw new MigrationException("meta.liceneName", $"{vrm1.Modification}");
                }
                break;
            }

            default:
                throw new NotImplementedException();
            }
        }