Exemplo n.º 1
0
 private void serialize <valueType>(ref valueType value, CharStream jsonStream, SerializeConfig config)
 {
     Config = config ?? DefaultConfig;
     CharStream.From(jsonStream);
     try
     {
         serialize(ref value);
     }
     finally { jsonStream.From(CharStream); }
 }
Exemplo n.º 2
0
 private SerializeWarning serialize <valueType>(valueType value, CharStream xmlStream, SerializeConfig config)
 {
     Config = config ?? DefaultConfig;
     CharStream.From(xmlStream);
     try
     {
         serialize(value);
         return(Warning);
     }
     finally { xmlStream.From(CharStream); }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 序列化
        /// </summary>
        /// <typeparam name="valueType"></typeparam>
        /// <param name="stream"></param>
        /// <param name="value"></param>
        internal void SerializeTcpServer <valueType>(ref valueType value, UnmanagedStream stream)
        //where valueType : struct
        {
            int index = stream.Data.CurrentIndex;

            if (forefatherCount != 0)
            {
                System.Array.Clear(forefather, 0, forefatherCount);
                forefatherCount = 0;
            }
            CharStream.From(stream);
            try
            {
                //Warning = SerializeWarning.None;
                TypeSerializer <valueType> .SerializeTcpServer(this, ref value);
            }
            finally { stream.From(CharStream); }
            if (((stream.Data.CurrentIndex - index) & 2) != 0)
            {
                stream.Write(' ');
            }
        }