protected virtual JsonContract CreateContract(Type objectType)
        {
            Type type = Class194.smethod_11(objectType);

            if (smethod_0(objectType))
            {
                return(this.CreatePrimitiveContract(objectType));
            }
            if (Class139.smethod_1(type) == null)
            {
                if (Class139.smethod_2(type) != null)
                {
                    return(this.CreateArrayContract(objectType));
                }
                if (Class139.smethod_3(type) != null)
                {
                    return(this.CreateDictionaryContract(objectType));
                }
                if ((type == typeof(JToken)) || type.IsSubclassOf(typeof(JToken)))
                {
                    return(this.CreateLinqContract(objectType));
                }
                if (Class191.smethod_2(type))
                {
                    return(this.CreateDictionaryContract(objectType));
                }
                if (typeof(IEnumerable).IsAssignableFrom(type))
                {
                    return(this.CreateArrayContract(objectType));
                }
                if (smethod_2(type))
                {
                    return(this.CreateStringContract(objectType));
                }
                if (!this.IgnoreSerializableInterface && typeof(ISerializable).IsAssignableFrom(type))
                {
                    return(this.CreateISerializableContract(objectType));
                }
                if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(type))
                {
                    return(this.CreateDynamicContract(objectType));
                }
                if (smethod_1(type))
                {
                    return(this.CreatePrimitiveContract(type));
                }
            }
            return(this.CreateObjectContract(objectType));
        }
Exemplo n.º 2
0
 public TextSelection(Paragraph para, int startCharPos, int endCharPos)
 {
     this.list_0      = new List <TextRange>();
     this.paragraph_0 = para;
     if (this.paragraph_0.Items.Count != 0)
     {
         TextRange range;
         this.int_2 = Class191.smethod_2(this.paragraph_0, startCharPos + 1, out range);
         if (range != null)
         {
             this.int_0       = startCharPos - range.StartPos;
             this.textRange_0 = range;
             this.int_3       = Class191.smethod_2(this.paragraph_0, endCharPos, out range);
             if ((this.int_3 >= this.int_2) && (range != null))
             {
                 this.int_1 = endCharPos - range.StartPos;
             }
             else
             {
                 for (int j = para.Items.Count; j > 0; j--)
                 {
                     ParagraphBase base2 = para[j - 1];
                     if (base2 is TextRange)
                     {
                         range = base2 as TextRange;
                         break;
                     }
                 }
                 this.int_1 = (endCharPos - range.StartPos) - 1;
             }
             this.textRange_1 = range;
             if (this.int_1 == range.TextLength)
             {
                 this.int_1 = -1;
             }
             for (int i = this.int_2; i <= this.int_3; i++)
             {
                 range = this.paragraph_0.Items[i] as TextRange;
                 if (range != null)
                 {
                     this.list_0.Add(range);
                 }
             }
         }
     }
 }