diff --git a/libsecondlife/DirectoryManager.cs b/libsecondlife/DirectoryManager.cs index a02b43a1..b561885e 100644 --- a/libsecondlife/DirectoryManager.cs +++ b/libsecondlife/DirectoryManager.cs @@ -506,6 +506,38 @@ namespace libsecondlife return transactionID; } + #region Blocking Functions + + public bool PeopleSearch(DirFindFlags findFlags, string searchText, int queryStart, + int timeoutMS, out List results) + { + AutoResetEvent searchEvent = new AutoResetEvent(false); + LLUUID id = LLUUID.Random(); + List people = null; + + DirPeopleReplyCallback callback = + delegate(LLUUID queryid, List matches) + { + if (id == queryid) + { + people = matches; + searchEvent.Set(); + } + }; + + OnDirPeopleReply += callback; + StartPeopleSearch(findFlags, searchText, queryStart, id); + searchEvent.WaitOne(timeoutMS, false); + OnDirPeopleReply -= callback; + + results = people; + return (results != null); + } + + #endregion Blocking Functions + + #region Packet Handlers + private void DirClassifiedReplyHandler(Packet packet, Simulator simulator) { if (OnClassifiedReply != null) @@ -626,5 +658,7 @@ namespace libsecondlife catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); } } } + + #endregion Packet Handlers } } diff --git a/libsecondlife/Helpers.cs b/libsecondlife/Helpers.cs index c00bad7f..82b6f6c6 100644 --- a/libsecondlife/Helpers.cs +++ b/libsecondlife/Helpers.cs @@ -1041,7 +1041,7 @@ namespace libsecondlife /// was not successfully loaded public static System.IO.Stream GetResourceStream(string resourceName) { - return GetResourceStream(resourceName, String.Empty); + return GetResourceStream(resourceName, Settings.RESOURCE_DIR); } /// @@ -1068,7 +1068,8 @@ namespace libsecondlife try { - return new System.IO.FileStream(searchPath + System.IO.Path.DirectorySeparatorChar + resourceName,System.IO.FileMode.Open); + return new System.IO.FileStream(searchPath + System.IO.Path.DirectorySeparatorChar + resourceName, + System.IO.FileMode.Open); } catch (Exception) { diff --git a/libsecondlife/OpenJPEG.cs b/libsecondlife/OpenJPEG.cs index 3e53dc96..0937110e 100644 --- a/libsecondlife/OpenJPEG.cs +++ b/libsecondlife/OpenJPEG.cs @@ -7,8 +7,7 @@ using libsecondlife; namespace OpenJPEGNet { -#if NO_UNSAFE -#else +#if !NO_UNSAFE public class OpenJPEG { diff --git a/libsecondlife/Resources/avatar_lad.xml b/libsecondlife/Resources/avatar_lad.xml new file mode 100644 index 00000000..4ca21572 --- /dev/null +++ b/libsecondlife/Resources/avatar_lad.xml @@ -0,0 +1,11223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libsecondlife/Settings.cs b/libsecondlife/Settings.cs index 854e2789..c0b67bc2 100644 --- a/libsecondlife/Settings.cs +++ b/libsecondlife/Settings.cs @@ -39,13 +39,15 @@ namespace libsecondlife /// happen at login or dynamically public class Settings { + /// Main grid login server public const string AGNI_LOGIN_SERVER = "https://login.agni.lindenlab.com/cgi-bin/login.cgi"; + /// Beta grid login server public const string ADITI_LOGIN_SERVER = "https://login.aditi.lindenlab.com/cgi-bin/login.cgi"; + /// The relative directory where external resources are kept + public const string RESOURCE_DIR = "libsl_data"; /// XML-RPC login server to connect to public string LOGIN_SERVER = AGNI_LOGIN_SERVER; - /// The relative directory where files needed for baking are kept - public string RESOURCE_DIR = "avatar_data"; // Timeouts and Intervals diff --git a/libsecondlife/TGALoader.cs b/libsecondlife/TGALoader.cs index 1373ce27..cccf9568 100644 --- a/libsecondlife/TGALoader.cs +++ b/libsecondlife/TGALoader.cs @@ -2,8 +2,7 @@ using System; namespace OpenJPEGNet { -#if NO_UNSAFE -#else +#if !NO_UNSAFE /// /// Capability to load TGAs to Bitmap diff --git a/libsecondlife/examples/TestClient/Commands/Appearance/CloneCommand.cs b/libsecondlife/examples/TestClient/Commands/Appearance/CloneCommand.cs new file mode 100644 index 00000000..b1eca757 --- /dev/null +++ b/libsecondlife/examples/TestClient/Commands/Appearance/CloneCommand.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using libsecondlife; +using libsecondlife.Packets; + +namespace libsecondlife.TestClient +{ + public class CloneCommand : Command + { + uint SerialNum = 2; + + public CloneCommand(TestClient testClient) + { + Name = "clone"; + Description = "Clone the appearance of a nearby avatar. Usage: clone [name]"; + } + + public override string Execute(string[] args, LLUUID fromAgentID) + { + string targetName = String.Empty; + List matches; + + for (int ct = 0; ct < args.Length; ct++) + targetName = targetName + args[ct] + " "; + targetName = targetName.TrimEnd(); + + if (targetName.Length == 0) + return "Usage: clone [name]"; + + if (Client.Directory.PeopleSearch(DirectoryManager.DirFindFlags.People, targetName, 0, 1000 * 10, + out matches) && matches.Count > 0) + { + LLUUID target = matches[0].AgentID; + targetName += String.Format(" ({0})", target); + + if (Client.Appearances.ContainsKey(target)) + { + #region AvatarAppearance to AgentSetAppearance + + AvatarAppearancePacket appearance = Client.Appearances[target]; + + AgentSetAppearancePacket set = new AgentSetAppearancePacket(); + set.AgentData.AgentID = Client.Self.AgentID; + set.AgentData.SessionID = Client.Self.SessionID; + set.AgentData.SerialNum = SerialNum++; + set.AgentData.Size = new LLVector3(2f, 2f, 2f); // HACK + + set.WearableData = new AgentSetAppearancePacket.WearableDataBlock[0]; + set.VisualParam = new AgentSetAppearancePacket.VisualParamBlock[appearance.VisualParam.Length]; + + for (int i = 0; i < appearance.VisualParam.Length; i++) + { + set.VisualParam[i] = new AgentSetAppearancePacket.VisualParamBlock(); + set.VisualParam[i].ParamValue = appearance.VisualParam[i].ParamValue; + } + + set.ObjectData.TextureEntry = appearance.ObjectData.TextureEntry; + + #endregion AvatarAppearance to AgentSetAppearance + + // Detach everything we are currently wearing + Client.Appearance.AddAttachments(new List(), true); + + // Send the new appearance packet + Client.Network.SendPacket(set); + + return "Cloned " + targetName; + } + else + { + return "Don't know the appearance of avatar " + targetName; + } + } + else + { + return "Couldn't find avatar " + targetName; + } + } + } +} diff --git a/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs b/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs index 63832484..ea8b55c3 100644 --- a/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs +++ b/libsecondlife/examples/TestClient/Commands/System/SetMasterCommand.cs @@ -17,7 +17,7 @@ namespace libsecondlife.TestClient public SetMasterCommand(TestClient testClient) { Name = "setmaster"; - Description = "Sets the user name of the master user. The master user can IM to run commands. Usage: setmaster name"; + Description = "Sets the user name of the master user. The master user can IM to run commands. Usage: setmaster [name]"; } public override string Execute(string[] args, LLUUID fromAgentID) @@ -28,7 +28,7 @@ namespace libsecondlife.TestClient masterName = masterName.TrimEnd(); if (masterName.Length == 0) - return "Usage: setmaster name"; + return "Usage: setmaster [name]"; DirectoryManager.DirPeopleReplyCallback callback = new DirectoryManager.DirPeopleReplyCallback(KeyResolvHandler); Client.Directory.OnDirPeopleReply += callback; @@ -61,7 +61,7 @@ namespace libsecondlife.TestClient { if (query != queryid) return; - // We can't handle ambiguities here as nicely as we can in ClientManager. + resolvedMasterKey = matches[0].AgentID; keyResolution.Set(); query = LLUUID.Zero; diff --git a/libsecondlife/examples/TestClient/TestClient.csproj b/libsecondlife/examples/TestClient/TestClient.csproj index c8f104fa..a58aa6dc 100644 --- a/libsecondlife/examples/TestClient/TestClient.csproj +++ b/libsecondlife/examples/TestClient/TestClient.csproj @@ -38,6 +38,7 @@ + diff --git a/libsecondlife/libsecondlife.build b/libsecondlife/libsecondlife.build index 42887065..04d59855 100644 --- a/libsecondlife/libsecondlife.build +++ b/libsecondlife/libsecondlife.build @@ -50,9 +50,6 @@ - - - @@ -101,6 +98,10 @@ + + + + diff --git a/libsecondlife/libsecondlife.csproj b/libsecondlife/libsecondlife.csproj index 25b54563..0cc1420a 100644 --- a/libsecondlife/libsecondlife.csproj +++ b/libsecondlife/libsecondlife.csproj @@ -178,6 +178,6 @@ - xcopy "$(ProjectDir)\Resources\*.*" "$(OutDir)avatar_data" /i /d /y + xcopy "$(ProjectDir)\Resources\*.*" "$(OutDir)libsl_data" /i /d /y \ No newline at end of file