From 9830bf85e49cb30b9fadfcd31c966249fc18a75b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 24 Oct 2006 11:16:26 +0000 Subject: [PATCH] On a mad coding spree. * Implemented AvatarManager, added the async functions * Rebuilt the key2name functionality * Fixed and cleaned up a lot of the teleporting code * More functions implemented in GroupManager * Renamed SecondLife.Avatar to SecondLife.Self * Updated the groupmanager example to list group members * Renamed Form1.cs to AnimationSample.cs git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@386 52acb1d6-8a22-11de-b505-999d5b087335 --- libsecondlife-cs/AssetSystem/AssetManager.cs | 2 +- libsecondlife-cs/Avatar.cs | 96 ++---- libsecondlife-cs/GridManager.cs | 8 +- libsecondlife-cs/GroupManager.cs | 40 ++- .../InventorySystem/InventoryManager.cs | 4 +- libsecondlife-cs/NetworkManager.cs | 20 +- libsecondlife-cs/ObjectManager.cs | 16 +- libsecondlife-cs/Parcel.cs | 12 +- libsecondlife-cs/Region.cs | 2 +- libsecondlife-cs/SecondLife.cs | 92 +----- ...esigner.cs => AnimationSample.Designer.cs} | 304 +++++++++--------- .../{Form1.cs => AnimationSample.cs} | 140 ++++---- .../AnimationSample/AnimationSample.csproj | 12 +- .../{Form1.resx => AnimationSample.resx} | 238 +++++++------- .../IA_SimpleInventory/IA_SimpleInventory.cs | 2 +- .../examples/Teleport/Teleport.cs | 4 +- .../groupmanager/frmGroupInfo.Designer.cs | 175 ++++------ .../examples/groupmanager/frmGroupInfo.cs | 109 ++++++- .../examples/groupmanager/frmGroupManager.cs | 2 +- .../examples/slaccountant/frmSLAccountant.cs | 6 +- libsecondlife-cs/libsecondlife.csproj | 1 + 21 files changed, 636 insertions(+), 649 deletions(-) rename libsecondlife-cs/examples/AnimationSample/{Form1.Designer.cs => AnimationSample.Designer.cs} (97%) rename libsecondlife-cs/examples/AnimationSample/{Form1.cs => AnimationSample.cs} (92%) rename libsecondlife-cs/examples/AnimationSample/{Form1.resx => AnimationSample.resx} (97%) diff --git a/libsecondlife-cs/AssetSystem/AssetManager.cs b/libsecondlife-cs/AssetSystem/AssetManager.cs index eb00772c..dcbcbe3b 100644 --- a/libsecondlife-cs/AssetSystem/AssetManager.cs +++ b/libsecondlife-cs/AssetSystem/AssetManager.cs @@ -103,7 +103,7 @@ namespace libsecondlife.AssetSystem switch( sinkType ) { case SINK_FEE_IMAGE: - slClient.Avatar.GiveMoney( new LLUUID(), 10, "Image Upload" ); + slClient.Self.GiveMoney( new LLUUID(), 10, "Image Upload" ); break; default: throw new Exception("AssetManager: Unknown sinktype (" + sinkType + ")"); diff --git a/libsecondlife-cs/Avatar.cs b/libsecondlife-cs/Avatar.cs index a0c69c24..aabfcc0e 100644 --- a/libsecondlife-cs/Avatar.cs +++ b/libsecondlife-cs/Avatar.cs @@ -69,13 +69,6 @@ namespace libsecondlife bool dialog, bool groupIM, LLUUID imSessionID, DateTime timestamp, string message, byte offline, byte[] binaryBucket); - /// - /// Triggered after friend request packet is sent out - /// - /// - /// - public delegate void FriendNotificationCallback(LLUUID agentID, bool online); - /// /// Triggered for any status updates of a teleport (progress, failed, succeeded) /// @@ -160,8 +153,6 @@ namespace libsecondlife /// public event InstantMessageCallback OnInstantMessage; /// - public event FriendNotificationCallback OnFriendNotification; - /// public event TeleportCallback OnTeleport; /// public event BalanceCallback OnBalanceUpdated; @@ -238,11 +229,6 @@ namespace libsecondlife // Chat callback Client.Network.RegisterCallback(PacketType.ChatFromSimulator, new PacketCallback(ChatHandler)); - // Friend notification callback - callback = new PacketCallback(FriendNotificationHandler); - Client.Network.RegisterCallback(PacketType.OnlineNotification, callback); - Client.Network.RegisterCallback(PacketType.OfflineNotification, callback); - TeleportTimer = new Timer(18000); TeleportTimer.Elapsed += new ElapsedEventHandler(TeleportTimerEvent); TeleportTimeout = false; @@ -532,28 +518,44 @@ namespace libsecondlife /// public bool Teleport(string simName, LLVector3 position, LLVector3 lookAt) { + int attempts = 0; TeleportStat = TeleportStatus.None; - Client.Grid.AddSim(simName); - int attempts = 0; + simName = simName.ToLower(); - while (attempts++ < 5) + GridRegion region = Client.Grid.GetGridRegion(simName); + + if (region != null) { - if (Client.Grid.Regions.ContainsKey(simName.ToLower())) + return Teleport(region.RegionHandle, position, lookAt); + } + else + { + while (attempts++ < 5) { - return Teleport(Client.Grid.Regions[simName.ToLower()].RegionHandle, position, lookAt); - } - else - { - System.Threading.Thread.Sleep(1000); - Client.Grid.AddSim(simName); - Client.Tick(); + region = Client.Grid.GetGridRegion(simName); + + if (region != null) + { + return Teleport(region.RegionHandle, position, lookAt); + } + else + { + // Request the region info again + Client.Grid.AddSim(simName); + + System.Threading.Thread.Sleep(1000); + } } } + if (OnTeleport != null) { - OnTeleport("Unable to resolve name: " + simName, TeleportStat); + TeleportMessage = "Unable to resolve name: " + simName; + TeleportStat = TeleportStatus.Failed; + OnTeleport(TeleportMessage, TeleportStat); } + return false; } @@ -564,6 +566,7 @@ namespace libsecondlife public void CompleteAgentMovement(Simulator simulator) { CompleteAgentMovementPacket move = new CompleteAgentMovementPacket(); + move.AgentData.AgentID = Client.Network.AgentID; move.AgentData.SessionID = Client.Network.SessionID; move.AgentData.CircuitCode = simulator.CircuitCode; @@ -602,47 +605,6 @@ namespace libsecondlife Client.Network.SendPacket((Packet)fovPacket);*/ } - private void FriendNotificationHandler(Packet packet, Simulator simulator) - { - // If the agent is online... - if (packet.Type == PacketType.OnlineNotification) - { - foreach (OnlineNotificationPacket.AgentBlockBlock block in ((OnlineNotificationPacket)packet).AgentBlock) - { - Client.AddAvatar(block.AgentID); - #region AvatarsMutex - Client.AvatarsMutex.WaitOne(); - ((Avatar)Client.Avatars[block.AgentID]).Online = true; - Client.AvatarsMutex.ReleaseMutex(); - #endregion AvatarsMutex - - if (OnFriendNotification != null) - { - OnFriendNotification(block.AgentID, true); - } - } - } - - // If the agent is Offline... - if (packet.Type == PacketType.OfflineNotification) - { - foreach (OfflineNotificationPacket.AgentBlockBlock block in ((OfflineNotificationPacket)packet).AgentBlock) - { - Client.AddAvatar(block.AgentID); - #region AvatarsMutex - Client.AvatarsMutex.WaitOne(); - ((Avatar)Client.Avatars[block.AgentID]).Online = false; - Client.AvatarsMutex.ReleaseMutex(); - #endregion AvatarsMutex - - if (OnFriendNotification != null) - { - OnFriendNotification(block.AgentID, true); - } - } - } - } - private void CoarseLocationHandler(Packet packet, Simulator simulator) { // TODO: This will be useful one day diff --git a/libsecondlife-cs/GridManager.cs b/libsecondlife-cs/GridManager.cs index ce12bc2a..f49adc2d 100644 --- a/libsecondlife-cs/GridManager.cs +++ b/libsecondlife-cs/GridManager.cs @@ -49,7 +49,7 @@ namespace libsecondlife public string Name; /// public byte Access; - /// Sim's various flags (presumably things like PG/M) + /// Various flags for the region (presumably things like PG/Mature) public uint RegionFlags; /// Sim's defined Water Height public byte WaterHeight; @@ -57,11 +57,11 @@ namespace libsecondlife public byte Agents; /// UUID of the World Map image public LLUUID MapImageID; - /// Used for teleporting. + /// Used for teleporting public ulong RegionHandle; /// - /// Constructor. + /// Constructor /// public GridRegion() { @@ -109,7 +109,7 @@ namespace libsecondlife map.AgentData.AgentID = Client.Network.AgentID; map.AgentData.SessionID = Client.Network.SessionID; - map.NameData.Name = Helpers.StringToField(name.ToLower()); + map.NameData.Name = Helpers.StringToField(name); Client.Network.SendPacket(map); } diff --git a/libsecondlife-cs/GroupManager.cs b/libsecondlife-cs/GroupManager.cs index 8638ea01..c174ee1c 100644 --- a/libsecondlife-cs/GroupManager.cs +++ b/libsecondlife-cs/GroupManager.cs @@ -53,13 +53,10 @@ namespace libsecondlife public string Title; public string Description; public ulong Powers; - /// Contains all the group members belonging to this role - public Dictionary Members; public GroupRole(LLUUID id) { ID = id; - Members = new Dictionary(); } } @@ -420,6 +417,43 @@ namespace libsecondlife private void GroupRoleDataHandler(Packet packet, Simulator simulator) { GroupRoleDataReplyPacket roles = (GroupRoleDataReplyPacket)packet; + + #region GroupRolesCachesMutex + GroupRolesCachesMutex.WaitOne(); + + // If nothing is registered to receive this RequestID drop the data + if (GroupRolesCaches.ContainsKey(roles.GroupData.RequestID)) + { + Dictionary groupRoleCache = GroupRolesCaches[roles.GroupData.RequestID]; + + foreach (GroupRoleDataReplyPacket.RoleDataBlock block in roles.RoleData) + { + GroupRole groupRole = new GroupRole(block.RoleID); + + groupRole.Description = Helpers.FieldToString(block.Description); + groupRole.Name = Helpers.FieldToString(block.Name); + groupRole.Powers = block.Powers; + groupRole.Title = Helpers.FieldToString(block.Title); + + groupRoleCache[block.RoleID] = groupRole; + } + + // Release the mutex before the callback + GroupRolesCachesMutex.ReleaseMutex(); + + // Check if we've received all the group members that are showing up + if (groupRoleCache.Count >= roles.GroupData.RoleCount) + { + GroupRolesCallbacks[roles.GroupData.GroupID](groupRoleCache); + } + } + else + { + GroupRolesCachesMutex.ReleaseMutex(); + } + + GroupRolesCachesMutex.ReleaseMutex(); + #endregion GroupRolesCachesMutex } private void GroupRoleMembersHandler(Packet packet, Simulator simulator) diff --git a/libsecondlife-cs/InventorySystem/InventoryManager.cs b/libsecondlife-cs/InventorySystem/InventoryManager.cs index 8faafb1e..eebe9a13 100644 --- a/libsecondlife-cs/InventorySystem/InventoryManager.cs +++ b/libsecondlife-cs/InventorySystem/InventoryManager.cs @@ -285,8 +285,8 @@ namespace libsecondlife.InventorySystem Packet packet = InvPacketHelper.ImprovedInstantMessage( MessageID , ToAgentID - , slClient.Avatar.FirstName + " " + slClient.Avatar.LastName - , slClient.Avatar.Position + , slClient.Self.FirstName + " " + slClient.Self.LastName + , slClient.Self.Position , iitem ); diff --git a/libsecondlife-cs/NetworkManager.cs b/libsecondlife-cs/NetworkManager.cs index db15842b..2f414d4c 100644 --- a/libsecondlife-cs/NetworkManager.cs +++ b/libsecondlife-cs/NetworkManager.cs @@ -972,8 +972,8 @@ namespace libsecondlife array = (JSONArray)jsonObject["region_handle"]; regionHandle = Helpers.UIntsToLong((uint)(int)array[0], (uint)(int)array[1]); - Client.Avatar.Position = posVector; - Client.Avatar.LookAt = lookatVector; + Client.Self.Position = posVector; + Client.Self.LookAt = lookatVector; // Create a hashtable to hold the home values home = new Dictionary(); @@ -985,12 +985,12 @@ namespace libsecondlife this.AgentID = new LLUUID((string)LoginValues["agent_id"]); this.SessionID = new LLUUID((string)LoginValues["session_id"]); - Client.Avatar.ID = this.AgentID; - Client.Avatar.FirstName = (string)LoginValues["first_name"]; - Client.Avatar.LastName = (string)LoginValues["last_name"]; - Client.Avatar.LookAt = vector; - Client.Avatar.HomePosition = posVector; - Client.Avatar.HomeLookAt = lookatVector; + Client.Self.ID = this.AgentID; + Client.Self.FirstName = (string)LoginValues["first_name"]; + Client.Self.LastName = (string)LoginValues["last_name"]; + Client.Self.LookAt = vector; + Client.Self.HomePosition = posVector; + Client.Self.HomeLookAt = lookatVector; // Connect to the sim given in the login reply Simulator simulator = new Simulator(Client, this.Callbacks, (uint)(int)LoginValues["circuit_code"], @@ -1007,7 +1007,7 @@ namespace libsecondlife Simulators.Add(simulator); // Move our agent in to the sim to complete the connection - Client.Avatar.CompleteAgentMovement(simulator); + Client.Self.CompleteAgentMovement(simulator); SendInitialPackets(); @@ -1206,7 +1206,7 @@ namespace libsecondlife //Client.Avatar.SetHeightWidth(676, 909); // Set the initial avatar camera position - Client.Avatar.UpdateCamera(true); + Client.Self.UpdateCamera(true); // TODO: What animation are we stopping here? AgentAnimationPacket animation = new AgentAnimationPacket(); diff --git a/libsecondlife-cs/ObjectManager.cs b/libsecondlife-cs/ObjectManager.cs index 7a9352a9..66ffccea 100644 --- a/libsecondlife-cs/ObjectManager.cs +++ b/libsecondlife-cs/ObjectManager.cs @@ -310,16 +310,16 @@ namespace libsecondlife avatar.Online = true; avatar.CurrentRegion = simulator.Region; - if (FirstName == Client.Avatar.FirstName && LastName == Client.Avatar.LastName) + if (FirstName == Client.Self.FirstName && LastName == Client.Self.LastName) { // Update our avatar - Client.Avatar.LocalID = avatar.LocalID; - Client.Avatar.Position = avatar.Position; - Client.Avatar.Rotation = avatar.Rotation; + Client.Self.LocalID = avatar.LocalID; + Client.Self.Position = avatar.Position; + Client.Self.Rotation = avatar.Rotation; } else { - Client.AddAvatar(avatar); + Client.Avatars.AddAvatar(avatar); if (OnNewAvatar != null) { @@ -407,10 +407,10 @@ namespace libsecondlife if (avatar) { - if (localid == Client.Avatar.LocalID) + if (localid == Client.Self.LocalID) { - Client.Avatar.Position = Position; - Client.Avatar.Rotation = Rotation; + Client.Self.Position = Position; + Client.Self.Rotation = Rotation; } AvatarUpdate avupdate = new AvatarUpdate(); diff --git a/libsecondlife-cs/Parcel.cs b/libsecondlife-cs/Parcel.cs index 0fc7b73d..cf5803f4 100644 --- a/libsecondlife-cs/Parcel.cs +++ b/libsecondlife-cs/Parcel.cs @@ -231,7 +231,7 @@ namespace libsecondlife { ParcelBuyPacket request = new ParcelBuyPacket(); - request.AgentData.AgentID = client.Avatar.ID; + request.AgentData.AgentID = client.Network.AgentID; request.AgentData.SessionID = client.Network.SessionID; request.Data.Final = true; @@ -252,7 +252,7 @@ namespace libsecondlife public bool Reclaim(SecondLife client) { ParcelReclaimPacket request = new ParcelReclaimPacket(); - request.AgentData.AgentID = client.Avatar.ID; + request.AgentData.AgentID = client.Network.AgentID; request.AgentData.SessionID = client.Network.SessionID; request.Data.LocalID = this.LocalID; @@ -270,7 +270,7 @@ namespace libsecondlife public bool Deed(SecondLife client, LLUUID groupID) { ParcelDeedToGroupPacket request = new ParcelDeedToGroupPacket(); - request.AgentData.AgentID = client.Avatar.ID; + request.AgentData.AgentID = client.Network.AgentID; request.AgentData.SessionID = client.Network.SessionID; request.Data.LocalID = this.LocalID; @@ -288,7 +288,7 @@ namespace libsecondlife { ParcelPropertiesUpdatePacket request = new ParcelPropertiesUpdatePacket(); - request.AgentData.AgentID = client.Avatar.ID; + request.AgentData.AgentID = client.Network.AgentID; request.AgentData.SessionID = client.Network.SessionID; request.ParcelData.Flags = 0xFFFFFFFF; // TODO: Probably very important @@ -327,7 +327,7 @@ namespace libsecondlife // TODO: ENUM for returnType ParcelReturnObjectsPacket request = new ParcelReturnObjectsPacket(); - request.AgentData.AgentID = client.Avatar.ID; + request.AgentData.AgentID = client.Network.AgentID; request.AgentData.SessionID = client.Network.SessionID; request.ParcelData.LocalID = this.LocalID; @@ -519,7 +519,7 @@ namespace libsecondlife if (simulator.Region.ParcelMarked[x, y] == 0) { ParcelPropertiesRequestPacket tPacket = new ParcelPropertiesRequestPacket(); - tPacket.AgentData.AgentID = Client.Avatar.ID; + tPacket.AgentData.AgentID = Client.Network.AgentID; tPacket.AgentData.SessionID = Client.Network.SessionID; tPacket.ParcelData.SequenceID = -10000; tPacket.ParcelData.West = (x * 4.0f); diff --git a/libsecondlife-cs/Region.cs b/libsecondlife-cs/Region.cs index 1e0a14f5..2314a50d 100644 --- a/libsecondlife-cs/Region.cs +++ b/libsecondlife-cs/Region.cs @@ -257,7 +257,7 @@ namespace libsecondlife ParcelDownloading = true; ParcelPropertiesRequestPacket tPacket = new ParcelPropertiesRequestPacket(); - tPacket.AgentData.AgentID = Client.Avatar.ID; + tPacket.AgentData.AgentID = Client.Self.ID; tPacket.AgentData.SessionID = Client.Network.SessionID; tPacket.ParcelData.SequenceID = -10000; tPacket.ParcelData.West = 0.0f; diff --git a/libsecondlife-cs/SecondLife.cs b/libsecondlife-cs/SecondLife.cs index cf838f52..ba973f95 100644 --- a/libsecondlife-cs/SecondLife.cs +++ b/libsecondlife-cs/SecondLife.cs @@ -53,11 +53,9 @@ namespace libsecondlife /// Parcel (subdivided simulator lots) Subsystem public ParcelManager Parcels; /// 'Client's Avatar' Subsystem - public MainAvatar Avatar; - /// Avatar (others) Subsystem - public Dictionary Avatars; - /// Threading setup (for what?) - public Mutex AvatarsMutex; + public MainAvatar Self; + /// Other Avatars Subsystem + public AvatarManager Avatars; /// Grid (aka simulator group) Subsystem public GridManager Grid; /// Object Subsystem @@ -76,15 +74,12 @@ namespace libsecondlife { Network = new NetworkManager(this); Parcels = new ParcelManager(this); - Avatar = new MainAvatar(this); - Avatars = new Dictionary(); - AvatarsMutex = new Mutex(false, "AvatarsMutex"); + Self = new MainAvatar(this); + Avatars = new AvatarManager(this); Grid = new GridManager(this); Objects = new ObjectManager(this); Groups = new GroupManager(this); Debug = true; - - Network.RegisterCallback(PacketType.UUIDNameReply, new PacketCallback(GetAgentNameHandler)); } /// @@ -93,7 +88,7 @@ namespace libsecondlife /// Client Avatar's Full Name public override string ToString() { - return Avatar.FirstName + " " + Avatar.LastName; + return Self.FirstName + " " + Self.LastName; } /// @@ -142,81 +137,6 @@ namespace libsecondlife } } } - - /// - /// Add an Avatar into the Avatars Dictionary, by UUID - /// - /// UUID of Avatar to add - public void AddAvatar(LLUUID AgentID) - { - // Quick sanity check - if (Avatars.ContainsKey(AgentID)) - { - return; - } - - GetAgentDetails(AgentID); - - AvatarsMutex.WaitOne(); - Avatars[AgentID] = new Avatar(); - AvatarsMutex.ReleaseMutex(); - } - - /// - /// Add an Avatar into the Avatars Dictionary, by avatar struct directly - /// - /// Filled-out Avatar struct to insert - public void AddAvatar(Avatar avatar) - { - AvatarsMutex.WaitOne(); - Avatars[avatar.ID] = avatar; - AvatarsMutex.ReleaseMutex(); - } - - /// - /// [NOT WORKING, STUBBED] Get Info on an Avatar. - /// - /// Ideally a rewrite of this should either spit out an Avatar struct or update - /// an existing one. --TSK - /// - /// - /// UUID of Avatar - private void GetAgentDetails(LLUUID AgentID) - { - //FIXME: - //Packet packet = Packets.Communication.UUIDNameRequest(Protocol, AgentID); - //Network.SendPacket(packet); - - //// TODO: Shouldn't this function block? - } - - /// - /// Process an incoming UUIDNameReply Packet and insert Full Names into the Avatars Dictionary - /// - /// Incoming Packet to process - /// [NOT USED] What is this for? --TSK - private void GetAgentNameHandler(Packet packet, Simulator simulator) - { - if (packet.Type == PacketType.UUIDNameReply) - { - UUIDNameReplyPacket reply = (UUIDNameReplyPacket)packet; - - #region AvatarsMutex - AvatarsMutex.WaitOne(); - foreach (UUIDNameReplyPacket.UUIDNameBlockBlock block in reply.UUIDNameBlock) - { - if (!Avatars.ContainsKey(block.ID)) - { - Avatars[block.ID] = new Avatar(); - Avatars[block.ID].ID = block.ID; - } - (Avatars[block.ID]).Name = Helpers.FieldToString(block.FirstName) + - " " + Helpers.FieldToString(block.LastName); - } - AvatarsMutex.ReleaseMutex(); - #endregion AvatarsMutex - } - } } /// diff --git a/libsecondlife-cs/examples/AnimationSample/Form1.Designer.cs b/libsecondlife-cs/examples/AnimationSample/AnimationSample.Designer.cs similarity index 97% rename from libsecondlife-cs/examples/AnimationSample/Form1.Designer.cs rename to libsecondlife-cs/examples/AnimationSample/AnimationSample.Designer.cs index e8ed1376..6d697050 100644 --- a/libsecondlife-cs/examples/AnimationSample/Form1.Designer.cs +++ b/libsecondlife-cs/examples/AnimationSample/AnimationSample.Designer.cs @@ -1,152 +1,152 @@ -namespace AnimationSample -{ - partial class Form1 - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - try - { - client.Network.Logout(); - } - catch - { - //ignore - } - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.txtLast = new System.Windows.Forms.TextBox(); - this.txtFirst = new System.Windows.Forms.TextBox(); - this.txtPassword = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.btnLogin = new System.Windows.Forms.Button(); - this.btnPlay = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // txtLast - // - this.txtLast.Location = new System.Drawing.Point(162, 33); - this.txtLast.Name = "txtLast"; - this.txtLast.Size = new System.Drawing.Size(133, 20); - this.txtLast.TabIndex = 0; - this.txtLast.Text = "Malthus"; - // - // txtFirst - // - this.txtFirst.Location = new System.Drawing.Point(23, 33); - this.txtFirst.Name = "txtFirst"; - this.txtFirst.Size = new System.Drawing.Size(133, 20); - this.txtFirst.TabIndex = 0; - this.txtFirst.Text = "Jesse"; - // - // txtPassword - // - this.txtPassword.Location = new System.Drawing.Point(301, 33); - this.txtPassword.Name = "txtPassword"; - this.txtPassword.PasswordChar = '*'; - this.txtPassword.Size = new System.Drawing.Size(133, 20); - this.txtPassword.TabIndex = 0; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(159, 17); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(58, 13); - this.label1.TabIndex = 1; - this.label1.Text = "Last Name"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(20, 17); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(57, 13); - this.label2.TabIndex = 1; - this.label2.Text = "First Name"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(298, 17); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(53, 13); - this.label3.TabIndex = 1; - this.label3.Text = "Password"; - // - // btnLogin - // - this.btnLogin.Location = new System.Drawing.Point(305, 61); - this.btnLogin.Name = "btnLogin"; - this.btnLogin.Size = new System.Drawing.Size(128, 29); - this.btnLogin.TabIndex = 2; - this.btnLogin.Text = "Login"; - this.btnLogin.UseVisualStyleBackColor = true; - this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); - // - // btnPlay - // - this.btnPlay.Location = new System.Drawing.Point(162, 131); - this.btnPlay.Name = "btnPlay"; - this.btnPlay.Size = new System.Drawing.Size(133, 42); - this.btnPlay.TabIndex = 3; - this.btnPlay.Text = "Play \"dance1\" animation"; - this.btnPlay.UseVisualStyleBackColor = true; - this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(464, 196); - this.Controls.Add(this.btnPlay); - this.Controls.Add(this.btnLogin); - this.Controls.Add(this.label2); - this.Controls.Add(this.label3); - this.Controls.Add(this.label1); - this.Controls.Add(this.txtPassword); - this.Controls.Add(this.txtFirst); - this.Controls.Add(this.txtLast); - this.Name = "Form1"; - this.Text = "LibSL Animation Example"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TextBox txtLast; - private System.Windows.Forms.TextBox txtFirst; - private System.Windows.Forms.TextBox txtPassword; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Button btnLogin; - private System.Windows.Forms.Button btnPlay; - } -} - +namespace AnimationSample +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + try + { + client.Network.Logout(); + } + catch + { + //ignore + } + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.txtLast = new System.Windows.Forms.TextBox(); + this.txtFirst = new System.Windows.Forms.TextBox(); + this.txtPassword = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.btnLogin = new System.Windows.Forms.Button(); + this.btnPlay = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txtLast + // + this.txtLast.Location = new System.Drawing.Point(162, 33); + this.txtLast.Name = "txtLast"; + this.txtLast.Size = new System.Drawing.Size(133, 20); + this.txtLast.TabIndex = 0; + this.txtLast.Text = "Malthus"; + // + // txtFirst + // + this.txtFirst.Location = new System.Drawing.Point(23, 33); + this.txtFirst.Name = "txtFirst"; + this.txtFirst.Size = new System.Drawing.Size(133, 20); + this.txtFirst.TabIndex = 0; + this.txtFirst.Text = "Jesse"; + // + // txtPassword + // + this.txtPassword.Location = new System.Drawing.Point(301, 33); + this.txtPassword.Name = "txtPassword"; + this.txtPassword.PasswordChar = '*'; + this.txtPassword.Size = new System.Drawing.Size(133, 20); + this.txtPassword.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(159, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 1; + this.label1.Text = "Last Name"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(20, 17); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(57, 13); + this.label2.TabIndex = 1; + this.label2.Text = "First Name"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(298, 17); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(53, 13); + this.label3.TabIndex = 1; + this.label3.Text = "Password"; + // + // btnLogin + // + this.btnLogin.Location = new System.Drawing.Point(305, 61); + this.btnLogin.Name = "btnLogin"; + this.btnLogin.Size = new System.Drawing.Size(128, 29); + this.btnLogin.TabIndex = 2; + this.btnLogin.Text = "Login"; + this.btnLogin.UseVisualStyleBackColor = true; + this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click); + // + // btnPlay + // + this.btnPlay.Location = new System.Drawing.Point(162, 131); + this.btnPlay.Name = "btnPlay"; + this.btnPlay.Size = new System.Drawing.Size(133, 42); + this.btnPlay.TabIndex = 3; + this.btnPlay.Text = "Play \"dance1\" animation"; + this.btnPlay.UseVisualStyleBackColor = true; + this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(464, 196); + this.Controls.Add(this.btnPlay); + this.Controls.Add(this.btnLogin); + this.Controls.Add(this.label2); + this.Controls.Add(this.label3); + this.Controls.Add(this.label1); + this.Controls.Add(this.txtPassword); + this.Controls.Add(this.txtFirst); + this.Controls.Add(this.txtLast); + this.Name = "Form1"; + this.Text = "LibSL Animation Example"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txtLast; + private System.Windows.Forms.TextBox txtFirst; + private System.Windows.Forms.TextBox txtPassword; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button btnLogin; + private System.Windows.Forms.Button btnPlay; + } +} + diff --git a/libsecondlife-cs/examples/AnimationSample/Form1.cs b/libsecondlife-cs/examples/AnimationSample/AnimationSample.cs similarity index 92% rename from libsecondlife-cs/examples/AnimationSample/Form1.cs rename to libsecondlife-cs/examples/AnimationSample/AnimationSample.cs index 55c5836b..1d13d835 100644 --- a/libsecondlife-cs/examples/AnimationSample/Form1.cs +++ b/libsecondlife-cs/examples/AnimationSample/AnimationSample.cs @@ -1,71 +1,71 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using libsecondlife; -using libsecondlife.Packets; -using System.Collections; - -namespace AnimationSample -{ - public partial class Form1 : Form - { - SecondLife client; - public Form1() - { - InitializeComponent(); - //Create the SecondLife client object - client = new SecondLife(); - - } - - private void btnPlay_Click(object sender, EventArgs e) - { - //Build an animation packet - AgentAnimationPacket packet = new AgentAnimationPacket(); - - //create an AgentData block - AgentAnimationPacket.AgentDataBlock agentdata = new AgentAnimationPacket.AgentDataBlock(); - //Fill in its values - agentdata.AgentID = client.Avatar.ID; - agentdata.SessionID = client.Network.SessionID; - //Add it in the packet - packet.AgentData = agentdata; - - //Create an AnimationList block - AgentAnimationPacket.AnimationListBlock anims = new AgentAnimationPacket.AnimationListBlock(); - //Set the UUID of the animation to avatar_dance1.bvh, a standard animation - anims.AnimID = new LLUUID("b68a3d7c-de9e-fc87-eec8-543d787e5b0d"); - //Start the animation - anims.StartAnim = true; - //Add it to the packet. SInce it's a Variable number block, we have to construct an array. - packet.AnimationList = new AgentAnimationPacket.AnimationListBlock[] { anims }; - - //Send the packet - client.Network.SendPacket(packet); - } - - private void btnLogin_Click(object sender, EventArgs e) - { - //Login information - Dictionary loginParams = NetworkManager.DefaultLoginValues(txtFirst.Text, txtLast.Text, txtPassword.Text, "00:00:00:00:00:00", - "last", 1, 12, 12, 12, "Win", "0", "animationsample", "jessemalthus@gmail.com"); - Hashtable loginReply = new Hashtable(); - - // Login - if (!client.Network.Login(loginParams)) - { - // Login failed - MessageBox.Show("We're sorry, but login failed. Error: \n " + client.Network.LoginError); - - } - else - { - MessageBox.Show("Login succeded. You're at " + client.Avatar.Position + " on " + client.Network.CurrentSim.Region.Name); - } - } - } +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using libsecondlife; +using libsecondlife.Packets; +using System.Collections; + +namespace AnimationSample +{ + public partial class Form1 : Form + { + SecondLife client; + public Form1() + { + InitializeComponent(); + //Create the SecondLife client object + client = new SecondLife(); + + } + + private void btnPlay_Click(object sender, EventArgs e) + { + //Build an animation packet + AgentAnimationPacket packet = new AgentAnimationPacket(); + + //create an AgentData block + AgentAnimationPacket.AgentDataBlock agentdata = new AgentAnimationPacket.AgentDataBlock(); + //Fill in its values + agentdata.AgentID = client.Self.ID; + agentdata.SessionID = client.Network.SessionID; + //Add it in the packet + packet.AgentData = agentdata; + + //Create an AnimationList block + AgentAnimationPacket.AnimationListBlock anims = new AgentAnimationPacket.AnimationListBlock(); + //Set the UUID of the animation to avatar_dance1.bvh, a standard animation + anims.AnimID = new LLUUID("b68a3d7c-de9e-fc87-eec8-543d787e5b0d"); + //Start the animation + anims.StartAnim = true; + //Add it to the packet. SInce it's a Variable number block, we have to construct an array. + packet.AnimationList = new AgentAnimationPacket.AnimationListBlock[] { anims }; + + //Send the packet + client.Network.SendPacket(packet); + } + + private void btnLogin_Click(object sender, EventArgs e) + { + //Login information + Dictionary loginParams = NetworkManager.DefaultLoginValues(txtFirst.Text, txtLast.Text, txtPassword.Text, "00:00:00:00:00:00", + "last", 1, 12, 12, 12, "Win", "0", "animationsample", "jessemalthus@gmail.com"); + Hashtable loginReply = new Hashtable(); + + // Login + if (!client.Network.Login(loginParams)) + { + // Login failed + MessageBox.Show("We're sorry, but login failed. Error: \n " + client.Network.LoginError); + + } + else + { + MessageBox.Show("Login succeded. You're at " + client.Self.Position + " on " + client.Network.CurrentSim.Region.Name); + } + } + } } \ No newline at end of file diff --git a/libsecondlife-cs/examples/AnimationSample/AnimationSample.csproj b/libsecondlife-cs/examples/AnimationSample/AnimationSample.csproj index 258e8b22..fd1083df 100644 --- a/libsecondlife-cs/examples/AnimationSample/AnimationSample.csproj +++ b/libsecondlife-cs/examples/AnimationSample/AnimationSample.csproj @@ -14,7 +14,7 @@ true full false - bin\Debug\ + ..\..\..\bin\ DEBUG;TRACE prompt 4 @@ -36,17 +36,17 @@ - + Form - - Form1.cs + + AnimationSample.cs - + Designer - Form1.cs + AnimationSample.cs ResXFileCodeGenerator diff --git a/libsecondlife-cs/examples/AnimationSample/Form1.resx b/libsecondlife-cs/examples/AnimationSample/AnimationSample.resx similarity index 97% rename from libsecondlife-cs/examples/AnimationSample/Form1.resx rename to libsecondlife-cs/examples/AnimationSample/AnimationSample.resx index 19dc0dd8..ff31a6db 100644 --- a/libsecondlife-cs/examples/AnimationSample/Form1.resx +++ b/libsecondlife-cs/examples/AnimationSample/AnimationSample.resx @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/libsecondlife-cs/examples/IA_SimpleInventory/IA_SimpleInventory.cs b/libsecondlife-cs/examples/IA_SimpleInventory/IA_SimpleInventory.cs index 8830ac0c..e5d639c1 100644 --- a/libsecondlife-cs/examples/IA_SimpleInventory/IA_SimpleInventory.cs +++ b/libsecondlife-cs/examples/IA_SimpleInventory/IA_SimpleInventory.cs @@ -120,7 +120,7 @@ namespace IA_SimpleInventory protected void doStuff() { - Console.WriteLine("Dumping a copy of " + client.Avatar.FirstName + "'s inventory to the console."); + Console.WriteLine("Dumping a copy of " + client.Self.FirstName + "'s inventory to the console."); Console.WriteLine(); Console.WriteLine(AgentInventory.getRootFolder().toXML(false)); diff --git a/libsecondlife-cs/examples/Teleport/Teleport.cs b/libsecondlife-cs/examples/Teleport/Teleport.cs index aa161199..203f1fe7 100644 --- a/libsecondlife-cs/examples/Teleport/Teleport.cs +++ b/libsecondlife-cs/examples/Teleport/Teleport.cs @@ -116,10 +116,10 @@ namespace Teleport Console.WriteLine(); Console.WriteLine("Okay, hopefully all the initial connect stuff is done, trying now..."); - client.Avatar.OnTeleport += new TeleportCallback(Avatar_OnTeleportMessage); + client.Self.OnTeleport += new TeleportCallback(Avatar_OnTeleportMessage); DoneTeleporting = false; - client.Avatar.Teleport(sim, coords); + client.Self.Teleport(sim, coords); while (!DoneTeleporting) { diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs index d30d5317..76c995d6 100644 --- a/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs +++ b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.Designer.cs @@ -32,22 +32,19 @@ namespace groupmanager this.lblGroupName = new System.Windows.Forms.Label(); this.lblFoundedBy = new System.Windows.Forms.Label(); this.txtCharter = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); this.lstMembers = new System.Windows.Forms.ListView(); this.colName = new System.Windows.Forms.ColumnHeader(); this.colTitle = new System.Windows.Forms.ColumnHeader(); this.colLasLogin = new System.Windows.Forms.ColumnHeader(); - this.label3 = new System.Windows.Forms.Label(); this.grpPreferences = new System.Windows.Forms.GroupBox(); - this.chkShow = new System.Windows.Forms.CheckBox(); - this.chkPublish = new System.Windows.Forms.CheckBox(); - this.chkOpenEnrollment = new System.Windows.Forms.CheckBox(); - this.chkFee = new System.Windows.Forms.CheckBox(); - this.chkGroupNotices = new System.Windows.Forms.CheckBox(); - this.numFee = new System.Windows.Forms.NumericUpDown(); - this.chkMature = new System.Windows.Forms.CheckBox(); this.lblMemberTitle = new System.Windows.Forms.Label(); + this.chkMature = new System.Windows.Forms.CheckBox(); + this.numFee = new System.Windows.Forms.NumericUpDown(); + this.chkGroupNotices = new System.Windows.Forms.CheckBox(); + this.chkFee = new System.Windows.Forms.CheckBox(); + this.chkOpenEnrollment = new System.Windows.Forms.CheckBox(); + this.chkPublish = new System.Windows.Forms.CheckBox(); + this.chkShow = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.picInsignia)).BeginInit(); this.grpPreferences.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numFee)).BeginInit(); @@ -55,6 +52,7 @@ namespace groupmanager // // picInsignia // + this.picInsignia.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.picInsignia.Location = new System.Drawing.Point(12, 51); this.picInsignia.Name = "picInsignia"; this.picInsignia.Size = new System.Drawing.Size(150, 150); @@ -89,24 +87,6 @@ namespace groupmanager this.txtCharter.Size = new System.Drawing.Size(316, 221); this.txtCharter.TabIndex = 3; // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(420, 31); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); - this.label1.TabIndex = 4; - this.label1.Text = "Group Charter"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 280); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(143, 13); - this.label2.TabIndex = 5; - this.label2.Text = "Owners and Visible Members"; - // // lstMembers // this.lstMembers.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { @@ -135,15 +115,6 @@ namespace groupmanager this.colLasLogin.Text = "Last Login"; this.colLasLogin.Width = 121; // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 205); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(75, 13); - this.label3.TabIndex = 7; - this.label3.Text = "Group Insignia"; - // // grpPreferences // this.grpPreferences.Controls.Add(this.lblMemberTitle); @@ -161,62 +132,14 @@ namespace groupmanager this.grpPreferences.TabStop = false; this.grpPreferences.Text = "Group Preferences"; // - // chkShow + // lblMemberTitle // - this.chkShow.AutoSize = true; - this.chkShow.Location = new System.Drawing.Point(16, 19); - this.chkShow.Name = "chkShow"; - this.chkShow.Size = new System.Drawing.Size(116, 17); - this.chkShow.TabIndex = 0; - this.chkShow.Text = "Show In Group List"; - this.chkShow.UseVisualStyleBackColor = true; - // - // chkPublish - // - this.chkPublish.AutoSize = true; - this.chkPublish.Location = new System.Drawing.Point(16, 42); - this.chkPublish.Name = "chkPublish"; - this.chkPublish.Size = new System.Drawing.Size(116, 17); - this.chkPublish.TabIndex = 1; - this.chkPublish.Text = "Publish on the web"; - this.chkPublish.UseVisualStyleBackColor = true; - // - // chkOpenEnrollment - // - this.chkOpenEnrollment.AutoSize = true; - this.chkOpenEnrollment.Location = new System.Drawing.Point(16, 65); - this.chkOpenEnrollment.Name = "chkOpenEnrollment"; - this.chkOpenEnrollment.Size = new System.Drawing.Size(104, 17); - this.chkOpenEnrollment.TabIndex = 2; - this.chkOpenEnrollment.Text = "Open Enrollment"; - this.chkOpenEnrollment.UseVisualStyleBackColor = true; - // - // chkFee - // - this.chkFee.AutoSize = true; - this.chkFee.Location = new System.Drawing.Point(36, 88); - this.chkFee.Name = "chkFee"; - this.chkFee.Size = new System.Drawing.Size(114, 17); - this.chkFee.TabIndex = 3; - this.chkFee.Text = "Enrollment Fee: L$"; - this.chkFee.UseVisualStyleBackColor = true; - // - // chkGroupNotices - // - this.chkGroupNotices.AutoSize = true; - this.chkGroupNotices.Location = new System.Drawing.Point(312, 87); - this.chkGroupNotices.Name = "chkGroupNotices"; - this.chkGroupNotices.Size = new System.Drawing.Size(137, 17); - this.chkGroupNotices.TabIndex = 4; - this.chkGroupNotices.Text = "Receive Group Notices"; - this.chkGroupNotices.UseVisualStyleBackColor = true; - // - // numFee - // - this.numFee.Location = new System.Drawing.Point(162, 87); - this.numFee.Name = "numFee"; - this.numFee.Size = new System.Drawing.Size(144, 20); - this.numFee.TabIndex = 5; + this.lblMemberTitle.AutoSize = true; + this.lblMemberTitle.Location = new System.Drawing.Point(162, 43); + this.lblMemberTitle.Name = "lblMemberTitle"; + this.lblMemberTitle.Size = new System.Drawing.Size(68, 13); + this.lblMemberTitle.TabIndex = 7; + this.lblMemberTitle.Text = "Member Title"; // // chkMature // @@ -228,14 +151,62 @@ namespace groupmanager this.chkMature.Text = "Mature publish"; this.chkMature.UseVisualStyleBackColor = true; // - // lblMemberTitle + // numFee // - this.lblMemberTitle.AutoSize = true; - this.lblMemberTitle.Location = new System.Drawing.Point(162, 43); - this.lblMemberTitle.Name = "lblMemberTitle"; - this.lblMemberTitle.Size = new System.Drawing.Size(68, 13); - this.lblMemberTitle.TabIndex = 7; - this.lblMemberTitle.Text = "Member Title"; + this.numFee.Location = new System.Drawing.Point(162, 87); + this.numFee.Name = "numFee"; + this.numFee.Size = new System.Drawing.Size(144, 20); + this.numFee.TabIndex = 5; + // + // chkGroupNotices + // + this.chkGroupNotices.AutoSize = true; + this.chkGroupNotices.Location = new System.Drawing.Point(312, 87); + this.chkGroupNotices.Name = "chkGroupNotices"; + this.chkGroupNotices.Size = new System.Drawing.Size(137, 17); + this.chkGroupNotices.TabIndex = 4; + this.chkGroupNotices.Text = "Receive Group Notices"; + this.chkGroupNotices.UseVisualStyleBackColor = true; + // + // chkFee + // + this.chkFee.AutoSize = true; + this.chkFee.Location = new System.Drawing.Point(36, 88); + this.chkFee.Name = "chkFee"; + this.chkFee.Size = new System.Drawing.Size(114, 17); + this.chkFee.TabIndex = 3; + this.chkFee.Text = "Enrollment Fee: L$"; + this.chkFee.UseVisualStyleBackColor = true; + // + // chkOpenEnrollment + // + this.chkOpenEnrollment.AutoSize = true; + this.chkOpenEnrollment.Location = new System.Drawing.Point(16, 65); + this.chkOpenEnrollment.Name = "chkOpenEnrollment"; + this.chkOpenEnrollment.Size = new System.Drawing.Size(104, 17); + this.chkOpenEnrollment.TabIndex = 2; + this.chkOpenEnrollment.Text = "Open Enrollment"; + this.chkOpenEnrollment.UseVisualStyleBackColor = true; + // + // chkPublish + // + this.chkPublish.AutoSize = true; + this.chkPublish.Location = new System.Drawing.Point(16, 42); + this.chkPublish.Name = "chkPublish"; + this.chkPublish.Size = new System.Drawing.Size(116, 17); + this.chkPublish.TabIndex = 1; + this.chkPublish.Text = "Publish on the web"; + this.chkPublish.UseVisualStyleBackColor = true; + // + // chkShow + // + this.chkShow.AutoSize = true; + this.chkShow.Location = new System.Drawing.Point(16, 19); + this.chkShow.Name = "chkShow"; + this.chkShow.Size = new System.Drawing.Size(116, 17); + this.chkShow.TabIndex = 0; + this.chkShow.Text = "Show In Group List"; + this.chkShow.UseVisualStyleBackColor = true; // // frmGroupInfo // @@ -243,10 +214,7 @@ namespace groupmanager this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(505, 562); this.Controls.Add(this.grpPreferences); - this.Controls.Add(this.label3); this.Controls.Add(this.lstMembers); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); this.Controls.Add(this.txtCharter); this.Controls.Add(this.lblFoundedBy); this.Controls.Add(this.lblGroupName); @@ -273,13 +241,10 @@ namespace groupmanager private System.Windows.Forms.Label lblGroupName; private System.Windows.Forms.Label lblFoundedBy; private System.Windows.Forms.TextBox txtCharter; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; private System.Windows.Forms.ListView lstMembers; private System.Windows.Forms.ColumnHeader colName; private System.Windows.Forms.ColumnHeader colTitle; private System.Windows.Forms.ColumnHeader colLasLogin; - private System.Windows.Forms.Label label3; private System.Windows.Forms.GroupBox grpPreferences; private System.Windows.Forms.CheckBox chkPublish; private System.Windows.Forms.CheckBox chkShow; diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs index 7dd4d036..791deeab 100644 --- a/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs +++ b/libsecondlife-cs/examples/groupmanager/frmGroupInfo.cs @@ -11,6 +11,16 @@ using libsecondlife.AssetSystem; namespace groupmanager { + public class GroupMemberData + { + public LLUUID ID; + public string Name; + public string Title; + public string LastOnline; + public ulong Powers; + public bool IsOwner; + } + public partial class frmGroupInfo : Form { Group Group; @@ -18,11 +28,16 @@ namespace groupmanager GroupProfile Profile; Dictionary Members; Dictionary Titles; + Dictionary MemberData; + Dictionary Names; public frmGroupInfo(Group group, SecondLife client) { Group = group; Client = client; + Profile = new GroupProfile(); + MemberData = new Dictionary(); + Names = new Dictionary(); InitializeComponent(); } @@ -61,7 +76,6 @@ namespace groupmanager private void UpdateProfile() { lblGroupName.Text = Profile.Name; - lblFoundedBy.Text = "Founded by " + Profile.FounderID.ToStringHyphenated(); txtCharter.Text = Profile.Charter; chkShow.Checked = Profile.ShowInList; chkPublish.Checked = Profile.AllowPublish; @@ -70,6 +84,74 @@ namespace groupmanager numFee.Value = Profile.MembershipFee; chkMature.Checked = Profile.MaturePublish; lblMemberTitle.Text = Profile.MemberTitle; + + Client.Avatars.BeginGetAvatarName(Profile.FounderID, new AgentNamesCallback(AgentNamesHandler)); + } + + private void AgentNamesHandler(Dictionary names) + { + lock (Names) + { + foreach (KeyValuePair agent in names) + { + Names[agent.Key] = agent.Value; + } + } + + Invoke(new MethodInvoker(UpdateNames)); + } + + private void UpdateNames() + { + GroupMemberData member; + + lock (Names) + { + if (Profile.FounderID != null && Names.ContainsKey(Profile.FounderID)) + { + lblFoundedBy.Text = "Founded by " + Names[Profile.FounderID]; + } + + lock (MemberData) + { + foreach (KeyValuePair name in Names) + { + if (!MemberData.ContainsKey(name.Key)) + { + MemberData[name.Key] = new GroupMemberData(); + } + + member = MemberData[name.Key]; + member.Name = name.Value; + } + } + } + + UpdateMemberList(); + } + + private void UpdateMemberList() + { + lock (lstMembers) + { + lstMembers.Items.Clear(); + + foreach (GroupMemberData entry in MemberData.Values) + { + ListViewItem lvi = new ListViewItem(); + lvi.Text = entry.Name; + + ListViewItem.ListViewSubItem lvsi = new ListViewItem.ListViewSubItem(); + lvsi.Text = entry.Title; + lvi.SubItems.Add(lvsi); + + lvsi = new ListViewItem.ListViewSubItem(); + lvsi.Text = entry.LastOnline; + lvi.SubItems.Add(lvsi); + + lstMembers.Items.Add(lvi); + } + } } private void GroupMembersHandler(Dictionary members) @@ -81,7 +163,30 @@ namespace groupmanager private void UpdateMembers() { - ; + List requestids = new List(); + + lock (Members) + { + lock (MemberData) + { + foreach (GroupMember member in Members.Values) + { + GroupMemberData memberData = new GroupMemberData(); + memberData.ID = member.ID; + memberData.IsOwner = member.IsOwner; + memberData.LastOnline = member.OnlineStatus; + memberData.Powers = member.Powers; + memberData.Title = member.Title; + + MemberData[member.ID] = memberData; + + // Add this ID to the name request batch + requestids.Add(member.ID); + } + } + } + + Client.Avatars.BeginGetAvatarNames(requestids, new AgentNamesCallback(AgentNamesHandler)); } private void GroupTitlesHandler(Dictionary titles) diff --git a/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs b/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs index 8a542627..1956f116 100644 --- a/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs +++ b/libsecondlife-cs/examples/groupmanager/frmGroupManager.cs @@ -102,7 +102,7 @@ namespace groupmanager private void cmdInfo_Click(object sender, EventArgs e) { - if (lstGroups.Items[lstGroups.SelectedIndex].ToString() != "none") + if (lstGroups.SelectedIndex >= 0 && lstGroups.Items[lstGroups.SelectedIndex].ToString() != "none") { Group group = (Group)lstGroups.Items[lstGroups.SelectedIndex]; diff --git a/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs b/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs index 4c99feee..fd397d70 100644 --- a/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs +++ b/libsecondlife-cs/examples/slaccountant/frmSLAccountant.cs @@ -411,7 +411,7 @@ namespace SLAccountant lblName.Text = client.Network.LoginValues["first_name"] + " " + client.Network.LoginValues["last_name"]; - client.Avatar.SetHeightWidth((ushort)rand.Next(0, 65535), (ushort)rand.Next(0, 65535)); + client.Self.SetHeightWidth((ushort)rand.Next(0, 65535), (ushort)rand.Next(0, 65535)); // AgentSetAppearance AgentSetAppearancePacket appearance = new AgentSetAppearancePacket(); @@ -491,8 +491,8 @@ namespace SLAccountant return; } - client.Avatar.GiveMoney(new LLUUID(lstFind.SelectedItems[0].SubItems[2].Text), - amount, "SLAccountant payment"); + client.Self.GiveMoney(new LLUUID(lstFind.SelectedItems[0].SubItems[2].Text), + amount, "SLAccountant payment"); } } } diff --git a/libsecondlife-cs/libsecondlife.csproj b/libsecondlife-cs/libsecondlife.csproj index 447840fc..9fd8b433 100644 --- a/libsecondlife-cs/libsecondlife.csproj +++ b/libsecondlife-cs/libsecondlife.csproj @@ -101,6 +101,7 @@ Code + Code