2006-08-14 19:18:41 +00:00
using System ;
using System.Collections ;
using System.IO ;
using libsecondlife ;
using libsecondlife.InventorySystem ;
2006-08-14 20:23:21 +00:00
using libsecondlife.Packets ;
2006-08-14 19:18:41 +00:00
namespace InventoryTools
{
/// <summary>
/// Summary description for Class1.
/// </summary>
2006-08-14 20:05:22 +00:00
class CreateNotecard : libsecondlife . Utils . InventoryApp
2006-08-14 19:18:41 +00:00
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main ( string [ ] args )
{
CreateNotecard cn = new CreateNotecard ( ) ;
cn . Connect ( args ) ;
cn . doStuff ( ) ;
cn . Disconnect ( ) ;
System . Threading . Thread . Sleep ( 500 ) ;
}
override protected void doStuff ( )
{
if ( AgentInventory = = null )
{
return ;
}
2006-09-25 21:33:50 +00:00
Console . WriteLine ( "This example contains numerous code snippets for inventory management and notecard creation, please see the source code. The default SVN operation simply creates a single notecard in your Notecards folder." ) ;
2006-08-14 19:18:41 +00:00
// Find folder to put notecard in
InventoryFolder ifNotecards = AgentInventory . getFolder ( "Notecards" ) ;
// Create Notecard
Console . WriteLine ( "Create Notecard" ) ;
InventoryItem iiNotecard = ifNotecards . NewNotecard ( "Test Card " + System . DateTime . Now . ToShortTimeString ( ) , "Test Description" , "Test Body" ) ;
2006-09-25 21:33:50 +00:00
// iiNotecard.GiveTo("e225438416bc4f1788ac5beb5b41f141");
2006-08-14 19:18:41 +00:00
// iiNotecard.GiveTo("4403a8f0-245c-a56b-23a7-cc1c72c8f2e9");
// iiNotecard.GiveTo("25472683-cb32-4516-904a-6cd0ecabf128");
/ *
StreamReader sr = System . IO . File . OpenText ( "bignote.txt" ) ;
String body = sr . ReadToEnd ( ) ;
body = "Testing Inventory Delivery" ;
// Create Notecard
Console . WriteLine ( "Create Notecard" ) ;
InventoryNotecard iNotecard = ifNotecards . NewNotecard ( "Big Card " + System . DateTime . Now . ToShortTimeString ( ) , "Test Description" , body ) ;
* /
// Delete Notecard
// Console.WriteLine("Delete Notecard");
// iNotecard.Delete();
/ *
// Create Folder
InventoryFolder ifTestFolderA = ifNotecards . CreateFolder ( "SubA" ) ;
InventoryFolder ifTestFolderB = ifNotecards . CreateFolder ( "SubB" ) ;
// Move a folder
ifTestFolderB . MoveTo ( ifTestFolderA ) ;
// Rename a folder
ifTestFolderA . Name = "Sub1" ;
// Delete Folder
ifTestFolderB . Delete ( ) ;
// Create Notecard
Console . WriteLine ( "Create Notecard" ) ;
InventoryItem iiNotecard = ifNotecards . NewNotecard ( "Test Card " + System . DateTime . Now . ToShortTimeString ( ) , "Test Description" , "Test Body" ) ;
// Move Notecard
Console . WriteLine ( "Move Notecard" ) ;
iiNotecard . MoveTo ( ifTestFolderA ) ;
// Delete Notecard
Console . WriteLine ( "Delete Notecard" ) ;
iiNotecard . Delete ( ) ;
// Delete Folder
ifTestFolderA . Delete ( ) ;
// Download inventory and output to visually verify Folder has been deleted
2006-09-25 21:33:50 +00:00
2006-08-14 19:18:41 +00:00
AgentInventory . DownloadInventory ( ) ;
ifNotecards = AgentInventory . getFolder ( "Notecards" ) ;
2006-09-25 21:33:50 +00:00
Console . WriteLine ( ifNotecards . toXML ( false ) ) ;
2006-08-14 19:18:41 +00:00
* /
}
}
}