本文整理汇总了C#中IInventoryService.GetRootFolder方法的典型用法代码示例。如果您正苦于以下问题:C# IInventoryService.GetRootFolder方法的具体用法?C# IInventoryService.GetRootFolder怎么用?C# IInventoryService.GetRootFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IInventoryService
的用法示例。
在下文中一共展示了IInventoryService.GetRootFolder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindFolderByPath
/// <summary>
/// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder
/// </summary>
/// This method does not handle paths that contain multiple delimiters
///
/// FIXME: We have no way of distinguishing folders with the same path
///
/// FIXME: Delimiters which occur in names themselves are not currently escapable.
/// <param name="inventoryService">
/// Inventory service to query
/// </param>
/// <param name="userId">
/// User id to search
/// </param>
/// <param name="path">
/// The path to the required folder.
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
/// </param>
/// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
public static List<InventoryFolderBase> FindFolderByPath(IInventoryService inventoryService, UUID userId, string path)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null)
{
// we don't appear to have any inventory setup yet
if (!inventoryService.CreateUserInventory(userId, true))
return new List<InventoryFolderBase>();
// get the new root folder
rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null)
return new List<InventoryFolderBase>(); // unable to create the root folder??
}
return FindFolderByPath(inventoryService, rootFolder, path);
}
示例2: FindFolderByPath
/// <summary>
/// Find a folder given a PATH_DELIMITER delimited path starting from a user's root folder
/// </summary>
///
/// This method does not handle paths that contain multiple delimitors
///
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
/// XPath like expression
///
/// FIXME: Delimitors which occur in names themselves are not currently escapable.
///
/// <param name="inventoryService">
/// Inventory service to query
/// </param>
/// <param name="userId">
/// User id to search
/// </param>
/// <param name="path">
/// The path to the required folder.
/// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
/// </param>
/// <returns>null if the folder is not found</returns>
public static InventoryFolderBase FindFolderByPath(
IInventoryService inventoryService, UUID userId, string path)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (null == rootFolder)
return null;
return FindFolderByPath(inventoryService, rootFolder, path);
}
示例3: FindItemByPath
/// <summary>
/// Find an item given a PATH_DELIMITOR delimited path starting from the user's root folder.
/// This method does not handle paths that contain multiple delimiters
/// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some
/// XPath like expression
/// FIXME: Delimiters which occur in names themselves are not currently escapable.
/// </summary>
/// <param name="inventoryService">
/// Inventory service to query
/// </param>
/// <param name="userId">
/// The user to search
/// </param>
/// <param name="path">
/// The path to the required item.
/// </param>
/// <returns>null if the item is not found</returns>
public static InventoryItemBase FindItemByPath(
IInventoryService inventoryService, UUID userId, string path)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null)
{
// we don't appear to have any inventory setup yet
if (!inventoryService.CreateUserInventory(userId, true))
return null; // something really wrong
rootFolder = inventoryService.GetRootFolder(userId);
if (rootFolder == null) // really wrong!!
return null;
}
return FindItemByPath(inventoryService, rootFolder, path);
}
示例4: CreateInventoryFolder
/// <summary>
/// Create inventory folders starting from the user's root folder.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path">
/// The folders to create. Multiple folders can be specified on a path delimited by the PATH_DELIMITER
/// </param>
/// <param name="useExistingFolders">
/// If true, then folders in the path which already the same name are
/// used. This applies to the terminal folder as well.
/// If false, then all folders in the path are created, even if there is already a folder at a particular
/// level with the same name.
/// </param>
/// <returns>
/// The folder created. If the path contains multiple folders then the last one created is returned.
/// Will return null if the root folder could not be found.
/// </returns>
public static InventoryFolderBase CreateInventoryFolder(
IInventoryService inventoryService, UUID userId, string path, bool useExistingFolders)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (null == rootFolder)
return null;
return CreateInventoryFolder(inventoryService, rootFolder, path, useExistingFolders);
}
示例5: FindItemsByPath
public static List<InventoryItemBase> FindItemsByPath(
IInventoryService inventoryService, UUID userId, string path)
{
InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
if (null == rootFolder)
return new List<InventoryItemBase>();
return FindItemsByPath(inventoryService, rootFolder, path);
}
示例6: DoStoreFolderCheck
private void DoStoreFolderCheck(IClientAPI client)
{
bool hasfolder = false;
List<InventoryFolderBase> m_invbase = new List<InventoryFolderBase> ();
Scene scene = (Scene)client.Scene;
inventoryService = scene.InventoryService;
m_invbase = inventoryService.GetInventorySkeleton (client.AgentId);
InventoryFolderBase rootFolder = inventoryService.GetRootFolder (client.AgentId);
InventoryFolderBase folder = new InventoryFolderBase();
foreach (InventoryFolderBase current in m_invbase) {
if (current.Name.ToString () == "Web Store Items") {
hasfolder = true;
}
}
if (!hasfolder) {
UUID id = UUID.Random ();
folder = new InventoryFolderBase (id, "Web Store Items", client.AgentId, 8, rootFolder.ID, rootFolder.Version);
inventoryService.AddFolder (folder);
}
ScenePresence avatar = null;
if (scene.TryGetScenePresence(client.AgentId, out avatar))
{
scene.SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
}
}