Tools for dealing with agents inventory
        public override string Execute(string[] args, UUID fromAgentID)
        {
            Manager = Client.Inventory;
            Inventory = Client.InventoryStore;

            if (args.Length == 0)
                return "Current folder: " + Client.CurrentDirectory.Name;

            string path = args[0];
            for(int i = 1; i < args.Length; ++i)
            {
                path += " " + args[i];
            }

            List<InventoryBase> results = Inventory.InventoryFromPath(path, Client.CurrentDirectory, true);
            if (results.Count == 0)
                return "Can not find inventory at: " + path;
            InventoryFolder destFolder = null;
            foreach (InventoryBase ib in results)
            {
                if (ib is InventoryFolder) 
                {
                    destFolder = ib as InventoryFolder;
                    break;
                }
            }
            if (destFolder == null)
                return path + " is not a folder.";

            Client.CurrentDirectory = destFolder;
            return "Current folder: " + Client.CurrentDirectory.Name;
        }
示例#2
0
 public Inventory(GridClient client, InventoryManager manager, UUID owner)
 {
     Client = client;
     //Manager = manager;
     _Owner = owner;
     if (owner == UUID.Zero)
         Logger.Log("Inventory owned by nobody!", Helpers.LogLevel.Warning, Client);
     Items = new Dictionary<UUID, InventoryNode>();
 }
示例#3
0
        public override string Execute(string[] args, UUID fromAgentID)
        {
            Manager = Client.Inventory;
            Inventory = Client.InventoryStore;

            StringBuilder result = new StringBuilder();

            InventoryFolder rootFolder = Inventory.RootFolder;
            PrintFolder(rootFolder, result, 0);

            return result.ToString();
        }
        public override string Execute(string[] args, UUID fromAgentID)
        {
            if (args.Length > 1)
                return "Usage: ls [-l]";
            bool longDisplay = false;
            if (args.Length > 0 && args[0] == "-l")
                longDisplay = true;

            Manager = Client.Inventory;
            Inventory = Manager.Store;
            // WARNING: Uses local copy of inventory contents, need to download them first.
            List<InventoryBase> contents = Inventory.GetContents(Client.CurrentDirectory);
            string displayString = "";
            string nl = "\n"; // New line character
            // Pretty simple, just print out the contents.
            foreach (InventoryBase b in contents)
            {
                if (longDisplay)
                {
                    // Generate a nicely formatted description of the item.
                    // It kinda looks like the output of the unix ls.
                    // starts with 'd' if the inventory is a folder, '-' if not.
                    // 9 character permissions string
                    // UUID of object
                    // Name of object
                    if (b is InventoryFolder)
                    {
                        InventoryFolder folder = b as InventoryFolder;
                        displayString += "d--------- ";
                        displayString += folder.UUID;
                        displayString += " " + folder.Name;
                    }
                    else if (b is InventoryItem)
                    {
                        InventoryItem item = b as InventoryItem;
                        displayString += "-";
                        displayString += PermMaskString(item.Permissions.OwnerMask);
                        displayString += PermMaskString(item.Permissions.GroupMask);
                        displayString += PermMaskString(item.Permissions.EveryoneMask);
                        displayString += " " + item.UUID;
                        displayString += " " + item.Name;
                        displayString += nl;
                        displayString += "  AssetID: " + item.AssetUUID;
                    }
                }
                else
                {
                    displayString += b.Name;
                }
                displayString += nl;
            }
            return displayString;
        }
示例#5
0
 public SimAssetStore(BotClient GC)
 {
     TheStore = this;
     Client = GC;                       
     Manager = Client.Inventory;
     Manager.ItemReceived += Inventory_OnItemReceived;
     Manager.TaskItemReceived += Inventory_OnTaskItemReceived;
     Manager.FolderUpdated += Inventory_OnFolderUpdated;
     Inventory = Manager.Store;
     Client.Network.SimConnected += Ensure_Downloaded;
     SlowConnectedQueue.DebugQueue = true;
     FillAssetNames();
 }
示例#6
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            Manager = Client.Inventory;
            Inventory = Manager.Store;

            StringBuilder result = new StringBuilder();

            InventoryFolder rootFolder = Inventory.RootFolder;
            PrintFolder(rootFolder, result, 0);

            return Success(result.ToString());
            ;
        }
示例#7
0
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            Manager = Client.Inventory;
            Inventory = Client.Inventory.Store;

            if (args.Length > 0)
                return ShowUsage(); // " pwd";
            string pathStr = "";
            string[] path = null;

            InventoryFolder currentFolder = Client.CurrentDirectory;

            if (currentFolder == null) // We need this to be set to something. 
                return Failure("Error: Client not logged in.");

            return Success("Current folder: " + currentFolder.Name);
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            Manager = Client.Inventory;
            Inventory = Manager.Store;

            InventoryFolder rootFolder = Inventory.RootFolder;
            int found = 0;
            int items = 0;
            int remed = 0;
            foreach (KeyValuePair<UUID, InventoryNode> node in MushDLR223.Utilities.LockInfo.CopyOf(Inventory.Items))
            {
                found++;
                var n = node.Value;
                if (n.Parent == null || n.Parent.Data.Name == "TaskInvHolder")
                {
                    var d = n.Data;
                    items++;
                    if (d is InventoryItem) continue;
                    if (n.ParentID == UUID.Zero || (n.Parent != null && n.Parent.Data.Name == "TaskInvHolder"))
                    {
                        UUID uuid;
                        if (UUID.TryParse(d.Name, out uuid) || d.Name.ToLower().Contains("taskinv"))
                        {
                            remed++;
                            Client.Inventory.MoveFolder(node.Key,
                                                        Client.Inventory.FindFolderForType(AssetType.TrashFolder));
                            /*
                            Client.Inventory.RemoveDescendants(node.Key);
                            Client.Inventory.RemoveFolder(node.Key);
                            Client.Inventory.RemoveItem(node.Key);
                             */
                        }
                    }
                }
            }

            return Success("remed=" + remed + " items=" + items + " total=" + found);
            ;
        }
示例#9
0
 public Inventory(GridClient client, InventoryManager manager)
     : this(client, manager, client.Self.AgentID) { }
示例#10
0
        // FIXME: Create a class-level appearance thread so multiple threads can't be launched

        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="client">This agents <seealso cref="OpenMetaverse.GridClient"/> Object</param>
        /// <param name="assets">Reference to an AssetManager object</param>
        public AppearanceManager(LoggerInstance log, NetworkManager network, InventoryManager inventory, AssetManager assets, ObjectManager objects, AgentManager self)
        {
            Log = log;
            Network = network;
            Inventory = inventory;
            Assets = assets;
            Self = self;
            Objects = objects;

            // Initialize AgentTextures to zero UUIDs
            for (int i = 0; i < AgentTextures.Length; i++)
                AgentTextures[i] = UUID.Zero;

            Network.RegisterCallback(PacketType.AgentWearablesUpdate, new NetworkManager.PacketCallback(AgentWearablesUpdateHandler));
            Network.RegisterCallback(PacketType.AgentCachedTextureResponse, new NetworkManager.PacketCallback(AgentCachedTextureResponseHandler));
            Network.RegisterCallback(PacketType.RebakeAvatarTextures,new NetworkManager.PacketCallback(RebakeAvatarTexturesHandler));
            Network.OnDisconnected += new NetworkManager.DisconnectedCallback(Network_OnDisconnected);
        }
示例#11
0
        /// <summary>
        /// Parse the results of a RequestTaskInventory() response
        /// </summary>
        /// <param name="manager"></param>
        /// <param name="taskData">A string which contains the data from the task reply</param>
        /// <param name="items"></param>
        /// <param name="folders"></param>
        /// <returns>A List containing the items contained within the tasks inventory</returns>
        public static void ParseTaskInventory(InventoryManager manager, string taskData, out List<ItemData> items, out List<FolderData> folders)
        {
            items = new List<ItemData>();
            folders = new List<FolderData>();
            int lineNum = 0;
            string[] lines = taskData.Replace("\r\n", "\n").Split('\n');

            while (lineNum < lines.Length)
            {
                string key, value;
                if (ParseLine(lines[lineNum++], out key, out value))
                {
                    if (key == "inv_object")
                    {
                        #region inv_object

                        // In practice this appears to only be used for folders
                        UUID itemID = UUID.Zero;
                        UUID parentID = UUID.Zero;
                        string name = String.Empty;
                        AssetType assetType = AssetType.Unknown;

                        while (lineNum < lines.Length)
                        {
                            if (ParseLine(lines[lineNum++], out key, out value))
                            {
                                if (key == "{")
                                {
                                    continue;
                                }
                                else if (key == "}")
                                {
                                    break;
                                }
                                else if (key == "obj_id")
                                {
                                    UUID.TryParse(value, out itemID);
                                }
                                else if (key == "parent_id")
                                {
                                    UUID.TryParse(value, out parentID);
                                }
                                else if (key == "type")
                                {
                                    assetType = StringToAssetType(value);
                                }
                                else if (key == "name")
                                {
                                    name = value.Substring(0, value.IndexOf('|'));
                                }
                            }
                        }

                        if (assetType == AssetType.Folder)
                        {
                            FolderData folderData = new FolderData(itemID);
                            folderData.Name = name;
                            folderData.ParentUUID = parentID;

                            folders.Add(folderData);
                        }
                        else
                        {
                            ItemData itemParams = new ItemData(itemID);
                            itemParams.Name = name;
                            itemParams.ParentUUID = parentID;
                            itemParams.AssetType = assetType;
                            items.Add(itemParams);
                        }

                        #endregion inv_object
                    }
                    else if (key == "inv_item")
                    {
                        #region inv_item

                        // Any inventory item that links to an assetID, has permissions, etc
                        UUID itemID = UUID.Zero;
                        UUID assetID = UUID.Zero;
                        UUID parentID = UUID.Zero;
                        UUID creatorID = UUID.Zero;
                        UUID ownerID = UUID.Zero;
                        UUID lastOwnerID = UUID.Zero;
                        UUID groupID = UUID.Zero;
                        bool groupOwned = false;
                        string name = String.Empty;
                        string desc = String.Empty;
                        AssetType assetType = AssetType.Unknown;
                        InventoryType inventoryType = InventoryType.Unknown;
                        DateTime creationDate = Utils.Epoch;
                        uint flags = 0;
                        Permissions perms = Permissions.NoPermissions;
                        SaleType saleType = SaleType.Not;
                        int salePrice = 0;

                        while (lineNum < lines.Length)
                        {
                            if (ParseLine(lines[lineNum++], out key, out value))
                            {
                                if (key == "{")
                                {
                                    continue;
                                }
                                else if (key == "}")
                                {
                                    break;
                                }
                                else if (key == "item_id")
                                {
                                    UUID.TryParse(value, out itemID);
                                }
                                else if (key == "parent_id")
                                {
                                    UUID.TryParse(value, out parentID);
                                }
                                else if (key == "permissions")
                                {
                                    #region permissions

                                    while (lineNum < lines.Length)
                                    {
                                        if (ParseLine(lines[lineNum++], out key, out value))
                                        {
                                            if (key == "{")
                                            {
                                                continue;
                                            }
                                            else if (key == "}")
                                            {
                                                break;
                                            }
                                            else if (key == "creator_mask")
                                            {
                                                // Deprecated
                                                uint val;
                                                if (Utils.TryParseHex(value, out val))
                                                    perms.BaseMask = (PermissionMask)val;
                                            }
                                            else if (key == "base_mask")
                                            {
                                                uint val;
                                                if (Utils.TryParseHex(value, out val))
                                                    perms.BaseMask = (PermissionMask)val;
                                            }
                                            else if (key == "owner_mask")
                                            {
                                                uint val;
                                                if (Utils.TryParseHex(value, out val))
                                                    perms.OwnerMask = (PermissionMask)val;
                                            }
                                            else if (key == "group_mask")
                                            {
                                                uint val;
                                                if (Utils.TryParseHex(value, out val))
                                                    perms.GroupMask = (PermissionMask)val;
                                            }
                                            else if (key == "everyone_mask")
                                            {
                                                uint val;
                                                if (Utils.TryParseHex(value, out val))
                                                    perms.EveryoneMask = (PermissionMask)val;
                                            }
                                            else if (key == "next_owner_mask")
                                            {
                                                uint val;
                                                if (Utils.TryParseHex(value, out val))
                                                    perms.NextOwnerMask = (PermissionMask)val;
                                            }
                                            else if (key == "creator_id")
                                            {
                                                UUID.TryParse(value, out creatorID);
                                            }
                                            else if (key == "owner_id")
                                            {
                                                UUID.TryParse(value, out ownerID);
                                            }
                                            else if (key == "last_owner_id")
                                            {
                                                UUID.TryParse(value, out lastOwnerID);
                                            }
                                            else if (key == "group_id")
                                            {
                                                UUID.TryParse(value, out groupID);
                                            }
                                            else if (key == "group_owned")
                                            {
                                                uint val;
                                                if (UInt32.TryParse(value, out val))
                                                    groupOwned = (val != 0);
                                            }
                                        }
                                    }

                                    #endregion permissions
                                }
                                else if (key == "sale_info")
                                {
                                    #region sale_info

                                    while (lineNum < lines.Length)
                                    {
                                        if (ParseLine(lines[lineNum++], out key, out value))
                                        {
                                            if (key == "{")
                                            {
                                                continue;
                                            }
                                            else if (key == "}")
                                            {
                                                break;
                                            }
                                            else if (key == "sale_type")
                                            {
                                                saleType = StringToSaleType(value);
                                            }
                                            else if (key == "sale_price")
                                            {
                                                Int32.TryParse(value, out salePrice);
                                            }
                                        }
                                    }

                                    #endregion sale_info
                                }
                                else if (key == "shadow_id")
                                {
                                    //FIXME:
                                }
                                else if (key == "asset_id")
                                {
                                    UUID.TryParse(value, out assetID);
                                }
                                else if (key == "type")
                                {
                                    assetType = StringToAssetType(value);
                                }
                                else if (key == "inv_type")
                                {
                                    inventoryType = StringToInventoryType(value);
                                }
                                else if (key == "flags")
                                {
                                    UInt32.TryParse(value, out flags);
                                }
                                else if (key == "name")
                                {
                                    name = value.Substring(0, value.IndexOf('|'));
                                }
                                else if (key == "desc")
                                {
                                    desc = value.Substring(0, value.IndexOf('|'));
                                }
                                else if (key == "creation_date")
                                {
                                    uint timestamp;
                                    if (UInt32.TryParse(value, out timestamp))
                                        creationDate = Utils.UnixTimeToDateTime(timestamp);
                                    else
                                        Logger.Log("Failed to parse creation_date " + value, Helpers.LogLevel.Warning);
                                }
                            }
                        }
                        ItemData item = new ItemData(itemID, inventoryType);
                        item.AssetUUID = assetID;
                        item.AssetType = assetType;
                        item.CreationDate = creationDate;
                        item.CreatorID = creatorID;
                        item.Description = desc;
                        item.Flags = flags;
                        item.GroupID = groupID;
                        item.GroupOwned = groupOwned;
                        item.Name = name;
                        item.OwnerID = ownerID;
                        item.ParentUUID = parentID;
                        item.Permissions = perms;
                        item.SalePrice = salePrice;
                        item.SaleType = saleType;
                        items.Add(item);

                        #endregion inv_item
                    }
                    else
                    {
                        Logger.Log("Unrecognized token " + key + " in: " + Helpers.NewLine + taskData,
                            Helpers.LogLevel.Error);
                    }
                }
            }
        }
        public InventoryConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(InventoryConsole_Disposed);

            TreeUpdateTimer = new System.Timers.Timer()
            {
                Interval = updateInterval,
                Enabled = false,
                SynchronizingObject = invTree
            };
            TreeUpdateTimer.Elapsed += TreeUpdateTimerTick;

            this.instance = instance;
            Manager = client.Inventory;
            Inventory = Manager.Store;
            Inventory.RootFolder.OwnerID = client.Self.AgentID;
            invTree.ImageList = frmMain.ResourceImages;
            invRootNode = AddDir(null, Inventory.RootFolder);
            Logger.Log("Reading inventory cache from " + instance.InventoryCacheFileName, Helpers.LogLevel.Debug, client);
            Inventory.RestoreFromDisk(instance.InventoryCacheFileName);
            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);
        }
示例#13
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // Initialise SmartThreadPool when using mono
            if (Type.GetType("Mono.Runtime") != null)
            {
                WorkPool.Init(true);
            }

            // These are order-dependant
            Network = new NetworkManager(this);
            Settings = new Settings(this);
            Parcels = new ParcelManager(this);
            Self = new AgentManager(this);
            Avatars = new AvatarManager(this);
            Estate = new EstateTools(this);
            Friends = new FriendsManager(this);
            Grid = new GridManager(this);
            Objects = new ObjectManager(this);
            Groups = new GroupManager(this);
            Assets = new AssetManager(this);
            Appearance = new AppearanceManager(this);
            Inventory = new InventoryManager(this);
            Directory = new DirectoryManager(this);
            Terrain = new TerrainManager(this);
            Sound = new SoundManager(this);
            Throttle = new AgentThrottle(this);
            Stats = new OpenMetaverse.Stats.UtilizationStatistics();
        }
示例#14
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public GridClient()
 {
     // These are order-dependant
     Network = new NetworkManager(this);
     Settings = new Settings(this);
     Parcels = new ParcelManager(this);
     Self = new AgentManager(this);
     Avatars = new AvatarManager(this);
     Estate = new EstateTools(this);
     Friends = new FriendsManager(this);
     Grid = new GridManager(this);
     Objects = new ObjectManager(this);
     Groups = new GroupManager(this);
     Assets = new AssetManager(this);
     Appearance = new AppearanceManager(this);
     Inventory = new InventoryManager(this);
     Directory = new DirectoryManager(this);
     Terrain = new TerrainManager(this);
     Sound = new SoundManager(this);
     Throttle = new AgentThrottle(this);
     Stats = new OpenMetaverse.Stats.UtilizationStatistics();
 }
示例#15
0
 public Inventory(LoggerInstance log, InventoryManager manager, UUID owner)
 {
     Log = log;
     Manager = manager;
     _Owner = owner;
     if (owner == UUID.Zero)
         Log.Log("Inventory owned by nobody!", Helpers.LogLevel.Warning);
     Items = new Dictionary<UUID, InventoryNode>();
 }
示例#16
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // These are order-dependant
            Log = new LoggerInstance();
            Network = new NetworkManager(Log);
            Terrain = new TerrainManager(Log, Network);
            Parcels = new ParcelManager(Log, Network, Terrain);
            Self = new AgentManager(Log, Network, Grid);
            Avatars = new AvatarManager(Log, Network);
            Friends = new FriendsManager(Log, Network, Inventory, Self, Avatars);
            Grid = new GridManager(Log, Network);
            Objects = new ObjectManager(Log, Network, Self);
            Groups = new GroupManager(Log, Network, Self);
            Assets = new AssetManager(Log, Network);
            Estate = new EstateTools(Log, Network, Assets);
            Appearance = new AppearanceManager(Log, Network, Inventory, Assets, Objects, Self);
            Inventory = new InventoryManager(Log, Network, Self, Assets);
            Directory = new DirectoryManager(Log, Network);
            Sound = new SoundManager(Log, Network, Self);
            Throttle = new AgentThrottle(Network);

            Settings = new Settings(this);
            //if (Settings.ENABLE_INVENTORY_STORE)
            //    InventoryStore = new Inventory(Inventory);
            //if (Settings.ENABLE_LIBRARY_STORE)
            //    LibraryStore = new Inventory(Inventory);

            //Inventory.OnSkeletonsReceived +=
            //    delegate(InventoryManager manager)
            //    {
            //        if (Settings.ENABLE_INVENTORY_STORE)
            //            InventoryStore.InitializeFromSkeleton(Inventory.InventorySkeleton);
            //        if (Settings.ENABLE_LIBRARY_STORE)
            //            LibraryStore.InitializeFromSkeleton(Inventory.LibrarySkeleton);
            //    };

            Network.RegisterLoginResponseCallback(
                delegate(bool loginSuccess, bool redirect, string message, string reason, LoginResponseData replyData)
                {
                    if (loginSuccess) Log.BotName = replyData.FirstName + " " + replyData.LastName;
                });
        }
示例#17
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            #if USE_SMART_THREAD_POOL
            ThreadPool = new SmartThreadPool(-1, 25);
            #endif
            // These are order-dependant
            #if USE_SMART_THREAD_POOL
            Network = new NetworkManager(this, ThreadPool);
            #else
            Network = new NetworkManager(this);
            #endif
            Settings = new Settings(this);
            #if USE_SMART_THREAD_POOL
            Parcels = new ParcelManager(this, ThreadPool);
            #else
            Parcels = new ParcelManager(this);
            #endif
            Self = new AgentManager(this);
            Avatars = new AvatarManager(this);
            Friends = new FriendsManager(this);
            Grid = new GridManager(this);
            Objects = new ObjectManager(this);
            Groups = new GroupManager(this);
            #if USE_SMART_THREAD_POOL
            Assets = new AssetManager(this, ThreadPool);
            #else
            Assets = new AssetManager(this);
            #endif
            Appearance = new AppearanceManager(this, Assets);
            Inventory = new InventoryManager(this);
            Directory = new DirectoryManager(this);
            Terrain = new TerrainManager(this);
            Sound = new SoundManager(this);
            Throttle = new AgentThrottle(this);

            //if (Settings.ENABLE_INVENTORY_STORE)
            //    InventoryStore = new Inventory(Inventory);
            //if (Settings.ENABLE_LIBRARY_STORE)
            //    LibraryStore = new Inventory(Inventory);

            //Inventory.OnSkeletonsReceived +=
            //    delegate(InventoryManager manager)
            //    {
            //        if (Settings.ENABLE_INVENTORY_STORE)
            //            InventoryStore.InitializeFromSkeleton(Inventory.InventorySkeleton);
            //        if (Settings.ENABLE_LIBRARY_STORE)
            //            LibraryStore.InitializeFromSkeleton(Inventory.LibrarySkeleton);
            //    };
        }
        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            Manager = Client.Inventory;
            Inventory = Client.Inventory.Store;

            if (args.Length > 1)
                return ShowUsage(); // " cd [path-to-folder]";
            string pathStr = "";
            string[] path = null;
            if (args.Length == 0)
            {
                path = new string[] {""};
                // cd without any arguments doesn't do anything.
            }
            else if (args.Length == 1)
            {
                pathStr = args[0];
                path = pathStr.Split(new char[] {'/'});
                // Use '/' as a path seperator.
            }
            InventoryFolder currentFolder = Client.CurrentDirectory;
            if (pathStr.StartsWith("/"))
                currentFolder = Inventory.RootFolder;

            if (currentFolder == null) // We need this to be set to something. 
                return Failure("Error: Client not logged in.");

            // Traverse the path, looking for the 
            for (int i = 0; i < path.Length; ++i)
            {
                string nextName = path[i];
                if (string.IsNullOrEmpty(nextName) || nextName == ".")
                    continue; // Ignore '.' and blanks, stay in the current directory.
                if (nextName == ".." && currentFolder != Inventory.RootFolder)
                {
                    // If we encounter .., move to the Client folder.
                    currentFolder = Inventory[currentFolder.ParentUUID] as InventoryFolder;
                }
                else
                {
                    List<InventoryBase> currentContents = Inventory.GetContents(currentFolder);
                    // Try and find an InventoryBase with the corresponding name.
                    bool found = false;
                    foreach (InventoryBase item in currentContents)
                    {
                        // Allow lookup by UUID as well as name:
                        if (item.Name == nextName || item.UUID.ToString() == nextName)
                        {
                            found = true;
                            if (item is InventoryFolder)
                            {
                                currentFolder = item as InventoryFolder;
                            }
                            else
                            {
                                return Failure(item.Name + " is not a folder.");
                            }
                        }
                    }
                    if (!found)
                        return Failure(nextName + " not found in " + currentFolder.Name);
                }
            }
            Client.CurrentDirectory = currentFolder;
            return Success("Current folder: " + currentFolder.Name);
        }
示例#19
0
        /// <summary>
        /// Internal constructor
        /// </summary>
        /// <param name="client">A reference to the GridClient Object</param>
        internal FriendsManager(LoggerInstance log, NetworkManager network, InventoryManager inventory, AgentManager self, AvatarManager avatars)
        {
            Log = log;
            Network = network;
            Inventory = inventory;
            Self = self;
            Avatars = avatars;

            Network.OnConnected += new NetworkManager.ConnectedCallback(Network_OnConnect);
            Avatars.OnAvatarNames += new AvatarManager.AvatarNamesCallback(Avatars_OnAvatarNames);
            Self.OnInstantMessage += new AgentManager.InstantMessageCallback(MainAvatar_InstantMessage);

            Network.RegisterCallback(PacketType.OnlineNotification, OnlineNotificationHandler);
            Network.RegisterCallback(PacketType.OfflineNotification, OfflineNotificationHandler);
            Network.RegisterCallback(PacketType.ChangeUserRights, ChangeUserRightsHandler);
            Network.RegisterCallback(PacketType.TerminateFriendship, TerminateFriendshipHandler);
            Network.RegisterCallback(PacketType.FindAgent, OnFindAgentReplyHandler);

            Network.RegisterLoginResponseCallback(new NetworkManager.LoginResponseCallback(Network_OnLoginResponse),
                new string[] { "buddy-list" });
        }
示例#20
0
 private string Fullpath(InventoryManager manager, InventoryNode item)
 {
     if (item == null) return "";
     return Fullpath(manager, item.Parent) + "/" + item.Data.Name;
 }
示例#21
0
 private string Fullpath(InventoryManager manager, InventoryItem item)
 {
     if (item == null) return "null";
     return Fullpath(manager, manager.Store.GetNodeFor(item.ParentUUID)) + "/" + item.Name;
 }
示例#22
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public GridClient()
        {
            // These are order-dependant
            Network = new NetworkManager(this);
            Settings = new Settings(this);
            Parcels = new ParcelManager(this);
            Self = new AgentManager(this);
            Avatars = new AvatarManager(this);
            Friends = new FriendsManager(this);
            Grid = new GridManager(this);
            Objects = new ObjectManager(this);
            Groups = new GroupManager(this);
            Assets = new AssetManager(this);
            Appearance = new AppearanceManager(this, Assets);
            Inventory = new InventoryManager(this);
            Directory = new DirectoryManager(this);
            Terrain = new TerrainManager(this);
            Sound = new SoundManager(this);
            Throttle = new AgentThrottle(this);

            //if (Settings.ENABLE_INVENTORY_STORE)
            //    InventoryStore = new Inventory(Inventory);
            //if (Settings.ENABLE_LIBRARY_STORE)
            //    LibraryStore = new Inventory(Inventory);

            //Inventory.OnSkeletonsReceived +=
            //    delegate(InventoryManager manager)
            //    {
            //        if (Settings.ENABLE_INVENTORY_STORE)
            //            InventoryStore.InitializeFromSkeleton(Inventory.InventorySkeleton);
            //        if (Settings.ENABLE_LIBRARY_STORE)
            //            LibraryStore.InitializeFromSkeleton(Inventory.LibrarySkeleton);
            //    };
        }
示例#23
0
        public InventoryConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(InventoryConsole_Disposed);

            TreeUpdateTimer = new System.Timers.Timer()
            {
                Interval = updateInterval,
                Enabled = false,
                SynchronizingObject = invTree
            };
            TreeUpdateTimer.Elapsed += TreeUpdateTimerTick;

            this.instance = instance;
            Manager = client.Inventory;
            Inventory = Manager.Store;
            Inventory.RootFolder.OwnerID = client.Self.AgentID;
            invTree.ImageList = frmMain.ResourceImages;
            invRootNode = AddDir(null, Inventory.RootFolder);
            UpdateStatus("Reading cache");
            Init1();
        }
示例#24
0
文件: Tools.cs 项目: jvanveen/ppt2os
 //Finds our ppt2os basefolder, or creates one if not existing yet
 private UUID find_ppt2os_folder(GridClient client)
 {
     Manager = client.Inventory;
     Inventory = Manager.Store;
     InventoryFolder rootFolder = Inventory.RootFolder;
     UUID texture_basefolder = client.Inventory.FindFolderForType(AssetType.Texture);
     List<InventoryBase> texture_contents = Inventory.GetContents(texture_basefolder);
     foreach (InventoryBase c in texture_contents)
     {
         InventoryFolder subfolder = c as InventoryFolder;
         if (c is InventoryFolder)
        	{
             if (subfolder.Name == "ppt2os") {
             ppt2os_folder = subfolder.UUID;
             return ppt2os_folder;
             }
         }
     }
     //No folder yet
     if (ppt2os_folder == UUID.Zero) {
         client.Inventory.CreateFolder(texture_basefolder, "ppt2os");
         find_ppt2os_folder(client);
     }
     return ppt2os_folder;
 }
示例#25
0
        private void productCallback(object obj)
        {
            Manager = client.Inventory;
            Inventory = Manager.Store;
            if (Inventory == null)
            {
                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Waiting for Inventory...");
                return;
            }

            if (isSending == true)
            {
                instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": Waiting...");
                return;
            }
            isSending = true;

            Inventory.RootFolder.OwnerID = client.Self.AgentID;

            Dictionary<string, string> param = new Dictionary<string, string>();
            param.Add("botUUID", client.Self.AgentID.ToString());
            var strContent = this.RequestVendor("GETOUTSTANDING", param);
            List<DeliveryQueue> queue = this.parseResponse(strContent);
            instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + ": " + queue.Count + " Items in Queue List");

            // check if something neddc to be done
            if (queue.Count > 0)
            {
                foreach (DeliveryQueue p in queue)
                    this.SendObject(p);
            }

            isSending = false;
        }
示例#26
0
 public Inventory(GridClient client, InventoryManager manager, Guid owner)
 {
     Client = client;
     //Manager = manager;
     _Owner = owner;
     if (owner == Guid.Empty)
         Logger.Log("Inventory owned by nobody!", Helpers.LogLevel.Warning, Client);
     Items = new Dictionary<Guid, InventoryNode>();
 }