diff --git a/libsecondlife-cs/examples/CreateNotecard/App.ico b/libsecondlife-cs/examples/CreateNotecard/App.ico new file mode 100644 index 00000000..3a5525fd Binary files /dev/null and b/libsecondlife-cs/examples/CreateNotecard/App.ico differ diff --git a/libsecondlife-cs/examples/CreateNotecard/AssemblyInfo.cs b/libsecondlife-cs/examples/CreateNotecard/AssemblyInfo.cs new file mode 100644 index 00000000..177a4f0e --- /dev/null +++ b/libsecondlife-cs/examples/CreateNotecard/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/libsecondlife-cs/examples/CreateNotecard/CreateNotecard.cs b/libsecondlife-cs/examples/CreateNotecard/CreateNotecard.cs new file mode 100644 index 00000000..b7d8472e --- /dev/null +++ b/libsecondlife-cs/examples/CreateNotecard/CreateNotecard.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections; +using System.IO; + +using libsecondlife; +using libsecondlife.InventorySystem; +using libsecondlife.AssetSystem.PacketHelpers; + +namespace InventoryTools +{ + /// + /// Summary description for Class1. + /// + class CreateNotecard : libsecondlife.InventoryApp + { + /// + /// The main entry point for the application. + /// + [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; + } + + client.Avatar.OnChat +=new ChatCallback(Avatar_OnChat); + + + // 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"); + + iiNotecard.GiveTo("e225438416bc4f1788ac5beb5b41f141"); +// 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 + AgentInventory.DownloadInventory(); + ifNotecards = AgentInventory.getFolder("Notecards"); + Console.WriteLine(ifNotecards.toXML()); +*/ + } + + private void Avatar_OnChat(string message, byte audible, byte type, byte sourcetype, string name, LLUUID id, byte command, LLUUID commandID) + { + + } + } +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/CreateNotecard/CreateNotecard.csproj b/libsecondlife-cs/examples/CreateNotecard/CreateNotecard.csproj new file mode 100644 index 00000000..92c22513 --- /dev/null +++ b/libsecondlife-cs/examples/CreateNotecard/CreateNotecard.csproj @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libsecondlife-cs/examples/ImageTool/App.ico b/libsecondlife-cs/examples/ImageTool/App.ico new file mode 100644 index 00000000..3a5525fd Binary files /dev/null and b/libsecondlife-cs/examples/ImageTool/App.ico differ diff --git a/libsecondlife-cs/examples/ImageTool/AssemblyInfo.cs b/libsecondlife-cs/examples/ImageTool/AssemblyInfo.cs new file mode 100644 index 00000000..177a4f0e --- /dev/null +++ b/libsecondlife-cs/examples/ImageTool/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/libsecondlife-cs/examples/ImageTool/ImageTool.cs b/libsecondlife-cs/examples/ImageTool/ImageTool.cs new file mode 100644 index 00000000..23df0ea4 --- /dev/null +++ b/libsecondlife-cs/examples/ImageTool/ImageTool.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections; +using System.IO; + +using libsecondlife; +using libsecondlife.InventorySystem; +using libsecondlife.AssetSystem; + +namespace ImageTool +{ + /// + /// Summary description for Class1. + /// + class ImageTool : libsecondlife.InventoryApp + { + private LLUUID _ImageID; + private string _FileName; + private bool _Put; + + /// + /// Sample texture for downloading: 0444bf21-f77e-7f63-89e9-b839ec66bc15 + /// + [STAThread] + static void Main(string[] args) + { + if( ImageTools.Check4Tools() == false ) + { + return; + } + + if (args.Length < 5) + { + Console.WriteLine("Usage: ImageTool [first] [last] [password] [get] [uuid] [(filename)]"); + Console.WriteLine("Usage: ImageTool [first] [last] [password] [put] [filename]"); + + Console.WriteLine(); + Console.WriteLine("Example: ImageTool John Doe Password get 0444bf21-f77e-7f63-89e9-b839ec66bc15 cloud.tif"); + Console.WriteLine("Example: ImageTool John Doe Password put Sample.tif"); + return; + } + + + LLUUID id = null; + string filename = ""; + bool put = false; + if( args[3].ToLower().Equals("put") ) + { + put = true; + filename = args[4]; + } + else + { + id = new LLUUID(args[4]); + if( args.Length == 6 ) + { + filename = args[5]; + } + else + { + filename = args[4] + ".tif"; + } + } + + ImageTool it = new ImageTool( id, filename, put ); + it.Connect(args); + it.doStuff(); + it.Disconnect(); + + System.Threading.Thread.Sleep(500); + } + + protected ImageTool( LLUUID imageID, string filename, bool put ) + { + _ImageID = imageID; + _FileName = filename; + _Put = put; + } + + protected override void doStuff() + { + if( _Put ) + { + Console.WriteLine("Reading: " + _FileName); + + byte[] j2cdata = ImageTools.ReadJ2CData( _FileName ); + + Console.WriteLine("Connecting to your Texture folder..."); + InventoryFolder iFolder = AgentInventory.getFolder("Textures"); + + Console.WriteLine("Uploading Texture..."); + iFolder.NewImage( _FileName, "ImageTool Upload", j2cdata ); + } + else + { + Console.WriteLine("Downloading: " + _ImageID); + + ImageManager im = new ImageManager( base.client ); + byte[] j2cdata = im.RequestImage( _ImageID ); + + Console.WriteLine("Writing to: " + _FileName); + ImageTools.WriteJ2CAsTiff( _FileName, j2cdata ); + } + + Console.WriteLine("Done..."); + + } + + } +} \ No newline at end of file diff --git a/libsecondlife-cs/examples/ImageTool/ImageTool.csproj b/libsecondlife-cs/examples/ImageTool/ImageTool.csproj new file mode 100644 index 00000000..addb4aa0 --- /dev/null +++ b/libsecondlife-cs/examples/ImageTool/ImageTool.csproj @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libsecondlife-cs/examples/ImageTool/Readme.txt b/libsecondlife-cs/examples/ImageTool/Readme.txt new file mode 100644 index 00000000..9a69ee88 --- /dev/null +++ b/libsecondlife-cs/examples/ImageTool/Readme.txt @@ -0,0 +1,5 @@ +SecondLife uses Kakadu Software's JPEG2000 framework to compress and expand images to/from JPEG2000. + +Libsecondlife currently makes use of a freely available set of command line tools from Kakadu to support Image upload and download from SecondLife. + +These tools are available from Kakadu's website at http://www.kakadusoftware.com/ \ No newline at end of file diff --git a/libsecondlife-cs/examples/InventoryDump/App.ico b/libsecondlife-cs/examples/InventoryDump/App.ico new file mode 100644 index 00000000..3a5525fd Binary files /dev/null and b/libsecondlife-cs/examples/InventoryDump/App.ico differ diff --git a/libsecondlife-cs/examples/InventoryDump/AssemblyInfo.cs b/libsecondlife-cs/examples/InventoryDump/AssemblyInfo.cs new file mode 100644 index 00000000..177a4f0e --- /dev/null +++ b/libsecondlife-cs/examples/InventoryDump/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly: AssemblyTitle("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/libsecondlife-cs/examples/InventoryDump/InventoryDump.cs b/libsecondlife-cs/examples/InventoryDump/InventoryDump.cs new file mode 100644 index 00000000..60c296ce --- /dev/null +++ b/libsecondlife-cs/examples/InventoryDump/InventoryDump.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections; +using System.IO; + +using libsecondlife; +using libsecondlife.InventorySystem; + +namespace InventoryDump +{ + class InventoryDump : libsecondlife.InventoryApp + { + private string sOutputFile; + private bool bOutputAssets; + + /// + /// The main entry point for the application. + /// + [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."); + } + } + } +} + diff --git a/libsecondlife-cs/examples/InventoryDump/InventoryDump.csproj b/libsecondlife-cs/examples/InventoryDump/InventoryDump.csproj new file mode 100644 index 00000000..10554d63 --- /dev/null +++ b/libsecondlife-cs/examples/InventoryDump/InventoryDump.csproj @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + +