public virtual InventoryCollection GetFolderContent(UUID principalID, UUID folderID) { InventoryCollection inventory = new InventoryCollection(); try { Dictionary<string, object> ret = MakeRequest("GETFOLDERCONTENT", new Dictionary<string, object> { {"PRINCIPAL", principalID.ToString()}, {"FOLDER", folderID.ToString()} }); if (ret == null) return null; if (ret.Count == 0) return null; inventory.Folders = new List<InventoryFolderBase>(); inventory.Items = new List<InventoryItemBase>(); inventory.UserID = principalID; Dictionary<string, object> folders = (Dictionary<string, object>)ret["FOLDERS"]; Dictionary<string, object> items = (Dictionary<string, object>)ret["ITEMS"]; foreach (Object o in folders.Values) // getting the values directly, we don't care about the keys folder_i inventory.Folders.Add(BuildFolder((Dictionary<string, object>)o)); foreach (Object o in items.Values) // getting the values directly, we don't care about the keys item_i inventory.Items.Add(BuildItem((Dictionary<string, object>)o)); } catch (Exception e) { MainConsole.Instance.DebugFormat("[XINVENTORY CONNECTOR STUB]: Exception in GetFolderContent: {0}", e.Message); } return inventory; }
private InventoryCollection FindInventoryCollection(UUID userID, UUID folderID) { InventoryCollection collection = new InventoryCollection(); collection.UserID = userID; collection.Items = new List<InventoryItemBase> (); if (m_items.ContainsKey (folderID)) collection.Items = m_items[folderID]; collection.Folders = new List<InventoryFolderBase> (); if (m_childFolders.ContainsKey (folderID)) collection.Folders = m_childFolders[folderID]; return collection; }
/// <summary> /// Gets the items inside a folder /// </summary> /// <param name = "userID"></param> /// <param name = "folderID"></param> /// <returns></returns> public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) { InventoryCollection inventory = new InventoryCollection {UserID = userID}; NameValueCollection requestArgs = new NameValueCollection { {"RequestMethod", "GetInventoryNode"}, {"ItemID", folderID.ToString()}, {"OwnerID", userID.ToString()}, {"IncludeFolders", "0"}, {"IncludeItems", "1"}, {"ChildrenOnly", "1"} }; OSDMap response = WebUtils.PostToService(m_serverUrl, requestArgs); if (response["Success"].AsBoolean() && response["Items"] is OSDArray) { OSDArray items = (OSDArray) response["Items"]; return GetItemsFromResponse(items); } else { MainConsole.Instance.Warn("[SIMIAN INVENTORY CONNECTOR]: Error fetching folder " + folderID + " for " + userID + ": " + response["Message"].AsString()); return new List<InventoryItemBase>(0); } }
public virtual InventoryCollection GetFolderContent(UUID UserID, UUID folderID) { object remoteValue = DoRemote(UserID, folderID); if (remoteValue != null || m_doRemoteOnly) return (InventoryCollection)remoteValue; // This method doesn't receive a valud principal id from the // connector. So we disregard the principal and look // by ID. // MainConsole.Instance.DebugFormat("[XINVENTORY SERVICE]: Fetch contents for folder {0}", folderID.ToString()); InventoryCollection inventory = new InventoryCollection { UserID = UserID, FolderID = folderID, Folders = m_Database.GetFolders( new[] { "parentFolderID" }, new[] { folderID.ToString() }), Items = m_Database.GetItems(UserID, new[] { "parentFolderID" }, new[] { folderID.ToString() }) }; return inventory; }