private ReadResults ValidatePrimary(JsonObject json, Components components)
        {
            Dictionary <string, ComponentArgument> componentArguments = components.GetPrimary();

            if (componentArguments == null || componentArguments.Count == 0)
            {
                return(ReadResults.Success());
            }
            foreach (string key in componentArguments.Keys)
            {
                if (json.TryGetKey(key, componentArguments[key].MayUseKeyResourceLocation(), out string actualKey))
                {
                    return(componentArguments[key].Validate(json, actualKey, this, components, StringReader, Start, Resources));
                }
            }
            StringReader.SetCursor(Start);
            return(ReadResults.Failure(ComponentCommandError.UnknownComponent(json).WithContext(StringReader)));
        }
        private ReadResults ValidateArray(JsonArray json, Components components)
        {
            if (json.GetLength() == 0)
            {
                StringReader.SetCursor(Start);
                return(ReadResults.Failure(ComponentCommandError.EmptyComponent().WithContext(StringReader)));
            }
            ReadResults readResults;

            for (int i = 0; i < json.GetLength(); i++)
            {
                readResults = ValidateContents(json[i], components);
                if (!readResults.Successful)
                {
                    return(readResults);
                }
            }
            return(ReadResults.Success());
        }
 public ReadResults ValidateContents(IJsonArgument json, Components components)
 {
     if (json is JsonNull)
     {
         StringReader.SetCursor(Start);
         return(ReadResults.Failure(ComponentCommandError.UnknownComponent(json).WithContext(StringReader)));
     }
     else if (json is JsonObject jsonObject)
     {
         return(ValidateObject(jsonObject, components));
     }
     else if (json is JsonArray jsonArray)
     {
         return(ValidateArray(jsonArray, components));
     }
     else
     {
         return(ReadResults.Success());
     }
 }