Ejemplo n.º 1
0
 internal ScriptAction(string name, string uri, HdiNodeTypes roles, string parameters)
 {
     Name       = name;
     Uri        = uri;
     Roles      = roles;
     Parameters = parameters;
 }
        internal static ScriptAction DeserializeScriptAction(JsonElement element)
        {
            string            name       = default;
            string            uri        = default;
            HdiNodeTypes      roles      = default;
            Optional <string> parameters = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("uri"))
                {
                    uri = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("roles"))
                {
                    roles = new HdiNodeTypes(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("parameters"))
                {
                    parameters = property.Value.GetString();
                    continue;
                }
            }
            return(new ScriptAction(name, uri, roles, parameters.Value));
        }
Ejemplo n.º 3
0
        public ScriptAction(string name, string uri, HdiNodeTypes roles)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            Name  = name;
            Uri   = uri;
            Roles = roles;
        }