当前位置: 首页>>代码示例>>C#>>正文


C# OpenMetaverse.InventoryFolder类代码示例

本文整理汇总了C#中OpenMetaverse.InventoryFolder的典型用法代码示例。如果您正苦于以下问题:C# InventoryFolder类的具体用法?C# InventoryFolder怎么用?C# InventoryFolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InventoryFolder类属于OpenMetaverse命名空间,在下文中一共展示了InventoryFolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: myfolder_OnContentsRetrieved

        public void myfolder_OnContentsRetrieved(InventoryFolder folder)
        {
            regFolderHook(folder);
            // folder.DownloadContentsOpenSim(TimeSpan.FromSeconds(60));
            // WriteLine("    myfolder_OnContentsRetrieved [" + folder.Name + "] = " + folder.UUID.ToString()+ " with count="+folder.Contents.Count.ToString());
            List<InventoryBase> folderContents = client.Inventory.FolderContents(folder.UUID, client.Self.AgentID,
                                                                                    true, true, InventorySortOrder.ByName, 10000);
            if (folderContents != null)
            {

                foreach (InventoryBase ib in folderContents)
                {
                    if (ib is InventoryItem)
                    {
                        InventoryItem ii = ib as InventoryItem;
                        if (current_operation == "print")
                        {
                            //int indent = 1;
                            //StringBuilder result = new StringBuilder();
                            //result.AppendFormat("{0}{1} ({2})\n", new String(' ', indent * 2), ii.Name, ii.UUID.ToString());
                            //WriteLine(result.ToString());
                            WriteLine("   [Inventory Item] Name: " + ii.Name + " <==> " + ii.UUID.ToString() + " in folder[" + folder.Name + "]");
                        }


                        if (ii.Name == current_itemName)
                        {
                            // we found a matcher so lets do our ops
                            if (current_operation == "wear") client.Appearance.AddToOutfit(new List<InventoryItem> { ii });
                            if (current_operation == "animationStart") client.Self.AnimationStart(ii.UUID, false);
                            if (current_operation == "animationStop") client.Self.AnimationStop(ii.UUID, false);
                            if (current_operation == "attach") client.Appearance.Attach(ii, AttachmentPoint.Default);
                            if (current_operation == "rez")
                            {
                                client.Inventory.RequestRestoreRezFromInventory(client.Network.CurrentSim, ii,
                                                                                   UUID.Random());
                            }
                        }
                    }
                }
                // now run any sub folders
                foreach (InventoryBase ib in folderContents)
                {
                    if (ib is InventoryFolder)
                    {
                        InventoryFolder fld = (InventoryFolder)ib;

                        WriteLine(String.Format(" [Folder] Name: {0} <==> {1} in folder[{2}] RECIEVED", ib.Name, ib.UUID, folder.Name));

                        //evalOnFolders(ib as InventoryFolder, operation, itemName);
                        appendFolderHook(fld);
                        //fld.RequestContents();

                    }
                }
            }

        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:58,代码来源:BotInventoryEval.cs

示例2: regFolderHook

        public void regFolderHook(InventoryFolder folder)
        {
            if (!hooked.ContainsKey(folder.UUID))
            {
                hooked.Add(folder.UUID, folder.Name);
                WriteLine("  regFolderHook " + folder.Name);
            }

        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:9,代码来源:BotInventoryEval.cs

示例3: appendFolderHook

        public void appendFolderHook(InventoryFolder folder)
        {
            if (!hooked.ContainsKey(folder.UUID))
            {
                hooked.Add(folder.UUID, folder.Name);
                //    botclient.Inventory.OnContentsRetrieved += new InventoryFolder.ContentsRetrieved(myfolder_OnContentsRetrieved);
                WriteLine("  appendFolderHook " + folder.Name);
            }

        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:10,代码来源:BotInventoryEval.cs

示例4: PrintFolder

 void PrintFolder(InventoryFolder folder, StringBuilder result, int indent)
 {
     folder.DownloadContents(TimeSpan.FromSeconds(10));
     foreach (InventoryBase b in folder)
     {
         if (b is InventoryFolder)
         {
             result.Append(Print(b as InventoryFolder, indent));
             PrintFolder(b as InventoryFolder, result, indent + 1);
         }
         else if (b is InventoryItem)
         {
             result.Append(Print(b as InventoryItem, indent));
         }
     }
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:16,代码来源:InventoryCommand.cs

示例5: PrintFolder

        private void PrintFolder(InventoryFolder f, StringBuilder result, int indent)
        {
            List<InventoryBase> contents = Manager.FolderContents(f.UUID, Client.Self.AgentID,
                                                                  true, true, InventorySortOrder.ByName, 10000);

            if (contents != null)
            {
                foreach (InventoryBase i in contents)
                {
                    result.AppendFormat("{0}{1} ({2})\n", new String(' ', indent*2), i.Name, i.UUID);
                    if (i is InventoryFolder)
                    {
                        InventoryFolder folder = (InventoryFolder) i;
                        PrintFolder(folder, result, indent + 1);
                    }
                }
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:18,代码来源:InventoryCommand.cs

示例6: CopyFolder

 public void CopyFolder(InventoryFolder dest, InventoryFolder folder)
 {
     UUID newFolderID = Client.Inventory.CreateFolder(dest.UUID, folder.Name, AssetType.Unknown);
     Thread.Sleep(500);
     var items = Client.Inventory.FolderContents(folder.UUID, folder.OwnerID, true, true, InventorySortOrder.ByDate, 45 * 1000);
     AutoResetEvent copied = new AutoResetEvent(false);
     foreach (var item in items)
     {
         if (item is InventoryItem)
         {
             copied.Reset();
             Client.Inventory.RequestCopyItem(item.UUID, newFolderID, item.Name, folder.OwnerID, (InventoryBase target) =>
             {
                 Instance.TabConsole.DisplayNotificationInChat(string.Format("    * Copied {0} to {1}", item.Name, dest.Name));
                 copied.Set();
             });
             copied.WaitOne(15 * 1000, false);
         }
     }
 }
开发者ID:TooheyPaneer,项目名称:radegast,代码行数:20,代码来源:FolderCopy.cs

示例7: ParseInventorySkeleton

        public InventoryFolder[] ParseInventorySkeleton(string key, OSDMap reply)
        {
            List<InventoryFolder> folders = new List<InventoryFolder>();

            OSD skeleton;
            if (reply.TryGetValue(key, out skeleton) && skeleton.Type == OSDType.Array)
            {
                OSDArray array = (OSDArray)skeleton;
                for (int i = 0; i < array.Count; i++)
                {
                    if (array[i].Type == OSDType.Map)
                    {
                        OSDMap map = (OSDMap)array[i];
                        InventoryFolder folder = new InventoryFolder(map["folder_id"].AsUUID());
                        folder.Name = map["name"].AsString();
                        folder.ParentUUID = map["parent_id"].AsUUID();
                        folder.PreferredType = (AssetType)map["type_default"].AsInteger();
                        folder.Version = map["version"].AsInteger();
                        folders.Add(folder);
                    }
                }
            }
            return folders.ToArray();
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:24,代码来源:Login.cs

示例8: BulkUpdateInventoryHandler

        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void BulkUpdateInventoryHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;

            BulkUpdateInventoryPacket update = packet as BulkUpdateInventoryPacket;

            if (update.FolderData.Length > 0 && update.FolderData[0].FolderID != UUID.Zero)
            {
                foreach (BulkUpdateInventoryPacket.FolderDataBlock dataBlock in update.FolderData)
                {
                    if (!_Store.Contains(dataBlock.FolderID))
                        Logger.Log("Received BulkUpdate for unknown folder: " + dataBlock.FolderID, Helpers.LogLevel.Warning, Client);

                    InventoryFolder folder = new InventoryFolder(dataBlock.FolderID);
                    folder.Name = Utils.BytesToString(dataBlock.Name);
                    folder.OwnerID = update.AgentData.AgentID;
                    folder.ParentUUID = dataBlock.ParentID;
                    _Store[folder.UUID] = folder;
                }
            }

            if (update.ItemData.Length > 0 && update.ItemData[0].ItemID != UUID.Zero)
            {
                for (int i = 0; i < update.ItemData.Length; i++)
                {
                    BulkUpdateInventoryPacket.ItemDataBlock dataBlock = update.ItemData[i];

                    // If we are given a folder of items, the item information might arrive before the folder
                    // (parent) is in the store
                    if (!_Store.Contains(dataBlock.ItemID))
                        Logger.Log("Received BulkUpdate for unknown item: " + dataBlock.ItemID, Helpers.LogLevel.Warning, Client);

                    InventoryItem item = SafeCreateInventoryItem((InventoryType)dataBlock.InvType, dataBlock.ItemID);

                    item.AssetType = (AssetType)dataBlock.Type;
                    if (dataBlock.AssetID != UUID.Zero) item.AssetUUID = dataBlock.AssetID;
                    item.CreationDate = Utils.UnixTimeToDateTime(dataBlock.CreationDate);
                    item.CreatorID = dataBlock.CreatorID;
                    item.Description = Utils.BytesToString(dataBlock.Description);
                    item.Flags = dataBlock.Flags;
                    item.GroupID = dataBlock.GroupID;
                    item.GroupOwned = dataBlock.GroupOwned;
                    item.Name = Utils.BytesToString(dataBlock.Name);
                    item.OwnerID = dataBlock.OwnerID;
                    item.ParentUUID = dataBlock.FolderID;
                    item.Permissions = new Permissions(
                        dataBlock.BaseMask,
                        dataBlock.EveryoneMask,
                        dataBlock.GroupMask,
                        dataBlock.NextOwnerMask,
                        dataBlock.OwnerMask);
                    item.SalePrice = dataBlock.SalePrice;
                    item.SaleType = (SaleType)dataBlock.SaleType;

                    _Store[item.UUID] = item;

                    // Look for an "item created" callback
                    ItemCreatedCallback callback;
                    if (_ItemCreatedCallbacks.TryGetValue(dataBlock.CallbackID, out callback))
                    {
                        _ItemCreatedCallbacks.Remove(dataBlock.CallbackID);

                        try { callback(true, item); }
                        catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); }
                    }

                    // Look for an "item copied" callback
                    ItemCopiedCallback copyCallback;
                    if (_ItemCopiedCallbacks.TryGetValue(dataBlock.CallbackID, out copyCallback))
                    {
                        _ItemCopiedCallbacks.Remove(dataBlock.CallbackID);

                        try { copyCallback(item); }
                        catch (Exception ex) { Logger.Log(ex.Message, Helpers.LogLevel.Error, Client, ex); }
                    }
                }
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:81,代码来源:InventoryManager.cs

示例9: Network_OnLoginResponse

        private void Network_OnLoginResponse(bool loginSuccess, bool redirect, string message, string reason, LoginResponseData replyData)
        {
            if (loginSuccess)
            {
                // Initialize the store here so we know who owns it:
                _Store = new Inventory(Client, this, Client.Self.AgentID);
                Logger.DebugLog("Setting InventoryRoot to " + replyData.InventoryRoot.ToString(), Client);
                InventoryFolder rootFolder = new InventoryFolder(replyData.InventoryRoot);
                rootFolder.Name = String.Empty;
                rootFolder.ParentUUID = UUID.Zero;
                _Store.RootFolder = rootFolder;

                for (int i = 0; i < replyData.InventorySkeleton.Length; i++)
                    _Store.UpdateNodeFor(replyData.InventorySkeleton[i]);

                InventoryFolder libraryRootFolder = new InventoryFolder(replyData.LibraryRoot);
                libraryRootFolder.Name = String.Empty;
                libraryRootFolder.ParentUUID = UUID.Zero;
                _Store.LibraryFolder = libraryRootFolder;

                for (int i = 0; i < replyData.LibrarySkeleton.Length; i++)
                    _Store.UpdateNodeFor(replyData.LibrarySkeleton[i]);
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:24,代码来源:InventoryManager.cs

示例10: CreateLink

 /// <summary>
 /// Creates inventory link to another inventory folder
 /// </summary>
 /// <param name="folderID">Put newly created link in folder with this UUID</param>
 /// <param name="folder">Original inventory folder</param>
 /// <param name="callback">Method to call upon creation of the link</param>
 public void CreateLink(UUID folderID, InventoryFolder folder, ItemCreatedCallback callback)
 {
     CreateLink(folderID, folder.UUID, folder.Name, "", AssetType.LinkFolder, InventoryType.Folder, UUID.Random(), callback);
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:10,代码来源:InventoryManager.cs

示例11: Move

 /// <summary>
 /// Move an inventory item or folder to a new location and change its name
 /// </summary>
 /// <param name="item">The <seealso cref="T:InventoryBase"/> item or folder to move</param>
 /// <param name="newParent">The <seealso cref="T:InventoryFolder"/> to move item or folder to</param>
 /// <param name="newName">The name to change the item or folder to</param>
 public void Move(InventoryBase item, InventoryFolder newParent, string newName)
 {
     if (item is InventoryFolder)
         MoveFolder(item.UUID, newParent.UUID, newName);
     else
         MoveItem(item.UUID, newParent.UUID, newName);
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:13,代码来源:InventoryManager.cs

示例12: AddDir

 TreeNode AddDir(TreeNode parentNode, InventoryFolder f)
 {
     TreeNode dirNode = new TreeNode();
     dirNode.Name = f.UUID.ToString();
     dirNode.Text = f.Name;
     dirNode.Tag = f;
     dirNode.ImageIndex = GetDirImageIndex(f.PreferredType.ToString().ToLower());
     dirNode.SelectedImageIndex = dirNode.ImageIndex;
     if (parentNode == null)
     {
         invTree.Nodes.Add(dirNode);
     }
     else
     {
         parentNode.Nodes.Add(dirNode);
     }
     lock (UUID2NodeCache)
     {
         UUID2NodeCache[f.UUID] = dirNode;
     }
     return dirNode;
 }
开发者ID:robincornelius,项目名称:radegast,代码行数:22,代码来源:InventoryConsole.cs

示例13: GetContents

 public List<InventoryBase> GetContents(InventoryFolder folder)
 {
     return GetContents(folder.UUID);
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:4,代码来源:Inventory.cs

示例14: Init2

        public void Init2()
        {
            if (instance.MainForm.InvokeRequired)
            {
                instance.MainForm.BeginInvoke(new MethodInvoker(() => Init2()));
                return;
            }

            AddFolderFromStore(invRootNode, Inventory.RootFolder);

            sorter = new InvNodeSorter();

            if (!instance.GlobalSettings.ContainsKey("inv_sort_bydate"))
                instance.GlobalSettings["inv_sort_bydate"] = OSD.FromBoolean(true);
            if (!instance.GlobalSettings.ContainsKey("inv_sort_sysfirst"))
                instance.GlobalSettings["inv_sort_sysfirst"] = OSD.FromBoolean(true);

            sorter.ByDate = instance.GlobalSettings["inv_sort_bydate"].AsBoolean();
            sorter.SystemFoldersFirst = instance.GlobalSettings["inv_sort_sysfirst"].AsBoolean();

            tbtnSortByDate.Checked = sorter.ByDate;
            tbtbSortByName.Checked = !sorter.ByDate;
            tbtnSystemFoldersFirst.Checked = sorter.SystemFoldersFirst;

            invTree.TreeViewNodeSorter = sorter;

            if (instance.MonoRuntime)
            {
                invTree.BackColor = Color.FromKnownColor(KnownColor.Window);
                invTree.ForeColor = invTree.LineColor = Color.FromKnownColor(KnownColor.WindowText);
                InventoryFolder f = new InventoryFolder(UUID.Random());
                f.Name = "";
                f.ParentUUID = UUID.Zero;
                f.PreferredType = AssetType.Unknown;
                TreeNode dirNode = new TreeNode();
                dirNode.Name = f.UUID.ToString();
                dirNode.Text = f.Name;
                dirNode.Tag = f;
                dirNode.ImageIndex = GetDirImageIndex(f.PreferredType.ToString().ToLower());
                dirNode.SelectedImageIndex = dirNode.ImageIndex;
                invTree.Nodes.Add(dirNode);
                invTree.Sort();
            }

            saveAllTToolStripMenuItem.Enabled = false;
            InventoryUpdate = new Thread(new ThreadStart(StartTraverseNodes));
            InventoryUpdate.Name = "InventoryUpdate";
            InventoryUpdate.IsBackground = true;
            InventoryUpdate.Start();

            invRootNode.Expand();

            invTree.AfterExpand += new TreeViewEventHandler(TreeView_AfterExpand);
            invTree.NodeMouseClick += new TreeNodeMouseClickEventHandler(invTree_MouseClick);
            invTree.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(invTree_NodeMouseDoubleClick);

            _EditTimer = new System.Threading.Timer(OnLabelEditTimer, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);

            // Callbacks
            Inventory.InventoryObjectAdded += new EventHandler<InventoryObjectAddedEventArgs>(Inventory_InventoryObjectAdded);
            Inventory.InventoryObjectUpdated += new EventHandler<InventoryObjectUpdatedEventArgs>(Inventory_InventoryObjectUpdated);
            Inventory.InventoryObjectRemoved += new EventHandler<InventoryObjectRemovedEventArgs>(Inventory_InventoryObjectRemoved);

            client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_AttachmentUpdate);
            client.Objects.KillObject += new EventHandler<KillObjectEventArgs>(Objects_KillObject);
            client.Appearance.AppearanceSet += new EventHandler<AppearanceSetEventArgs>(Appearance_AppearanceSet);
        }
开发者ID:robincornelius,项目名称:radegast,代码行数:67,代码来源:InventoryConsole.cs

示例15: CompareFolders

 int CompareFolders(InventoryFolder x, InventoryFolder y)
 {
     if (_sysfirst)
     {
         if (x.PreferredType != AssetType.Unknown && y.PreferredType == AssetType.Unknown)
         {
             return -1;
         }
         else if (x.PreferredType == AssetType.Unknown && y.PreferredType != AssetType.Unknown)
         {
             return 1;
         }
     }
     return String.Compare(x.Name, y.Name);
 }
开发者ID:robincornelius,项目名称:radegast,代码行数:15,代码来源:InventoryConsole.cs


注:本文中的OpenMetaverse.InventoryFolder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。