Beispiel #1
0
        internal NetworkOptionsResponse(Version version, Allow allow)
        {
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }
            if (allow == null)
            {
                throw new ArgumentNullException(nameof(allow));
            }

            Version = version;
            Allow   = allow;
        }
        internal static NetworkOptionsResponse DeserializeNetworkOptionsResponse(JsonElement element)
        {
            Version version = default;
            Allow   allow   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("version"))
                {
                    version = Version.DeserializeVersion(property.Value);
                    continue;
                }
                if (property.NameEquals("allow"))
                {
                    allow = Allow.DeserializeAllow(property.Value);
                    continue;
                }
            }
            return(new NetworkOptionsResponse(version, allow));
        }