public override void Add(InventoryFolder folder) { var reqmap = new Map { { "folder_id", folder.ID }, { "parent_id", folder.ParentFolderID }, { "type", (int)folder.DefaultType }, { "name", folder.Name } }; using (Stream s = new HttpClient.Post(m_CreateInventoryCategoryCap, "application/llsd+xml", (Stream reqstream) => { LlsdXml.Serialize(reqmap, reqstream); }) { TimeoutMs = TimeoutMs }.ExecuteStreamRequest()) { Map resmap = (Map)LlsdXml.Deserialize(s); if (resmap["folder_id"] != reqmap["folder_id"] || resmap["parent_id"] != reqmap["folder_id"] || resmap["type"] != reqmap["type"]) { throw new InvalidOperationException(); } } }
public bool Run() { m_HttpServer.UriHandlers.Add("/test", HttpHandler); int NumberConnections = 1000; int numConns = m_HttpServer.AcceptedConnectionsCount; m_Log.InfoFormat("Testing 1000 HTTP POST requests (no connection reuse)"); for (int connidx = 0; connidx++ < NumberConnections;) { string res; var headers = new Dictionary <string, string>(); try { res = new HttpClient.Post(m_HttpServer.ServerURI + "test", "text/plain", (instream) => { byte[] connbytes = Encoding.ASCII.GetBytes(connidx.ToString()); instream.Write(connbytes, 0, connbytes.Length); }) { TimeoutMs = 60000, ConnectionMode = HttpClient.ConnectionModeEnum.SingleRequest, Headers = headers, Expect100Continue = true }.ExecuteRequest(); } catch (Exception e) { m_Log.ErrorFormat("Failed at connection {0}: {1}: {2}: {3}", connidx, e.GetType().FullName, e.Message, e.StackTrace); return(false); } int resval; if (!int.TryParse(res, out resval) || connidx != resval) { m_Log.InfoFormat("Wrong text response at connection {0}: {1}", connidx, res); return(false); } string connval = GetConnectionValue(headers).Trim().ToLower(); if (connval != "close") { m_Log.ErrorFormat("Connection: field has wrong response: \"{0}\"", connval); return(false); } string chunkval = GetTransferEncodingValue(headers).Trim().ToLower(); if (chunkval != string.Empty) { m_Log.ErrorFormat("Transfer-Encoding: field has wrong response: \"{0}\"", chunkval); return(false); } } numConns = m_HttpServer.AcceptedConnectionsCount - numConns; if (numConns != NumberConnections) { m_Log.InfoFormat("HTTP client did not have the specified number of reconnections"); return(false); } return(true); }
public static XmlRpc.XmlRpcResponse DoXmlRpcRequest(string url, XmlRpc.XmlRpcRequest req, int timeoutms, X509CertificateCollection clientCertificates = null) { byte[] rpcdata = req.Serialize(); using (Stream res = new HttpClient.Post(url, "text/xml", rpcdata.Length, (Stream s) => s.Write(rpcdata, 0, rpcdata.Length)) { TimeoutMs = timeoutms, ClientCertificates = clientCertificates }.ExecuteStreamRequest()) { return(XmlRpc.DeserializeResponse(res)); } }
public HashtableApi.Hashtable CapsUpdateTaskInventory(ScriptInstance instance, string uri, LSLKey objectid, LSLKey itemid, string contentType, ByteArrayApi.ByteArray assetData) { HashtableApi.Hashtable res = new HashtableApi.Hashtable(); lock (instance) { Map result; using (Stream s = new HttpClient.Post(uri, new HttpClient.LlsdXmlRequest(new Map { { "task_id", objectid.AsUUID }, { "item_id", itemid.AsUUID }, })) { TimeoutMs = 20000 }.ExecuteStreamRequest()) { result = (Map)LlsdXml.Deserialize(s); } res["result"] = result["state"].ToString(); if (result["state"].ToString() == "upload") { string uploader_uri = res["uploader"].ToString(); using (Stream s = new HttpClient.Post( uploader_uri, contentType, assetData.Length, (Stream sd) => sd.Write(assetData.Data, 0, assetData.Length)) { TimeoutMs = 20000 }.ExecuteStreamRequest()) { result = (Map)LlsdXml.Deserialize(s); } res["result"] = result["state"].ToString(); if (result["state"].ToString() == "complete") { res["assetid"] = new LSLKey(result["new_asset"].AsUUID); } if (result.ContainsKey("compiled")) { res["compiled"] = ((bool)result["compiled"].AsBoolean).ToLSLBoolean(); } if (result.ContainsKey("errors")) { res.Add("errors", (AnArray)result["errors"]); } } } return(res); }
void IInventoryFolderServiceInterface.Add(InventoryFolder folder) { var m = new Map(); var categories = new AnArray(); m.Add("categories", categories); var category = new Map(); categories.Add(category); category.Add("name", folder.Name); category.Add("type_default", (int)folder.DefaultType); byte[] reqdata; using (var ms = new MemoryStream()) { LlsdXml.Serialize(m, ms); reqdata = ms.ToArray(); } IValue res; HttpStatusCode statuscode; using (Stream sres = new HttpClient.Post( $"{m_CapabilityUri}category/{folder.ParentFolderID}", "application/llsd+xml", reqdata.Length, (Stream s) => s.Write(reqdata, 0, reqdata.Length)) { TimeoutMs = TimeoutMs }.ExecuteStreamRequest(out statuscode)) { if (statuscode != HttpStatusCode.Created) { throw new InventoryFolderNotFoundException(folder.ParentFolderID); } res = LlsdXml.Deserialize(sres); } var resmap = res as Map; if (resmap == null) { throw new InvalidDataException(); } var created_items = resmap["_created_categories"] as AnArray; if (created_items == null) { throw new InvalidDataException(); } folder.ID = created_items[0].AsUUID; }
public static IValue DoJson20RpcRequest(string url, string method, string jsonId, IValue param, int timeoutms, X509CertificateCollection clientCertificates = null) { string jsonReq = Json20Rpc.SerializeRequest(method, jsonId, param); using (Stream res = new HttpClient.Post(url, "application/json-rpc", jsonReq) { TimeoutMs = timeoutms, ClientCertificates = clientCertificates }.ExecuteStreamRequest()) { return(Json20Rpc.DeserializeResponse(res)); } }
public bool Run() { m_HttpServer.UriHandlers.Add("/test", HttpHandler); int NumberConnections = 1000; int numConns = m_HttpServer.AcceptedConnectionsCount; m_Log.InfoFormat("Testing 1000 HTTP/2 POST requests (keep-alive, 100-continue)"); for (int connidx = 0; connidx++ < NumberConnections;) { string res; var headers = new Dictionary <string, string>(); try { res = new HttpClient.Post(m_HttpServer.ServerURI + "test", "text/plain", connidx.ToString()) { IsCompressed = true, TimeoutMs = 60000, ConnectionMode = HttpClient.ConnectionModeEnum.UpgradeHttp2, Headers = headers, Expect100Continue = true }.ExecuteRequest(); } catch (Exception e) { m_Log.ErrorFormat("Failed at connection {0}: {1}: {2}: {3}", connidx, e.GetType().FullName, e.Message, e.StackTrace); return(false); } int resval; if (!int.TryParse(res, out resval) || connidx != resval) { m_Log.InfoFormat("Wrong text response at connection {0}: {1}", connidx, res); return(false); } string chunkval = GetTransferEncodingValue(headers).Trim().ToLower(); if (chunkval != string.Empty) { m_Log.ErrorFormat("Transfer-Encoding: field has wrong response: \"{0}\"", chunkval); return(false); } } numConns = m_HttpServer.AcceptedConnectionsCount - numConns; if (numConns > 1) { m_Log.InfoFormat("HTTP client did not re-use connections (actual {0})", numConns); return(false); } return(true); }
public bool Run() { m_HttpServer.UriHandlers.Add("/test", HttpHandler); m_Log.InfoFormat("Testing HTTP POST error responses"); for (m_SendStatusCode = HttpStatusCode.MultipleChoices; m_SendStatusCode < HttpStatusCode.HttpVersionNotSupported; ++m_SendStatusCode) { var headers = new Dictionary <string, string>(); try { HttpStatusCode statuscode = new HttpClient.Post(m_HttpServer.ServerURI + "test", "text/plain", string.Empty) { TimeoutMs = 60000, ConnectionMode = HttpClient.ConnectionModeEnum.UpgradeHttp2, Headers = headers, Expect100Continue = true, DisableExceptions = HttpClient.Request.DisableExceptionFlags.DisableConflict }.ExecuteStatusRequest(); if (statuscode != m_SendStatusCode) { m_Log.ErrorFormat("Got wrong status at connection {0}: {1}", m_SendStatusCode, statuscode); return(false); } } catch (System.Web.HttpException e) { if (e.GetHttpCode() == (int)HttpStatusCode.NotFound || e.GetHttpCode() == (int)HttpStatusCode.Conflict) { m_Log.ErrorFormat("Got exception at connection {0}: {1}: {2}: {3}", m_SendStatusCode, e.GetType().FullName, e.Message, e.StackTrace); return(false); } else if (e.GetHttpCode() != (int)m_SendStatusCode) { m_Log.ErrorFormat("Got wrong status at connection {0}: {1}: {2}: {3}", m_SendStatusCode, e.GetType().FullName, e.Message, e.StackTrace); return(false); } } catch (Exception e) { m_Log.ErrorFormat("Failed at connection {0}: {1}: {2}: {3}", m_SendStatusCode, e.GetType().FullName, e.Message, e.StackTrace); return(false); } } return(true); }
private void EnableSimCircuit(RegionInfo destinationInfo, out UUID sessionID, out uint circuitCode) { var reqmap = new Map { ["to_region_id"] = destinationInfo.ID, ["from_region_id"] = ID }; byte[] reqdata; using (var ms = new MemoryStream()) { LlsdXml.Serialize(reqmap, ms); reqdata = ms.ToArray(); } /* try DNS lookup before triggering add circuit code */ IPAddress[] addresses = Dns.GetHostAddresses(destinationInfo.ServerIP); var ep = new IPEndPoint(addresses[0], (int)destinationInfo.ServerPort); Map resmap; using (var responseStream = new HttpClient.Post( destinationInfo.ServerURI + "circuit", "application/llsd+xml", reqdata.Length, (Stream s) => s.Write(reqdata, 0, reqdata.Length)).ExecuteStreamRequest()) { resmap = (Map)LlsdXml.Deserialize(responseStream); } circuitCode = resmap["circuit_code"].AsUInt; sessionID = resmap["session_id"].AsUUID; Neighbors[destinationInfo.ID].RemoteCircuit = UDPServer.UseSimCircuit( ep, sessionID, this, destinationInfo.ID, circuitCode, destinationInfo.Location, destinationInfo.Location - GridPosition); CheckAgentsForNeighbors(); }
public HashtableApi.Hashtable SeedRequest( ScriptInstance instance, string seedCaps, AnArray elements) { lock (instance) { byte[] post; using (var ms = new MemoryStream()) { LlsdXml.Serialize(elements, ms); post = ms.ToArray(); } Map resdata; try { using (Stream res = new HttpClient.Post(seedCaps, "application/llsd+xml", post.Length, (Stream req) => req.Write(post, 0, post.Length)).ExecuteStreamRequest()) { resdata = LlsdXml.Deserialize(res) as Map; } } catch { return(new HashtableApi.Hashtable()); } if (null == resdata) { return(new HashtableApi.Hashtable()); } var result = new HashtableApi.Hashtable(); foreach (KeyValuePair <string, IValue> kvp in resdata) { result.Add(kvp.Key, kvp.Value); } return(result); } }
private Dictionary <UUID, KeyValuePair <InventoryFolder, InventoryFolderContent> > GetFolderContents(UUID[] folderids, bool fetch_children) { var folderidsreq = new AnArray(); var reqmap = new Map { ["folder_ids"] = folderidsreq }; foreach (UUID folderid in folderids) { folderidsreq.Add(new Map { { "folder_id", folderid }, { "fetch_folders", fetch_children }, { "fetch_items", fetch_children } }); } byte[] reqdata; using (var ms = new MemoryStream()) { LlsdXml.Serialize(reqmap, ms); reqdata = ms.ToArray(); } Map resdata; using (Stream s = new HttpClient.Post(m_CapabilityUri, "application/llsd+xml", reqdata.Length, (Stream o) => o.Write(reqdata, 0, reqdata.Length)) { TimeoutMs = TimeoutMs }.ExecuteStreamRequest()) { resdata = LlsdXml.Deserialize(s) as Map; } if (resdata == null) { throw new InvalidDataException(); } AnArray foldersres; var resultset = new Dictionary <UUID, KeyValuePair <InventoryFolder, InventoryFolderContent> >(); if (!resdata.TryGetValue("folders", out foldersres)) { return(resultset); } foreach (IValue folderiv in foldersres) { var folderdata = folderiv as Map; if (folderdata == null) { continue; } var folder = new InventoryFolder(folderdata["folder_id"].AsUUID) { Owner = new UGUI(folderdata["owner_id"].AsUUID), Version = folderdata["version"].AsInt, ParentFolderID = folderdata["parent_id"].AsUUID, }; var content = new InventoryFolderContent { Version = folderdata["version"].AsInt, FolderID = folderdata["folder_id"].AsUUID, Owner = new UGUI(folderdata["owner_id"].AsUUID) }; AnArray categories; if (folderdata.TryGetValue("categories", out categories)) { foreach (IValue categoryiv in categories) { var category = categoryiv as Map; if (category == null) { continue; } content.Folders.Add(new InventoryFolder(category["folder_id"].AsUUID) { Name = category["name"].ToString(), ParentFolderID = category["parent_id"].AsUUID, DefaultType = (AssetType)category["type"].AsInt, Version = category["version"].AsInt }); } } AnArray childitems; if (folderdata.TryGetValue("items", out childitems)) { foreach (IValue childiv in childitems) { var childdata = childiv as Map; if (childdata == null) { continue; } if (childdata["parent_id"].AsUUID != folder.ID) { continue; } var permissions = (Map)childdata["permissions"]; var sale_info = (Map)childdata["sale_info"]; var item = new InventoryItem(childdata["item_id"].AsUUID) { AssetID = childdata["asset_id"].AsUUID, CreationDate = Date.UnixTimeToDateTime(childdata["created_at"].AsULong), Description = childdata["desc"].ToString(), Flags = (InventoryFlags)childdata["flags"].AsInt, InventoryType = (InventoryType)childdata["inv_type"].AsInt, Name = childdata["name"].ToString(), ParentFolderID = childdata["parent_id"].AsUUID, AssetType = (AssetType)childdata["type"].AsInt, Creator = new UGUI(permissions["creator_id"].AsUUID), Group = new UGI(permissions["group_id"].AsUUID), IsGroupOwned = permissions["is_owner_group"].AsBoolean, LastOwner = new UGUI(permissions["last_owner_id"].AsUUID), Owner = new UGUI(permissions["owner_id"].AsUUID), SaleInfo = new InventoryItem.SaleInfoData { Price = sale_info["sale_price"].AsInt, Type = (InventoryItem.SaleInfoData.SaleType)sale_info["sale_type"].AsInt } }; item.Permissions.Base = (InventoryPermissionsMask)permissions["base_mask"].AsInt; item.Permissions.EveryOne = (InventoryPermissionsMask)permissions["everyone_mask"].AsInt; item.Permissions.Group = (InventoryPermissionsMask)permissions["group_mask"].AsInt; item.Permissions.NextOwner = (InventoryPermissionsMask)permissions["next_owner_mask"].AsInt; item.Permissions.Current = (InventoryPermissionsMask)permissions["owner_mask"].AsInt; content.Items.Add(item); } } resultset.Add(folder.ID, new KeyValuePair <InventoryFolder, InventoryFolderContent>(folder, content)); } return(resultset); }
List <InventoryItem> this[List <UUID> itemids] { get { var items = new AnArray(); var reqmap = new Map { ["items"] = items }; foreach (UUID itemid in itemids) { items.Add(itemid); } byte[] reqdata; using (var ms = new MemoryStream()) { LlsdXml.Serialize(reqmap, ms); reqdata = ms.ToArray(); } Map resdata; using (Stream s = new HttpClient.Post(m_CapabilityUri, "application/llsd+xml", reqdata.Length, (Stream o) => o.Write(reqdata, 0, reqdata.Length)) { TimeoutMs = TimeoutMs }.ExecuteStreamRequest()) { resdata = LlsdXml.Deserialize(s) as Map; } if (resdata == null) { throw new InvalidDataException(); } AnArray itemres; if (!resdata.TryGetValue("items", out itemres)) { throw new InvalidDataException(); } var result = new List <InventoryItem>(); foreach (IValue item in itemres) { var itemdata = item as Map; if (itemdata == null) { continue; } var permissions = (Map)itemdata["permissions"]; var sale_info = (Map)itemdata["sale_info"]; var resitem = new InventoryItem(itemdata["item_id"].AsUUID) { AssetID = itemdata["asset_id"].AsUUID, CreationDate = Date.UnixTimeToDateTime(itemdata["created_at"].AsULong), Description = itemdata["desc"].ToString(), Flags = (InventoryFlags)itemdata["flags"].AsInt, InventoryType = (InventoryType)itemdata["inv_type"].AsInt, Name = itemdata["name"].ToString(), ParentFolderID = itemdata["parent_id"].AsUUID, AssetType = (AssetType)itemdata["type"].AsInt, Creator = new UGUI(permissions["creator_id"].AsUUID), Group = new UGI(permissions["group_id"].AsUUID), IsGroupOwned = permissions["is_owner_group"].AsBoolean, LastOwner = new UGUI(permissions["last_owner_id"].AsUUID), Owner = new UGUI(permissions["owner_id"].AsUUID), SaleInfo = new InventoryItem.SaleInfoData { Price = sale_info["sale_price"].AsInt, Type = (InventoryItem.SaleInfoData.SaleType)sale_info["sale_type"].AsInt } }; resitem.Permissions.Base = (InventoryPermissionsMask)permissions["base_mask"].AsInt; resitem.Permissions.EveryOne = (InventoryPermissionsMask)permissions["everyone_mask"].AsInt; resitem.Permissions.Group = (InventoryPermissionsMask)permissions["group_mask"].AsInt; resitem.Permissions.NextOwner = (InventoryPermissionsMask)permissions["next_owner_mask"].AsInt; resitem.Permissions.Current = (InventoryPermissionsMask)permissions["owner_mask"].AsInt; } return(result); } }
void IInventoryItemServiceInterface.Add(InventoryItem item) { var m = new Map(); var items = new AnArray(); m.Add("items", items); var itemdata = new Map(); items.Add(itemdata); itemdata.Add("asset_id", item.AssetID); itemdata.Add("inv_type", (int)item.InventoryType); itemdata.Add("name", item.Name); var saleinfo = new Map(); itemdata.Add("sale_info", saleinfo); saleinfo.Add("sale_price", item.SaleInfo.Price); saleinfo.Add("sale_type", (int)item.SaleInfo.Type); itemdata.Add("flags", (int)item.Flags); itemdata.Add("desc", item.Description); itemdata.Add("type", (int)item.AssetType); var perminfo = new Map(); itemdata.Add("permissions", perminfo); perminfo.Add("owner_id", item.Owner.ID); perminfo.Add("last_owner_id", item.LastOwner.ID); perminfo.Add("creator_id", item.Creator.ID); itemdata.Add("agent_id", item.Owner.ID); perminfo.Add("group_id", item.Group.ID); perminfo.Add("owner_mask", (int)item.Permissions.Current); perminfo.Add("base_mask", (int)item.Permissions.Base); perminfo.Add("next_owner_mask", (int)item.Permissions.NextOwner); perminfo.Add("group_mask", (int)item.Permissions.Group); perminfo.Add("everyone_mask", (int)item.Permissions.EveryOne); byte[] reqdata; using (var ms = new MemoryStream()) { LlsdXml.Serialize(m, ms); reqdata = ms.ToArray(); } IValue res; try { using (Stream sres = new HttpClient.Post( $"{m_CapabilityUri}category/{item.ParentFolderID}", "application/llsd+xml", reqdata.Length, (Stream s) => s.Write(reqdata, 0, reqdata.Length)) { TimeoutMs = TimeoutMs }.ExecuteStreamRequest()) { res = LlsdXml.Deserialize(sres); } } catch (HttpException e) { if (e.GetHttpCode() == 404) { throw new InvalidParentFolderIdException(); } throw; } var resmap = res as Map; if (resmap == null) { throw new InvalidDataException(); } var created_items = resmap["_created_items"] as AnArray; if (created_items == null) { throw new InvalidDataException(); } item.SetNewID(created_items[0].AsUUID); }
public bool Run() { m_HttpServer.UriHandlers.Add("/test", HttpHandler); int NumberConnections = 1000; int numConns = m_HttpServer.AcceptedConnectionsCount; m_Log.InfoFormat("Testing 1000 HTTP POST requests (keep-alive)"); for (int connidx = 0; connidx++ < NumberConnections;) { string res; var headers = new Dictionary <string, string>(); try { res = new HttpClient.Post(m_HttpServer.ServerURI + "test", "text/plain", (instream) => { using (var gzip = new GZipStream(instream, CompressionMode.Compress)) { byte[] connbytes = Encoding.ASCII.GetBytes(connidx.ToString()); gzip.Write(connbytes, 0, connbytes.Length); } }) { IsCompressed = true, TimeoutMs = 60000, ConnectionMode = connidx == NumberConnections ? HttpClient.ConnectionModeEnum.Close : HttpClient.ConnectionModeEnum.Keepalive, Headers = headers }.ExecuteRequest(); } catch (Exception e) { m_Log.ErrorFormat("Failed at connection {0}: {1}: {2}: {3}", connidx, e.GetType().FullName, e.Message, e.StackTrace); return(false); } int resval; if (!int.TryParse(res, out resval) || connidx != resval) { m_Log.InfoFormat("Wrong text response at connection {0}: {1}", connidx, res); return(false); } string connval = GetConnectionValue(headers).Trim().ToLower(); if (connidx == NumberConnections) { if (connval != "close") { m_Log.ErrorFormat("Connection: field has wrong response on last request: \"{0}\"", connval); return(false); } } else { if (connval != "keep-alive") { m_Log.ErrorFormat("Connection: field has wrong response: \"{0}\"", connval); return(false); } } string chunkval = GetTransferEncodingValue(headers).Trim().ToLower(); if (chunkval != string.Empty) { m_Log.ErrorFormat("Transfer-Encoding: field has wrong response: \"{0}\"", chunkval); return(false); } } numConns = m_HttpServer.AcceptedConnectionsCount - numConns; if (numConns != 1) { m_Log.InfoFormat("HTTP client did not re-use connections (actual {0})", numConns); return(false); } return(true); }
public void HandleRequest(object unused) { try { var reqmap = new Map { { "ack", new Undef() }, { "done", false } }; HttpStatusCode statusCode; using (Stream s = new HttpClient.Post(m_Url, "application/llsd+xml", (Stream o) => LlsdXml.Serialize(reqmap, o)) { TimeoutMs = m_TimeoutMs, DisableExceptions = HttpClient.Request.DisableExceptionFlags.Disable5XX }.ExecuteStreamRequest(out statusCode)) { if (statusCode == HttpStatusCode.OK) { var resmap = (Map)LlsdXml.Deserialize(s); foreach (Map evmap in ((AnArray)resmap["events"]).OfType <Map>()) { IValue body; string msgtype; Func <IValue, Message> del; if (evmap.TryGetValue("message", out msgtype) && evmap.TryGetValue("body", out body) && m_EQGDecoder.EQGDecoders.TryGetValue(msgtype, out del)) { Message m; try { m = del(body); } catch { continue; } Action <Message> handle; if (msgtype == "ObjectPhysicsProperties") { var msg = (ObjectPhysicsProperties)m; var ev = new ObjectPhysicsPropertiesReceivedEvent { Agent = m_ViewerAgent }; foreach (ObjectPhysicsProperties.ObjectDataEntry d in msg.ObjectData) { ev.ObjectData.Add(new ObjectPhysicsPropertiesData { LocalID = (int)d.LocalID, PhysicsShapeType = (int)d.PhysicsShapeType, Density = d.Density, Friction = d.Friction, Restitution = d.Restitution, GravityMultiplier = d.GravityMultiplier }); } } else if (msgtype == "EstablishAgentCommunication") { var msg = (EstablishAgentCommunication)m; m_ViewerConnection.PostEvent(new EstablishAgentCommunicationReceivedEvent { Agent = m_ViewerAgent, SimIpAndPort = msg.SimIpAndPort.ToString(), SeedCapability = msg.SeedCapability, GridPositionX = (int)msg.GridPosition.X, GridPositionY = (int)msg.GridPosition.Y, RegionSizeX = (int)msg.RegionSize.X, RegionSizeY = (int)msg.RegionSize.Y }); } else if (msgtype == "ParcelVoiceInfo") { var msg = (ParcelVoiceInfo)m; m_ViewerConnection.PostEvent(new ParcelVoiceInfoReceivedEvent { Agent = m_ViewerAgent, ParcelLocalId = msg.ParcelLocalId, ChannelUri = msg.ChannelUri, ChannelCredentials = msg.ChannelCredentials }); } else if (msgtype == "SimConsoleResponse") { var msg = (SimConsoleResponse)m; m_ViewerConnection.PostEvent(new SimConsoleResponseReceivedEvent { Agent = m_ViewerAgent, Response = msg.Message }); } else if (m_MessageRouting.TryGetValue(m.Number, out handle)) { handle(m); } } } } m_ViewerConnection.PostEvent(new EventQueueGetFinishedEvent( m_ViewerAgent, m_ReqID, (int)statusCode)); } } catch { m_ViewerConnection.PostEvent(new EventQueueGetFinishedEvent( m_ViewerAgent, m_ReqID, 499)); } }