Ejemplo n.º 1
0
        public override void Serialize(HessianOutput output, object map, string customTypeName)
        {
            var typeName = customTypeName ?? _type.FullName;
            var defIdx   = output.WriteMapDefinition(typeName, _fieldNames);

            if (defIdx < 0)
            {
                output.WriteMapStart(typeName);
                for (int i = 0; i < _fields.Length; i++)
                {
                    output.WriteString(_fieldNames[i]);
                    _fieldSerializers[i].WriteField(output, map);
                }
                output.WriteMapEnd();
            }
            else
            {
                output.WriteMapStart(defIdx);

                for (int i = 0; i < _fields.Length; i++)
                {
                    _fieldSerializers[i].WriteField(output, map);
                }
            }
        }
Ejemplo n.º 2
0
        public override void Serialize(HessianOutput output, object map, string customTypeName)
        {
            var typeName = customTypeName ?? _type.FullName;
            var value    = Enum.GetName(_type, map);

            var defIdx = output.WriteMapDefinition(typeName, _fieldNames);

            if (defIdx < 0)
            {
                output.WriteMapStart(typeName);
                output.WriteString("name");
                output.WriteString(value);
                output.WriteMapEnd();
            }
            else
            {
                output.WriteMapStart(defIdx);
                output.WriteString(value);
            }
        }
Ejemplo n.º 3
0
        public override void Serialize(HessianOutput output, object map, string customTypeName)
        {
            var typeName = customTypeName ?? _type.FullName;

            output.WriteMapStart(typeName);

            // entries
            foreach (var fieldInfo in _fields)
            {
                output.WriteString(fieldInfo.Name);
                output.WriteObject(fieldInfo.GetValue(map));
            }

            output.WriteMapEnd();
        }