2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using System.Xml.Serialization;
|
2008-07-21 21:12:59 +00:00
|
|
|
using OpenMetaverse;
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-07-16 02:37:23 +00:00
|
|
|
/// <summary>
|
|
|
|
|
/// Inventory Example, Moves a folder to the Trash folder
|
|
|
|
|
/// </summary>
|
2007-04-28 20:54:02 +00:00
|
|
|
public class DeleteFolderCommand : Command
|
|
|
|
|
{
|
2008-08-21 01:19:06 +00:00
|
|
|
public DeleteFolderCommand(TestClient testClient)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
Name = "deleteFolder";
|
2008-07-16 02:37:23 +00:00
|
|
|
Description = "Moves a folder to the Trash Folder";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Inventory;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-07-16 02:37:23 +00:00
|
|
|
// parse the command line
|
|
|
|
|
string target = String.Empty;
|
|
|
|
|
for (int ct = 0; ct < args.Length; ct++)
|
|
|
|
|
target = target + args[ct] + " ";
|
2008-08-21 01:19:06 +00:00
|
|
|
target = target.TrimEnd();
|
2007-04-28 20:54:02 +00:00
|
|
|
|
2008-07-16 02:37:23 +00:00
|
|
|
// initialize results list
|
|
|
|
|
List<InventoryBase> found = new List<InventoryBase>();
|
2009-07-31 17:43:01 +00:00
|
|
|
|
|
|
|
|
// find the folder
|
|
|
|
|
found = Client.Inventory.LocalFind(Client.Inventory.Store.RootFolder.UUID, target.Split('/'), 0, true);
|
|
|
|
|
|
|
|
|
|
if (found.Count.Equals(1))
|
2008-07-16 02:37:23 +00:00
|
|
|
{
|
2009-07-31 17:43:01 +00:00
|
|
|
// move the folder to the trash folder
|
2015-08-05 11:38:32 -04:00
|
|
|
Client.Inventory.MoveFolder(found[0].UUID, Client.Inventory.FindFolderForType(FolderType.Trash));
|
2009-07-31 17:43:01 +00:00
|
|
|
|
|
|
|
|
return String.Format("Moved folder {0} to Trash", found[0].Name);
|
2008-07-16 02:37:23 +00:00
|
|
|
}
|
2009-07-31 17:43:01 +00:00
|
|
|
|
|
|
|
|
return String.Empty;
|
2008-08-21 01:19:06 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|