本文整理汇总了C#中OSDArray类的典型用法代码示例。如果您正苦于以下问题:C# OSDArray类的具体用法?C# OSDArray怎么用?C# OSDArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OSDArray类属于命名空间,在下文中一共展示了OSDArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeJson
public static OSD DeserializeJson(JsonData json)
{
switch (json.GetJsonType())
{
case JsonType.Boolean:
return OSD.FromBoolean((bool)json);
case JsonType.Int:
return OSD.FromInteger((int)json);
case JsonType.Long:
return OSD.FromLong((long)json);
case JsonType.Double:
return OSD.FromReal((double)json);
case JsonType.String:
string str = (string)json;
if (String.IsNullOrEmpty(str))
return new OSD();
else
return OSD.FromString(str);
case JsonType.Array:
OSDArray array = new OSDArray(json.Count);
for (int i = 0; i < json.Count; i++)
array.Add(DeserializeJson(json[i]));
return array;
case JsonType.Object:
OSDMap map = new OSDMap(json.Count);
IDictionaryEnumerator e = ((IOrderedDictionary)json).GetEnumerator();
while (e.MoveNext())
map.Add((string)e.Key, DeserializeJson((JsonData)e.Value));
return map;
case JsonType.None:
default:
return new OSD();
}
}
示例2: PackAgentCircuitData
public OSDMap PackAgentCircuitData()
{
OSDMap args = new OSDMap();
args["agent_id"] = OSD.FromUUID(AgentID);
args["base_folder"] = OSD.FromUUID(BaseFolder);
args["caps_path"] = OSD.FromString(CapsPath);
OSDArray childrenSeeds = new OSDArray(ChildrenCapSeeds.Count);
foreach (KeyValuePair<ulong, string> kvp in ChildrenCapSeeds)
{
OSDMap pair = new OSDMap();
pair["handle"] = OSD.FromString(kvp.Key.ToString());
pair["seed"] = OSD.FromString(kvp.Value);
childrenSeeds.Add(pair);
}
if (ChildrenCapSeeds.Count > 0)
args["children_seeds"] = childrenSeeds;
args["child"] = OSD.FromBoolean(child);
args["circuit_code"] = OSD.FromString(circuitcode.ToString());
args["first_name"] = OSD.FromString(firstname);
args["last_name"] = OSD.FromString(lastname);
args["inventory_folder"] = OSD.FromUUID(InventoryFolder);
args["secure_session_id"] = OSD.FromUUID(SecureSessionID);
args["session_id"] = OSD.FromUUID(SessionID);
args["start_pos"] = OSD.FromString(startpos.ToString());
return args;
}
示例3: OnMessageReceived
protected OSDMap OnMessageReceived(OSDMap message)
{
//If it is an async message request, make sure that the request is valid and check it
if (message["Method"] == "AsyncMessageRequest")
{
try
{
OSDMap response = new OSDMap();
OSDArray array = new OSDArray();
if (m_regionMessages.ContainsKey(message["RegionHandle"].AsULong()))
{
foreach (OSDMap asyncMess in m_regionMessages[message["RegionHandle"].AsULong()])
{
array.Add(asyncMess);
}
m_regionMessages.Remove(message["RegionHandle"].AsULong());
}
response["Messages"] = array;
return response;
}
catch
{
}
}
return null;
}
示例4: DeserializeJson
public static OSD DeserializeJson(JsonData json)
{
switch (json.GetJsonType())
{
case JsonType.Boolean:
return OSD.FromBoolean((bool)json);
case JsonType.Int:
return OSD.FromInteger((int)json);
case JsonType.Long:
return OSD.FromLong((long)json);
case JsonType.Double:
return OSD.FromReal((double)json);
case JsonType.String:
string str = (string)json;
if (String.IsNullOrEmpty(str))
return new OSD();
else
return OSD.FromString(str);
case JsonType.Array:
OSDArray array = new OSDArray(json.Count);
for (int i = 0; i < json.Count; i++)
array.Add(DeserializeJson(json[i]));
return array;
case JsonType.Object:
OSDMap map = new OSDMap(json.Count);
foreach (KeyValuePair<string, JsonData> kvp in json)
map.Add(kvp.Key, DeserializeJson(kvp.Value));
return map;
case JsonType.None:
default:
return new OSD();
}
}
示例5: GetParcelsByRegion
OSDMap GetParcelsByRegion (OSDMap map)
{
var resp = new OSDMap ();
resp ["Parcels"] = new OSDArray ();
resp ["Total"] = OSD.FromInteger (0);
var directory = DataPlugins.RequestPlugin<IDirectoryServiceConnector> ();
if (directory != null && map.ContainsKey ("Region") == true) {
UUID regionID = UUID.Parse (map ["Region"]);
UUID scopeID = map.ContainsKey ("ScopeID") ? UUID.Parse (map ["ScopeID"].ToString ()) : UUID.Zero;
UUID owner = map.ContainsKey ("Owner") ? UUID.Parse (map ["Owner"].ToString ()) : UUID.Zero;
uint start = map.ContainsKey ("Start") ? uint.Parse (map ["Start"].ToString ()) : 0;
uint count = map.ContainsKey ("Count") ? uint.Parse (map ["Count"].ToString ()) : 10;
ParcelFlags flags = map.ContainsKey ("Flags") ? (ParcelFlags)int.Parse (map ["Flags"].ToString ()) : ParcelFlags.None;
ParcelCategory category = map.ContainsKey ("Category") ? (ParcelCategory)uint.Parse (map ["Flags"].ToString ()) : ParcelCategory.Any;
uint total = directory.GetNumberOfParcelsByRegion (regionID, owner, flags, category);
if (total > 0) {
resp ["Total"] = OSD.FromInteger ((int)total);
if (count == 0) {
return resp;
}
List<LandData> regionParcels = directory.GetParcelsByRegion (start, count, regionID, owner, flags, category);
OSDArray parcels = new OSDArray (regionParcels.Count);
regionParcels.ForEach (delegate (LandData parcel) {
parcels.Add (LandData2WebOSD (parcel));
});
resp ["Parcels"] = parcels;
}
}
return resp;
}
示例6: 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;
}
示例7: ToOSD
public OSD ToOSD()
{
OSDArray array = new OSDArray(4) {null, null, null, null};
array[0] = new OSDMap {{"regionID", RegionID}};
Cycle.ToOSD(ref array);
Water.ToOSD(ref array);
return array;
}
示例8: ToOSD
public override OSDMap ToOSD()
{
OSDMap map = new OSDMap();
map["Items"] = new OSDArray(Items.ConvertAll<OSD>((item) => item.ToOSD()));
map["Folders"] = new OSDArray(Folders.ConvertAll<OSD>((folder) => folder.ToOSD()));
map["UserID"] = UserID;
return map;
}
示例9: ToOSD
public OSDMap ToOSD()
{
OSDMap map = new OSDMap();
map["AuctionStart"] = AuctionStart;
map["AuctionLength"] = AuctionLength;
map["Description"] = Description;
OSDArray array = new OSDArray();
foreach (AuctionBid bid in AuctionBids)
array.Add(bid.ToOSD());
map["AuctionBids"] = array;
return map;
}
示例10: AddRegion
/// <summary>
/// This adds the entire region into the search database
/// </summary>
/// <param name="args"></param>
public void AddRegion(List<LandData> parcels)
{
OSDMap mess = new OSDMap();
OSDArray requests = new OSDArray();
foreach (LandData data in parcels)
requests.Add(data.ToOSD());
mess["Requests"] = requests;
mess["Method"] = "addregion";
List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("RemoteServerURI");
foreach (string m_ServerURI in m_ServerURIs)
{
WebUtils.PostToService (m_ServerURI + "osd", mess, false, false);
}
}
示例11: ToOSD
public override OSDMap ToOSD()
{
OSDMap result = new OSDMap();
foreach (KeyValuePair<ulong, List<mapItemReply>> kvp in items)
{
OSDArray array = new OSDArray();
foreach (mapItemReply item in kvp.Value)
{
array.Add(item.ToOSD());
}
result[kvp.Key.ToString()] = array;
}
return result;
}
示例12: ProductInfoRequestCAP
byte[] ProductInfoRequestCAP(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
//OSDMap data = m_service.GetCAPS ();
var data = new OSDArray();
var mf = new OSDMap ();
mf ["name"] = "mainland_full";
mf ["description"] = "Mainland / Full Region";
mf ["sku"] = "001";
data.Add(mf);
var mh = new OSDMap ();
mh ["name"] = "mainland_homestead";
mh ["description"] = "Mainland / Homestead";
mh ["sku"] = "011";
data.Add(mh);
var mo = new OSDMap ();
mo ["name"] = "mainland_openspace";
mo ["description"] = "Mainland / Openspace";
mo ["sku"] = "021";
data.Add(mo);
var ef = new OSDMap ();
ef ["name"] = "estate_full";
ef ["description"] = "Estate / Full Region";
ef ["sku"] = "002";
data.Add(ef);
var eh = new OSDMap ();
eh ["name"] = "estate_homestead";
eh ["description"] = "Estate / Homestead";
eh ["sku"] = "012";
data.Add(eh);
var eo = new OSDMap ();
eo ["name"] = "estate_openspace";
eo ["description"] = "Estate / Openspace";
eo ["sku"] = "022";
data.Add(eo);
var wh = new OSDMap ();
wh ["name"] = "universe_homes";
wh ["description"] = "Universe Homes / Full Region";
wh ["sku"] = "101";
data.Add(wh);
return OSDParser.SerializeLLSDXmlBytes (data);
}
示例13: LoadFromOSD
void LoadFromOSD(ConcurrentDictionary<string, FilterItem> items, OSDArray filters)
{
try
{
foreach (var filter in filters)
{
if (filter is OSDMap)
{
var item = FilterItem.FromOSD((OSDMap)filter);
items[item.Name] = item;
}
}
}
catch { }
}
示例14: ToOSD
public OSDArray ToOSD(ref OSDArray array)
{
OSDMap settings = new OSDMap();
OSDArray cycle = new OSDArray();
foreach (KeyValuePair<string, SkyData> kvp in DataSettings)
{
cycle.Add(new OSDArray {kvp.Key, kvp.Value.preset_name});
settings[kvp.Value.preset_name] = kvp.Value.ToOSD();
}
array[1] = cycle;
array[2] = settings;
return array;
}
示例15: EnableSimulator
public static OSDMap EnableSimulator(ulong regionHandle, IPAddress ip, int port)
{
OSDMap llsdSimInfo = new OSDMap(3);
llsdSimInfo.Add("Handle", OSD.FromULong(regionHandle));
llsdSimInfo.Add("IP", OSD.FromBinary(ip.GetAddressBytes()));
llsdSimInfo.Add("Port", OSD.FromInteger(port));
OSDArray arr = new OSDArray(1);
arr.Add(llsdSimInfo);
OSDMap llsdBody = new OSDMap(1);
llsdBody.Add("SimulatorInfo", arr);
return llsdBody;
}