Example #1
0
    private void  fromJSONPlayers(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        JSONArrayValue json_array1 = json_value.array_value();

        if (json_array1 == null)
        {
            throw new Exception("The value for field Players of SportsPlayersInformationNuggetJSON is not an array.");
        }
        int count1 = json_array1.componentCount();
        List <SportsPlayerJSON> vector_Players1 = new List <SportsPlayerJSON>(count1);

        for (int num1 = 0; num1 < count1; ++num1)
        {
            SportsPlayerJSON convert_classy = SportsPlayerJSON.from_json(json_array1.component(num1), ignore_extras, true);
            vector_Players1.Add(convert_classy);
        }
        initPlayers();
        for (int num2 = 0; num2 < vector_Players1.Count; ++num2)
        {
            appendPlayers(vector_Players1[num2]);
        }
        for (int num1 = 0; num1 < vector_Players1.Count; ++num1)
        {
        }
    }
Example #2
0
 public void appendPlayers(SportsPlayerJSON to_append)
 {
     if (!flagHasPlayers)
     {
         flagHasPlayers = true;
         storePlayers.Clear();
     }
     Debug.Assert(flagHasPlayers);
     storePlayers.Add(to_append);
 }
Example #3
0
    private void  fromJSONValue(JSONValue json_value, bool ignore_extras)
    {
        Debug.Assert(json_value != null);
        TypeValue or_result = new TypeValue();
        bool      or_done   = false;

        if (!or_done)
        {
            try
            {
                SportsTeamNewJSON convert_classy = SportsTeamNewJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice0 = convert_classy;
                or_result.key       = 0;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            try
            {
                SportsPlayerJSON convert_classy = SportsPlayerJSON.from_json(json_value, ignore_extras, true);
                or_result.u.choice1 = convert_classy;
                or_result.key       = 1;
                or_done             = true;
            }
            catch (Exception)
            {
            }
        }
        if (!or_done)
        {
            throw new Exception("The value for field Value of SportsTeamOrPlayerJSON is not one of the allowed values.");
        }
        setValue(or_result);
        switch (or_result.key)
        {
        case 0:
            break;

        case 1:
            break;

        default:
            Debug.Assert(false);
            break;
        }
    }