Beispiel #1
0
        public void BeginGetResponse(OSD data, OSDFormat format, int millisecondsTimeout)
        {
            byte[] postData;
            string contentType;

            switch (format)
            {
            case OSDFormat.Xml:
                postData    = OSDParser.SerializeLLSDXmlBytes(data);
                contentType = "application/llsd+xml";
                break;

            case OSDFormat.Binary:
                postData    = OSDParser.SerializeLLSDBinary(data);
                contentType = "application/llsd+binary";
                break;

            case OSDFormat.Json:
            default:
                postData    = System.Text.Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(data));
                contentType = "application/llsd+json";
                break;
            }

            BeginGetResponse(postData, contentType, millisecondsTimeout);
        }
Beispiel #2
0
        /// <summary>
        /// Serializes OSD data for http request
        /// </summary>
        /// <param name="data"><seealso cref="OSD"/>formatted data for input</param>
        /// <param name="format">Format to serialize data to</param>
        /// <param name="serializedData">Output serialized data as byte array</param>
        /// <param name="contentType">content-type string of serialized data</param>
        private void serializeData(OSD data, OSDFormat format, out byte[] serializedData, out string contentType)
        {
            switch (format)
            {
            case OSDFormat.Xml:
                serializedData = OSDParser.SerializeLLSDXmlBytes(data);
                contentType    = "application/llsd+xml";
                break;

            case OSDFormat.Binary:
                serializedData = OSDParser.SerializeLLSDBinary(data);
                contentType    = "application/llsd+binary";
                break;

            case OSDFormat.Json:
            default:
                serializedData = System.Text.Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(data));
                contentType    = "application/llsd+json";
                break;
            }
        }
        public void BeginGetResponse(OSD data, OSDFormat format, int millisecondsTimeout)
        {
            byte[] postData;
            string contentType;

            switch (format)
            {
                case OSDFormat.Xml:
                    postData = OSDParser.SerializeLLSDXmlBytes(data);
                    contentType = "application/llsd+xml";
                    break;
                case OSDFormat.Binary:
                    postData = OSDParser.SerializeLLSDBinary(data);
                    contentType = "application/llsd+binary";
                    break;
                case OSDFormat.Json:
                default:
                    postData = System.Text.Encoding.UTF8.GetBytes(OSDParser.SerializeJsonString(data));
                    contentType = "application/llsd+json";
                    break;
            }

            BeginGetResponse(postData, contentType, millisecondsTimeout);
        }
 public OSD GetResponse(OSD data, OSDFormat format, int millisecondsTimeout)
 {
     BeginGetResponse(data, format, millisecondsTimeout);
     _ResponseEvent.WaitOne(millisecondsTimeout, false);
     return _Response;
 }
Beispiel #5
0
 public OSD GetResponse(OSD data, OSDFormat format, int millisecondsTimeout)
 {
     BeginGetResponse(data, format, millisecondsTimeout);
     _ResponseEvent.WaitOne(millisecondsTimeout, false);
     return(_Response);
 }
Beispiel #6
0
 public OSD DeleteRequest(OSD data, OSDFormat format, int msTimeout)
 {
     DeleteRequestAsync(data, format, msTimeout);
     _ResponseEvent.WaitOne(msTimeout, false);
     return(_Response);
 }
Beispiel #7
0
 public void DeleteRequestAsync(OSD data, OSDFormat format, int msTimeout)
 {
     serializeData(data, format, out byte[] serializedData, out string contentType);
     DeleteRequestAsync(serializedData, contentType, msTimeout);
 }