cosmetics

This commit is contained in:
UbitUmarov
2026-03-15 18:22:50 +00:00
parent 0120e62250
commit da5f1b3f7e
18 changed files with 71 additions and 82 deletions

View File

@@ -623,8 +623,7 @@ namespace OpenSim.Groups
, OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName)
);
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
List<GroupChatListAgentUpdateData> updates = [new GroupChatListAgentUpdateData(AgentID)];
eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates);
}
}
@@ -663,8 +662,7 @@ namespace OpenSim.Groups
IEventQueue queue = remoteClient.Scene.RequestModuleInterface<IEventQueue>();
if (queue != null)
{
var update = new GroupChatListAgentUpdateData(AgentID);
var updates = new List<GroupChatListAgentUpdateData> { update };
List<GroupChatListAgentUpdateData> updates = [new GroupChatListAgentUpdateData(AgentID)];
queue.ChatterBoxSessionAgentListUpdates(GroupID, remoteClient.AgentId, updates);
}
}
@@ -673,8 +671,8 @@ namespace OpenSim.Groups
// Send a message from locally connected client to a group
if ((im.dialog == (byte)InstantMessageDialog.SessionSend))
{
UUID GroupID = new UUID(im.imSessionID);
UUID AgentID = new UUID(im.fromAgentID);
UUID GroupID = new(im.imSessionID);
UUID AgentID = new(im.fromAgentID);
if (m_debugEnabled)
m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());

View File

@@ -142,20 +142,25 @@ namespace OpenSim.Groups
}
// Create the group
GroupData data = new GroupData();
data.GroupID = UUID.Random();
data.Data = new Dictionary<string, string>();
data.Data["Name"] = name;
data.Data["Charter"] = charter;
data.Data["InsigniaID"] = insigniaID.ToString();
data.Data["FounderID"] = founderID.ToString();
data.Data["MembershipFee"] = membershipFee.ToString();
data.Data["OpenEnrollment"] = openEnrollment ? "1" : "0";
data.Data["ShowInList"] = showInList ? "1" : "0";
data.Data["AllowPublish"] = allowPublish ? "1" : "0";
data.Data["MaturePublish"] = maturePublish ? "1" : "0";
UUID ownerRoleID = UUID.Random();
data.Data["OwnerRoleID"] = ownerRoleID.ToString();
string founderIDstr = founderID.ToString();
GroupData data = new()
{
GroupID = UUID.Random(),
Data = new Dictionary<string, string>
{
["Name"] = name,
["Charter"] = charter,
["InsigniaID"] = insigniaID.ToString(),
["FounderID"] = founderIDstr,
["MembershipFee"] = membershipFee.ToString(),
["OpenEnrollment"] = openEnrollment ? "1" : "0",
["ShowInList"] = showInList ? "1" : "0",
["AllowPublish"] = allowPublish ? "1" : "0",
["MaturePublish"] = maturePublish ? "1" : "0",
["OwnerRoleID"] = ownerRoleID.ToString()
}
};
if (!m_Database.StoreGroup(data))
return UUID.Zero;
@@ -171,8 +176,8 @@ namespace OpenSim.Groups
_AddOrUpdateGroupRole(RequestingAgentID, data.GroupID, ownerRoleID, "Owners", "Owners of the group", "Owner of " + name, (ulong)OwnerPowers, true);
// Add founder to group
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, ownerRoleID);
_AddAgentToGroup(RequestingAgentID, founderID.ToString(), data.GroupID, officersRoleID);
_AddAgentToGroup(RequestingAgentID, founderIDstr, data.GroupID, ownerRoleID);
_AddAgentToGroup(RequestingAgentID, founderIDstr, data.GroupID, officersRoleID);
return data.GroupID;
}
@@ -186,7 +191,7 @@ namespace OpenSim.Groups
// Check perms
if (!HasPower(RequestingAgentID, groupID, GroupPowers.ChangeActions))
{
m_log.DebugFormat("[Groups]: ({0}) Attempt at updating group {1} denied because of lack of permission", RequestingAgentID, groupID);
m_log.Debug($"[Groups]: ({RequestingAgentID}) Attempt at updating group {groupID} denied because of lack of permission");
return;
}
@@ -219,7 +224,7 @@ namespace OpenSim.Groups
public List<DirGroupsReplyData> FindGroups(string RequestingAgentID, string search)
{
List<DirGroupsReplyData> groups = new List<DirGroupsReplyData>();
List<DirGroupsReplyData> groups = [];
GroupData[] data = m_Database.RetrieveGroups(search);
@@ -228,7 +233,7 @@ namespace OpenSim.Groups
foreach (GroupData d in data)
{
// Don't list group proxies
if (d.Data.ContainsKey("Location") && d.Data["Location"] != string.Empty)
if (d.Data.TryGetValue("Location", out string loc) && loc != string.Empty)
continue;
int nmembers = m_Database.MemberCount(d.GroupID);
@@ -257,7 +262,7 @@ namespace OpenSim.Groups
public List<ExtendedGroupMembersData> GetGroupMembers(string RequestingAgentID, UUID GroupID)
{
List<ExtendedGroupMembersData> members = new List<ExtendedGroupMembersData>();
List<ExtendedGroupMembersData> members = [];
GroupData group = m_Database.RetrieveGroup(GroupID);
if (group == null)

View File

@@ -155,7 +155,7 @@ namespace osWebRtcVoice
// getHashCode() is not deterministic across sessions.
public static int CalcRoomNumber(string pRegionId, string pChannelType, int pParcelLocalID, string pChannelID)
{
var hasher = new BHasherMdjb2();
BHasherMdjb2 hasher = new();
// If there is a channel specified it must be group
switch (pChannelType)
{
@@ -174,7 +174,7 @@ namespace osWebRtcVoice
default:
throw new Exception("Unknown channel type: " + pChannelType);
}
var hashed = hasher.Finish();
BHash hashed = hasher.Finish();
// The "Abs()" is because Janus room number must be a positive integer
// And note that this is the BHash.GetHashCode() and not Object.getHashCode().
int roomNumber = Math.Abs(hashed.GetHashCode());

View File

@@ -193,7 +193,7 @@ namespace osWebRtcVoice
public static JanusMessageResp FromJson(string pJson)
{
var newBody = OSDParser.DeserializeJson(pJson) as OSDMap;
OSDMap newBody = OSDParser.DeserializeJson(pJson) as OSDMap;
return new JanusMessageResp(newBody);
}

View File

@@ -105,7 +105,7 @@ namespace osWebRtcVoice
JanusMessageResp resp = await SendToJanus(new CreateSessionReq());
if (resp is not null && resp.isSuccess)
{
var sessionResp = new CreateSessionResp(resp);
CreateSessionResp sessionResp = new(resp);
SessionId = sessionResp.returnedId;
IsConnected = true;
SessionUri = _JanusServerURI + "/" + SessionId;
@@ -702,7 +702,7 @@ namespace osWebRtcVoice
break;
case "GETERROR":
// Special error response from the GET
var errorResp = new ErrorResp(resp);
ErrorResp errorResp = new(resp);
switch (errorResp.errorCode)
{
case 404:

View File

@@ -720,7 +720,7 @@ namespace osWebRtcVoice
roomid, room["description"], room["num_participants"],
room["sampling_rate"], room["spatial_audio"], room["record"]);
var participantResp = ab.SendAudioBridgeMsg(new AudioBridgeListParticipantsReq(roomid)).Result;
AudioBridgeResp participantResp = ab.SendAudioBridgeMsg(new AudioBridgeListParticipantsReq(roomid)).Result;
if (participantResp is not null && participantResp.AudioBridgeReturnCode == "participants")
{

View File

@@ -82,7 +82,7 @@ namespace osWebRtcVoice
{
lock (ViewerSessions)
{
var sessions = ViewerSessions.Where(v => v.Value.VoiceServiceSessionId == pVSSessionId);
IEnumerable<KeyValuePair<string,IVoiceViewerSession>> sessions = ViewerSessions.Where(v => v.Value.VoiceServiceSessionId == pVSSessionId);
if (sessions.Count() > 0)
{
pViewerSession = sessions.First().Value;

View File

@@ -101,7 +101,7 @@ namespace osWebRtcVoice
{ "userID", pUserID.ToString() },
{ "scene", pSceneID.ToString() }
};
var resp = JsonRpcRequest("provision_voice_account_request", m_serverURI, req);
OSDMap resp = JsonRpcRequest("provision_voice_account_request", m_serverURI, req);
// Kludge to sync the viewer session number in our IVoiceViewerSession with the one from the WebRTC service.
if (resp.TryGetString("viewer_session", out string otherViewerSessionId))

View File

@@ -1526,8 +1526,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
m_log.Info("[RADMIN]: AuthenticateUser: new request");
var responseData = (Hashtable)response.Value;
var requestData = (Hashtable)request.Params[0];
Hashtable responseData = (Hashtable)response.Value;
Hashtable requestData = (Hashtable)request.Params[0];
lock (m_requestLock)
{
@@ -1541,11 +1541,11 @@ namespace OpenSim.ApplicationPlugins.RemoteController
"token_lifetime"
});
var firstName = (string)requestData["user_firstname"];
var lastName = (string)requestData["user_lastname"];
var password = (string)requestData["user_password"];
string firstName = (string)requestData["user_firstname"];
string lastName = (string)requestData["user_lastname"];
string password = (string)requestData["user_password"];
var scene = m_application.SceneManager.CurrentOrFirstScene;
Scene scene = m_application.SceneManager.CurrentOrFirstScene;
if (scene.Equals(null))
{
@@ -1553,8 +1553,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
throw new Exception("Scene does not exist.");
}
var scopeID = scene.RegionInfo.ScopeID;
var account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName);
UUID scopeID = scene.RegionInfo.ScopeID;
UserAccount account = scene.UserAccountService.GetUserAccount(scopeID, firstName, lastName);
if (account.Equals(null) || account.PrincipalID.Equals(UUID.Zero))
{
@@ -1584,18 +1584,17 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
m_log.DebugFormat("[RADMIN]: AuthenticateUser: token lifetime longer than 30s for {0} {1}", firstName,
lastName);
throw new Exception(String.Format("token lifetime longer than 30s for {0} {1}", firstName,
lastName));
throw new Exception($"token lifetime longer than 30s for {firstName} {lastName}");
}
var authModule = scene.RequestModuleInterface<IAuthenticationService>();
IAuthenticationService authModule = scene.RequestModuleInterface<IAuthenticationService>();
if (authModule == null)
{
m_log.Debug("[RADMIN]: AuthenticateUser: no authentication module loded");
throw new Exception("no authentication module loaded");
}
var token = authModule.Authenticate(account.PrincipalID, password, lifetime);
string token = authModule.Authenticate(account.PrincipalID, password, lifetime);
if (String.IsNullOrEmpty(token))
{
m_log.DebugFormat("[RADMIN]: AuthenticateUser: authentication failed for {0} {1}", firstName,

View File

@@ -93,7 +93,7 @@ namespace OpenSim.Capabilities.Handlers
response.StatusCode = (int)HttpStatusCode.BadRequest;
var queries = req.QueryAsDictionary;
Dictionary<string, string> queries = req.QueryAsDictionary;
if(queries.Count == 0)
return;

View File

@@ -44,13 +44,12 @@ namespace OpenSim.Data.PGSQL
public MuteData[] Get(UUID agentID)
{
var data = base.Get("AgentID", agentID.ToString());
return data;
return base.Get("AgentID", agentID.ToString());
}
public bool Delete(UUID agentID, UUID muteID, string muteName)
{
var query = $"DELETE FROM MuteList WHERE \"AgentID\" = :AgentID and " +
string query = $"DELETE FROM MuteList WHERE \"AgentID\" = :AgentID and " +
$"\"MuteID\" = :MuteID and " +
$"\"MuteName\" = :MuteName";

View File

@@ -981,7 +981,7 @@ namespace OpenSim.Data.PGSQL
"TerrainPBR4" = :TerrainPBR4
""";
using (var connection = new NpgsqlConnection(m_connectionString))
using (NpgsqlConnection connection = new(m_connectionString))
{
connection.Open();
NpgsqlCommand command = new NpgsqlCommand(queryString, connection, connection.BeginTransaction());
@@ -1984,7 +1984,7 @@ namespace OpenSim.Data.PGSQL
{
while (reader.Read())
{
var sp = new SpawnPoint
SpawnPoint sp = new()
{
Yaw = Convert.ToSingle(reader["Yaw"]),
Pitch = Convert.ToSingle(reader["Pitch"]),
@@ -2033,9 +2033,9 @@ namespace OpenSim.Data.PGSQL
INSERT INTO regionextra ("RegionID", "Name", "value")
VALUES (:RegionID, :Name, :Value)
""";
using var connection = new NpgsqlConnection(m_connectionString);
using NpgsqlConnection connection = new(m_connectionString);
connection.Open();
using var command = new NpgsqlCommand(queryString, connection, connection.BeginTransaction());
using NpgsqlCommand command = new(queryString, connection, connection.BeginTransaction());
try
{
command.Parameters.AddWithValue("RegionID", regionID.ToString());
@@ -2054,9 +2054,9 @@ namespace OpenSim.Data.PGSQL
public void RemoveExtra(UUID regionID, string name)
{
const string queryString = """DELETE FROM regionextra WHERE "RegionID"=:RegionID AND "Name"=:Name""";
using var connection = new NpgsqlConnection(m_connectionString);
using NpgsqlConnection connection = new(m_connectionString);
connection.Open();
using var command = new NpgsqlCommand(queryString, connection, connection.BeginTransaction());
using NpgsqlCommand command = new(queryString, connection, connection.BeginTransaction());
try
{
command.Parameters.AddWithValue("RegionID", regionID.ToString());

View File

@@ -1177,7 +1177,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
{
var xmlDes = new XmlRpcRequestDeserializer();
XmlRpcRequestDeserializer xmlDes = new();
xmlRprcRequest = (XmlRpcRequest)xmlDes.Deserialize(reader);
}
}
@@ -1272,7 +1272,7 @@ namespace OpenSim.Framework.Servers.HttpServer
using (XmlTextWriter writer = new XmlTextWriter(outs, UTF8NoBOM))
{
writer.Formatting = Formatting.None;
var xmlrpcSer = new XmlRpcResponseSerializer();
XmlRpcResponseSerializer xmlrpcSer = new();
xmlrpcSer.Serialize(writer, xmlRpcResponse);
writer.Flush();
response.RawBuffer = outs.GetBuffer();
@@ -1314,7 +1314,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
using (StreamReader reader = new StreamReader(requestStream, Encoding.UTF8))
{
var xmlDes = new XmlRpcRequestDeserializer();
XmlRpcRequestDeserializer xmlDes = new();
xmlRprcRequest = (XmlRpcRequest)xmlDes.Deserialize(reader);
}
}
@@ -1406,7 +1406,7 @@ namespace OpenSim.Framework.Servers.HttpServer
using (XmlTextWriter writer = new XmlTextWriter(outs, UTF8NoBOM))
{
writer.Formatting = Formatting.None;
var xmlrpcSer = new XmlRpcResponseSerializer();
XmlRpcResponseSerializer xmlrpcSer = new();
xmlrpcSer.Serialize(writer, xmlRpcResponse);
writer.Flush();
response.RawBuffer = outs.GetBuffer();
@@ -1641,7 +1641,7 @@ namespace OpenSim.Framework.Servers.HttpServer
return false;
}
var searchquery = CleanSearchPath(path.AsSpan());
ReadOnlySpan<char> searchquery = CleanSearchPath(path.AsSpan());
lock (m_llsdHandlers)
{
@@ -1661,7 +1661,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <returns>true if we have one, false if not</returns>
private bool DoWeHaveAHTTPHandler(string path)
{
var searchquery = CleanSearchPath(path.AsSpan());
ReadOnlySpan<char> searchquery = CleanSearchPath(path.AsSpan());
//m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery);
lock (m_HTTPHandlers)
@@ -1688,7 +1688,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// {0}/{1}/{2}
// where {0} isn't something we really control 100%
var searchquery = CleanSearchPath(path.AsSpan());
ReadOnlySpan<char> searchquery = CleanSearchPath(path.AsSpan());
// while the matching algorithm below doesn't require it, we're expecting a query in the form
//
@@ -1808,7 +1808,7 @@ namespace OpenSim.Framework.Servers.HttpServer
return false;
}
var searchquery = CleanSearchPath(path);
ReadOnlySpan<char> searchquery = CleanSearchPath(path);
string bestMatch = null;
bool nomatch = true;

View File

@@ -209,7 +209,7 @@ namespace OSHttpServer
/// </remarks>
public virtual void Start()
{
Task.Run(ReceiveLoop).ConfigureAwait(false);
_ = Task.Run(ReceiveLoop);
}
/// <summary>
@@ -343,7 +343,7 @@ namespace OSHttpServer
}
}
private async void ReceiveLoop()
private async Task ReceiveLoop()
{
try
{

View File

@@ -123,7 +123,7 @@ namespace OSHttpServer
/// </summary>
public bool UseTraceLogs { get; set; }
private async void AcceptLoop()
private async Task AcceptLoop()
{
while (true)
{
@@ -239,7 +239,7 @@ namespace OSHttpServer
m_listener = new TcpListener(m_address, m_port);
m_listener.Start(backlog);
Task.Run(AcceptLoop).ConfigureAwait(false);
_ = Task.Run(AcceptLoop);
}
/// <summary>

View File

@@ -45,12 +45,6 @@ using Caps=OpenSim.Framework.Capabilities.Caps;
namespace OpenSim.Region.ClientStack.Linden
{
public struct QueueItem
{
public int id;
public OSDMap body;
}
[Mono.Addins.Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EventQueueGetModule")]
public partial class EventQueueGetModule : IEventQueue, INonSharedRegionModule
{

View File

@@ -347,13 +347,7 @@ namespace OpenSim.Region.ClientStack.Linden
GridInfo ginfo = scene.SceneGridInfo;
lock (m_features)
{
OSDMap extrasMap;
if (m_features.TryGetValue("OpenSimExtras", out OSD extra))
extrasMap = extra as OSDMap;
else
{
extrasMap = new OSDMap();
}
OSDMap extrasMap = m_features.TryGetOSDMap("OpenSimExtras", out OSDMap extra) ? extra : new OSDMap();
foreach (string key in extraFeatures.Keys)
{

View File

@@ -246,7 +246,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_IsRunningInbound = true;
// kick start the receiver tasks dance.
Task.Run(AsyncBeginReceive).ConfigureAwait(false);
_ = Task.Run(AsyncBeginReceive);
}
}
@@ -280,7 +280,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_IsRunningOutbound = false;
}
private async void AsyncBeginReceive()
private async Task AsyncBeginReceive()
{
SocketAddress workSktAddress = new(m_udpSocket.AddressFamily);
while (m_IsRunningInbound)