void Avatars_OnAvatarProperties(UUID avatarID, Avatar.AvatarProperties properties) { lock (ReceivedProfileEvent) { Properties = properties; ReceivedProperties = true; if (ReceivedInterests && ReceivedProperties && ReceivedGroups) ReceivedProfileEvent.Set(); } }
/// <summary> /// Process incoming avatar properties (profile data) /// </summary> /// <param name="packet"></param> /// <param name="sim"></param> private void AvatarPropertiesHandler(Packet packet, Simulator sim) { if (OnAvatarProperties != null) { AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; Avatar.AvatarProperties properties = new Avatar.AvatarProperties(); properties.ProfileImage = reply.PropertiesData.ImageID; properties.FirstLifeImage = reply.PropertiesData.FLImageID; properties.Partner = reply.PropertiesData.PartnerID; properties.AboutText = Utils.BytesToString(reply.PropertiesData.AboutText); properties.FirstLifeText = Utils.BytesToString(reply.PropertiesData.FLAboutText); properties.BornOn = Utils.BytesToString(reply.PropertiesData.BornOn); //properties.CharterMember = Utils.BytesToString(reply.PropertiesData.CharterMember); uint charter = Utils.BytesToUInt(reply.PropertiesData.CharterMember); if (charter == 0) { properties.CharterMember = "Resident"; } else if (charter == 2) { properties.CharterMember = "Charter"; } else if (charter == 3) { properties.CharterMember = "Linden"; } else { properties.CharterMember = Utils.BytesToString(reply.PropertiesData.CharterMember); } properties.Flags = (ProfileFlags)reply.PropertiesData.Flags; properties.ProfileURL = Utils.BytesToString(reply.PropertiesData.ProfileURL); OnAvatarProperties(reply.AgentData.AvatarID, properties); } }
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e) { if (e.AvatarID != agentID) return; if (InvokeRequired) { Invoke(new MethodInvoker(() => Avatars_AvatarPropertiesReply(sender, e))); return; } Profile = e.Properties; FLImageID = e.Properties.FirstLifeImage; SLImageID = e.Properties.ProfileImage; if (agentID == client.Self.AgentID || SLImageID != UUID.Zero) { SLImageHandler pic = new SLImageHandler(instance, SLImageID, ""); if (agentID == client.Self.AgentID) { pic.AllowUpdateImage = true; pic.ImageUpdated += (usender, ue) => { Profile.ProfileImage = ue.NewImageID; pic.UpdateImage(ue.NewImageID); client.Self.UpdateProfile(Profile); }; } pic.Dock = DockStyle.Fill; pic.SizeMode = PictureBoxSizeMode.StretchImage; slPicPanel.Controls.Add(pic); slPicPanel.Show(); } else { slPicPanel.Hide(); } if (agentID == client.Self.AgentID || FLImageID != UUID.Zero) { SLImageHandler pic = new SLImageHandler(instance, FLImageID, ""); pic.Dock = DockStyle.Fill; if (agentID == client.Self.AgentID) { pic.AllowUpdateImage = true; pic.ImageUpdated += (usender, ue) => { Profile.FirstLifeImage = ue.NewImageID; pic.UpdateImage(ue.NewImageID); client.Self.UpdateProfile(Profile); }; } rlPicPanel.Controls.Add(pic); rlPicPanel.Show(); } else { rlPicPanel.Hide(); } this.BeginInvoke( new OnSetProfileProperties(SetProfileProperties), new object[] { e.Properties }); }
public AvatarPropertiesReplyEventArgs(UUID avatarID, Avatar.AvatarProperties properties) { this.m_AvatarID = avatarID; this.m_Properties = properties; }
/// <summary>Process an incoming packet and raise the appropriate events</summary> /// <param name="sender">The sender</param> /// <param name="e">The EventArgs object containing the packet data</param> protected void AvatarPropertiesHandler(object sender, PacketReceivedEventArgs e) { if (m_AvatarPropertiesReply != null) { Packet packet = e.Packet; AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; Avatar.AvatarProperties properties = new Avatar.AvatarProperties(); properties.ProfileImage = reply.PropertiesData.ImageID; properties.FirstLifeImage = reply.PropertiesData.FLImageID; properties.Partner = reply.PropertiesData.PartnerID; properties.AboutText = Utils.BytesToString(reply.PropertiesData.AboutText); properties.FirstLifeText = Utils.BytesToString(reply.PropertiesData.FLAboutText); properties.BornOn = Utils.BytesToString(reply.PropertiesData.BornOn); //properties.CharterMember = Utils.BytesToString(reply.PropertiesData.CharterMember); uint charter = Utils.BytesToUInt(reply.PropertiesData.CharterMember); if (charter == 0) { properties.CharterMember = "Resident"; } else if (charter == 2) { properties.CharterMember = "Charter"; } else if (charter == 3) { properties.CharterMember = "Linden"; } else { properties.CharterMember = Utils.BytesToString(reply.PropertiesData.CharterMember); } properties.Flags = (ProfileFlags)reply.PropertiesData.Flags; properties.ProfileURL = Utils.BytesToString(reply.PropertiesData.ProfileURL); OnAvatarPropertiesReply(new AvatarPropertiesReplyEventArgs(reply.AgentData.AvatarID, properties)); } }
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e) { if (e.AvatarID == Client.Self.AgentID) { MyProfile = e.Properties; Alice.GlobalSettings.updateSetting("birthday", MyProfile.BornOn); DateTime bd; if (DateTime.TryParse(MyProfile.BornOn, Utils.EnUsCulture, System.Globalization.DateTimeStyles.None, out bd)) { DateTime now = DateTime.Today; int age = now.Year - bd.Year; if (now.Month < bd.Month || (now.Month == bd.Month && now.Day < bd.Day)) { --age; } Alice.GlobalSettings.updateSetting("age", age.ToString()); Alice.GlobalSettings.updateSetting("birthday", bd.ToLongDateString()); } } }
/// <summary> /// Process incoming avatar properties (profile data) /// </summary> /// <param name="packet"></param> /// <param name="sim"></param> private void AvatarPropertiesHandler(Packet packet, Simulator sim) { if (OnAvatarProperties != null) { AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; Avatar.AvatarProperties properties = new Avatar.AvatarProperties(); properties.ProfileImage = reply.PropertiesData.ImageID; properties.FirstLifeImage = reply.PropertiesData.FLImageID; properties.Partner = reply.PropertiesData.PartnerID; properties.AboutText = Utils.BytesToString(reply.PropertiesData.AboutText); properties.FirstLifeText = Utils.BytesToString(reply.PropertiesData.FLAboutText); properties.BornOn = Utils.BytesToString(reply.PropertiesData.BornOn); //properties.CharterMember = Utils.BytesToString(reply.PropertiesData.CharterMember); uint charter = Utils.BytesToUInt(reply.PropertiesData.CharterMember); if ( charter == 0 ) { properties.CharterMember = "Resident"; } else if ( charter == 2 ) { properties.CharterMember = "Charter"; } else if ( charter == 3 ) { properties.CharterMember = "Linden"; } else { properties.CharterMember = Utils.BytesToString(reply.PropertiesData.CharterMember); } properties.Flags = (ProfileFlags)reply.PropertiesData.Flags; properties.ProfileURL = Utils.BytesToString(reply.PropertiesData.ProfileURL); OnAvatarProperties(reply.AgentData.AvatarID, properties); } }
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e) { if (e.AvatarID != agentID) return; if (InvokeRequired) { Invoke(new MethodInvoker(() => Avatars_AvatarPropertiesReply(sender, e))); return; } Profile = e.Properties; FLImageID = e.Properties.FirstLifeImage; SLImageID = e.Properties.ProfileImage; if (SLImageID != UUID.Zero) { SLImageHandler pic = new SLImageHandler(instance, SLImageID, ""); pic.Dock = DockStyle.Fill; pic.SizeMode = PictureBoxSizeMode.StretchImage; slPicPanel.Controls.Add(pic); slPicPanel.Show(); } else { slPicPanel.Hide(); } if (FLImageID != UUID.Zero) { SLImageHandler pic = new SLImageHandler(instance, FLImageID, ""); pic.Dock = DockStyle.Fill; rlPicPanel.Controls.Add(pic); rlPicPanel.Show(); } else { rlPicPanel.Hide(); } this.BeginInvoke( new OnSetProfileProperties(SetProfileProperties), new object[] { e.Properties }); }
//comes in on separate thread private void Avatars_OnAvatarProperties(object sender, AvatarPropertiesReplyEventArgs e) { if (InvokeRequired) { Invoke(new MethodInvoker(() => Avatars_OnAvatarProperties(sender, e))); return; } if (e.AvatarID != agentID) return; props = e.Properties; FLImageID = props.FirstLifeImage; SLImageID = props.ProfileImage; if (instance.avtags.ContainsKey(e.AvatarID)) { try { string atag = instance.avtags[e.AvatarID]; txtTag.Text = atag; } catch { ; } } else { txtTag.Text = "avatar out of range"; } if (SLImageID != UUID.Zero) { if (!instance.ImageCache.ContainsImage(SLImageID)) client.Assets.RequestImage(SLImageID, ImageType.Normal, Assets_OnImageReceived); else BeginInvoke( new OnSetProfileImage(SetProfileImage), new object[] { SLImageID, instance.ImageCache.GetImage(SLImageID) }); } else { BeginInvoke(new MethodInvoker(SetBlankSLImage)); } if (FLImageID != UUID.Zero) { if (!instance.ImageCache.ContainsImage(FLImageID)) client.Assets.RequestImage(FLImageID, ImageType.Normal, Assets_OnImageReceived); else BeginInvoke( new OnSetProfileImage(SetProfileImage), new object[] { FLImageID, instance.ImageCache.GetImage(FLImageID) }); } else { BeginInvoke(new MethodInvoker(SetBlankFLImage)); } this.BeginInvoke( new OnSetProfileProperties(SetProfileProperties), new object[] { props }); }
// updated for new callbacks public void AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e) { /* AvatarPropertiesReplyPacket reply = (AvatarPropertiesReplyPacket)packet; bool status = false; if ( (reply.PropertiesData.Flags & 1 << 4 ) != 0 ) { status = true; } else { status = false; } */ Avatar.AvatarProperties Properties = new Avatar.AvatarProperties(); Properties = e.Properties; DebugUtilities.WriteInfo(session + " " + MethodName + " Processing AvatarPropertiesReply for " + e.AvatarID.ToString() + " is " + Properties.Online.ToString()); lock ( avatarOnline ) { avatarOnline[e.AvatarID] = Properties.Online; } if ( OnlineLookupEvents.ContainsKey(e.AvatarID) ) { OnlineLookupEvents[e.AvatarID].Set(); } }
private void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e) { if (e.AvatarID != targetID) return; lock (ReceivedProfileEvent) { Properties = e.Properties; ReceivedProperties = true; if (ReceivedInterests && ReceivedProperties && ReceivedGroups) ReceivedProfileEvent.Set(); } }
void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e) { lock (ReceivedProfileEvent) { Properties = e.Properties; ReceivedProperties = true; if (ReceivedInterests && ReceivedProperties && ReceivedGroups) ReceivedProfileEvent.Set(); } }