diff --git a/libsecondlife/examples/TestClient/Commands/Inventory/DeleteFolderCommand.cs b/libsecondlife/examples/TestClient/Commands/Inventory/DeleteFolderCommand.cs index 657ebc2e..e3d2c959 100644 --- a/libsecondlife/examples/TestClient/Commands/Inventory/DeleteFolderCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/Inventory/DeleteFolderCommand.cs @@ -9,32 +9,43 @@ using libsecondlife; namespace libsecondlife.TestClient { + /// + /// Inventory Example, Moves a folder to the Trash folder + /// public class DeleteFolderCommand : Command { public DeleteFolderCommand(TestClient testClient) { Name = "deleteFolder"; - Description = "Deletes a folder from inventory."; + Description = "Moves a folder to the Trash Folder"; } public override string Execute(string[] args, LLUUID fromAgentID) { - return "Broken until someone fixes me"; + // parse the command line + string target = String.Empty; + for (int ct = 0; ct < args.Length; ct++) + target = target + args[ct] + " "; + target = target.TrimEnd(); - //string target = String.Empty; - //for (int ct = 0; ct < args.Length; ct++) - // target = target + args[ct] + " "; - //target = target.TrimEnd(); - - //Client.Inventory.DownloadInventory(); - //InventoryFolder folder = Client.Inventory.getFolder(target); - //if (folder != null) - //{ - // folder.Delete(); - // return "Folder " + target + " deleted."; - //} - - //return "Unable to find: " + target; + // initialize results list + List found = new List(); + try + { + // find the folder + found = Client.Inventory.LocalFind(Client.Inventory.Store.RootFolder.UUID, target.Split('/'), 0, true); + if (found.Count.Equals(1)) + { + // move the folder to the trash folder + Client.Inventory.MoveFolder(found[0].UUID, Client.Inventory.FindFolderForType(AssetType.TrashFolder)); + return String.Format("Moved folder {0} to Trash", found[0].Name); + } + } + catch (InvalidOutfitException ex) + { + return "Folder Not Found: (" + ex.Message + ")"; + } + return string.Empty; } } } \ No newline at end of file