Esempio n. 1
0
        public bool SetContent(string key, object?value, Json.Token jsonType)
        {
            if (ContentTable.ContainsKey(key))
            {
                return(Program.ReportFailure($"Key '{key}' already parsed for object"));
            }

            Debug.Assert(!ContentTypeTable.ContainsKey(key));

            ContentTable.Add(key, value !);
            ContentTypeTable.Add(key, jsonType);

            return(true);
        }
Esempio n. 2
0
        public bool FinishArray(string key, ParsingContext arrayContext)
        {
            if (ContentTable.ContainsKey(key))
            {
                return(Program.ReportFailure($"Key '{key}' already parsed for object"));
            }

            Debug.Assert(!ContentTypeTable.ContainsKey(key));

            ContentTable.Add(key, arrayContext.ItemCollection);
            ContentTypeTable.Add(key, arrayContext.LastItemType);

            return(true);
        }
Esempio n. 3
0
        public bool RecordContext()
        {
            ContextList.Add(this);

            if (ObjectKey.Length > 0)
            {
                if (!RecordContextInStringTable(ObjectKeyTable, ObjectKey, ErrorControl.Normal))
                {
                    return(false);
                }

                if (ContentTable.ContainsKey("Name") && FieldTableStore.IsTypeWithName(ObjectType))
                {
                    if (!RecordContextInStringTable(ObjectNameTable, ContentTable["Name"], ErrorControl.IgnoreIfFound))
                    {
                        return(false);
                    }
                }

                if (ContentTable.ContainsKey("InternalName") && FieldTableStore.IsTypeWithInternalName(ObjectType))
                {
                    if (!RecordContextInStringTable(ObjectInternalNameTable, ContentTable["InternalName"], ErrorControl.Normal))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (!KeylessObjectTable.ContainsKey(ObjectType))
                {
                    KeylessObjectTable.Add(ObjectType, new List <ParsingContext>());
                }

                List <ParsingContext> TypedContextList = KeylessObjectTable[ObjectType];
                TypedContextList.Add(this);
            }

            if (ContentTable.ContainsKey("Id"))
            {
                if (!RecordContextInIntTable(ObjectIdTable, ContentTable["Id"]))
                {
                    return(false);
                }
            }

            return(true);
        }