public void GetFromat(string fieldName, Type type, ref int startOffet, StringBuilder offsetBuilder, StringBuilder formats) { if (ByteConverter.SupportType(type)) { object obj2 = Activator.CreateInstance(type); byte[] buffer = ByteConverter.ToBytes(type, obj2); formats.Append(string.Format("FieldName:{0,-20} ;", fieldName)); formats.Append(string.Format("Type:{0,-20} ;", TypeHelper.GetClassSimpleName(type))); formats.Append(string.Format("StartOffet:{0,-20} ;", ((int)startOffet).ToString() + offsetBuilder.ToString())); formats.Append(string.Format("Length:{0,-20} ;", buffer.Length)); formats.Append("\n"); startOffet += buffer.Length; } else if (type == typeof(string)) { formats.Append(string.Format("FieldName:{0,-20} ;", fieldName + "Len")); formats.Append(string.Format("Type:{0,-20} ;", "int")); formats.Append(string.Format("StartOffet:{0,-20} ;", ((int)startOffet).ToString() + offsetBuilder.ToString())); formats.Append(string.Format("Length:{0,-20} ;", 4)); formats.Append("\n"); startOffet += 4; formats.Append(string.Format("FieldName:{0,-20} ;", fieldName)); formats.Append(string.Format("Type:{0,-20} ;", TypeHelper.GetClassSimpleName(type))); formats.Append(string.Format("StartOffet:{0,-20} ;", ((int)startOffet).ToString() + offsetBuilder.ToString())); formats.Append(string.Format("Length:{0,-20} ;", fieldName + "Len")); formats.Append("\n"); offsetBuilder.Append(string.Format("+{0}Len", fieldName)); } else if (type == typeof(byte[])) { formats.Append(string.Format("FieldName:{0,-20} ;", fieldName + "Len")); formats.Append(string.Format("Type:{0,-20} ;", "int")); formats.Append(string.Format("StartOffet:{0,-20} ;", ((int)startOffet).ToString() + offsetBuilder.ToString())); formats.Append(string.Format("Length:{0,-20} ;", 4)); formats.Append("\n"); startOffet += 4; formats.Append(string.Format("FieldName:{0,-20} ;", fieldName)); formats.Append(string.Format("Type:{0,-20} ;", TypeHelper.GetClassSimpleName(type))); formats.Append(string.Format("StartOffet:{0,-20} ;", ((int)startOffet).ToString() + offsetBuilder.ToString())); formats.Append(string.Format("Length:{0,-20} ;", fieldName + "Len")); formats.Append("\n"); offsetBuilder.Append(string.Format("+{0}Len", fieldName)); } else if (((!type.IsGenericType || ((type.GetGenericTypeDefinition() != typeof(IList <>)) && (type.GetGenericTypeDefinition() != typeof(List <>)))) && (!type.IsGenericType || ((type.GetGenericTypeDefinition() != typeof(IDictionary <,>)) && (type.GetGenericTypeDefinition() != typeof(Dictionary <,>))))) && (!type.IsGenericType && !type.IsArray)) { string classSimpleName = TypeHelper.GetClassSimpleName(type); formats.Append(string.Format("FieldName:{0,-20} ;", classSimpleName + "Len")); formats.Append(string.Format("Type:{0,-20} ;", "int")); formats.Append(string.Format("StartOffet:{0,-20} ;", ((int)startOffet).ToString() + offsetBuilder.ToString())); formats.Append(string.Format("Length:{0,-20} ;", 4)); formats.Append("\n"); startOffet += 4; Class137 class2 = this.xrxcLalgu3(type); for (int i = 0; i < class2.method_1().Length; i++) { this.GetFromat(class2.method_1()[i].Name, class2.method_1()[i].PropertyType, ref startOffet, offsetBuilder, formats); } } }
// Token: 0x06000B44 RID: 2884 RVA: 0x0003AC0C File Offset: 0x00038E0C public Class137 method_1(Class137 class137_1, JsonSchema jsonSchema_0) { string key; if (class137_1 != null) { if (class137_1.method_1().Contains(jsonSchema_0)) { return(class137_1); } key = Class137.smethod_0(class137_1.method_1().Union(new JsonSchema[] { jsonSchema_0 })); } else { key = Class137.smethod_0(new JsonSchema[] { jsonSchema_0 }); } if (this.class139_0.Contains(key)) { return(this.class139_0[key]); } Class137 @class = (class137_1 != null) ? class137_1.method_9(jsonSchema_0) : new Class137(jsonSchema_0); this.class139_0.Add(@class); this.method_2(jsonSchema_0.Properties, @class.method_2()); this.method_2(jsonSchema_0.PatternProperties, @class.method_3()); if (jsonSchema_0.Items != null) { for (int i = 0; i < jsonSchema_0.Items.Count; i++) { this.method_4(@class, i, jsonSchema_0.Items[i]); } } if (jsonSchema_0.AdditionalItems != null) { this.method_6(@class, jsonSchema_0.AdditionalItems); } if (jsonSchema_0.AdditionalProperties != null) { this.method_5(@class, jsonSchema_0.AdditionalProperties); } if (jsonSchema_0.Extends != null) { foreach (JsonSchema jsonSchema_ in jsonSchema_0.Extends) { @class = this.method_1(@class, jsonSchema_); } } return(@class); }
protected override object DoDeserializeComplicatedType(Type type, byte[] buff, ref int offset) { int num = ByteConverter.Parse <int>(buff, ref offset); object obj2 = null; if (num > -1) { obj2 = Activator.CreateInstance(type); Class137 class2 = this.xrxcLalgu3(type); for (int i = 0; i < class2.method_1().Length; i++) { object obj3 = base.DoDeserialize(class2.method_1()[i].PropertyType, buff, ref offset); this.method_0(type, class2.method_0(), obj2, class2.method_1()[i].Name, obj3); } } return(obj2); }
protected override void DoSerializeComplicatedType(Type type, object obj, MemoryStream stream) { if (obj == null) { byte[] buffer3 = ByteConverter.ToBytes <int>(-1); stream.Write(buffer3, 0, buffer3.Length); } else { Class137 class2 = this.xrxcLalgu3(type); MemoryStream stream2 = new MemoryStream(); for (int i = 0; i < class2.method_1().Length; i++) { object obj2 = class2.method_0().GetValue(obj, class2.method_1()[i].Name); base.DoSerialize(stream2, class2.method_1()[i].PropertyType, obj2); } byte[] buffer = stream2.ToArray(); byte[] buffer2 = ByteConverter.ToBytes <int>(buffer.Length); stream.Write(buffer2, 0, buffer2.Length); stream.Write(buffer, 0, buffer.Length); } }
// Token: 0x06000B56 RID: 2902 RVA: 0x0003B058 File Offset: 0x00039258 private Class137(Class137 class137_2, JsonSchema jsonSchema_0) { Class202.ofdixO4zTbIfy(); base..ctor(); this.readOnlyCollection_0 = new ReadOnlyCollection <JsonSchema>(class137_2.method_1().Union(new JsonSchema[] { jsonSchema_0 }).ToList <JsonSchema>()); this.dictionary_0 = new Dictionary <string, Class137>(class137_2.method_2()); this.dictionary_1 = new Dictionary <string, Class137>(class137_2.method_3()); this.list_0 = new List <Class137>(class137_2.method_4()); this.method_6(class137_2.method_5()); this.method_8(class137_2.method_7()); this.string_0 = Class137.smethod_0(this.method_1()); }
// Token: 0x06000B4A RID: 2890 RVA: 0x0003AE44 File Offset: 0x00039044 private Class135 method_7(Class137 class137_1) { Class135 @class; if (this.dictionary_0.TryGetValue(class137_1, out @class)) { return(@class); } @class = Class135.Create(class137_1.method_1()); this.dictionary_0[class137_1] = @class; foreach (KeyValuePair <string, Class137> keyValuePair in class137_1.method_2()) { if (@class.method_24() == null) { @class.method_25(new Dictionary <string, Class135>()); } @class.method_24()[keyValuePair.Key] = this.method_7(keyValuePair.Value); } foreach (KeyValuePair <string, Class137> keyValuePair2 in class137_1.method_3()) { if (@class.method_26() == null) { @class.method_27(new Dictionary <string, Class135>()); } @class.method_26()[keyValuePair2.Key] = this.method_7(keyValuePair2.Value); } foreach (Class137 class137_2 in class137_1.method_4()) { if (@class.method_22() == null) { @class.method_23(new List <Class135>()); } @class.method_22().Add(this.method_7(class137_2)); } if (class137_1.method_5() != null) { @class.method_29(this.method_7(class137_1.method_5())); } if (class137_1.method_7() != null) { @class.method_31(this.method_7(class137_1.method_7())); } return(@class); }