/// <summary> /// Serialiaztion of objects /// </summary> /// <param name="obj">Object to serialize</param> /// <param name="abstractHessianOutput">HessianOutput - Instance</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { if (abstractHessianOutput.AddRef(obj)) { return; } var ds = obj as DataSet; abstractHessianOutput.WriteMapBegin(obj.GetType().FullName); foreach (DataTable dt in ds.Tables) { abstractHessianOutput.WriteMapBegin(null); abstractHessianOutput.WriteString(dt.TableName); foreach (DataColumn column in dt.Columns) { abstractHessianOutput.WriteString(column.ColumnName); abstractHessianOutput.WriteString(column.DataType.FullName); } abstractHessianOutput.WriteMapEnd(); abstractHessianOutput.WriteMapBegin(null); foreach (DataRow dr in dt.Rows) { abstractHessianOutput.WriteMapBegin(null); foreach (object value in dr.ItemArray) { abstractHessianOutput.WriteObject(value); } abstractHessianOutput.WriteMapEnd(); } abstractHessianOutput.WriteMapEnd(); } abstractHessianOutput.WriteMapEnd(); }
/// <summary> /// Serialiaztion of objects /// </summary> /// <param name="objData">Object to serialize</param> /// <param name="abstractHessianOutput">HessianOutput - Instance</param> public override void WriteObject(object objData, AbstractHessianOutput abstractHessianOutput) { if (abstractHessianOutput.AddRef(objData)) { return; } if (objData == null) { abstractHessianOutput.WriteNull(); } else { int iref = abstractHessianOutput.WriteObjectBegin(PROT_GUID_TYPE); if (iref < -1) { abstractHessianOutput.WriteString("value"); abstractHessianOutput.WriteString(objData.ToString()); abstractHessianOutput.WriteMapEnd(); } else { if (iref == -1) { abstractHessianOutput.WriteClassFieldLength(1); abstractHessianOutput.WriteString("value"); abstractHessianOutput.WriteObjectBegin(PROT_GUID_TYPE); } abstractHessianOutput.WriteString(objData.ToString()); } } }
/// <summary> /// Writes map in the output stream /// </summary> /// <param name="obj"> Object to write</param> /// <param name="abstractHessianOutput">Instance of the hessian output</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { if (abstractHessianOutput.AddRef(obj)) { return; } IDictionary dictionary = (IDictionary)obj; Type mapType = obj.GetType(); if (mapType.Equals(typeof(Hashtable))) { abstractHessianOutput.WriteMapBegin(null); } else { abstractHessianOutput.WriteMapBegin(mapType.Name); } IDictionaryEnumerator enumerator = dictionary.GetEnumerator(); while (enumerator.MoveNext()) { object objKey = enumerator.Key; abstractHessianOutput.WriteObject(objKey); object objValue = enumerator.Value; abstractHessianOutput.WriteObject(objValue); } abstractHessianOutput.WriteMapEnd(); }
protected void WriteObject10(SerializationInfo serializationInfo, AbstractHessianOutput abstractHessianOutput) { foreach (SerializationEntry serializationEntry in serializationInfo) { abstractHessianOutput.WriteString(serializationEntry.Name); abstractHessianOutput.WriteObject(serializationEntry.Value); } abstractHessianOutput.WriteMapEnd(); }
protected void WriteObject10(Object obj, AbstractHessianOutput abstractHessianOutput) { List <MemberInfo> serFields = GetSerializableFieldList(); for (int i = 0; i < serFields.Count; i++) { MemberInfo field = serFields[i]; abstractHessianOutput.WriteString(field.Name); abstractHessianOutput.WriteObject(ReflectionUtils.GetMemberValue(field, obj)); } abstractHessianOutput.WriteMapEnd(); }
/// <summary> /// Serialiaztion of string valued objects /// </summary> /// <param name="obj">Object to serialize</param> /// <param name="abstractHessianOutput">HessianOutput - Instance</param> public override void WriteObject(object obj, AbstractHessianOutput abstractHessianOutput) { if (obj == null) { abstractHessianOutput.WriteNull(); } else { if (abstractHessianOutput.AddRef(obj)) { return; } Type type = obj.GetType(); int iref = abstractHessianOutput.WriteObjectBegin(type.Name); if (iref < -1) { abstractHessianOutput.WriteString("value"); abstractHessianOutput.WriteString(obj.ToString()); abstractHessianOutput.WriteMapEnd(); } else { if (iref == -1) { abstractHessianOutput.WriteInt(1); abstractHessianOutput.WriteString("value"); abstractHessianOutput.WriteObjectBegin(type.Name); } abstractHessianOutput.WriteString(obj.ToString()); } } }