Exemplo n.º 1
0
        /// <summary>
        /// BackupFolder - recurse through the inventory nodes sending scripts and notecards to the transfer queue
        /// </summary>
        /// <param name="folder">The current leaf in the inventory tree</param>
        /// <param name="sPathSoFar">path so far, in the form @"c:\here" -- this needs to be "clean" for the current filesystem</param>
        private void BackupFolder(InventoryNode folder, string sPathSoFar)
        {
            StringBuilder sbRequests = new StringBuilder();

            // FIXME:
            //Client.Inventory.RequestFolderContents(folder.Data.UUID, Client.Self.AgentID, true, true, false, 
            //    InventorySortOrder.ByName);

            // first scan this folder for text
            foreach (InventoryNode iNode in folder.Nodes.Values)
            {
                if (BackupWorker.CancellationPending)
                    return;
                if (iNode.Data is libsecondlife.InventoryItem)
                {
                    InventoryItem ii = iNode.Data as InventoryItem;
                    if (ii.AssetType == AssetType.LSLText || ii.AssetType == AssetType.Notecard)
                    {
                        // check permissions on scripts
                        if (ii.AssetType == AssetType.LSLText)
                        {
                            if ((ii.Permissions.OwnerMask & PermissionMask.Modify) == PermissionMask.None)
                            {
                                // skip this one
                                continue;
                            }
                        }

                        string sExtension = (ii.AssetType == AssetType.LSLText) ? ".lsl" : ".txt";
                        // make the output file
                        string sPath = sPathSoFar + @"\" + MakeValid(ii.Name.Trim()) + sExtension;

                        // create the new qdi
                        QueuedDownloadInfo qdi = new QueuedDownloadInfo(sPath, ii.AssetUUID, iNode.Data.UUID, LLUUID.Zero, 
                            Client.Self.AgentID, ii.AssetType);
                        
                        // add it to the queue
                        lock (PendingDownloads)
                        {
                            TextItemsFound++;
                            PendingDownloads.Enqueue(qdi);
                        }
                    }
                }
            }

            // now run any subfolders
            foreach (InventoryNode i in folder.Nodes.Values)
            {
                if (BackupWorker.CancellationPending)
                    return;
                else if (i.Data is libsecondlife.InventoryFolder)
                    BackupFolder(i, sPathSoFar + @"\" + MakeValid(i.Data.Name.Trim()));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// BackupFolder - recurse through the inventory nodes sending scripts and notecards to the transfer queue
        /// </summary>
        /// <param name="folder">The current leaf in the inventory tree</param>
        /// <param name="sPathSoFar">path so far, in the form @"c:\here" -- this needs to be "clean" for the current filesystem</param>
        private void BackupFolder(InventoryNode folder, string sPathSoFar)
        {
            StringBuilder sbRequests = new StringBuilder();

            // FIXME:
            //Client.Inventory.RequestFolderContents(folder.Data.UUID, Client.Self.AgentID, true, true, false,
            //    InventorySortOrder.ByName);

            // first scan this folder for text
            foreach (InventoryNode iNode in folder.Nodes.Values)
            {
                if (BackupWorker.CancellationPending)
                {
                    return;
                }
                if (iNode.Data is libsecondlife.InventoryItem)
                {
                    InventoryItem ii = iNode.Data as InventoryItem;
                    if (ii.AssetType == AssetType.LSLText || ii.AssetType == AssetType.Notecard)
                    {
                        // check permissions on scripts
                        if (ii.AssetType == AssetType.LSLText)
                        {
                            if ((ii.Permissions.OwnerMask & PermissionMask.Modify) == PermissionMask.None)
                            {
                                // skip this one
                                continue;
                            }
                        }

                        string sExtension = (ii.AssetType == AssetType.LSLText) ? ".lsl" : ".txt";
                        // make the output file
                        string sPath = sPathSoFar + @"\" + MakeValid(ii.Name.Trim()) + sExtension;

                        // create the new qdi
                        QueuedDownloadInfo qdi = new QueuedDownloadInfo(sPath, ii.AssetUUID, iNode.Data.UUID, LLUUID.Zero,
                                                                        Client.Self.AgentID, ii.AssetType);

                        // add it to the queue
                        lock (PendingDownloads)
                        {
                            TextItemsFound++;
                            PendingDownloads.Enqueue(qdi);
                        }
                    }
                }
            }

            // now run any subfolders
            foreach (InventoryNode i in folder.Nodes.Values)
            {
                if (BackupWorker.CancellationPending)
                {
                    return;
                }
                else if (i.Data is libsecondlife.InventoryFolder)
                {
                    BackupFolder(i, sPathSoFar + @"\" + MakeValid(i.Data.Name.Trim()));
                }
            }
        }