Exemple #1
0
        /// serialize any object. depending on the type of the object, it will be serialized in binary format
        static public string SerializeObjectWithType(object o)
        {
            if (o == null)
            {
                return("null:void");
            }

            bool binary = ShouldParameterEncodeBinary(o);

            string result = SerializeObject(o, binary);

            if (THttpBinarySerializer.isJSClient())
            {
                if ((result.Length > 0) && (result[0] != '{') && (result[0] != '['))
                {
                    result = "\"" + result + "\"";
                }

                return(result);
            }

            // fat client
            if (result.EndsWith(":binary"))
            {
                return(result);
            }
            else
            {
                return(result + ":" + (binary ? "binary" : o.GetType().ToString()));
            }
        }
Exemple #2
0
 /// <summary>
 /// serialize any object. if it is a complex type, use JSON or Base64 (fat client)
 /// </summary>
 static public string SerializeObject(object o, bool binary)
 {
     return(THttpBinarySerializer.isJSClient() ? SerializeObjectJSON(o, binary) : SerializeObjectBase64(o, binary));
 }
Exemple #3
0
 /// <summary>
 /// serialize any object. if it is a complex type, use JSON or Base64 (fat client)
 /// </summary>
 static public string SerializeObject(object o)
 {
     return(THttpBinarySerializer.isJSClient() ? SerializeObjectJSON(o) : SerializeObjectJSON(o).Trim('"'));
 }