本文整理汇总了C#中OSDMap类的典型用法代码示例。如果您正苦于以下问题:C# OSDMap类的具体用法?C# OSDMap怎么用?C# OSDMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OSDMap类属于命名空间,在下文中一共展示了OSDMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Charge
public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge, TransactionType type, string identifer, bool chargeImmediately)
{
IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
if (moneyModule != null)
{
if (chargeImmediately)
{
bool success = moneyModule.Charge(agentID, amount, text, type);
if (!success)
return false;
}
IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
if (scheduler != null)
{
OSDMap itemInfo = new OSDMap();
itemInfo.Add("AgentID", agentID);
itemInfo.Add("Amount", amount);
itemInfo.Add("Text", text);
itemInfo.Add("Type", (int)type);
SchedulerItem item = new SchedulerItem("ScheduledPayment " + identifer,
OSDParser.SerializeJsonString(itemInfo), false,
DateTime.UtcNow, daysUntilNextCharge, RepeatType.days, agentID);
itemInfo.Add("SchedulerID", item.id);
scheduler.Save(item);
}
}
return true;
}
示例2: Charge
public bool Charge(UUID agentID, int amount, string text, int daysUntilNextCharge)
{
IMoneyModule moneyModule = m_registry.RequestModuleInterface<IMoneyModule>();
if (moneyModule != null)
{
bool success = moneyModule.Charge(agentID, amount, text);
if (!success)
return false;
IScheduleService scheduler = m_registry.RequestModuleInterface<IScheduleService>();
if (scheduler != null)
{
OSDMap itemInfo = new OSDMap();
itemInfo.Add("AgentID", agentID);
itemInfo.Add("Amount", amount);
itemInfo.Add("Text", text);
SchedulerItem item = new SchedulerItem("ScheduledPayment",
OSDParser.SerializeJsonString(itemInfo), false,
DateTime.Now.AddDays(daysUntilNextCharge) - DateTime.Now);
itemInfo.Add("SchedulerID", item.id);
scheduler.Save(item);
}
}
return true;
}
示例3: GetAbuseReports
OSDMap GetAbuseReports (OSDMap map)
{
var resp = new OSDMap ();
var areports = m_registry.RequestModuleInterface<IAbuseReports> ();
int start = map ["Start"].AsInteger ();
int count = map ["Count"].AsInteger ();
bool active = map ["Active"].AsBoolean ();
List<AbuseReport> arList = areports.GetAbuseReports (start, count, active);
var AbuseReports = new OSDArray ();
if (arList != null) {
foreach (AbuseReport rpt in arList) {
AbuseReports.Add (rpt.ToOSD ());
}
}
resp ["AbuseReports"] = AbuseReports;
resp ["Start"] = OSD.FromInteger (start);
resp ["Count"] = OSD.FromInteger (count);
resp ["Active"] = OSD.FromBoolean (active);
return resp;
}
示例4: AddNewUrls
public virtual void AddNewUrls(string key, OSDMap urls)
{
m_autoConfig.Remove("ServerURI");
foreach (KeyValuePair<string, OSD> kvp in urls)
{
if (kvp.Value == "" && kvp.Value.Type != OSDType.Array)
continue;
if (!m_autoConfig.ContainsKey(kvp.Key))
{
if (kvp.Value.Type == OSDType.String)
m_autoConfig[kvp.Key] = kvp.Value;
else if (kvp.Value.Type != OSDType.Boolean) // "Success" coming from IWC
m_autoConfig[kvp.Key] = string.Join(",", ((OSDArray)kvp.Value).ConvertAll<string>((osd) => osd).ToArray());
}
else
{
List<string> keys = kvp.Value.Type == OSDType.Array ? ((OSDArray)kvp.Value).ConvertAll<string>((osd) => osd) : new List<string>(new string[1] { kvp.Value.AsString() });
foreach (string url in keys)
{
//Check to see whether the base URLs are the same (removes the UUID at the end)
if (url.Length < 36)
continue; //Not a URL
string u = url.Remove(url.Length - 36, 36);
if (!m_autoConfig[kvp.Key].AsString().Contains(u))
m_autoConfig[kvp.Key] = m_autoConfig[kvp.Key] + "," + kvp.Value;
}
}
}
m_allConfigs[key] = urls;
}
示例5: PostToService
/// <summary>
/// POST URL-encoded form data to a web service that returns LLSD or
/// JSON data
/// </summary>
public static string PostToService (string url, OSDMap data)
{
byte [] buffer = data != null ? Encoding.UTF8.GetBytes (OSDParser.SerializeJsonString (data, true)) : null;
Task<byte []> t = ServiceOSDRequest (url, buffer, "POST", m_defaultTimeout);
t.Wait ();
return t.Result == null ? null : Encoding.UTF8.GetString (t.Result);
}
示例6: SimulatorFeaturesCAP
private Hashtable SimulatorFeaturesCAP(Hashtable mDhttpMethod)
{
OSDMap data = new OSDMap();
data["MeshRezEnabled"] = true;
data["MeshUploadEnabled"] = true;
data["MeshXferEnabled"] = true;
data["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap();
typesMap["convex"] = true;
typesMap["none"] = true;
typesMap["prim"] = true;
data["PhysicsShapeTypes"] = typesMap;
//Data URLS need sent as well
//Not yet...
//data["DataUrls"] = m_service.Registry.RequestModuleInterface<IGridRegistrationService> ().GetUrlForRegisteringClient (m_service.AgentID + "|" + m_service.RegionHandle);
//Send back data
Hashtable responsedata = new Hashtable();
responsedata["int_response_code"] = 200; //501; //410; //404;
responsedata["content_type"] = "text/plain";
responsedata["keepalive"] = false;
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(data);
return responsedata;
}
示例7: AddGeneric
public static bool AddGeneric(UUID ownerID, string type, string key, OSDMap map, string m_ServerURI)
{
string value = OSDParser.SerializeJsonString(map);
NameValueCollection RequestArgs = new NameValueCollection
{
{ "RequestMethod", "AddGeneric" },
{ "OwnerID", ownerID.ToString() },
{ "Type", type },
{ "Key", key },
{ "Value", value}
};
OSDMap Response = CachedPostRequest(RequestArgs, m_ServerURI);
if (Response["Success"].AsBoolean())
{
return true;
}
else
{
//m_log.WarnFormat("[SIMIAN GROUPS CONNECTOR]: Error {0}, {1}, {2}, {3}", ownerID, type, key, Response["Message"]);
return false;
}
}
示例8: FireMessageReceived
public OSDMap FireMessageReceived(string SessionID, OSDMap message)
{
OSDMap result = null;
ulong reg;
if (ulong.TryParse(SessionID, out reg)) //Local region
{
if (OnMessageReceived != null)
{
MessageReceived eventCopy = OnMessageReceived;
foreach (OSDMap r in from MessageReceived messagedelegate in eventCopy.GetInvocationList() select messagedelegate(message) into r where r != null select r)
{
result = r;
}
}
}
else //IWC
{
/*string[] session = SessionID.Split('|');
ISyncMessagePosterService smps = m_registry.RequestModuleInterface<ISyncMessagePosterService>();
//Forward it on
result = smps.Get(message, UUID.Parse(session[0]), ulong.Parse(session[1]));*/
}
return result;
}
示例9: PostInternal
public void PostInternal(bool remote, string url, OSDMap request)
{
if (remote)
DoRemoteCallPost(true, url + "/syncmessage/", false, url + "/syncmessage/", request);
else
m_registry.RequestModuleInterface<ISyncMessageRecievedService>().FireMessageReceived(request);
}
示例10: GetExternalCaps
public OSDMap GetExternalCaps(UUID agentID, GridRegion region)
{
if (m_registry == null) return new OSDMap();
OSDMap resp = new OSDMap();
if (m_registry.RequestModuleInterface<IGridServerInfoService>() != null)
{
m_servers = m_registry.RequestModuleInterface<IGridServerInfoService>().GetGridURIs("SyncMessageServerURI");
OSDMap req = new OSDMap();
req["AgentID"] = agentID;
req["Region"] = region.ToOSD();
req["Method"] = "GetCaps";
List<ManualResetEvent> events = new List<ManualResetEvent>();
foreach (string uri in m_servers)
{
ManualResetEvent even = new ManualResetEvent(false);
m_syncPoster.Get(uri, req, (r) =>
{
if (r == null)
return;
foreach (KeyValuePair<string, OSD> kvp in r)
resp.Add(kvp.Key, kvp.Value);
even.Set();
});
events.Add(even);
}
ManualResetEvent.WaitAll(events.ToArray());
}
foreach (var h in GetHandlers(agentID, region.RegionID))
{
if (m_allowedCapsModules.Contains(h.Name))
h.IncomingCapsRequest(agentID, region, m_registry.RequestModuleInterface<ISimulationBase>(), ref resp);
}
return resp;
}
示例11: SimulatorFeaturesCAP
byte [] SimulatorFeaturesCAP (string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
OSDMap data = new OSDMap ();
// AvatarHoverHeight enabled
data ["AvatarHoverHeightEnabled"] = true;
// MaxMaterialsPerTransaction enabled
data ["MaxMaterialsPerTransaction"] = 50;
data ["MeshRezEnabled"] = true;
data ["MeshUploadEnabled"] = true;
data ["MeshXferEnabled"] = true;
data ["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap ();
typesMap ["convex"] = true;
typesMap ["none"] = true;
typesMap ["prim"] = true;
data ["PhysicsShapeTypes"] = typesMap;
// some additional features
data ["god_names"] = GodNames (httpRequest);
//Send back data
return OSDParser.SerializeLLSDXmlBytes (data);
}
示例12: SimulatorFeaturesCAP
private byte[] SimulatorFeaturesCAP(string path, Stream request,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
OSDMap data = new OSDMap();
data["MeshRezEnabled"] = true;
data["MeshUploadEnabled"] = true;
data["MeshXferEnabled"] = true;
data["PhysicsMaterialsEnabled"] = true;
OSDMap typesMap = new OSDMap();
typesMap["convex"] = true;
typesMap["none"] = true;
typesMap["prim"] = true;
data["PhysicsShapeTypes"] = typesMap;
//Data URLS need sent as well
//Not yet...
//data["DataUrls"] = m_service.Registry.RequestModuleInterface<IGridRegistrationService> ().GetUrlForRegisteringClient (m_service.AgentID + "|" + m_service.RegionHandle);
//Send back data
return OSDParser.SerializeLLSDXmlBytes(data);
}
示例13: Pack
public OSDMap Pack()
{
OSDMap args = new OSDMap();
args["message_type"] = OSD.FromString("AgentPosition");
args["region_handle"] = OSD.FromString(RegionHandle.ToString());
args["circuit_code"] = OSD.FromString(CircuitCode.ToString());
args["agent_uuid"] = OSD.FromUUID(AgentID);
args["session_uuid"] = OSD.FromUUID(SessionID);
args["position"] = OSD.FromString(Position.ToString());
args["velocity"] = OSD.FromString(Velocity.ToString());
args["center"] = OSD.FromString(Center.ToString());
args["size"] = OSD.FromString(Size.ToString());
args["at_axis"] = OSD.FromString(AtAxis.ToString());
args["left_axis"] = OSD.FromString(LeftAxis.ToString());
args["up_axis"] = OSD.FromString(UpAxis.ToString());
args["far"] = OSD.FromReal(Far);
args["changed_grid"] = OSD.FromBoolean(ChangedGrid);
if ((Throttles != null) && (Throttles.Length > 0))
args["throttles"] = OSD.FromBinary(Throttles);
return args;
}
示例14: GetInternal
public OSDMap GetInternal(bool remote, string url, OSDMap request)
{
try
{
LogMessage(remote, url, request);
if (remote)
{
if (url != "")
{
url = (url.EndsWith("/syncmessage/", StringComparison.Ordinal) ? url : (url + "/syncmessage/"));
return DoRemoteCallGet(true, url, false, url, request) as OSDMap;
}
else
return DoRemoteCallGet(true, "SyncMessageServerURI", false, url, request) as OSDMap;
}
return m_registry.RequestModuleInterface<ISyncMessageRecievedService>().FireMessageReceived(request);
}
catch (Exception ex)
{
MainConsole.Instance.WarnFormat("[Sync Message Poster Service]: Caught exception when attempting to post to {0}: {1}",
url, ex.ToString());
}
return null;
}
示例15: GetEmails
public List<Email> GetEmails(UUID objectID)
{
OSDMap map = new OSDMap();
map["ObjectID"] = objectID;
map["Method"] = "getemails";
List<Email> Messages = new List<Email>();
try
{
List<string> urls =
m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
foreach (string url in urls)
{
OSDMap result = WebUtils.PostToService(url + "osd", map, true, false);
OSDArray array = (OSDArray) OSDParser.DeserializeJson(result["_RawResult"]);
foreach (OSD o in array)
{
Email message = new Email();
message.FromOSD((OSDMap) o);
Messages.Add(message);
}
}
return Messages;
}
catch (Exception e)
{
MainConsole.Instance.DebugFormat("[AuroraRemoteEmailConnector]: Exception when contacting server: {0}", e);
}
return Messages;
}