Files
libremetaverse/libsecondlife-cs/examples/InventoryDump/InventoryDump.cs
Michael Cortez 7f9d2de5f6 The mallet gets bigger' en' bigger...
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@158 52acb1d6-8a22-11de-b505-999d5b087335
2006-08-14 20:05:22 +00:00

75 lines
1.5 KiB
C#

using System;
using System.Collections;
using System.IO;
using libsecondlife;
using libsecondlife.InventorySystem;
namespace InventoryDump
{
class InventoryDump : libsecondlife.Utils.InventoryApp
{
private string sOutputFile;
private bool bOutputAssets;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
if (args.Length < 3)
{
Console.WriteLine("Usage: InventoryDump [loginfirstname] [loginlastname] [password] [output.xml]");
return;
}
InventoryDump id = new InventoryDump();
if( args.Length == 4 )
{
id.sOutputFile = args[3];
} else {
id.sOutputFile = "output.xml";
}
id.bOutputAssets = false;
id.Connect(args);
id.doStuff();
id.Disconnect();
System.Threading.Thread.Sleep(500);
}
override protected void doStuff()
{
if( AgentInventory == null )
{
return;
}
// Request Inventory Download
try
{
AgentInventory.DownloadInventory();
Console.WriteLine("Writing Inventory to " + sOutputFile);
// Save inventory to file.
StreamWriter sw = File.CreateText(sOutputFile);
sw.Write(AgentInventory.getRootFolder().toXML( bOutputAssets ) );
sw.Close();
Console.WriteLine("Done.");
}
catch ( Exception e )
{
Console.WriteLine( e.Message );
Console.WriteLine("An error occured while downloading inventory, please report this along with any output to Static Sprocket.");
}
}
}
}