diff --git a/LibreMetaverse.GUI/AvatarList.cs b/LibreMetaverse.GUI/AvatarList.cs index bebe5fc4..8fb8c1c8 100644 --- a/LibreMetaverse.GUI/AvatarList.cs +++ b/LibreMetaverse.GUI/AvatarList.cs @@ -41,7 +41,6 @@ namespace OpenMetaverse.GUI { private GridClient _Client; private ListColumnSorter _ColumnSorter = new ListColumnSorter(); - private TrackedAvatar _SelectedAvatar; private DoubleDictionary _TrackedAvatars = new DoubleDictionary(); private Dictionary _UntrackedAvatars = new Dictionary(); @@ -75,10 +74,7 @@ namespace OpenMetaverse.GUI /// /// Returns the current selected avatar in the tracked avatars list /// - public TrackedAvatar SelectedAvatar - { - get { return _SelectedAvatar; } - } + public TrackedAvatar SelectedAvatar { get; private set; } /// /// TreeView control for an unspecified client's nearby avatar list @@ -124,7 +120,7 @@ namespace OpenMetaverse.GUI if (!_TrackedAvatars.TryGetValue(selectedID, out selectedAV) && !_UntrackedAvatars.TryGetValue(selectedID, out selectedAV)) selectedAV = null; - _SelectedAvatar = selectedAV; + SelectedAvatar = selectedAV; } } } @@ -368,13 +364,13 @@ namespace OpenMetaverse.GUI { case "Offer Teleport": { - Client.Self.SendTeleportLure(_SelectedAvatar.ID); + Client.Self.SendTeleportLure(SelectedAvatar.ID); break; } case "Teleport To": { Vector3 pos; - if (Client.Network.CurrentSim.AvatarPositions.TryGetValue(_SelectedAvatar.ID, out pos)) + if (Client.Network.CurrentSim.AvatarPositions.TryGetValue(SelectedAvatar.ID, out pos)) Client.Self.Teleport(Client.Network.CurrentSim.Name, pos); break; @@ -382,7 +378,7 @@ namespace OpenMetaverse.GUI case "Walk To": { Vector3 pos; - if (Client.Network.CurrentSim.AvatarPositions.TryGetValue(_SelectedAvatar.ID, out pos)) + if (Client.Network.CurrentSim.AvatarPositions.TryGetValue(SelectedAvatar.ID, out pos)) Client.Self.AutoPilotLocal((int)pos.X, (int)pos.Y, pos.Z); break; diff --git a/LibreMetaverse.GUI/InventoryTree.cs b/LibreMetaverse.GUI/InventoryTree.cs index 3baab80c..a2a6f206 100644 --- a/LibreMetaverse.GUI/InventoryTree.cs +++ b/LibreMetaverse.GUI/InventoryTree.cs @@ -39,17 +39,12 @@ namespace OpenMetaverse.GUI public class InventoryTree : TreeView { private GridClient _Client; - private ContextMenuStrip _ContextMenu; private UUID _SelectedItemID; /// /// Gets or sets the context menu associated with this control /// - public ContextMenuStrip Menu - { - get { return _ContextMenu; } - set { _ContextMenu = value; } - } + public ContextMenuStrip Menu { get; set; } /// /// Gets or sets the GridClient associated with this control @@ -66,9 +61,9 @@ namespace OpenMetaverse.GUI public InventoryTree() { EventHandler clickHandler = new EventHandler(defaultMenuItem_Click); - _ContextMenu = new ContextMenuStrip(); - _ContextMenu.Items.Add("Wear", null, clickHandler); - _ContextMenu.Items.Add("Detach", null, clickHandler); + Menu = new ContextMenuStrip(); + Menu.Items.Add("Wear", null, clickHandler); + Menu.Items.Add("Detach", null, clickHandler); this.NodeMouseClick += new TreeNodeMouseClickEventHandler(InventoryTree_NodeMouseClick); this.BeforeExpand += new TreeViewCancelEventHandler(InventoryTree_BeforeExpand); @@ -211,7 +206,7 @@ namespace OpenMetaverse.GUI if (e.Button == MouseButtons.Right) { _SelectedItemID = new UUID(e.Node.Name); - _ContextMenu.Show(this, e.Location); + Menu.Show(this, e.Location); } } diff --git a/LibreMetaverse.GUI/LoginPanel.cs b/LibreMetaverse.GUI/LoginPanel.cs index 4bc66057..5bd2754d 100644 --- a/LibreMetaverse.GUI/LoginPanel.cs +++ b/LibreMetaverse.GUI/LoginPanel.cs @@ -35,7 +35,6 @@ namespace OpenMetaverse.GUI public class LoginPanel : Panel { private GridClient _Client; - private LoginParams _LoginParams = new LoginParams(); private Thread LoginThread; private Dictionary _Accounts = new Dictionary(); private Button btnLogin = new Button(); @@ -58,11 +57,7 @@ namespace OpenMetaverse.GUI /// /// Gets or sets the LoginParams associated with this control's GridClient object /// - public LoginParams LoginParams - { - get { return _LoginParams; } - set { _LoginParams = value; } - } + public LoginParams LoginParams { get; set; } = new LoginParams(); /// /// First name parsed from the textbox control @@ -184,12 +179,12 @@ namespace OpenMetaverse.GUI { if (_Client == null) return; - if (_LoginParams.MethodName == null) - _LoginParams = Client.Network.DefaultLoginParams("", "", "", "", ""); + if (LoginParams.MethodName == null) + LoginParams = Client.Network.DefaultLoginParams("", "", "", "", ""); SetText(btnLogin, "Logout"); - SetText(listNames, _LoginParams.FirstName + " " + _LoginParams.LastName); - SetText(txtPass, _LoginParams.Password); + SetText(listNames, LoginParams.FirstName + " " + LoginParams.LastName); + SetText(txtPass, LoginParams.Password); if (LoginThread != null) { @@ -197,7 +192,7 @@ namespace OpenMetaverse.GUI _Client.Network.AbortLogin(); LoginThread = null; } - LoginThread = new Thread(delegate() { _Client.Network.Login(_LoginParams); }); + LoginThread = new Thread(delegate() { _Client.Network.Login(LoginParams); }); LoginThread.Start(); } @@ -232,10 +227,10 @@ namespace OpenMetaverse.GUI return; } - _LoginParams.FirstName = FirstName; - _LoginParams.LastName = LastName; - _LoginParams.Password = Password; - _LoginParams.Start = StartURI; + LoginParams.FirstName = FirstName; + LoginParams.LastName = LastName; + LoginParams.Password = Password; + LoginParams.Start = StartURI; Login(); } @@ -287,7 +282,7 @@ namespace OpenMetaverse.GUI { lock (_Accounts) { - _Accounts[_Client.Self.Name] = _LoginParams.Password; + _Accounts[_Client.Self.Name] = LoginParams.Password; if (!listNames.Items.Contains(_Client.Self.Name)) { @@ -305,8 +300,8 @@ namespace OpenMetaverse.GUI } else { - SetText(listNames, _LoginParams.FirstName + " " + _LoginParams.LastName); - SetText(txtPass, _LoginParams.Password); + SetText(listNames, LoginParams.FirstName + " " + LoginParams.LastName); + SetText(txtPass, LoginParams.Password); } } diff --git a/LibreMetaverse.StructuredData/JSON/JsonMapper.cs b/LibreMetaverse.StructuredData/JSON/JsonMapper.cs index 975fcf3d..fc41c49c 100644 --- a/LibreMetaverse.StructuredData/JSON/JsonMapper.cs +++ b/LibreMetaverse.StructuredData/JSON/JsonMapper.cs @@ -30,8 +30,6 @@ namespace LitJson internal struct ArrayMetadata { private Type element_type; - private bool is_array; - private bool is_list; public Type ElementType { @@ -45,24 +43,15 @@ namespace LitJson set { element_type = value; } } - public bool IsArray { - get { return is_array; } - set { is_array = value; } - } + public bool IsArray { get; set; } - public bool IsList { - get { return is_list; } - set { is_list = value; } - } + public bool IsList { get; set; } } internal struct ObjectMetadata { private Type element_type; - private bool is_dictionary; - - private IDictionary properties; public Type ElementType { @@ -76,15 +65,9 @@ namespace LitJson set { element_type = value; } } - public bool IsDictionary { - get { return is_dictionary; } - set { is_dictionary = value; } - } + public bool IsDictionary { get; set; } - public IDictionary Properties { - get { return properties; } - set { properties = value; } - } + public IDictionary Properties { get; set; } } diff --git a/LibreMetaverse.StructuredData/JSON/JsonReader.cs b/LibreMetaverse.StructuredData/JSON/JsonReader.cs index a3273001..75052bb0 100644 --- a/LibreMetaverse.StructuredData/JSON/JsonReader.cs +++ b/LibreMetaverse.StructuredData/JSON/JsonReader.cs @@ -46,16 +46,13 @@ namespace LitJson private Stack automaton_stack; private int current_input; private int current_symbol; - private bool end_of_json; - private bool end_of_input; private Lexer lexer; private bool parser_in_string; private bool parser_return; private bool read_started; private TextReader reader; private bool reader_is_owned; - private object token_value; - private JsonToken token; + #endregion @@ -70,13 +67,13 @@ namespace LitJson set { lexer.AllowSingleQuotedStrings = value; } } - public bool EndOfInput => end_of_input; + public bool EndOfInput { get; private set; } - public bool EndOfJson => end_of_json; + public bool EndOfJson { get; private set; } - public JsonToken Token => token; + public JsonToken Token { get; private set; } - public object Value => token_value; + public object Value { get; private set; } #endregion @@ -112,8 +109,8 @@ namespace LitJson lexer = new Lexer (reader); - end_of_input = false; - end_of_json = false; + EndOfInput = false; + EndOfJson = false; this.reader = reader; reader_is_owned = owned; @@ -250,8 +247,8 @@ namespace LitJson double n_double; if (Double.TryParse (number, out n_double)) { - token = JsonToken.Double; - token_value = n_double; + Token = JsonToken.Double; + Value = n_double; return; } @@ -259,41 +256,41 @@ namespace LitJson int n_int32; if (Int32.TryParse (number, out n_int32)) { - token = JsonToken.Int; - token_value = n_int32; + Token = JsonToken.Int; + Value = n_int32; return; } long n_int64; if (Int64.TryParse (number, out n_int64)) { - token = JsonToken.Long; - token_value = n_int64; + Token = JsonToken.Long; + Value = n_int64; return; } // Shouldn't happen, but just in case, return something - token = JsonToken.Int; - token_value = 0; + Token = JsonToken.Int; + Value = 0; } private void ProcessSymbol () { if (current_symbol == '[') { - token = JsonToken.ArrayStart; + Token = JsonToken.ArrayStart; parser_return = true; } else if (current_symbol == ']') { - token = JsonToken.ArrayEnd; + Token = JsonToken.ArrayEnd; parser_return = true; } else if (current_symbol == '{') { - token = JsonToken.ObjectStart; + Token = JsonToken.ObjectStart; parser_return = true; } else if (current_symbol == '}') { - token = JsonToken.ObjectEnd; + Token = JsonToken.ObjectEnd; parser_return = true; } else if (current_symbol == '"') { @@ -303,22 +300,22 @@ namespace LitJson parser_return = true; } else { - if (token == JsonToken.None) - token = JsonToken.String; + if (Token == JsonToken.None) + Token = JsonToken.String; parser_in_string = true; } } else if (current_symbol == (int) ParserToken.CharSeq) { - token_value = lexer.StringValue; + Value = lexer.StringValue; } else if (current_symbol == (int) ParserToken.False) { - token = JsonToken.Boolean; - token_value = false; + Token = JsonToken.Boolean; + Value = false; parser_return = true; } else if (current_symbol == (int) ParserToken.Null) { - token = JsonToken.Null; + Token = JsonToken.Null; parser_return = true; } else if (current_symbol == (int) ParserToken.Number) { @@ -327,11 +324,11 @@ namespace LitJson parser_return = true; } else if (current_symbol == (int) ParserToken.Pair) { - token = JsonToken.PropertyName; + Token = JsonToken.PropertyName; } else if (current_symbol == (int) ParserToken.True) { - token = JsonToken.Boolean; - token_value = true; + Token = JsonToken.Boolean; + Value = true; parser_return = true; } @@ -339,7 +336,7 @@ namespace LitJson private bool ReadToken () { - if (end_of_input) + if (EndOfInput) return false; lexer.NextToken (); @@ -359,11 +356,11 @@ namespace LitJson public void Close () { - if (end_of_input) + if (EndOfInput) return; - end_of_input = true; - end_of_json = true; + EndOfInput = true; + EndOfJson = true; if (reader_is_owned) reader.Close (); @@ -373,11 +370,11 @@ namespace LitJson public bool Read () { - if (end_of_input) + if (EndOfInput) return false; - if (end_of_json) { - end_of_json = false; + if (EndOfJson) { + EndOfJson = false; automaton_stack.Clear (); automaton_stack.Push ((int) ParserToken.End); automaton_stack.Push ((int) ParserToken.Text); @@ -386,8 +383,8 @@ namespace LitJson parser_in_string = false; parser_return = false; - token = JsonToken.None; - token_value = null; + Token = JsonToken.None; + Value = null; if (! read_started) { read_started = true; @@ -400,7 +397,7 @@ namespace LitJson while (true) { if (parser_return) { if (automaton_stack.Peek () == (int) ParserToken.End) - end_of_json = true; + EndOfJson = true; return true; } diff --git a/LibreMetaverse/AgentManager.cs b/LibreMetaverse/AgentManager.cs index a3a34998..e48d14fe 100644 --- a/LibreMetaverse/AgentManager.cs +++ b/LibreMetaverse/AgentManager.cs @@ -1271,24 +1271,24 @@ namespace OpenMetaverse /// Your (client) avatars /// "client", "agent", and "avatar" all represent the same thing - public UUID AgentID => id; + public UUID AgentID { get; private set; } /// Temporary assigned to this session, used for /// verifying our identity in packets - public UUID SessionID => sessionID; + public UUID SessionID { get; private set; } /// Shared secret that is never sent over the wire - public UUID SecureSessionID => secureSessionID; + public UUID SecureSessionID { get; private set; } /// Your (client) avatar ID, local to the current region/sim public uint LocalID => localID; /// Where the avatar started at login. Can be "last", "home" /// or a login - public string StartLocation => startLocation; + public string StartLocation { get; private set; } = string.Empty; /// The access level of this agent, usually M, PG or A - public string AgentAccess => agentAccess; + public string AgentAccess { get; private set; } = string.Empty; /// The CollisionPlane of Agent public Vector4 CollisionPlane => collisionPlane; @@ -1313,13 +1313,13 @@ namespace OpenMetaverse public Vector3 HomeLookAt => home.LookAt; /// Avatar First Name (i.e. Philip) - public string FirstName => firstName; + public string FirstName { get; private set; } = string.Empty; /// Avatar Last Name (i.e. Linden) - public string LastName => lastName; + public string LastName { get; private set; } = string.Empty; /// LookAt point received with the login response message - public Vector3 LookAt => lookAt; + public Vector3 LookAt { get; private set; } /// Avatar Full Name (i.e. Philip Linden) public string Name @@ -1329,28 +1329,28 @@ namespace OpenMetaverse // This is a fairly common request, so assume the name doesn't // change mid-session and cache the result if (fullName == null || fullName.Length < 2) - fullName = $"{firstName} {lastName}"; + fullName = $"{FirstName} {LastName}"; return fullName; } } /// Gets the health of the agent - public float Health => health; + public float Health { get; private set; } /// Gets the current balance of the agent - public int Balance => balance; + public int Balance { get; private set; } /// Gets the local ID of the prim the agent is sitting on, /// zero if the avatar is not currently sitting public uint SittingOn => sittingOn; /// Gets the of the agents active group. - public UUID ActiveGroup => activeGroup; + public UUID ActiveGroup { get; private set; } /// Gets the Agents powers in the currently active group - public GroupPowers ActiveGroupPowers => activeGroupPowers; + public GroupPowers ActiveGroupPowers { get; private set; } /// Current status message for teleporting - public string TeleportMessage => teleportMessage; + public string TeleportMessage { get; private set; } = string.Empty; /// Current position of the agent as a relative offset from /// the simulator, or the parent object if we are sitting on something @@ -1470,24 +1470,11 @@ namespace OpenMetaverse #region Private Members - private UUID id; - private UUID sessionID; - private UUID secureSessionID; - private string startLocation = string.Empty; - private string agentAccess = string.Empty; private HomeInfo home; - private Vector3 lookAt; - private string firstName = string.Empty; - private string lastName = string.Empty; private string fullName; - private string teleportMessage = string.Empty; private TeleportStatus teleportStat = TeleportStatus.None; private ManualResetEvent teleportEvent = new ManualResetEvent(false); private uint heightWidthGenCounter; - private float health; - private int balance; - private UUID activeGroup; - private GroupPowers activeGroupPowers; private Dictionary gestureCache = new Dictionary(); #endregion Private Members @@ -1602,7 +1589,7 @@ namespace OpenMetaverse { AgentData = { - AgentID = id, + AgentID = AgentID, SessionID = Client.Self.SessionID }, ChatData = @@ -2682,14 +2669,14 @@ namespace OpenMetaverse { AgentData = { - AgentID = id, + AgentID = AgentID, SessionID = Client.Self.SessionID }, MoneyData = { Description = Utils.StringToBytes(description), DestID = target, - SourceID = id, + SourceID = AgentID, TransactionType = (int) type, AggregatePermInventory = 0, AggregatePermNextOwner = 0, @@ -2981,7 +2968,7 @@ namespace OpenMetaverse teleportStat == TeleportStatus.Start || teleportStat == TeleportStatus.Progress) { - teleportMessage = "Teleport timed out."; + TeleportMessage = "Teleport timed out."; teleportStat = TeleportStatus.Failed; } @@ -3028,7 +3015,7 @@ namespace OpenMetaverse } else { - teleportMessage = "Unable to resolve name: " + simName; + TeleportMessage = "Unable to resolve name: " + simName; teleportStat = TeleportStatus.Failed; return false; } @@ -3091,7 +3078,7 @@ namespace OpenMetaverse teleportStat == TeleportStatus.Start || teleportStat == TeleportStatus.Progress) { - teleportMessage = "Teleport timed out."; + TeleportMessage = "Teleport timed out."; teleportStat = TeleportStatus.Failed; } @@ -3133,7 +3120,7 @@ namespace OpenMetaverse } else { - teleportMessage = "CAPS event queue is not running"; + TeleportMessage = "CAPS event queue is not running"; teleportEvent.Set(); teleportStat = TeleportStatus.Failed; } @@ -3177,7 +3164,7 @@ namespace OpenMetaverse { AgentData = { - AgentID = Client.Self.id, + AgentID = Client.Self.AgentID, SessionID = Client.Self.SessionID }, Info = @@ -3260,8 +3247,8 @@ namespace OpenMetaverse { AgentData = { - AgentID = id, - SessionID = sessionID + AgentID = AgentID, + SessionID = SessionID }, PropertiesData = { @@ -3288,8 +3275,8 @@ namespace OpenMetaverse { AgentData = { - AgentID = id, - SessionID = sessionID + AgentID = AgentID, + SessionID = SessionID }, PropertiesData = { @@ -3315,8 +3302,8 @@ namespace OpenMetaverse { AgentData = { - AgentID = id, - SessionID = sessionID + AgentID = AgentID, + SessionID = SessionID }, Data = { @@ -3630,7 +3617,7 @@ namespace OpenMetaverse AgentData = { AgentID = Client.Self.AgentID, - SessionID = Client.Self.sessionID + SessionID = Client.Self.SessionID }, Data = {PickID = pickID} }; @@ -3835,12 +3822,12 @@ namespace OpenMetaverse if (error == null && result is OSDMap osdMap) { var map = osdMap["access_prefs"]; - agentAccess = ((OSDMap)map)["max"]; - Logger.Log($"Max maturity access set to {agentAccess}", Helpers.LogLevel.Info, Client ); + AgentAccess = ((OSDMap)map)["max"]; + Logger.Log($"Max maturity access set to {AgentAccess}", Helpers.LogLevel.Info, Client ); } else if (error == null) { - Logger.Log($"Max maturity unchanged at {agentAccess}", Helpers.LogLevel.Info, Client); + Logger.Log($"Max maturity unchanged at {AgentAccess}", Helpers.LogLevel.Info, Client); } else { @@ -3850,7 +3837,7 @@ namespace OpenMetaverse if (callback != null) { - try { callback(new AgentAccessEventArgs(success, agentAccess)); } + try { callback(new AgentAccessEventArgs(success, AgentAccess)); } catch { } // *TODO: So gross } @@ -4135,7 +4122,7 @@ namespace OpenMetaverse protected void HealthHandler(object sender, PacketReceivedEventArgs e) { Packet packet = e.Packet; - health = ((HealthMessagePacket)packet).HealthData.Health; + Health = ((HealthMessagePacket)packet).HealthData.Health; } /// Process an incoming packet and raise the appropriate events @@ -4150,17 +4137,17 @@ namespace OpenMetaverse if (p.AgentData.AgentID == simulator.Client.Self.AgentID) { - firstName = Utils.BytesToString(p.AgentData.FirstName); - lastName = Utils.BytesToString(p.AgentData.LastName); - activeGroup = p.AgentData.ActiveGroupID; - activeGroupPowers = (GroupPowers)p.AgentData.GroupPowers; + FirstName = Utils.BytesToString(p.AgentData.FirstName); + LastName = Utils.BytesToString(p.AgentData.LastName); + ActiveGroup = p.AgentData.ActiveGroupID; + ActiveGroupPowers = (GroupPowers)p.AgentData.GroupPowers; if (m_AgentData == null) return; string groupTitle = Utils.BytesToString(p.AgentData.GroupTitle); string groupName = Utils.BytesToString(p.AgentData.GroupName); - OnAgentData(new AgentDataReplyEventArgs(firstName, lastName, activeGroup, groupTitle, activeGroupPowers, groupName)); + OnAgentData(new AgentDataReplyEventArgs(FirstName, LastName, ActiveGroup, groupTitle, ActiveGroupPowers, groupName)); } else { @@ -4179,7 +4166,7 @@ namespace OpenMetaverse if (packet.Type == PacketType.MoneyBalanceReply) { MoneyBalanceReplyPacket reply = (MoneyBalanceReplyPacket)packet; - this.balance = reply.MoneyData.MoneyBalance; + this.Balance = reply.MoneyData.MoneyBalance; if (m_MoneyBalance != null) { @@ -4206,7 +4193,7 @@ namespace OpenMetaverse if (m_Balance != null) { - OnBalance(new BalanceEventArgs(balance)); + OnBalance(new BalanceEventArgs(Balance)); } } @@ -4322,7 +4309,7 @@ namespace OpenMetaverse { TeleportStartPacket start = (TeleportStartPacket)packet; - teleportMessage = "Teleport started"; + TeleportMessage = "Teleport started"; flags = (TeleportFlags)start.Info.TeleportFlags; teleportStat = TeleportStatus.Start; @@ -4332,21 +4319,21 @@ namespace OpenMetaverse { TeleportProgressPacket progress = (TeleportProgressPacket)packet; - teleportMessage = Utils.BytesToString(progress.Info.Message); + TeleportMessage = Utils.BytesToString(progress.Info.Message); flags = (TeleportFlags)progress.Info.TeleportFlags; teleportStat = TeleportStatus.Progress; - Logger.DebugLog($"TeleportProgress received, Message: {teleportMessage}, Flags: {flags}", Client); + Logger.DebugLog($"TeleportProgress received, Message: {TeleportMessage}, Flags: {flags}", Client); } else if (packet.Type == PacketType.TeleportFailed) { TeleportFailedPacket failed = (TeleportFailedPacket)packet; - teleportMessage = Utils.BytesToString(failed.Info.Reason); + TeleportMessage = Utils.BytesToString(failed.Info.Reason); teleportStat = TeleportStatus.Failed; finished = true; - Logger.DebugLog($"TeleportFailed received, Reason: {teleportMessage}", Client); + Logger.DebugLog($"TeleportFailed received, Reason: {TeleportMessage}", Client); } else if (packet.Type == PacketType.TeleportFinish) { @@ -4365,25 +4352,25 @@ namespace OpenMetaverse if (newSimulator != null) { - teleportMessage = "Teleport finished"; + TeleportMessage = "Teleport finished"; teleportStat = TeleportStatus.Finished; Logger.Log($"Moved to new sim {newSimulator}", Helpers.LogLevel.Info, Client); } else { - teleportMessage = "Failed to connect to the new sim after a teleport"; + TeleportMessage = "Failed to connect to the new sim after a teleport"; teleportStat = TeleportStatus.Failed; // We're going to get disconnected now - Logger.Log(teleportMessage, Helpers.LogLevel.Error, Client); + Logger.Log(TeleportMessage, Helpers.LogLevel.Error, Client); } } else if (packet.Type == PacketType.TeleportCancel) { //TeleportCancelPacket cancel = (TeleportCancelPacket)packet; - teleportMessage = "Cancelled"; + TeleportMessage = "Cancelled"; teleportStat = TeleportStatus.Cancelled; finished = true; @@ -4393,7 +4380,7 @@ namespace OpenMetaverse { TeleportLocalPacket local = (TeleportLocalPacket)packet; - teleportMessage = "Teleport finished"; + TeleportMessage = "Teleport finished"; flags = (TeleportFlags)local.Info.TeleportFlags; teleportStat = TeleportStatus.Finished; relativePosition = local.Info.Position; @@ -4407,7 +4394,7 @@ namespace OpenMetaverse if (m_Teleport != null) { - OnTeleport(new TeleportEventArgs(teleportMessage, teleportStat, flags)); + OnTeleport(new TeleportEventArgs(TeleportMessage, teleportStat, flags)); } if (finished) teleportEvent.Set(); @@ -4493,16 +4480,16 @@ namespace OpenMetaverse private void Network_OnLoginResponse(bool loginSuccess, bool redirect, string message, string reason, LoginResponseData reply) { - id = reply.AgentID; - sessionID = reply.SessionID; - secureSessionID = reply.SecureSessionID; - firstName = reply.FirstName; - lastName = reply.LastName; - startLocation = reply.StartLocation; - agentAccess = reply.AgentAccess; + AgentID = reply.AgentID; + SessionID = reply.SessionID; + SecureSessionID = reply.SecureSessionID; + FirstName = reply.FirstName; + LastName = reply.LastName; + StartLocation = reply.StartLocation; + AgentAccess = reply.AgentAccess; Movement.Camera.LookDirection(reply.LookAt); home = reply.Home; - lookAt = reply.LookAt; + LookAt = reply.LookAt; if (reply.Gestures != null) { diff --git a/LibreMetaverse/AgentManagerMovement.cs b/LibreMetaverse/AgentManagerMovement.cs index fa4dbdc7..d16f227b 100644 --- a/LibreMetaverse/AgentManagerMovement.cs +++ b/LibreMetaverse/AgentManagerMovement.cs @@ -377,10 +377,7 @@ namespace OpenMetaverse } } /// The current value of the agent control flags - public uint AgentControls - { - get { return agentControls; } - } + public uint AgentControls { get; private set; } /// Gets or sets the interval in milliseconds at which /// AgentUpdate packets are sent to the current simulator. Setting @@ -420,11 +417,7 @@ namespace OpenMetaverse } /// Reset movement controls every time we send an update - public bool AutoResetControls - { - get { return autoResetControls; } - set { autoResetControls = value; } - } + public bool AutoResetControls { get; set; } #endregion Properties @@ -459,13 +452,11 @@ namespace OpenMetaverse private bool alwaysRun; private GridClient Client; - private uint agentControls; private int duplicateCount; private AgentState lastState; /// Timer for sending AgentUpdate packets private Timer updateTimer; private int updateInterval; - private bool autoResetControls; /// Default constructor public AgentMovement(GridClient client) @@ -609,7 +600,7 @@ namespace OpenMetaverse Vector3 zAxis = Camera.UpAxis; // Attempted to sort these in a rough order of how often they might change - if (agentControls == 0 && + if (AgentControls == 0 && yAxis == LastCameraYAxis && origin == LastCameraCenter && State == lastState && @@ -652,12 +643,12 @@ namespace OpenMetaverse update.AgentData.CameraUpAxis = zAxis; update.AgentData.Far = Camera.Far; update.AgentData.State = (byte)State; - update.AgentData.ControlFlags = agentControls; + update.AgentData.ControlFlags = AgentControls; update.AgentData.Flags = (byte)Flags; Client.Network.SendPacket(update, simulator); - if (autoResetControls) { + if (AutoResetControls) { ResetControlFlags(); } } @@ -710,20 +701,20 @@ namespace OpenMetaverse private bool GetControlFlag(ControlFlags flag) { - return (agentControls & (uint)flag) != 0; + return (AgentControls & (uint)flag) != 0; } private void SetControlFlag(ControlFlags flag, bool value) { - if (value) agentControls |= (uint)flag; - else agentControls &= ~((uint)flag); + if (value) AgentControls |= (uint)flag; + else AgentControls &= ~((uint)flag); } public void ResetControlFlags() { // Reset all of the flags except for persistent settings like // away, fly, mouselook, and crouching - agentControls &= + AgentControls &= (uint)(ControlFlags.AGENT_CONTROL_AWAY | ControlFlags.AGENT_CONTROL_FLY | ControlFlags.AGENT_CONTROL_MOUSELOOK | diff --git a/LibreMetaverse/BitPack.cs b/LibreMetaverse/BitPack.cs index 8134a367..65cb0703 100644 --- a/LibreMetaverse/BitPack.cs +++ b/LibreMetaverse/BitPack.cs @@ -43,14 +43,14 @@ namespace OpenMetaverse { get { - if (bytePos != 0 && bitPos == 0) + if (bytePos != 0 && BitPos == 0) return bytePos - 1; return bytePos; } } /// - public int BitPos => bitPos; + public int BitPos { get; private set; } private const int MAX_BITS = 8; @@ -58,8 +58,7 @@ namespace OpenMetaverse private static readonly byte[] Off = { 0 }; private int bytePos; - private int bitPos; - + /// /// Default constructor, initialize the bit packer / bit unpacker /// with a byte array and starting position @@ -301,7 +300,7 @@ namespace OpenMetaverse public string UnpackString(int size) { - if (bitPos != 0 || bytePos + size > Data.Length) throw new IndexOutOfRangeException(); + if (BitPos != 0 || bytePos + size > Data.Length) throw new IndexOutOfRangeException(); string str = System.Text.Encoding.UTF8.GetString(Data, bytePos, size); bytePos += size; @@ -310,7 +309,7 @@ namespace OpenMetaverse public UUID UnpackUUID() { - if (bitPos != 0) throw new IndexOutOfRangeException(); + if (BitPos != 0) throw new IndexOutOfRangeException(); UUID val = new UUID(Data, bytePos); bytePos += 16; @@ -338,7 +337,7 @@ namespace OpenMetaverse while (count > 0) { - byte curBit = (byte)(0x80 >> bitPos); + byte curBit = (byte)(0x80 >> BitPos); if ((data[curBytePos] & (0x01 << (count - 1))) != 0) Data[bytePos] |= curBit; @@ -346,12 +345,12 @@ namespace OpenMetaverse Data[bytePos] &= (byte)~curBit; --count; - ++bitPos; + ++BitPos; ++curBitPos; - if (bitPos >= MAX_BITS) + if (BitPos >= MAX_BITS) { - bitPos = 0; + BitPos = 0; ++bytePos; } if (curBitPos >= MAX_BITS) @@ -389,15 +388,15 @@ namespace OpenMetaverse output[curBytePos] <<= 1; // Grab one bit - if ((Data[bytePos] & (0x80 >> bitPos++)) != 0) + if ((Data[bytePos] & (0x80 >> BitPos++)) != 0) ++output[curBytePos]; --count; ++curBitPos; - if (bitPos >= MAX_BITS) + if (BitPos >= MAX_BITS) { - bitPos = 0; + BitPos = 0; ++bytePos; } if (curBitPos >= MAX_BITS) diff --git a/LibreMetaverse/DirectoryManager.cs b/LibreMetaverse/DirectoryManager.cs index 01798d9a..e1138de3 100644 --- a/LibreMetaverse/DirectoryManager.cs +++ b/LibreMetaverse/DirectoryManager.cs @@ -1446,32 +1446,27 @@ namespace OpenMetaverse /// Contains the Event data returned from the data server from an EventInfoRequest public class EventInfoReplyEventArgs : EventArgs { - private readonly DirectoryManager.EventInfo m_MatchedEvent; - /// /// A single EventInfo object containing the details of an event /// - public DirectoryManager.EventInfo MatchedEvent { get { return m_MatchedEvent; } } + public DirectoryManager.EventInfo MatchedEvent { get; } /// Construct a new instance of the EventInfoReplyEventArgs class /// A single EventInfo object containing the details of an event public EventInfoReplyEventArgs(DirectoryManager.EventInfo matchedEvent) { - this.m_MatchedEvent = matchedEvent; + this.MatchedEvent = matchedEvent; } } /// Contains the "Event" detail data returned from the data server public class DirEventsReplyEventArgs : EventArgs { - private readonly UUID m_QueryID; /// The ID returned by - public UUID QueryID { get { return m_QueryID; } } - - private readonly List m_matchedEvents; + public UUID QueryID { get; } /// A list of "Events" returned by the data server - public List MatchedEvents { get { return m_matchedEvents; } } + public List MatchedEvents { get; } /// Construct a new instance of the DirEventsReplyEventArgs class /// The ID of the query returned by the data server. @@ -1479,22 +1474,19 @@ namespace OpenMetaverse /// A list containing the "Events" returned by the search query public DirEventsReplyEventArgs(UUID queryID, List matchedEvents) { - this.m_QueryID = queryID; - this.m_matchedEvents = matchedEvents; + this.QueryID = queryID; + this.MatchedEvents = matchedEvents; } } /// Contains the "Event" list data returned from the data server public class PlacesReplyEventArgs : EventArgs { - private readonly UUID m_QueryID; /// The ID returned by - public UUID QueryID { get { return m_QueryID; } } - - private readonly List m_MatchedPlaces; + public UUID QueryID { get; } /// A list of "Places" returned by the data server - public List MatchedPlaces { get { return m_MatchedPlaces; } } + public List MatchedPlaces { get; } /// Construct a new instance of PlacesReplyEventArgs class /// The ID of the query returned by the data server. @@ -1502,60 +1494,53 @@ namespace OpenMetaverse /// A list containing the "Places" returned by the data server query public PlacesReplyEventArgs(UUID queryID, List matchedPlaces) { - this.m_QueryID = queryID; - this.m_MatchedPlaces = matchedPlaces; + this.QueryID = queryID; + this.MatchedPlaces = matchedPlaces; } } /// Contains the places data returned from the data server public class DirPlacesReplyEventArgs : EventArgs { - private readonly UUID m_QueryID; /// The ID returned by - public UUID QueryID { get { return m_QueryID; } } - - private readonly List m_MatchedParcels; + public UUID QueryID { get; } /// A list containing Places data returned by the data server - public List MatchedParcels { get { return m_MatchedParcels; } } - + public List MatchedParcels { get; } + /// Construct a new instance of the DirPlacesReplyEventArgs class /// The ID of the query returned by the data server. /// This will correlate to the ID returned by the method /// A list containing land data returned by the data server public DirPlacesReplyEventArgs(UUID queryID, List matchedParcels) { - this.m_QueryID = queryID; - this.m_MatchedParcels = matchedParcels; + this.QueryID = queryID; + this.MatchedParcels = matchedParcels; } } /// Contains the classified data returned from the data server public class DirClassifiedsReplyEventArgs : EventArgs { - private readonly List m_Classifieds; /// A list containing Classified Ads returned by the data server - public List Classifieds { get { return m_Classifieds; } } + public List Classifieds { get; } /// Construct a new instance of the DirClassifiedsReplyEventArgs class /// A list of classified ad data returned from the data server public DirClassifiedsReplyEventArgs(List classifieds) { - this.m_Classifieds = classifieds; + this.Classifieds = classifieds; } } /// Contains the group data returned from the data server public class DirGroupsReplyEventArgs : EventArgs { - private readonly UUID m_QueryID; /// The ID returned by - public UUID QueryID { get { return m_QueryID; } } - - private readonly List m_matchedGroups; + public UUID QueryID { get; } /// A list containing Groups data returned by the data server - public List MatchedGroups { get { return m_matchedGroups; } } + public List MatchedGroups { get; } /// Construct a new instance of the DirGroupsReplyEventArgs class /// The ID of the query returned by the data server. @@ -1563,22 +1548,19 @@ namespace OpenMetaverse /// A list of groups data returned by the data server public DirGroupsReplyEventArgs(UUID queryID, List matchedGroups) { - this.m_QueryID = queryID; - this.m_matchedGroups = matchedGroups; + this.QueryID = queryID; + this.MatchedGroups = matchedGroups; } } /// Contains the people data returned from the data server public class DirPeopleReplyEventArgs : EventArgs { - private readonly UUID m_QueryID; /// The ID returned by - public UUID QueryID { get { return m_QueryID; } } - - private readonly List m_MatchedPeople; + public UUID QueryID { get; } /// A list containing People data returned by the data server - public List MatchedPeople { get { return m_MatchedPeople; } } + public List MatchedPeople { get; } /// Construct a new instance of the DirPeopleReplyEventArgs class /// The ID of the query returned by the data server. @@ -1586,24 +1568,22 @@ namespace OpenMetaverse /// A list of people data returned by the data server public DirPeopleReplyEventArgs(UUID queryID, List matchedPeople) { - this.m_QueryID = queryID; - this.m_MatchedPeople = matchedPeople; + this.QueryID = queryID; + this.MatchedPeople = matchedPeople; } } /// Contains the land sales data returned from the data server public class DirLandReplyEventArgs : EventArgs { - private readonly List m_DirParcels; - /// A list containing land forsale data returned by the data server - public List DirParcels { get { return m_DirParcels; } } + public List DirParcels { get; } /// Construct a new instance of the DirLandReplyEventArgs class /// A list of parcels for sale returned by the data server public DirLandReplyEventArgs(List dirParcels) { - this.m_DirParcels = dirParcels; + this.DirParcels = dirParcels; } } #endregion diff --git a/LibreMetaverse/EstateTools.cs b/LibreMetaverse/EstateTools.cs index 1930e741..a498e8db 100644 --- a/LibreMetaverse/EstateTools.cs +++ b/LibreMetaverse/EstateTools.cs @@ -984,72 +984,66 @@ namespace OpenMetaverse /// Raised on LandStatReply when the report type is for "top colliders" public class TopCollidersReplyEventArgs : EventArgs { - private readonly int m_objectCount; - private readonly Dictionary m_Tasks; - /// /// The number of returned items in LandStatReply /// - public int ObjectCount { get { return m_objectCount; } } + public int ObjectCount { get; } + /// /// A Dictionary of Object UUIDs to tasks returned in LandStatReply /// - public Dictionary Tasks { get { return m_Tasks; } } + public Dictionary Tasks { get; } /// Construct a new instance of the TopCollidersReplyEventArgs class /// The number of returned items in LandStatReply /// Dictionary of Object UUIDs to tasks returned in LandStatReply public TopCollidersReplyEventArgs(int objectCount, Dictionary tasks) { - this.m_objectCount = objectCount; - this.m_Tasks = tasks; + this.ObjectCount = objectCount; + this.Tasks = tasks; } } /// Raised on LandStatReply when the report type is for "top Scripts" public class TopScriptsReplyEventArgs : EventArgs { - private readonly int m_objectCount; - private readonly Dictionary m_Tasks; - /// /// The number of scripts returned in LandStatReply /// - public int ObjectCount { get { return m_objectCount; } } + public int ObjectCount { get; } + /// /// A Dictionary of Object UUIDs to tasks returned in LandStatReply /// - public Dictionary Tasks { get { return m_Tasks; } } + public Dictionary Tasks { get; } /// Construct a new instance of the TopScriptsReplyEventArgs class /// The number of returned items in LandStatReply /// Dictionary of Object UUIDs to tasks returned in LandStatReply public TopScriptsReplyEventArgs(int objectCount, Dictionary tasks) { - this.m_objectCount = objectCount; - this.m_Tasks = tasks; + this.ObjectCount = objectCount; + this.Tasks = tasks; } } /// Returned, along with other info, upon a successful .RequestInfo() public class EstateBansReplyEventArgs : EventArgs { - private readonly uint m_estateID; - private readonly int m_count; - private readonly List m_banned; - /// /// The identifier of the estate /// - public uint EstateID { get { return m_estateID; } } + public uint EstateID { get; } + /// /// The number of returned itmes /// - public int Count { get { return m_count; } } + public int Count { get; } + /// /// List of UUIDs of Banned Users /// - public List Banned { get { return m_banned; } } + public List Banned { get; } /// Construct a new instance of the EstateBansReplyEventArgs class /// The estate's identifier on the grid @@ -1057,31 +1051,29 @@ namespace OpenMetaverse /// User UUIDs banned public EstateBansReplyEventArgs(uint estateID, int count, List banned) { - this.m_estateID = estateID; - this.m_count = count; - this.m_banned = banned; + this.EstateID = estateID; + this.Count = count; + this.Banned = banned; } } /// Returned, along with other info, upon a successful .RequestInfo() public class EstateUsersReplyEventArgs : EventArgs { - private readonly uint m_estateID; - private readonly int m_count; - private readonly List m_allowedUsers; - /// /// The identifier of the estate /// - public uint EstateID { get { return m_estateID; } } + public uint EstateID { get; } + /// /// The number of returned items /// - public int Count { get { return m_count; } } + public int Count { get; } + /// /// List of UUIDs of Allowed Users /// - public List AllowedUsers { get { return m_allowedUsers; } } + public List AllowedUsers { get; } /// Construct a new instance of the EstateUsersReplyEventArgs class /// The estate's identifier on the grid @@ -1089,31 +1081,29 @@ namespace OpenMetaverse /// Allowed users UUIDs public EstateUsersReplyEventArgs(uint estateID, int count, List allowedUsers) { - this.m_estateID = estateID; - this.m_count = count; - this.m_allowedUsers = allowedUsers; + this.EstateID = estateID; + this.Count = count; + this.AllowedUsers = allowedUsers; } } /// Returned, along with other info, upon a successful .RequestInfo() public class EstateGroupsReplyEventArgs : EventArgs { - private readonly uint m_estateID; - private readonly int m_count; - private readonly List m_allowedGroups; - /// /// The identifier of the estate /// - public uint EstateID { get { return m_estateID; } } + public uint EstateID { get; } + /// /// The number of returned items /// - public int Count { get { return m_count; } } + public int Count { get; } + /// /// List of UUIDs of Allowed Groups /// - public List AllowedGroups { get { return m_allowedGroups; } } + public List AllowedGroups { get; } /// Construct a new instance of the EstateGroupsReplyEventArgs class /// The estate's identifier on the grid @@ -1121,31 +1111,29 @@ namespace OpenMetaverse /// Allowed Groups UUIDs public EstateGroupsReplyEventArgs(uint estateID, int count, List allowedGroups) { - this.m_estateID = estateID; - this.m_count = count; - this.m_allowedGroups = allowedGroups; + this.EstateID = estateID; + this.Count = count; + this.AllowedGroups = allowedGroups; } } /// Returned, along with other info, upon a successful .RequestInfo() public class EstateManagersReplyEventArgs : EventArgs { - private readonly uint m_estateID; - private readonly int m_count; - private readonly List m_Managers; - /// /// The identifier of the estate /// - public uint EstateID { get { return m_estateID; } } + public uint EstateID { get; } + /// /// The number of returned items /// - public int Count { get { return m_count; } } + public int Count { get; } + /// /// List of UUIDs of the Estate's Managers /// - public List Managers { get { return m_Managers; } } + public List Managers { get; } /// Construct a new instance of the EstateManagersReplyEventArgs class /// The estate's identifier on the grid @@ -1153,36 +1141,34 @@ namespace OpenMetaverse /// Managers UUIDs public EstateManagersReplyEventArgs(uint estateID, int count, List managers) { - this.m_estateID = estateID; - this.m_count = count; - this.m_Managers = managers; + this.EstateID = estateID; + this.Count = count; + this.Managers = managers; } } /// Returned, along with other info, upon a successful .RequestInfo() public class EstateCovenantReplyEventArgs : EventArgs { - private readonly UUID m_covenantID; - private readonly long m_timestamp; - private readonly string m_estateName; - private readonly UUID m_estateOwnerID; - /// /// The Covenant /// - public UUID CovenantID { get { return m_covenantID; } } + public UUID CovenantID { get; } + /// /// The timestamp /// - public long Timestamp { get { return m_timestamp; } } + public long Timestamp { get; } + /// /// The Estate name /// - public String EstateName { get { return m_estateName; } } + public String EstateName { get; } + /// /// The Estate Owner's ID (can be a GroupID) /// - public UUID EstateOwnerID { get { return m_estateOwnerID; } } + public UUID EstateOwnerID { get; } /// Construct a new instance of the EstateCovenantReplyEventArgs class /// The Covenant ID @@ -1191,10 +1177,10 @@ namespace OpenMetaverse /// The Estate Owner's ID (can be a GroupID) public EstateCovenantReplyEventArgs(UUID covenantID, long timestamp, string estateName, UUID estateOwnerID) { - this.m_covenantID = covenantID; - this.m_timestamp = timestamp; - this.m_estateName = estateName; - this.m_estateOwnerID = estateOwnerID; + this.CovenantID = covenantID; + this.Timestamp = timestamp; + this.EstateName = estateName; + this.EstateOwnerID = estateOwnerID; } } @@ -1203,25 +1189,23 @@ namespace OpenMetaverse /// Returned, along with other info, upon a successful .RequestInfo() public class EstateUpdateInfoReplyEventArgs : EventArgs { - private readonly uint m_estateID; - private readonly bool m_denyNoPaymentInfo; - private readonly string m_estateName; - private readonly UUID m_estateOwner; - /// /// The estate's name /// - public String EstateName { get { return m_estateName; } } + public String EstateName { get; } + /// /// The Estate Owner's ID (can be a GroupID) /// - public UUID EstateOwner { get { return m_estateOwner; } } + public UUID EstateOwner { get; } + /// /// The identifier of the estate on the grid /// - public uint EstateID { get { return m_estateID; } } + public uint EstateID { get; } + /// - public bool DenyNoPaymentInfo { get { return m_denyNoPaymentInfo; } } + public bool DenyNoPaymentInfo { get; } /// Construct a new instance of the EstateUpdateInfoReplyEventArgs class /// The estate's name @@ -1230,10 +1214,10 @@ namespace OpenMetaverse /// public EstateUpdateInfoReplyEventArgs(string estateName, UUID estateOwner, uint estateID, bool denyNoPaymentInfo) { - this.m_estateName = estateName; - this.m_estateOwner = estateOwner; - this.m_estateID = estateID; - this.m_denyNoPaymentInfo = denyNoPaymentInfo; + this.EstateName = estateName; + this.EstateOwner = estateOwner; + this.EstateID = estateID; + this.DenyNoPaymentInfo = denyNoPaymentInfo; } } diff --git a/LibreMetaverse/FriendsManager.cs b/LibreMetaverse/FriendsManager.cs index 4e669406..f0536f59 100644 --- a/LibreMetaverse/FriendsManager.cs +++ b/LibreMetaverse/FriendsManager.cs @@ -55,40 +55,25 @@ namespace OpenMetaverse /// public class FriendInfo { - private UUID m_id; - private string m_name; - private bool m_isOnline; private bool m_canSeeMeOnline; private bool m_canSeeMeOnMap; - private bool m_canModifyMyObjects; - private bool m_canSeeThemOnline; - private bool m_canSeeThemOnMap; - private bool m_canModifyTheirObjects; #region Properties /// /// System ID of the avatar /// - public UUID UUID { get { return m_id; } } + public UUID UUID { get; } /// /// full name of the avatar /// - public string Name - { - get { return m_name; } - set { m_name = value; } - } + public string Name { get; set; } /// /// True if the avatar is online /// - public bool IsOnline - { - get { return m_isOnline; } - set { m_isOnline = value; } - } + public bool IsOnline { get; set; } /// /// True if the friend can see if I am online @@ -123,26 +108,22 @@ namespace OpenMetaverse /// /// True if the freind can modify my objects /// - public bool CanModifyMyObjects - { - get { return m_canModifyMyObjects; } - set { m_canModifyMyObjects = value; } - } + public bool CanModifyMyObjects { get; set; } /// /// True if I can see if my friend is online /// - public bool CanSeeThemOnline { get { return m_canSeeThemOnline; } } + public bool CanSeeThemOnline { get; private set; } /// /// True if I can see if my friend is on the map /// - public bool CanSeeThemOnMap { get { return m_canSeeThemOnMap; } } + public bool CanSeeThemOnMap { get; private set; } /// /// True if I can modify my friend's objects /// - public bool CanModifyTheirObjects { get { return m_canModifyTheirObjects; } } + public bool CanModifyTheirObjects { get; private set; } /// /// My friend's rights represented as bitmapped flags @@ -156,7 +137,7 @@ namespace OpenMetaverse results |= FriendRights.CanSeeOnline; if (m_canSeeMeOnMap) results |= FriendRights.CanSeeOnMap; - if (m_canModifyMyObjects) + if (CanModifyMyObjects) results |= FriendRights.CanModifyObjects; return results; @@ -165,7 +146,7 @@ namespace OpenMetaverse { m_canSeeMeOnline = (value & FriendRights.CanSeeOnline) != 0; m_canSeeMeOnMap = (value & FriendRights.CanSeeOnMap) != 0; - m_canModifyMyObjects = (value & FriendRights.CanModifyObjects) != 0; + CanModifyMyObjects = (value & FriendRights.CanModifyObjects) != 0; } } @@ -177,20 +158,20 @@ namespace OpenMetaverse get { FriendRights results = FriendRights.None; - if (m_canSeeThemOnline) + if (CanSeeThemOnline) results |= FriendRights.CanSeeOnline; - if (m_canSeeThemOnMap) + if (CanSeeThemOnMap) results |= FriendRights.CanSeeOnMap; - if (m_canModifyTheirObjects) + if (CanModifyTheirObjects) results |= FriendRights.CanModifyObjects; return results; } set { - m_canSeeThemOnline = (value & FriendRights.CanSeeOnline) != 0; - m_canSeeThemOnMap = (value & FriendRights.CanSeeOnMap) != 0; - m_canModifyTheirObjects = (value & FriendRights.CanModifyObjects) != 0; + CanSeeThemOnline = (value & FriendRights.CanSeeOnline) != 0; + CanSeeThemOnMap = (value & FriendRights.CanSeeOnMap) != 0; + CanModifyTheirObjects = (value & FriendRights.CanModifyObjects) != 0; } } @@ -204,14 +185,14 @@ namespace OpenMetaverse /// Rights you have to see your friend online and to modify their objects internal FriendInfo(UUID id, FriendRights theirRights, FriendRights myRights) { - m_id = id; + UUID = id; m_canSeeMeOnline = (theirRights & FriendRights.CanSeeOnline) != 0; m_canSeeMeOnMap = (theirRights & FriendRights.CanSeeOnMap) != 0; - m_canModifyMyObjects = (theirRights & FriendRights.CanModifyObjects) != 0; + CanModifyMyObjects = (theirRights & FriendRights.CanModifyObjects) != 0; - m_canSeeThemOnline = (myRights & FriendRights.CanSeeOnline) != 0; - m_canSeeThemOnMap = (myRights & FriendRights.CanSeeOnMap) != 0; - m_canModifyTheirObjects = (myRights & FriendRights.CanModifyObjects) != 0; + CanSeeThemOnline = (myRights & FriendRights.CanSeeOnline) != 0; + CanSeeThemOnMap = (myRights & FriendRights.CanSeeOnMap) != 0; + CanModifyTheirObjects = (myRights & FriendRights.CanModifyObjects) != 0; } /// @@ -220,11 +201,11 @@ namespace OpenMetaverse /// A string reprentation of both my rights and my friends rights public override string ToString() { - if (!String.IsNullOrEmpty(m_name)) - return String.Format("{0} (Their Rights: {1}, My Rights: {2})", m_name, TheirFriendRights, + if (!String.IsNullOrEmpty(Name)) + return String.Format("{0} (Their Rights: {1}, My Rights: {2})", Name, TheirFriendRights, MyFriendRights); else - return String.Format("{0} (Their Rights: {1}, My Rights: {2})", m_id, TheirFriendRights, + return String.Format("{0} (Their Rights: {1}, My Rights: {2})", UUID, TheirFriendRights, MyFriendRights); } } @@ -1051,10 +1032,9 @@ namespace OpenMetaverse public class FriendsReadyEventArgs : EventArgs { - private readonly int m_count; - /// Number of friends we have - public int Count { get { return m_count; } } + public int Count { get; } + /// Get the name of the agent we requested a friendship with /// @@ -1063,17 +1043,15 @@ namespace OpenMetaverse /// The total number of people loaded into the friend list. public FriendsReadyEventArgs(int count) { - this.m_count = count; + this.Count = count; } } /// Contains information on a member of our friends list public class FriendInfoEventArgs : EventArgs { - private readonly FriendInfo m_Friend; - /// Get the FriendInfo - public FriendInfo Friend { get { return m_Friend; } } + public FriendInfo Friend { get; } /// /// Construct a new instance of the FriendInfoEventArgs class @@ -1081,18 +1059,16 @@ namespace OpenMetaverse /// The FriendInfo public FriendInfoEventArgs(FriendInfo friend) { - this.m_Friend = friend; + this.Friend = friend; } } /// Contains Friend Names public class FriendNamesEventArgs : EventArgs { - private readonly Dictionary m_Names; - /// A dictionary where the Key is the ID of the Agent, /// and the Value is a string containing their name - public Dictionary Names { get { return m_Names; } } + public Dictionary Names { get; } /// /// Construct a new instance of the FriendNamesEventArgs class @@ -1101,24 +1077,22 @@ namespace OpenMetaverse /// and the Value is a string containing their name public FriendNamesEventArgs(Dictionary names) { - this.m_Names = names; + this.Names = names; } } /// Sent when another agent requests a friendship with our agent public class FriendshipOfferedEventArgs : EventArgs { - private readonly UUID m_AgentID; - private readonly string m_AgentName; - private readonly UUID m_SessionID; - /// Get the ID of the agent requesting friendship - public UUID AgentID { get { return m_AgentID; } } + public UUID AgentID { get; } + /// Get the name of the agent requesting friendship - public string AgentName { get { return m_AgentName; } } + public string AgentName { get; } + /// Get the ID of the session, used in accepting or declining the /// friendship offer - public UUID SessionID { get { return m_SessionID; } } + public UUID SessionID { get; } /// /// Construct a new instance of the FriendshipOfferedEventArgs class @@ -1129,25 +1103,23 @@ namespace OpenMetaverse /// friendship offer public FriendshipOfferedEventArgs(UUID agentID, string agentName, UUID imSessionID) { - this.m_AgentID = agentID; - this.m_AgentName = agentName; - this.m_SessionID = imSessionID; + this.AgentID = agentID; + this.AgentName = agentName; + this.SessionID = imSessionID; } } /// A response containing the results of our request to form a friendship with another agent public class FriendshipResponseEventArgs : EventArgs { - private readonly UUID m_AgentID; - private readonly string m_AgentName; - private readonly bool m_Accepted; - /// Get the ID of the agent we requested a friendship with - public UUID AgentID { get { return m_AgentID; } } + public UUID AgentID { get; } + /// Get the name of the agent we requested a friendship with - public string AgentName { get { return m_AgentName; } } + public string AgentName { get; } + /// true if the agent accepted our friendship offer - public bool Accepted { get { return m_Accepted; } } + public bool Accepted { get; } /// /// Construct a new instance of the FriendShipResponseEventArgs class @@ -1157,22 +1129,20 @@ namespace OpenMetaverse /// true if the agent accepted our friendship offer public FriendshipResponseEventArgs(UUID agentID, string agentName, bool accepted) { - this.m_AgentID = agentID; - this.m_AgentName = agentName; - this.m_Accepted = accepted; + this.AgentID = agentID; + this.AgentName = agentName; + this.Accepted = accepted; } } /// Contains data sent when a friend terminates a friendship with us public class FriendshipTerminatedEventArgs : EventArgs { - private readonly UUID m_AgentID; - private readonly string m_AgentName; - /// Get the ID of the agent that terminated the friendship with us - public UUID AgentID { get { return m_AgentID; } } + public UUID AgentID { get; } + /// Get the name of the agent that terminated the friendship with us - public string AgentName { get { return m_AgentName; } } + public string AgentName { get; } /// /// Construct a new instance of the FrindshipTerminatedEventArgs class @@ -1181,8 +1151,8 @@ namespace OpenMetaverse /// The name of the friend who terminated the friendship with us public FriendshipTerminatedEventArgs(UUID agentID, string agentName) { - this.m_AgentID = agentID; - this.m_AgentName = agentName; + this.AgentID = agentID; + this.AgentName = agentName; } } @@ -1191,16 +1161,14 @@ namespace OpenMetaverse /// public class FriendFoundReplyEventArgs : EventArgs { - private readonly UUID m_AgentID; - private readonly ulong m_RegionHandle; - private readonly Vector3 m_Location; - /// Get the ID of the agent we have received location information for - public UUID AgentID { get { return m_AgentID; } } + public UUID AgentID { get; } + /// Get the region handle where our mapped friend is located - public ulong RegionHandle { get { return m_RegionHandle; } } + public ulong RegionHandle { get; } + /// Get the simulator local position where our friend is located - public Vector3 Location { get { return m_Location; } } + public Vector3 Location { get; } /// /// Construct a new instance of the FriendFoundReplyEventArgs class @@ -1210,9 +1178,9 @@ namespace OpenMetaverse /// The simulator local position our friend is located public FriendFoundReplyEventArgs(UUID agentID, ulong regionHandle, Vector3 location) { - this.m_AgentID = agentID; - this.m_RegionHandle = regionHandle; - this.m_Location = location; + this.AgentID = agentID; + this.RegionHandle = regionHandle; + this.Location = location; } } #endregion diff --git a/LibreMetaverse/GridManager.cs b/LibreMetaverse/GridManager.cs index 56ee35c6..ab87359f 100644 --- a/LibreMetaverse/GridManager.cs +++ b/LibreMetaverse/GridManager.cs @@ -382,13 +382,16 @@ namespace OpenMetaverse #endregion Delegates /// Unknown - public float SunPhase { get { return sunPhase; } } - /// Current direction of the sun - public Vector3 SunDirection { get { return sunDirection; } } + public float SunPhase { get; private set; } + + /// Current direction of the sun + public Vector3 SunDirection { get; private set; } + /// Current angular velocity of the sun - public Vector3 SunAngVelocity { get { return sunAngVelocity; } } + public Vector3 SunAngVelocity { get; private set; } + /// Microseconds since the start of SL 4-hour day - public ulong TimeOfDay { get { return timeOfDay; } } + public ulong TimeOfDay { get; private set; } /// A dictionary of all the regions, indexed by region name internal Dictionary Regions = new Dictionary(); @@ -396,10 +399,6 @@ namespace OpenMetaverse internal Dictionary RegionsByHandle = new Dictionary(); private GridClient Client; - private float sunPhase; - private Vector3 sunDirection; - private Vector3 sunAngVelocity; - private ulong timeOfDay; /// /// Constructor @@ -784,10 +783,10 @@ namespace OpenMetaverse { SimulatorViewerTimeMessagePacket time = (SimulatorViewerTimeMessagePacket)e.Packet; - sunPhase = time.TimeInfo.SunPhase; - sunDirection = time.TimeInfo.SunDirection; - sunAngVelocity = time.TimeInfo.SunAngVelocity; - timeOfDay = time.TimeInfo.UsecSinceStart; + SunPhase = time.TimeInfo.SunPhase; + SunDirection = time.TimeInfo.SunDirection; + SunAngVelocity = time.TimeInfo.SunAngVelocity; + TimeOfDay = time.TimeInfo.UsecSinceStart; // TODO: Does anyone have a use for the time stuff? } @@ -857,72 +856,59 @@ namespace OpenMetaverse public class CoarseLocationUpdateEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly List m_NewEntries; - private readonly List m_RemovedEntries; - - public Simulator Simulator { get { return m_Simulator; } } - public List NewEntries { get { return m_NewEntries; } } - public List RemovedEntries { get { return m_RemovedEntries; } } + public Simulator Simulator { get; } + public List NewEntries { get; } + public List RemovedEntries { get; } public CoarseLocationUpdateEventArgs(Simulator simulator, List newEntries, List removedEntries) { - this.m_Simulator = simulator; - this.m_NewEntries = newEntries; - this.m_RemovedEntries = removedEntries; + this.Simulator = simulator; + this.NewEntries = newEntries; + this.RemovedEntries = removedEntries; } } public class GridRegionEventArgs : EventArgs { - private readonly GridRegion m_Region; - public GridRegion Region { get { return m_Region; } } + public GridRegion Region { get; } public GridRegionEventArgs(GridRegion region) { - this.m_Region = region; + this.Region = region; } } public class GridLayerEventArgs : EventArgs { - private readonly GridLayer m_Layer; - - public GridLayer Layer { get { return m_Layer; } } + public GridLayer Layer { get; } public GridLayerEventArgs(GridLayer layer) { - this.m_Layer = layer; + this.Layer = layer; } } public class GridItemsEventArgs : EventArgs { - private readonly GridItemType m_Type; - private readonly List m_Items; - - public GridItemType Type { get { return m_Type; } } - public List Items { get { return m_Items; } } + public GridItemType Type { get; } + public List Items { get; } public GridItemsEventArgs(GridItemType type, List items) { - this.m_Type = type; - this.m_Items = items; + this.Type = type; + this.Items = items; } } public class RegionHandleReplyEventArgs : EventArgs { - private readonly UUID m_RegionID; - private readonly ulong m_RegionHandle; - - public UUID RegionID { get { return m_RegionID; } } - public ulong RegionHandle { get { return m_RegionHandle; } } + public UUID RegionID { get; } + public ulong RegionHandle { get; } public RegionHandleReplyEventArgs(UUID regionID, ulong regionHandle) { - this.m_RegionID = regionID; - this.m_RegionHandle = regionHandle; + this.RegionID = regionID; + this.RegionHandle = regionHandle; } } diff --git a/LibreMetaverse/Inventory.cs b/LibreMetaverse/Inventory.cs index 7f239ec8..f6075388 100644 --- a/LibreMetaverse/Inventory.cs +++ b/LibreMetaverse/Inventory.cs @@ -134,7 +134,7 @@ namespace OpenMetaverse set { UpdateNodeFor(value); - _RootNode = Items[value.UUID]; + RootNode = Items[value.UUID]; } } @@ -147,24 +147,21 @@ namespace OpenMetaverse set { UpdateNodeFor(value); - _LibraryRootNode = Items[value.UUID]; + LibraryRootNode = Items[value.UUID]; } } - private InventoryNode _LibraryRootNode; - private InventoryNode _RootNode; - /// /// The root node of the avatars inventory /// - public InventoryNode RootNode => _RootNode; + public InventoryNode RootNode { get; private set; } /// /// The root node of the default shared library /// - public InventoryNode LibraryRootNode => _LibraryRootNode; + public InventoryNode LibraryRootNode { get; private set; } - public UUID Owner { get; } + public UUID Owner { get; private set; } private GridClient Client; //private InventoryManager Manager; diff --git a/LibreMetaverse/Login.cs b/LibreMetaverse/Login.cs index f71dc172..839b88a0 100644 --- a/LibreMetaverse/Login.cs +++ b/LibreMetaverse/Login.cs @@ -977,7 +977,7 @@ namespace OpenMetaverse /// Seed CAPS URL returned from the login server public string LoginSeedCapability = string.Empty; /// Current state of logging in - public LoginStatus LoginStatusCode => InternalStatusCode; + public LoginStatus LoginStatusCode { get; private set; } = LoginStatus.None; /// Upon login failure, contains a short string key for the /// type of login error that occurred @@ -1011,7 +1011,6 @@ namespace OpenMetaverse private LoginParams CurrentContext = null; private readonly AutoResetEvent LoginEvent = new AutoResetEvent(false); - private LoginStatus InternalStatusCode = LoginStatus.None; private readonly Dictionary CallbackOptions = new Dictionary(); /// A list of packets obtained during the login process which @@ -1096,12 +1095,12 @@ namespace OpenMetaverse if (CurrentContext != null) { CurrentContext = null; // Will force any pending callbacks to bail out early - InternalStatusCode = LoginStatus.Failed; + LoginStatusCode = LoginStatus.Failed; LoginMessage = "Timed out"; return false; } - return (InternalStatusCode == LoginStatus.Success); + return (LoginStatusCode == LoginStatus.Success); } public void BeginLogin(LoginParams loginParams) @@ -1157,7 +1156,7 @@ namespace OpenMetaverse } else { - InternalStatusCode = LoginStatus.Failed; + LoginStatusCode = LoginStatus.Failed; LoginMessage = "Aborted"; } UpdateLoginStatus(LoginStatus.Failed, "Abort Requested"); @@ -1379,7 +1378,7 @@ namespace OpenMetaverse private void UpdateLoginStatus(LoginStatus status, string message) { - InternalStatusCode = status; + LoginStatusCode = status; LoginMessage = message; Logger.DebugLog($"Login status: {status.ToString()}: {message}", Client); diff --git a/LibreMetaverse/NetworkManager.cs b/LibreMetaverse/NetworkManager.cs index cfb89be1..315ccdc8 100644 --- a/LibreMetaverse/NetworkManager.cs +++ b/LibreMetaverse/NetworkManager.cs @@ -316,7 +316,7 @@ namespace OpenMetaverse /// Shows whether the network layer is logged in to the /// grid or not - public bool Connected => connected; + public bool Connected { get; private set; } /// Number of packets in the incoming queue public int InboxCount => _packetInboxCount; @@ -346,7 +346,6 @@ namespace OpenMetaverse private GridClient Client; private Timer DisconnectTimer; - private bool connected; private long lastpacketwarning = 0; @@ -587,7 +586,7 @@ namespace OpenMetaverse { // Mark that we are connecting/connected to the grid // - connected = true; + Connected = true; // raise the SimConnecting event and allow any event // subscribers to cancel the connection @@ -746,7 +745,7 @@ namespace OpenMetaverse } // This will catch a Logout when the client is not logged in - if (CurrentSim == null || !connected) + if (CurrentSim == null || !Connected) { Logger.Log("Ignoring RequestLogout(), client is already logged out", Helpers.LogLevel.Warning, Client); return; @@ -865,7 +864,7 @@ namespace OpenMetaverse Interlocked.Exchange(ref _packetInboxCount, 0); Interlocked.Exchange(ref _packetOutboxCount, 0); - connected = false; + Connected = false; // Fire the disconnected callback if (m_Disconnected != null) @@ -923,7 +922,7 @@ namespace OpenMetaverse // FIXME: This is kind of ridiculous. Port the HTB code from Simian over ASAP! var stopwatch = new System.Diagnostics.Stopwatch(); - while (await reader.WaitToReadAsync() && connected) + while (await reader.WaitToReadAsync() && Connected) { while (reader.TryRead(out var outgoingPacket)) { @@ -956,7 +955,7 @@ namespace OpenMetaverse { var reader = _packetInbox.Reader; - while (await reader.WaitToReadAsync() && connected) + while (await reader.WaitToReadAsync() && Connected) { while (reader.TryRead(out var incomingPacket)) { @@ -1006,14 +1005,14 @@ namespace OpenMetaverse private void DisconnectTimer_Elapsed(object obj) { - if (!connected || CurrentSim == null) + if (!Connected || CurrentSim == null) { if (DisconnectTimer != null) { DisconnectTimer.Dispose(); DisconnectTimer = null; } - connected = false; + Connected = false; } else if (CurrentSim.DisconnectCandidate) { @@ -1027,7 +1026,7 @@ namespace OpenMetaverse DisconnectTimer = null; } - connected = false; + Connected = false; // Shutdown the network layer Shutdown(DisconnectType.NetworkTimeout); diff --git a/LibreMetaverse/ObjectManager.cs b/LibreMetaverse/ObjectManager.cs index ba1e2845..d1285ee7 100644 --- a/LibreMetaverse/ObjectManager.cs +++ b/LibreMetaverse/ObjectManager.cs @@ -3359,22 +3359,20 @@ namespace OpenMetaverse /// public class PrimEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly bool m_IsNew; - private readonly bool m_IsAttachment; - private readonly Primitive m_Prim; - private readonly ushort m_TimeDilation; - /// Get the simulator the originated from - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// Get the details - public Primitive Prim { get { return m_Prim; } } + public Primitive Prim { get; } + /// true if the did not exist in the dictionary before this update (always true if object tracking has been disabled) - public bool IsNew { get { return m_IsNew; } } + public bool IsNew { get; } + /// true if the is attached to an - public bool IsAttachment { get { return m_IsAttachment; } } + public bool IsAttachment { get; } + /// Get the simulator Time Dilation - public ushort TimeDilation { get { return m_TimeDilation; } } + public ushort TimeDilation { get; } /// /// Construct a new instance of the PrimEventArgs class @@ -3386,11 +3384,11 @@ namespace OpenMetaverse /// true if the primitive represents an attachment to an agent public PrimEventArgs(Simulator simulator, Primitive prim, ushort timeDilation, bool isNew, bool isAttachment) { - this.m_Simulator = simulator; - this.m_IsNew = isNew; - this.m_IsAttachment = isAttachment; - this.m_Prim = prim; - this.m_TimeDilation = timeDilation; + this.Simulator = simulator; + this.IsNew = isNew; + this.IsAttachment = isAttachment; + this.Prim = prim; + this.TimeDilation = timeDilation; } } @@ -3440,19 +3438,17 @@ namespace OpenMetaverse /// public class AvatarUpdateEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly Avatar m_Avatar; - private readonly ushort m_TimeDilation; - private readonly bool m_IsNew; - /// Get the simulator the object originated from - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// Get the data - public Avatar Avatar { get { return m_Avatar; } } + public Avatar Avatar { get; } + /// Get the simulator time dilation - public ushort TimeDilation { get { return m_TimeDilation; } } + public ushort TimeDilation { get; } + /// true if the did not exist in the dictionary before this update (always true if avatar tracking has been disabled) - public bool IsNew { get { return m_IsNew; } } + public bool IsNew { get; } /// /// Construct a new instance of the AvatarUpdateEventArgs class @@ -3463,24 +3459,22 @@ namespace OpenMetaverse /// The avatar was not in the dictionary before this update public AvatarUpdateEventArgs(Simulator simulator, Avatar avatar, ushort timeDilation, bool isNew) { - this.m_Simulator = simulator; - this.m_Avatar = avatar; - this.m_TimeDilation = timeDilation; - this.m_IsNew = isNew; + this.Simulator = simulator; + this.Avatar = avatar; + this.TimeDilation = timeDilation; + this.IsNew = isNew; } } public class ParticleUpdateEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly Primitive.ParticleSystem m_ParticleSystem; - private readonly Primitive m_Source; - /// Get the simulator the object originated from - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// Get the data - public Primitive.ParticleSystem ParticleSystem { get { return m_ParticleSystem; } } + public Primitive.ParticleSystem ParticleSystem { get; } + /// Get source - public Primitive Source { get { return m_Source; } } + public Primitive Source { get; } /// /// Construct a new instance of the ParticleUpdateEventArgs class @@ -3489,9 +3483,9 @@ namespace OpenMetaverse /// The ParticleSystem data /// The Primitive source public ParticleUpdateEventArgs(Simulator simulator, Primitive.ParticleSystem particlesystem, Primitive source) { - this.m_Simulator = simulator; - this.m_ParticleSystem = particlesystem; - this.m_Source = source; + this.Simulator = simulator; + this.ParticleSystem = particlesystem; + this.Source = source; } } @@ -3548,11 +3542,8 @@ namespace OpenMetaverse /// public class ObjectPropertiesUpdatedEventArgs : ObjectPropertiesEventArgs { - - private readonly Primitive m_Prim; - /// Get the primitive details - public Primitive Prim { get { return m_Prim; } } + public Primitive Prim { get; } /// /// Construct a new instance of the ObjectPropertiesUpdatedEvenrArgs class @@ -3562,7 +3553,7 @@ namespace OpenMetaverse /// The primitive Properties public ObjectPropertiesUpdatedEventArgs(Simulator simulator, Primitive prim, Primitive.ObjectProperties props) : base(simulator, props) { - this.m_Prim = prim; + this.Prim = prim; } } @@ -3575,22 +3566,20 @@ namespace OpenMetaverse /// public class ObjectPropertiesFamilyEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly Primitive.ObjectProperties m_Properties; - private readonly ReportType m_Type; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// - public Primitive.ObjectProperties Properties { get { return m_Properties; } } + public Primitive.ObjectProperties Properties { get; } + /// - public ReportType Type { get { return m_Type; } } + public ReportType Type { get; } public ObjectPropertiesFamilyEventArgs(Simulator simulator, Primitive.ObjectProperties props, ReportType type) { - this.m_Simulator = simulator; - this.m_Properties = props; - this.m_Type = type; + this.Simulator = simulator; + this.Properties = props; + this.Type = type; } } @@ -3599,26 +3588,24 @@ namespace OpenMetaverse /// public class TerseObjectUpdateEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly Primitive m_Prim; - private readonly ObjectMovementUpdate m_Update; - private readonly ushort m_TimeDilation; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// Get the primitive details - public Primitive Prim { get { return m_Prim; } } + public Primitive Prim { get; } + /// - public ObjectMovementUpdate Update { get { return m_Update; } } + public ObjectMovementUpdate Update { get; } + /// - public ushort TimeDilation { get { return m_TimeDilation; } } + public ushort TimeDilation { get; } public TerseObjectUpdateEventArgs(Simulator simulator, Primitive prim, ObjectMovementUpdate update, ushort timeDilation) { - this.m_Simulator = simulator; - this.m_Prim = prim; - this.m_Update = update; - this.m_TimeDilation = timeDilation; + this.Simulator = simulator; + this.Prim = prim; + this.Update = update; + this.TimeDilation = timeDilation; } } @@ -3627,35 +3614,33 @@ namespace OpenMetaverse /// public class ObjectDataBlockUpdateEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly Primitive m_Prim; - private readonly Primitive.ConstructionData m_ConstructionData; - private readonly ObjectUpdatePacket.ObjectDataBlock m_Block; - private readonly ObjectMovementUpdate m_Update; - private readonly NameValue[] m_NameValues; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// Get the primitive details - public Primitive Prim { get { return m_Prim; } } + public Primitive Prim { get; } + /// - public Primitive.ConstructionData ConstructionData { get { return m_ConstructionData; } } + public Primitive.ConstructionData ConstructionData { get; } + /// - public ObjectUpdatePacket.ObjectDataBlock Block { get { return m_Block; } } + public ObjectUpdatePacket.ObjectDataBlock Block { get; } + /// - public ObjectMovementUpdate Update { get { return m_Update; } } + public ObjectMovementUpdate Update { get; } + /// - public NameValue[] NameValues { get { return m_NameValues; } } + public NameValue[] NameValues { get; } public ObjectDataBlockUpdateEventArgs(Simulator simulator, Primitive prim, Primitive.ConstructionData constructionData, ObjectUpdatePacket.ObjectDataBlock block, ObjectMovementUpdate objectupdate, NameValue[] nameValues) { - this.m_Simulator = simulator; - this.m_Prim = prim; - this.m_ConstructionData = constructionData; - this.m_Block = block; - this.m_Update = objectupdate; - this.m_NameValues = nameValues; + this.Simulator = simulator; + this.Prim = prim; + this.ConstructionData = constructionData; + this.Block = block; + this.Update = objectupdate; + this.NameValues = nameValues; } } @@ -3663,18 +3648,16 @@ namespace OpenMetaverse /// event public class KillObjectEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly uint m_ObjectLocalID; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// The LocalID of the object - public uint ObjectLocalID { get { return m_ObjectLocalID; } } + public uint ObjectLocalID { get; } public KillObjectEventArgs(Simulator simulator, uint objectID) { - this.m_Simulator = simulator; - this.m_ObjectLocalID = objectID; + this.Simulator = simulator; + this.ObjectLocalID = objectID; } } @@ -3682,18 +3665,16 @@ namespace OpenMetaverse /// event public class KillObjectsEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly uint[] m_ObjectLocalIDs; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// The LocalID of the object - public uint[] ObjectLocalIDs { get { return m_ObjectLocalIDs; } } + public uint[] ObjectLocalIDs { get; } public KillObjectsEventArgs(Simulator simulator, uint[] objectIDs) { - this.m_Simulator = simulator; - this.m_ObjectLocalIDs = objectIDs; + this.Simulator = simulator; + this.ObjectLocalIDs = objectIDs; } } @@ -3702,26 +3683,24 @@ namespace OpenMetaverse /// public class AvatarSitChangedEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly Avatar m_Avatar; - private readonly uint m_SittingOn; - private readonly uint m_OldSeat; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// - public Avatar Avatar { get { return m_Avatar; } } + public Avatar Avatar { get; } + /// - public uint SittingOn { get { return m_SittingOn; } } + public uint SittingOn { get; } + /// - public uint OldSeat { get { return m_OldSeat; } } + public uint OldSeat { get; } public AvatarSitChangedEventArgs(Simulator simulator, Avatar avatar, uint sittingOn, uint oldSeat) { - this.m_Simulator = simulator; - this.m_Avatar = avatar; - this.m_SittingOn = sittingOn; - this.m_OldSeat = oldSeat; + this.Simulator = simulator; + this.Avatar = avatar; + this.SittingOn = sittingOn; + this.OldSeat = oldSeat; } } @@ -3730,26 +3709,24 @@ namespace OpenMetaverse /// public class PayPriceReplyEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly UUID m_ObjectID; - private readonly int m_DefaultPrice; - private readonly int[] m_ButtonPrices; - /// Get the simulator the object is located - public Simulator Simulator { get { return m_Simulator; } } + public Simulator Simulator { get; } + /// - public UUID ObjectID { get { return m_ObjectID; } } + public UUID ObjectID { get; } + /// - public int DefaultPrice { get { return m_DefaultPrice; } } + public int DefaultPrice { get; } + /// - public int[] ButtonPrices { get { return m_ButtonPrices; } } + public int[] ButtonPrices { get; } public PayPriceReplyEventArgs(Simulator simulator, UUID objectID, int defaultPrice, int[] buttonPrices) { - this.m_Simulator = simulator; - this.m_ObjectID = objectID; - this.m_DefaultPrice = defaultPrice; - this.m_ButtonPrices = buttonPrices; + this.Simulator = simulator; + this.ObjectID = objectID; + this.DefaultPrice = defaultPrice; + this.ButtonPrices = buttonPrices; } } diff --git a/LibreMetaverse/ParcelManager.cs b/LibreMetaverse/ParcelManager.cs index 05878155..dbd0e1c2 100644 --- a/LibreMetaverse/ParcelManager.cs +++ b/LibreMetaverse/ParcelManager.cs @@ -2114,18 +2114,14 @@ namespace OpenMetaverse /// Contains a parcels dwell data returned from the simulator in response to an public class ParcelDwellReplyEventArgs : EventArgs { - private readonly UUID m_ParcelID; - private readonly int m_LocalID; - private readonly float m_Dwell; - /// Get the global ID of the parcel - public UUID ParcelID => m_ParcelID; + public UUID ParcelID { get; } /// Get the simulator specific ID of the parcel - public int LocalID => m_LocalID; + public int LocalID { get; } /// Get the calculated dwell - public float Dwell => m_Dwell; + public float Dwell { get; } /// /// Construct a new instance of the ParcelDwellReplyEventArgs class @@ -2135,20 +2131,18 @@ namespace OpenMetaverse /// The calculated dwell for the parcel public ParcelDwellReplyEventArgs(UUID parcelID, int localID, float dwell) { - m_ParcelID = parcelID; - m_LocalID = localID; - m_Dwell = dwell; + ParcelID = parcelID; + LocalID = localID; + Dwell = dwell; } } /// Contains basic parcel information data returned from the /// simulator in response to an request public class ParcelInfoReplyEventArgs : EventArgs - { - private readonly ParcelInfo m_Parcel; - + { /// Get the object containing basic parcel info - public ParcelInfo Parcel => m_Parcel; + public ParcelInfo Parcel { get; } /// /// Construct a new instance of the ParcelInfoReplyEventArgs class @@ -2156,40 +2150,33 @@ namespace OpenMetaverse /// The object containing basic parcel info public ParcelInfoReplyEventArgs(ParcelInfo parcel) { - m_Parcel = parcel; + Parcel = parcel; } } /// Contains basic parcel information data returned from the simulator in response to an request public class ParcelPropertiesEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private Parcel m_Parcel; - private readonly ParcelResult m_Result; - private readonly int m_SelectedPrims; - private readonly int m_SequenceID; - private readonly bool m_SnapSelection; - /// Get the simulator the parcel is located in - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the object containing the details /// If Result is NoData, this object will not contain valid data - public Parcel Parcel => m_Parcel; + public Parcel Parcel { get; } /// Get the result of the request - public ParcelResult Result => m_Result; + public ParcelResult Result { get; } /// Get the number of primitieves your agent is /// currently selecting and or sitting on in this parcel - public int SelectedPrims => m_SelectedPrims; + public int SelectedPrims { get; } /// Get the user assigned ID used to correlate a request with /// these results - public int SequenceID => m_SequenceID; + public int SequenceID { get; } /// TODO: - public bool SnapSelection => m_SnapSelection; + public bool SnapSelection { get; } /// /// Construct a new instance of the ParcelPropertiesEventArgs class @@ -2205,39 +2192,33 @@ namespace OpenMetaverse public ParcelPropertiesEventArgs(Simulator simulator, Parcel parcel, ParcelResult result, int selectedPrims, int sequenceID, bool snapSelection) { - m_Simulator = simulator; - m_Parcel = parcel; - m_Result = result; - m_SelectedPrims = selectedPrims; - m_SequenceID = sequenceID; - m_SnapSelection = snapSelection; + Simulator = simulator; + Parcel = parcel; + Result = result; + SelectedPrims = selectedPrims; + SequenceID = sequenceID; + SnapSelection = snapSelection; } } /// Contains blacklist and whitelist data returned from the simulator in response to an request public class ParcelAccessListReplyEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly int m_SequenceID; - private readonly int m_LocalID; - private readonly uint m_Flags; - private readonly List m_AccessList; - /// Get the simulator the parcel is located in - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the user assigned ID used to correlate a request with /// these results - public int SequenceID => m_SequenceID; + public int SequenceID { get; } /// Get the simulator specific ID of the parcel - public int LocalID => m_LocalID; + public int LocalID { get; } /// TODO - public uint Flags => m_Flags; + public uint Flags { get; } /// Get the list containing the white/blacklisted agents for the parcel - public List AccessList => m_AccessList; + public List AccessList { get; } /// /// Construct a new instance of the ParcelAccessListReplyEventArgs class @@ -2250,11 +2231,11 @@ namespace OpenMetaverse /// The list containing the white/blacklisted agents for the parcel public ParcelAccessListReplyEventArgs(Simulator simulator, int sequenceID, int localID, uint flags, List accessEntries) { - m_Simulator = simulator; - m_SequenceID = sequenceID; - m_LocalID = localID; - m_Flags = flags; - m_AccessList = accessEntries; + Simulator = simulator; + SequenceID = sequenceID; + LocalID = localID; + Flags = flags; + AccessList = accessEntries; } } @@ -2262,14 +2243,11 @@ namespace OpenMetaverse /// simulator in response to an request public class ParcelObjectOwnersReplyEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly List m_Owners; - /// Get the simulator the parcel is located in - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the list containing prim ownership counts - public List PrimOwners => m_Owners; + public List PrimOwners { get; } /// /// Construct a new instance of the ParcelObjectOwnersReplyEventArgs class @@ -2278,27 +2256,23 @@ namespace OpenMetaverse /// The list containing prim ownership counts public ParcelObjectOwnersReplyEventArgs(Simulator simulator, List primOwners) { - m_Simulator = simulator; - m_Owners = primOwners; + Simulator = simulator; + PrimOwners = primOwners; } } /// Contains the data returned when all parcel data has been retrieved from a simulator public class SimParcelsDownloadedEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly InternalDictionary m_Parcels; - private readonly int[,] m_ParcelMap; - /// Get the simulator the parcel data was retrieved from - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// A dictionary containing the parcel data where the key correlates to the ParcelMap entry - public InternalDictionary Parcels => m_Parcels; + public InternalDictionary Parcels { get; } /// Get the multidimensional array containing a x,y grid mapped /// to each 64x64 parcel's LocalID. - public int[,] ParcelMap => m_ParcelMap; + public int[,] ParcelMap { get; } /// /// Construct a new instance of the SimParcelsDownloadedEventArgs class @@ -2309,28 +2283,24 @@ namespace OpenMetaverse /// to each 64x64 parcel's LocalID. public SimParcelsDownloadedEventArgs(Simulator simulator, InternalDictionary simParcels, int[,] parcelMap) { - m_Simulator = simulator; - m_Parcels = simParcels; - m_ParcelMap = parcelMap; + Simulator = simulator; + Parcels = simParcels; + ParcelMap = parcelMap; } } /// Contains the data returned when a request public class ForceSelectObjectsReplyEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly List m_ObjectIDs; - private readonly bool m_ResetList; - /// Get the simulator the parcel data was retrieved from - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the list of primitive IDs - public List ObjectIDs => m_ObjectIDs; + public List ObjectIDs { get; } /// true if the list is clean and contains the information /// only for a given request - public bool ResetList => m_ResetList; + public bool ResetList { get; } /// /// Construct a new instance of the ForceSelectObjectsReplyEventArgs class @@ -2341,23 +2311,20 @@ namespace OpenMetaverse /// only for a given request public ForceSelectObjectsReplyEventArgs(Simulator simulator, List objectIDs, bool resetList) { - this.m_Simulator = simulator; - this.m_ObjectIDs = objectIDs; - this.m_ResetList = resetList; + this.Simulator = simulator; + this.ObjectIDs = objectIDs; + this.ResetList = resetList; } } /// Contains data when the media data for a parcel the avatar is on changes public class ParcelMediaUpdateReplyEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly ParcelMedia m_ParcelMedia; - /// Get the simulator the parcel media data was updated in - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the updated media information - public ParcelMedia Media => m_ParcelMedia; + public ParcelMedia Media { get; } /// /// Construct a new instance of the ParcelMediaUpdateReplyEventArgs class @@ -2366,34 +2333,28 @@ namespace OpenMetaverse /// The updated media information public ParcelMediaUpdateReplyEventArgs(Simulator simulator, ParcelMedia media) { - this.m_Simulator = simulator; - this.m_ParcelMedia = media; + this.Simulator = simulator; + this.Media = media; } } /// Contains the media command for a parcel the agent is currently on public class ParcelMediaCommandEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly uint m_Sequence; - private readonly ParcelFlags m_ParcelFlags; - private readonly ParcelMediaCommand m_MediaCommand; - private readonly float m_Time; - /// Get the simulator the parcel media command was issued in - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// - public uint Sequence => m_Sequence; + public uint Sequence { get; } /// - public ParcelFlags ParcelFlags => m_ParcelFlags; + public ParcelFlags ParcelFlags { get; } /// Get the media command that was sent - public ParcelMediaCommand MediaCommand => m_MediaCommand; + public ParcelMediaCommand MediaCommand { get; } /// - public float Time => m_Time; + public float Time { get; } /// /// Construct a new instance of the ParcelMediaCommandEventArgs class @@ -2405,11 +2366,11 @@ namespace OpenMetaverse /// public ParcelMediaCommandEventArgs(Simulator simulator, uint sequence, ParcelFlags flags, ParcelMediaCommand command, float time) { - m_Simulator = simulator; - m_Sequence = sequence; - m_ParcelFlags = flags; - m_MediaCommand = command; - m_Time = time; + Simulator = simulator; + Sequence = sequence; + ParcelFlags = flags; + MediaCommand = command; + Time = time; } } #endregion diff --git a/LibreMetaverse/Settings.cs b/LibreMetaverse/Settings.cs index df180ce1..10855124 100644 --- a/LibreMetaverse/Settings.cs +++ b/LibreMetaverse/Settings.cs @@ -297,7 +297,7 @@ namespace OpenMetaverse /// Cost of uploading an asset /// Read-only since this value is dynamically fetched at login - public int UPLOAD_COST => priceUpload; + public int UPLOAD_COST { get; private set; } = 0; /// Maximum number of times to resend a failed packet public int MAX_RESEND_COUNT = 3; @@ -354,7 +354,6 @@ namespace OpenMetaverse #region Private Fields private GridClient Client; - private int priceUpload = 0; public static bool SORT_INVENTORY = false; /// Constructor @@ -375,7 +374,7 @@ namespace OpenMetaverse { EconomyDataPacket econ = (EconomyDataPacket)e.Packet; - priceUpload = econ.Info.PriceUpload; + UPLOAD_COST = econ.Info.PriceUpload; } #endregion diff --git a/LibreMetaverse/SoundManager.cs b/LibreMetaverse/SoundManager.cs index 48b20492..91d6ac02 100644 --- a/LibreMetaverse/SoundManager.cs +++ b/LibreMetaverse/SoundManager.cs @@ -343,18 +343,14 @@ namespace OpenMetaverse /// changes its volume level public class AttachedSoundGainChangeEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly UUID m_ObjectID; - private readonly float m_Gain; - /// Simulator where the event originated - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the ID of the Object - public UUID ObjectID => m_ObjectID; + public UUID ObjectID { get; } /// Get the volume level - public float Gain => m_Gain; + public float Gain { get; } /// /// Construct a new instance of the AttachedSoundGainChangedEventArgs class @@ -364,9 +360,9 @@ namespace OpenMetaverse /// The new volume level public AttachedSoundGainChangeEventArgs(Simulator sim, UUID objectID, float gain) { - m_Simulator = sim; - m_ObjectID = objectID; - m_Gain = gain; + Simulator = sim; + ObjectID = objectID; + Gain = gain; } } @@ -398,38 +394,29 @@ namespace OpenMetaverse /// public class SoundTriggerEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly UUID m_SoundID; - private readonly UUID m_OwnerID; - private readonly UUID m_ObjectID; - private readonly UUID m_ParentID; - private readonly float m_Gain; - private readonly ulong m_RegionHandle; - private readonly Vector3 m_Position; - /// Simulator where the event originated - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the sound asset id - public UUID SoundID => m_SoundID; + public UUID SoundID { get; } /// Get the ID of the owner - public UUID OwnerID => m_OwnerID; + public UUID OwnerID { get; } /// Get the ID of the Object - public UUID ObjectID => m_ObjectID; + public UUID ObjectID { get; } /// Get the ID of the objects parent - public UUID ParentID => m_ParentID; + public UUID ParentID { get; } /// Get the volume level - public float Gain => m_Gain; + public float Gain { get; } /// Get the regionhandle - public ulong RegionHandle => m_RegionHandle; + public ulong RegionHandle { get; } /// Get the source position - public Vector3 Position => m_Position; + public Vector3 Position { get; } /// /// Construct a new instance of the SoundTriggerEventArgs class @@ -444,14 +431,14 @@ namespace OpenMetaverse /// The source position public SoundTriggerEventArgs(Simulator sim, UUID soundID, UUID ownerID, UUID objectID, UUID parentID, float gain, ulong regionHandle, Vector3 position) { - m_Simulator = sim; - m_SoundID = soundID; - m_OwnerID = ownerID; - m_ObjectID = objectID; - m_ParentID = parentID; - m_Gain = gain; - m_RegionHandle = regionHandle; - m_Position = position; + Simulator = sim; + SoundID = soundID; + OwnerID = ownerID; + ObjectID = objectID; + ParentID = parentID; + Gain = gain; + RegionHandle = regionHandle; + Position = position; } } @@ -474,22 +461,17 @@ namespace OpenMetaverse /// public class PreloadSoundEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly UUID m_SoundID; - private readonly UUID m_OwnerID; - private readonly UUID m_ObjectID; - /// Simulator where the event originated - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Get the sound asset id - public UUID SoundID => m_SoundID; + public UUID SoundID { get; } /// Get the ID of the owner - public UUID OwnerID => m_OwnerID; + public UUID OwnerID { get; } /// Get the ID of the Object - public UUID ObjectID => m_ObjectID; + public UUID ObjectID { get; } /// /// Construct a new instance of the PreloadSoundEventArgs class @@ -500,10 +482,10 @@ namespace OpenMetaverse /// The ID of the object public PreloadSoundEventArgs(Simulator sim, UUID soundID, UUID ownerID, UUID objectID) { - m_Simulator = sim; - m_SoundID = soundID; - m_OwnerID = ownerID; - m_ObjectID = objectID; + Simulator = sim; + SoundID = soundID; + OwnerID = ownerID; + ObjectID = objectID; } } #endregion diff --git a/LibreMetaverse/TerrainManager.cs b/LibreMetaverse/TerrainManager.cs index 47dd5ec2..8a112e94 100644 --- a/LibreMetaverse/TerrainManager.cs +++ b/LibreMetaverse/TerrainManager.cs @@ -192,34 +192,28 @@ namespace OpenMetaverse // Provides data for LandPatchReceived public class LandPatchReceivedEventArgs : EventArgs { - private readonly Simulator m_Simulator; - private readonly int m_X; - private readonly int m_Y; - private readonly int m_PatchSize; - private readonly float[] m_HeightMap; - /// Simulator from that sent tha data - public Simulator Simulator => m_Simulator; + public Simulator Simulator { get; } /// Sim coordinate of the patch - public int X => m_X; + public int X { get; } /// Sim coordinate of the patch - public int Y => m_Y; + public int Y { get; } /// Size of tha patch - public int PatchSize => m_PatchSize; + public int PatchSize { get; } /// Heightmap for the patch - public float[] HeightMap => m_HeightMap; + public float[] HeightMap { get; } public LandPatchReceivedEventArgs(Simulator simulator, int x, int y, int patchSize, float[] heightMap) { - m_Simulator = simulator; - m_X = x; - m_Y = y; - m_PatchSize = patchSize; - m_HeightMap = heightMap; + Simulator = simulator; + X = x; + Y = y; + PatchSize = patchSize; + HeightMap = heightMap; } } #endregion diff --git a/LibreMetaverse/Voice/VoiceControl.cs b/LibreMetaverse/Voice/VoiceControl.cs index 77ca6793..94dd846b 100644 --- a/LibreMetaverse/Voice/VoiceControl.cs +++ b/LibreMetaverse/Voice/VoiceControl.cs @@ -88,16 +88,16 @@ namespace OpenMetaverse.Voice private Vector3d oldAt; // Audio interfaces - private List inputDevices; /// /// List of audio input devices /// - public List CaptureDevices { get { return inputDevices; } } - private List outputDevices; + public List CaptureDevices { get; private set; } + /// /// List of audio output devices /// - public List PlaybackDevices { get { return outputDevices; } } + public List PlaybackDevices { get; private set; } + private string currentCaptureDevice; private string currentPlaybackDevice; private bool testing = false; @@ -756,7 +756,7 @@ namespace OpenMetaverse.Voice object sender, VoiceDevicesEventArgs e) { - outputDevices = e.Devices; + PlaybackDevices = e.Devices; currentPlaybackDevice = e.CurrentDevice; } @@ -767,7 +767,7 @@ namespace OpenMetaverse.Voice object sender, VoiceDevicesEventArgs e) { - inputDevices = e.Devices; + CaptureDevices = e.Devices; currentCaptureDevice = e.CurrentDevice; } diff --git a/LibreMetaverse/Voice/VoiceDefinitions.cs b/LibreMetaverse/Voice/VoiceDefinitions.cs index 1bcce539..473c4a17 100644 --- a/LibreMetaverse/Voice/VoiceDefinitions.cs +++ b/LibreMetaverse/Voice/VoiceDefinitions.cs @@ -424,16 +424,14 @@ namespace OpenMetaverse.Voice #region Connector Delegates public class VoiceConnectorEventArgs : VoiceResponseEventArgs { - private readonly string m_Version; - private readonly string m_ConnectorHandle; - public string Version { get { return m_Version; } } - public string Handle { get { return m_ConnectorHandle; } } + public string Version { get; } + public string Handle { get; } public VoiceConnectorEventArgs(int rcode, int scode, string text, string version, string handle) : base(ResponseType.ConnectorCreate, rcode, scode, text) { - m_Version = version; - m_ConnectorHandle = handle; + Version = version; + Handle = handle; } } @@ -443,16 +441,14 @@ namespace OpenMetaverse.Voice #region Aux Event Args public class VoiceDevicesEventArgs : VoiceResponseEventArgs { - private readonly string m_CurrentDevice; - private readonly List m_Available; - public string CurrentDevice { get { return m_CurrentDevice; } } - public List Devices { get { return m_Available; } } + public string CurrentDevice { get; } + public List Devices { get; } public VoiceDevicesEventArgs(ResponseType type, int rcode, int scode, string text, string current, List avail) : base(type, rcode, scode, text) { - m_CurrentDevice = current; - m_Available = avail; + CurrentDevice = current; + Devices = avail; } } @@ -478,13 +474,12 @@ namespace OpenMetaverse.Voice #region Account Event Args public class VoiceAccountEventArgs : VoiceResponseEventArgs { - private readonly string m_AccountHandle; - public string AccountHandle { get { return m_AccountHandle; } } + public string AccountHandle { get; } public VoiceAccountEventArgs(int rcode, int scode, string text, string ahandle) : base(ResponseType.AccountLogin, rcode, scode, text) { - this.m_AccountHandle = ahandle; + this.AccountHandle = ahandle; } } diff --git a/LibreMetaverse/Voice/VoiceGateway.cs b/LibreMetaverse/Voice/VoiceGateway.cs index 202792b3..3d4088ce 100644 --- a/LibreMetaverse/Voice/VoiceGateway.cs +++ b/LibreMetaverse/Voice/VoiceGateway.cs @@ -312,13 +312,13 @@ namespace OpenMetaverse.Voice } break; case "Aux.GetCaptureDevices.1": - inputDevices = new List(); + CaptureDevices = new List(); if (rsp.Results.CaptureDevices.Count == 0 || rsp.Results.CurrentCaptureDevice == null) break; foreach (CaptureDevice device in rsp.Results.CaptureDevices) - inputDevices.Add(device.Device); + CaptureDevices.Add(device.Device); currentCaptureDevice = rsp.Results.CurrentCaptureDevice.Device; if (OnAuxGetCaptureDevicesResponse != null && rsp.Results.CaptureDevices.Count > 0) @@ -331,17 +331,17 @@ namespace OpenMetaverse.Voice int.Parse(rsp.Results.StatusCode), rsp.Results.StatusString, rsp.Results.CurrentCaptureDevice.Device, - inputDevices)); + CaptureDevices)); } break; case "Aux.GetRenderDevices.1": - outputDevices = new List(); + PlaybackDevices = new List(); if (rsp.Results.RenderDevices.Count == 0 || rsp.Results.CurrentRenderDevice == null) break; foreach (RenderDevice device in rsp.Results.RenderDevices) - outputDevices.Add(device.Device); + PlaybackDevices.Add(device.Device); currentPlaybackDevice = rsp.Results.CurrentRenderDevice.Device; @@ -356,7 +356,7 @@ namespace OpenMetaverse.Voice int.Parse(rsp.Results.StatusCode), rsp.Results.StatusString, rsp.Results.CurrentRenderDevice.Device, - outputDevices)); + PlaybackDevices)); } break; diff --git a/LibreMetaverse/Voice/VoiceParticipant.cs b/LibreMetaverse/Voice/VoiceParticipant.cs index 135d9a2f..ff8ebb2e 100644 --- a/LibreMetaverse/Voice/VoiceParticipant.cs +++ b/LibreMetaverse/Voice/VoiceParticipant.cs @@ -34,25 +34,21 @@ namespace OpenMetaverse.Voice { public class VoiceParticipant { - private string Sip; private string AvatarName { get; set; } - private UUID id; private bool muted; private int volume; private VoiceSession session; - private float energy; - public float Energy { get { return energy; } } - private bool speaking; - public bool IsSpeaking { get { return speaking; } } - public string URI { get { return Sip; } } - public UUID ID { get { return id; } } + public float Energy { get; private set; } + public bool IsSpeaking { get; private set; } + public string URI { get; } + public UUID ID { get; } public VoiceParticipant(string puri, VoiceSession s) { - id = IDFromName(puri); - Sip = puri; + ID = IDFromName(puri); + URI = puri; session = s; } @@ -128,7 +124,7 @@ namespace OpenMetaverse.Voice muted = value; StringBuilder sb = new StringBuilder(); sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("SessionHandle", session.Handle)); - sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("ParticipantURI", Sip)); + sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("ParticipantURI", URI)); sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("Mute", muted ? "1" : "0")); session.Connector.Request("Session.SetParticipantMuteForMe.1", sb.ToString()); } @@ -142,7 +138,7 @@ namespace OpenMetaverse.Voice volume = value; StringBuilder sb = new StringBuilder(); sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("SessionHandle", session.Handle)); - sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("ParticipantURI", Sip)); + sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("ParticipantURI", URI)); sb.Append(OpenMetaverse.Voice.VoiceGateway.MakeXML("Volume", volume.ToString())); session.Connector.Request("Session.SetParticipantVolumeForMe.1", sb.ToString()); } @@ -150,9 +146,9 @@ namespace OpenMetaverse.Voice internal void SetProperties(bool speak, bool mute, float en) { - speaking = speak; + IsSpeaking = speak; muted = mute; - energy = en; + Energy = en; } } } diff --git a/LibreMetaverse/Voice/VoiceSession.cs b/LibreMetaverse/Voice/VoiceSession.cs index aadc96ea..04e561a7 100644 --- a/LibreMetaverse/Voice/VoiceSession.cs +++ b/LibreMetaverse/Voice/VoiceSession.cs @@ -36,15 +36,12 @@ namespace OpenMetaverse.Voice /// public class VoiceSession { - private string m_Handle; private static Dictionary knownParticipants; public string RegionName; - private bool m_spatial; - public bool IsSpatial { get { return m_spatial; } } - private VoiceGateway connector; + public bool IsSpatial { get; } - public VoiceGateway Connector { get { return connector; } } - public string Handle { get { return m_Handle; } } + public VoiceGateway Connector { get; } + public string Handle { get; } public event System.EventHandler OnParticipantAdded; public event System.EventHandler OnParticipantUpdate; @@ -52,10 +49,10 @@ namespace OpenMetaverse.Voice public VoiceSession(VoiceGateway conn, string handle) { - m_Handle = handle; - connector = conn; + Handle = handle; + Connector = conn; - m_spatial = true; + IsSpatial = true; knownParticipants = new Dictionary(); } @@ -150,7 +147,7 @@ namespace OpenMetaverse.Voice public void Set3DPosition(VoicePosition SpeakerPosition, VoicePosition ListenerPosition) { - connector.SessionSet3DPosition(m_Handle, SpeakerPosition, ListenerPosition); + Connector.SessionSet3DPosition(Handle, SpeakerPosition, ListenerPosition); } } diff --git a/Programs/GridProxy/GridProxy.cs b/Programs/GridProxy/GridProxy.cs index 3259b7dc..76cb826c 100644 --- a/Programs/GridProxy/GridProxy.cs +++ b/Programs/GridProxy/GridProxy.cs @@ -2115,12 +2115,6 @@ namespace GridProxy // Describes a caps URI public class CapInfo { - private string uri; - private IPEndPoint sim; - private string type; - private CapsDataFormat reqFmt; - private CapsDataFormat respFmt; - private List Delegates = new List(); @@ -2129,28 +2123,17 @@ namespace GridProxy this(URI, Sim, CapType, CapsDataFormat.OSD, CapsDataFormat.OSD) { } public CapInfo(string URI, IPEndPoint Sim, string CapType, CapsDataFormat ReqFmt, CapsDataFormat RespFmt) { - uri = URI; sim = Sim; type = CapType; reqFmt = ReqFmt; respFmt = RespFmt; - } - public string URI - { - get { return uri; } - } - public string CapType - { - get { return type; } /* EventQueueGet, etc */ - } - public IPEndPoint Sim - { - get { return sim; } - } - public CapsDataFormat ReqFmt - { - get { return reqFmt; } /* expected request format */ - } - public CapsDataFormat RespFmt - { - get { return respFmt; } /* expected response format */ + this.URI = URI; this.Sim = Sim; this.CapType = CapType; this.ReqFmt = ReqFmt; this.RespFmt = RespFmt; } + public string URI { get; } + + public string CapType { get; /* EventQueueGet, etc */ } + + public IPEndPoint Sim { get; } + + public CapsDataFormat ReqFmt { get; /* expected request format */ } + + public CapsDataFormat RespFmt { get; /* expected response format */ } public void AddDelegate(CapsDelegate deleg) { diff --git a/Programs/GridProxy/GridProxyLoader.cs b/Programs/GridProxy/GridProxyLoader.cs index 30bc76d6..7a5dcd46 100644 --- a/Programs/GridProxy/GridProxyLoader.cs +++ b/Programs/GridProxy/GridProxyLoader.cs @@ -19,39 +19,19 @@ namespace GridProxy { public Proxy proxy; private Dictionary commandDelegates = new Dictionary(); - private UUID agentID; - private UUID sessionID; - private UUID secureSessionID; - private UUID inventoryRoot; private bool logLogin = false; - private string[] args; public delegate void CommandDelegate(string[] words); - public string[] Args - { - get { return args; } - } + public string[] Args { get; private set; } - public UUID AgentID - { - get { return agentID; } - } + public UUID AgentID { get; private set; } - public UUID SessionID - { - get { return sessionID; } - } + public UUID SessionID { get; private set; } - public UUID SecureSessionID - { - get { return secureSessionID; } - } + public UUID SecureSessionID { get; private set; } - public UUID InventoryRoot - { - get { return inventoryRoot; } - } + public UUID InventoryRoot { get; private set; } public void AddCommand(string cmd, CommandDelegate deleg) { @@ -71,7 +51,7 @@ namespace GridProxy private void Init(string[] args, ProxyConfig proxyConfig) { //bool externalPlugin = false; - this.args = args; + this.Args = args; if (proxyConfig == null) { @@ -166,19 +146,19 @@ namespace GridProxy { System.Collections.Hashtable values = (System.Collections.Hashtable)response.Value; if (values.Contains("agent_id")) - agentID = new UUID((string)values["agent_id"]); + AgentID = new UUID((string)values["agent_id"]); if (values.Contains("session_id")) - sessionID = new UUID((string)values["session_id"]); + SessionID = new UUID((string)values["session_id"]); if (values.Contains("secure_session_id")) - secureSessionID = new UUID((string)values["secure_session_id"]); + SecureSessionID = new UUID((string)values["secure_session_id"]); if (values.Contains("inventory-root")) { - inventoryRoot = new UUID( + InventoryRoot = new UUID( (string)((System.Collections.Hashtable)(((System.Collections.ArrayList)values["inventory-root"])[0]))?["folder_id"] ); if (logLogin) { - Console.WriteLine("inventory root: " + inventoryRoot); + Console.WriteLine("inventory root: " + InventoryRoot); } } @@ -230,7 +210,7 @@ namespace GridProxy ChatFromSimulatorPacket packet = new ChatFromSimulatorPacket(); packet.ChatData.SourceID = UUID.Random(); packet.ChatData.FromName = Utils.StringToBytes(fromName); - packet.ChatData.OwnerID = agentID; + packet.ChatData.OwnerID = AgentID; packet.ChatData.SourceType = (byte)2; packet.ChatData.ChatType = (byte)1; packet.ChatData.Audible = (byte)1; diff --git a/Programs/GridProxy/Plugins/ClientAO.cs b/Programs/GridProxy/Plugins/ClientAO.cs index e1033df1..1b946f58 100644 --- a/Programs/GridProxy/Plugins/ClientAO.cs +++ b/Programs/GridProxy/Plugins/ClientAO.cs @@ -286,7 +286,7 @@ public class ClientAO : ProxyPlugin // Start the search RequestFolderContents(baseFolder, true, - (searchPath.Length == 1) ? true : false, + (searchPath.Length == 1), InventorySortOrder.ByName); } diff --git a/Programs/examples/TestClient/TestClient.cs b/Programs/examples/TestClient/TestClient.cs index 4e6070e2..63fc19f2 100644 --- a/Programs/examples/TestClient/TestClient.cs +++ b/Programs/examples/TestClient/TestClient.cs @@ -100,7 +100,7 @@ namespace OpenMetaverse.TestClient void Self_IM(object sender, InstantMessageEventArgs e) { - bool groupIM = e.IM.GroupIM && GroupMembers != null && GroupMembers.ContainsKey(e.IM.FromAgentID) ? true : false; + bool groupIM = e.IM.GroupIM && GroupMembers != null && GroupMembers.ContainsKey(e.IM.FromAgentID); if (e.IM.FromAgentID == MasterKey || (GroupCommands && groupIM)) {