Ejemplo n.º 1
0
        protected override void WriteOptionalFields(IJSonWriter output)
        {
            // create basic JSON representation of Bayeux message:
            // {
            //   ... - parent inserted fields
            //  supportedConnectionTypes: "xxx",
            //  version: "1.0",
            //  minimumVersion: "1.0",
            //  ext: "xxx"
            // }

            if (Version != null)
            {
                output.WriteMember("version", Version.ToString());
            }
            if (MinimumVersion != null)
            {
                output.WriteMember("minimumVersion", MinimumVersion.ToString());
            }

            output.WriteMember("supportedConnectionTypes");
            output.WriteArrayBegin();
            foreach (string type in BayeuxConnectionTypesHelper.ToCollection(SupportedConnectionTypes))
            {
                output.WriteValue(type);
            }
            output.WriteArrayEnd();
        }
Ejemplo n.º 2
0
        public void Write(IJSonWriter output)
        {
            var reader = new JSonReader();
            var tree   = reader.Read(obj.ToString());

            output.Write(tree);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Writes content of this object to a JSON stream.
        /// </summary>
        public void Write(IJSonWriter output)
        {
            if (output == null)
            {
                return;
            }

            output.WriteObjectBegin();
            {
                output.WriteMember("channel", Channel);
                if (ID != null)
                {
                    output.WriteMember("id", ID);
                }
                output.WriteMember("clientId", ClientID);
                output.WriteMember("successful", Successful ? 1 : 0);
                if (Data != null)
                {
                    output.WriteMember("data");
                    output.Write(Data);
                }
                if (Ext != null)
                {
                    output.WriteMember("ext");
                    output.Write(Ext);
                }

                // writes additional members defined by child classes:
                WriteOptionalFields(output);
            }
            output.WriteObjectEnd();
        }
Ejemplo n.º 4
0
        public ArrayWriter(IJSonWriter output)
        {
            if (output == null)
                throw new ArgumentNullException("output");

            _output = output;
            GC.SuppressFinalize(this);
        }
Ejemplo n.º 5
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("supportedConnectionTypes");
     output.WriteArrayBegin();
     foreach (string type in BayeuxConnectionTypesHelper.ToCollection(SupportedConnectionTypes))
         output.WriteValue(type);
     output.WriteArrayEnd();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Serializes an object as a JSON formatted string.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     {
         output.WriteMember("user", UserName);
         output.WriteMember("credentials", Password);
     }
     output.WriteObjectEnd();
 }
Ejemplo n.º 7
0
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     output.WriteMember("ID", ID);
     output.WriteMember("Name", Name);
     output.WriteMember("Age", Age);
     output.WriteMember("Salary", Salary);
     output.WriteObjectEnd();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Writes JSON representation of this object.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     {
         output.WriteMember("reconnect", ToString(Reconnect));
         output.WriteMember("interval", Interval);
     }
     output.WriteObjectEnd();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Serializes an object as a JSON formatted string.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     {
         output.WriteMember("user", UserName);
         output.WriteMember("credentials", Password);
     }
     output.WriteObjectEnd();
 }
Ejemplo n.º 10
0
        public ObjectWriter(IJSonWriter output)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            _output = output;
            GC.SuppressFinalize(this);
        }
Ejemplo n.º 11
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("supportedConnectionTypes");
     output.WriteArrayBegin();
     foreach (string type in BayeuxConnectionTypesHelper.ToCollection(SupportedConnectionTypes))
     {
         output.WriteValue(type);
     }
     output.WriteArrayEnd();
 }
 /// <summary>
 /// Serializes an object as a JSON formatted string.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     {
         if (Credentials != null)
         {
             output.WriteMember("authentication");
             Credentials.Write(output);
         }
     }
     output.WriteObjectEnd();
 }
 /// <summary>
 /// Serializes an object as a JSON formatted string.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     {
         if (Credentials != null)
         {
             output.WriteMember("authentication");
             Credentials.Write(output);
         }
     }
     output.WriteObjectEnd();
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Writes content of this object to a JSON stream.
        /// </summary>
        public void Write(IJSonWriter output)
        {
            if (output == null)
            {
                return;
            }

            // create basic JSON representation of Bayeux message:
            // {
            //  channel: "xxx",
            //  clientId: "xxx",
            //  id: "xxx",
            //  ... - optional data inserted by child classes
            // }

            output.WriteObjectBegin();
            {
                output.WriteMember("channel", Channel);
                if (ClientID != null)
                {
                    output.WriteMember("clientId", ClientID);
                }
                if (ID != null)
                {
                    output.WriteMember("id", ID);
                }

                // write basic Bayeux request data field:
                if (HasData)
                {
                    output.WriteMember("data");
                    _data.Write(output);
                }

                // write additional (optional) request fields:
                WriteOptionalFields(output);

                // write the data extension:
                if (HasExt)
                {
                    output.WriteMember("ext");
                    _ext.Write(output);
                }
            }
            output.WriteObjectEnd();
        }
Ejemplo n.º 15
0
        protected override void WriteOptionalFields(IJSonWriter output)
        {
            // create basic JSON representation of Bayeux message:
            // {
            //   ... - parent inserted fields
            //  supportedConnectionTypes: "xxx",
            //  version: "1.0",
            //  minimumVersion: "1.0",
            //  ext: "xxx"
            // }

            if (Version != null)
                output.WriteMember("version", Version.ToString());
            if (MinimumVersion != null)
                output.WriteMember("minimumVersion", MinimumVersion.ToString());

            output.WriteMember("supportedConnectionTypes");
            output.WriteArrayBegin();
            foreach (string type in BayeuxConnectionTypesHelper.ToCollection(SupportedConnectionTypes))
                output.WriteValue(type);
            output.WriteArrayEnd();
        }
Ejemplo n.º 16
0
 void IJSonWritable.Write(IJSonWriter output)
 {
     // writes current decimal value as boolean:
     output.WriteValue(_data);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Write as JSON.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     // write as an object (as _data implements IDictionary interface):
     output.Write(_data);
 }
 void IJSonWritable.Write(IJSonWriter output)
 {
     output.WriteValue(_data);
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Writes content of this object to a JSON stream.
        /// </summary>
        public void Write(IJSonWriter output)
        {
            if (output == null)
                return;

            // create basic JSON representation of Bayeux message:
            // {
            //  channel: "xxx",
            //  clientId: "xxx",
            //  id: "xxx",
            //  ... - optional data inserted by child classes
            // }

            output.WriteObjectBegin();
            {
                output.WriteMember("channel", Channel);
                if (ClientID != null)
                    output.WriteMember("clientId", ClientID);
                if (ID != null)
                    output.WriteMember("id", ID);

                // write basic Bayeux request data field:
                if (HasData)
                {
                    output.WriteMember("data");
                    _data.Write(output);
                }

                // write additional (optional) request fields:
                WriteOptionalFields(output);

                // write the data extension:
                if (HasExt)
                {
                    output.WriteMember("ext");
                    _ext.Write(output);
                }
            }
            output.WriteObjectEnd();
        }
Ejemplo n.º 20
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("connectionType", BayeuxConnectionTypesHelper.ToString(ConnectionType));
 }
Ejemplo n.º 21
0
 void IJSonWritable.Write(IJSonWriter output)
 {
     // writes current decimal value as boolean:
     output.WriteValue(_data);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Writes additional data associated with this request, that is option for most of them.
 /// </summary>
 protected virtual void WriteOptionalFields(IJSonWriter output)
 {
 }
Ejemplo n.º 23
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("subscription", SubscriptionChannel);
 }
Ejemplo n.º 24
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("data");
     output.Write(EventData);
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Writes JSON representation of this object.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     output.WriteObjectBegin();
     {
         output.WriteMember("reconnect", ToString(Reconnect));
         output.WriteMember("interval", Interval);
     }
     output.WriteObjectEnd();
 }
Ejemplo n.º 26
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("connectionType", BayeuxConnectionTypesHelper.ToString(ConnectionType));
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Write as JSON.
 /// </summary>
 public void Write(IJSonWriter output)
 {
     // write as an object (as _data implements IDictionary interface):
     output.Write(_data);
 }
Ejemplo n.º 28
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("data");
     output.Write(EventData);
 }
Ejemplo n.º 29
0
 public void Write(IJSonWriter output)
 {
     var reader = new JSonReader();
     var tree = reader.Read(obj.ToString());
     output.Write(tree);
 }
Ejemplo n.º 30
0
 void IJSonWritable.Write(IJSonWriter output)
 {
     output.WriteValue(_data);
 }
Ejemplo n.º 31
0
        /// <summary>
        /// Writes content of this object to a JSON stream.
        /// </summary>
        public void Write(IJSonWriter output)
        {
            if (output == null)
                return;

            output.WriteObjectBegin();
            {
                output.WriteMember("channel", Channel);
                if (ID != null)
                    output.WriteMember("id", ID);
                output.WriteMember("clientId", ClientID);
                output.WriteMember("successful", Successful ? 1 : 0);
                if (Data != null)
                {
                    output.WriteMember("data");
                    output.Write(Data);
                }
                if (Ext != null)
                {
                    output.WriteMember("ext");
                    output.Write(Ext);
                }

                // writes additional members defined by child classes:
                WriteOptionalFields(output);
            }
            output.WriteObjectEnd();
        }
Ejemplo n.º 32
0
 protected override void WriteOptionalFields(IJSonWriter output)
 {
     output.WriteMember("subscription", SubscriptionChannel);
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Writes additional fields related to this response.
 /// </summary>
 protected virtual void WriteOptionalFields(IJSonWriter output)
 {
 }