public static void Write(KeywordReference keywordReference, JsonTextWriter writer)
        {
            KeywordCondition keywordCondition = keywordReference.conditionMask;

            if (keywordReference.type == ObjectReference.Type.None)
            {
                if (keywordCondition == (KeywordCondition)0)
                {
                    writer.WriteValue(keywordReference.keyword);
                    return;
                }
                writer.WriteStartObject();
                writer.WritePropertyName("condition");
                writer.WriteValue((object)keywordCondition);
                writer.WritePropertyName("keyword");
                writer.WriteValue(keywordReference.keyword);
                writer.WriteEndObject();
                return;
            }
            writer.WriteStartObject();
            if (keywordCondition != 0)
            {
                writer.WritePropertyName("condition");
                writer.WriteValue((object)keywordCondition);
            }
            writer.WritePropertyName("type");
            writer.WriteValue((object)keywordReference.type);
            writer.WritePropertyName("id");
            writer.WriteValue(keywordReference.id);
            writer.WriteEndObject();
        }
 public bool Equals(KeywordReference other)
 {
     if (type == other.type && id == other.id && string.Equals(keyword, other.keyword))
     {
         return(conditionMask == other.conditionMask);
     }
     return(false);
 }
Esempio n. 3
0
        private void AdditionalPopulateFromJson(JObject jsonObject)
        {
            JArray val = Serialization.JsonArray(jsonObject, "keywordReferences");
            int    num = (val != null) ? val.get_Count() : 0;

            if (num > 0)
            {
                m_keywordReferences = new KeywordReference[num];
                for (int i = 0; i < num; i++)
                {
                    m_keywordReferences[i] = KeywordReference.FromJson(val.get_Item(i));
                }
            }
            else
            {
                m_keywordReferences = NoKeywordReference;
            }
        }