Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix codacy issues #79

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
1,488 changes: 744 additions & 744 deletions LibreMetaverse/AgentManagerMovement.cs

Large diffs are not rendered by default.

44 changes: 28 additions & 16 deletions LibreMetaverse/GridManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,28 +93,40 @@ public struct GridRegion
/// <summary>Access level</summary>
public SimAccess Access;
/// <summary>Appears to always be zero (None)</summary>
public RegionFlags RegionFlags;
public RegionFlags RegionFlags;
/// <summary>Water Height</summary>
public byte WaterHeight;
/// <summary></summary>
public byte Agents;
/// <summary>UUID of the World Map image</summary>
public UUID MapImageID;
/// <summary>Unique identifier for this region, a combination of the X
/// <summary>Unique identifier for this region, a combination of the X
/// and Y position</summary>
public ulong RegionHandle;


/// <summary>
///
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"{Name} ({X}/{Y}), Handle: {RegionHandle}, MapImage: {MapImageID}, Access: {Access}";
return $"{Name} ({X}/{Y}), Handle: {RegionHandle}, MapImage: {MapImageID}, Access: {Access}";
}

/// <summary>
///
/// </summary>
/// <returns></returns>
public override int GetHashCode()
{
return X.GetHashCode() ^ Y.GetHashCode();
}

/// <summary>
///
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public override bool Equals(object obj)
{
return (obj is GridRegion region) && Equals(region);
Expand Down Expand Up @@ -173,7 +185,7 @@ public ulong RegionHandle
/// Represents an agent or group of agents location
/// </summary>
public class MapAgentLocation : MapItem
{
{
public int AvatarCount;
public string Identifier;
}
Expand All @@ -182,25 +194,25 @@ public class MapAgentLocation : MapItem
/// Represents a Telehub location
/// </summary>
public class MapTelehub : MapItem
{
{
}

/// <summary>
/// Represents a non-adult parcel of land for sale
/// </summary>
public class MapLandForSale : MapItem
{
{
public int Size;
public int Price;
public string Name;
public UUID ID;
public UUID ID;
}

/// <summary>
/// Represents an Adult parcel of land for sale
/// </summary>
public class MapAdultLandForSale : MapItem
{
{
public int Size;
public int Price;
public string Name;
Expand Down Expand Up @@ -260,7 +272,7 @@ protected virtual void OnCoarseLocationUpdate(CoarseLocationUpdateEventArgs e)
/// <summary>Thread sync lock object</summary>
private readonly object m_CoarseLocationUpdateLock = new object();

/// <summary>Raised when the simulator sends a <see cref="CoarseLocationUpdatePacket"/>
/// <summary>Raised when the simulator sends a <see cref="CoarseLocationUpdatePacket"/>
/// containing the location of agents in the simulator</summary>
public event EventHandler<CoarseLocationUpdateEventArgs> CoarseLocationUpdate
{
Expand All @@ -283,7 +295,7 @@ protected virtual void OnGridRegion(GridRegionEventArgs e)
/// <summary>Thread sync lock object</summary>
private readonly object m_GridRegionLock = new object();

/// <summary>Raised when the simulator sends a Region Data in response to
/// <summary>Raised when the simulator sends a Region Data in response to
/// a Map request</summary>
public event EventHandler<GridRegionEventArgs> GridRegion
{
Expand Down Expand Up @@ -446,7 +458,7 @@ public void RequestMapRegion(string regionName, GridLayerType layer)
/// <param name="maxX"></param>
/// <param name="maxY"></param>
/// <param name="returnNonExistent"></param>
public void RequestMapBlocks(GridLayerType layer, ushort minX, ushort minY, ushort maxX, ushort maxY,
public void RequestMapBlocks(GridLayerType layer, ushort minX, ushort minY, ushort maxX, ushort maxY,
bool returnNonExistent)
{
MapBlockRequestPacket request = new MapBlockRequestPacket
Expand All @@ -472,7 +484,7 @@ public void RequestMapBlocks(GridLayerType layer, ushort minX, ushort minY, usho
}

/// <summary>
///
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="item"></param>
Expand Down Expand Up @@ -611,7 +623,7 @@ void Callback(object sender, GridRegionEventArgs e)
return false;
}
}

protected void MapLayerResponseHandler(HttpResponseMessage response, byte[] responseData, Exception error)
{
if (error != null)
Expand Down Expand Up @@ -799,7 +811,7 @@ protected void MapItemReplyHandler(object sender, PacketReceivedEventArgs e)
protected void SimulatorViewerTimeMessageHandler(object sender, PacketReceivedEventArgs e)
{
SimulatorViewerTimeMessagePacket time = (SimulatorViewerTimeMessagePacket)e.Packet;

SunPhase = time.TimeInfo.SunPhase;
SunDirection = time.TimeInfo.SunDirection;
SunAngVelocity = time.TimeInfo.SunAngVelocity;
Expand Down Expand Up @@ -860,7 +872,7 @@ protected void CoarseLocationHandler(object sender, PacketReceivedEventArgs e)
/// <param name="sender">The sender</param>
/// <param name="e">The EventArgs object containing the packet data</param>
protected void RegionHandleReplyHandler(object sender, PacketReceivedEventArgs e)
{
{
if (m_RegionHandleReply != null)
{
RegionIDAndHandleReplyPacket reply = (RegionIDAndHandleReplyPacket)e.Packet;
Expand Down
6 changes: 3 additions & 3 deletions Programs/GridProxy/GridProxyMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class ProxyMain
public static void Main(string[] args)
{
ProxyFrame p = new ProxyFrame(args);
ProxyPlugin analyst = new Analyst(p);
analyst.Init();
p.proxy.Start();
ProxyPlugin analyst = new Analyst(p);
analyst.Init();
p.proxy.Start();
}
}
40 changes: 20 additions & 20 deletions Programs/examples/TestClient/ClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
* Copyright (c) 2019-2022, Sjofn, LLC
* All rights reserved.
*
* - Redistribution and use in source and binary forms, with or without
* - Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Neither the name of the openmetaverse.co nor the names
* - Neither the name of the openmetaverse.co nor the names
* of its contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

Expand Down Expand Up @@ -86,8 +86,8 @@ public TestClient Login(string[] args)

LoginDetails account = new LoginDetails
{
FirstName = args[0],
LastName = args[1],
FirstName = args[0],
LastName = args[1],
Password = args[2]
};

Expand Down Expand Up @@ -132,7 +132,7 @@ public TestClient Login(string[] args)
}

/// <summary>
/// Login account with provided <seealso cref="LoginDetails"/>
/// Login account with provided <seealso cref="LoginDetails"/>
/// </summary>
/// <param name="account"></param>
/// <returns></returns>
Expand Down Expand Up @@ -189,7 +189,7 @@ void PeopleDirCallback(object sender2, DirPeopleReplyEventArgs dpe)
}
else if (e.Status == LoginStatus.Failed)
{
Logger.Log($"Failed to login {account.FirstName} {account.LastName}: {client.Network.LoginMessage}",
Logger.Log($"Failed to login {account.FirstName} {account.LastName}: {client.Network.LoginMessage}",
Helpers.LogLevel.Warning);
--PendingLogins;
}
Expand All @@ -202,7 +202,7 @@ void PeopleDirCallback(object sender2, DirPeopleReplyEventArgs dpe)
client.Throttle.Task = 1000000;

client.GroupCommands = account.GroupCommands;
client.MasterName = account.MasterName;
client.MasterName = account.MasterName;
client.MasterKey = account.MasterKey;
client.AllowObjectMaster = client.MasterKey != UUID.Zero; // Require UUID for object master.

Expand Down Expand Up @@ -260,7 +260,7 @@ private void PrintPrompt()
}

/// <summary>
///
///
/// </summary>
/// <param name="cmd"></param>
/// <param name="fromAgentID"></param>
Expand All @@ -272,7 +272,7 @@ public void DoCommandAll(string cmd, UUID fromAgentID)
string[] tokens = cmd.Trim().Split(' ', '\t');
if (tokens.Length == 0)
return;

string firstToken = tokens[0].ToLower();
if (string.IsNullOrEmpty(firstToken))
return;
Expand All @@ -296,7 +296,7 @@ public void DoCommandAll(string cmd, UUID fromAgentID)
}
return;
}

string[] args = new string[tokens.Length - 1];
if (args.Length > 0)
Array.Copy(tokens, 1, args, 0, args.Length);
Expand Down
2 changes: 1 addition & 1 deletion Programs/examples/TestClient/TestClient.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>TestClient</AssemblyName>
<OutputType>Exe</OutputType>
Expand Down
59 changes: 30 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
```
_ _ _ __ __ ___ _____ ___ _____ ___ ___ ___
_ _ _ __ __ ___ _____ ___ _____ ___ ___ ___
| (_) |__ _ _ ___| \/ | __|_ _/_\ \ / / __| _ \/ __| __|
| | | '_ \ '_/ -_) |\/| | _| | |/ _ \ V /| _|| /\__ \ _|
| | | '_ \ '_/ -_) |\/| | _| | |/ _ \ V /| _|| /\__ \ _|
|_|_|_.__/_| \___|_| |_|___| |_/_/ \_\_/ |___|_|_\|___/___|
```

# LibreMetaverse

LibreMetaverse is a fork of libOpenMetaverse which in turn was a fork of
Expand All @@ -18,45 +19,45 @@ https://github.com/cinderblocks/libremetaverse

### Windows

The `dotnet` utility is cross-platform so compilation is no different than on Linux/macOS.
You may, however, opt to use Visual Studio as you would any other .NET application.
- Make sure you have at least `dotnet` installed, with a valid net6.0/net7.0 SDK _and_ runtime available! (use `dotnet --list-runtimes` and `dotnet --list-sdks` to confirm)

### Linux/macOS

- Make sure you have at least `dotnet` installed, with a valid SDK _and_ runtime of at least .NET5 available!
- Make sure you have at least `dotnet` installed, with a valid SDK _and_ runtime of at least .NET5 available!

- This update includes a solution file to skip GUI applications for non-Windows platforms. Use `LibreMetaverse.ReleaseNoGUI.sln` instead

- This update includes a solution file to skip GUI applications for non-Windows platforms. Use `LibreMetaverse.ReleaseNoGUI.sln` instead
- From the root, run `dotnet msbuild LibreMetaverse.ReleaseNoGUI.sln`, and enjoy the superfast Roslyn compiler at work 😄
It should finish after a few minutes, depending on the speed of your machine.

- From the root, run `dotnet restore LibreMetaverse.ReleaseNoGUI.sln`. You should get some errors regarding missing Windows libraries;
that's ok, you can ignore those, they're to be expected since Linux/macOS do _not_ include such libraries. Some test applications are Windows-only.
If all goes well, you should now have all dependent packages properly installed.
- Your binaries will be under `../bin/net6.0` or `../bin/net7.0` (there might be a few more directories under `../bin`),
depending on what runtimes you have installed on your system. Make sure you `cd` to the correct directory depending on the runtime you have,
and then search for all your binaries there: they should be normal-looking executable files (with the `x` attribute set) and having the name
of the appropriate test application (e.g. `TestClient` for the interactive testing tool).

- From the root, run `dotnet msbuild LibreMetaverse.ReleaseNoGUI.sln`, and enjoy the superfast Roslyn compiler at work 😄
It should finish after a few minutes, depending on the speed of your machine.
The `dotnet` utility is cross-platform so compilation is no different than on Linux/macOS; if you wish to skip the GUI applications, the instructions are the same as above.

- Your binaries will be under `../bin/net6.0` or `../bin/net7.0` (there might be a few more directories under `../bin`),
depending on what runtimes you have installed on your system. Make sure you `cd` to the correct directory depending on the runtime you have,
and then search for all your binaries there: they should be normal-looking executable files (with the `x` attribute set) and having the name
of the appropriate test application (e.g. `TestClient` for the interactive testing tool).
You may, however, opt to use Visual Studio as you would any other .NET application, using the default `LibreMetaverse.sln`.

- Unlike OpenSimulator and LibOpenMetaverse, you don't need to launch the binaries with Mono, they're _directly_ executable;
the `dotnet` chain already embeds the small runtime that allows .NET apps to run natively on whatever operating system you've got.
- Unlike OpenSimulator and LibOpenMetaverse, you don't need to launch the binaries with Mono, they're _directly_ executable;
the `dotnet` chain already embeds the small runtime that allows .NET apps to run natively on whatever operating system you've got.

### GUI support under Linux/macOS

LibreMetaverse.GUI is not available on Linux/macOS due to Microsoft's lack of support for GDI/WinForms on non-Windows platforms.
LibreMetaverse.GUI is not available on Linux/macOS due to Microsoft's lack of support for GDI/WinForms on non-Windows platforms.
They may work using Mono's implemention and can always be emulated using a product like Wine.

The GUI library is being phased out and eventually being replaced by a more cross-platform framework like Avalonia or MAUI.


[![LibreMetaverse NuGet-Release](https://img.shields.io/nuget/v/libremetaverse.svg?label=LibreMetaverse)](https://www.nuget.org/packages/LibreMetaverse/)
[![NuGet Downloads](https://img.shields.io/nuget/dt/LibreMetaverse?label=NuGet%20downloads)](https://www.nuget.org/packages/LibreMetaverse/)
[![Build status](https://ci.appveyor.com/api/projects/status/pga5w0qken2k2nnl?svg=true)](https://ci.appveyor.com/project/cinderblocks57647/libremetaverse-ksbcr)
[![Test status](https://img.shields.io/appveyor/tests/cinderblocks57647/libremetaverse-ksbcr?compact_message&svg=true)](https://ci.appveyor.com/project/cinderblocks57647/libremetaverse-ksbcr)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1cb97cd799c64ba49e2721f2ddda56ab)](https://www.codacy.com/gh/cinderblocks/libremetaverse/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=cinderblocks/libremetaverse&amp;utm_campaign=Badge_Grade)
[![.NET](https://github.com/cinderblocks/libremetaverse/actions/workflows/dotnet.yml/badge.svg)](https://github.com/cinderblocks/libremetaverse/actions/workflows/dotnet.yml)
[![CodeQL](https://github.com/cinderblocks/libremetaverse/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cinderblocks/libremetaverse/actions/workflows/codeql-analysis.yml)
[![BSD Licensed](https://img.shields.io/github/license/cinderblocks/libremetaverse)](https://github.com/cinderblocks/libremetaverse/blob/master/LICENSE.txt)
[![Commits per month](https://img.shields.io/github/commit-activity/m/cinderblocks/libremetaverse/master)](https://www.github.com/cinderblocks/libremetaverse/)
[![ZEC](https://img.shields.io/keybase/zec/cinder)](https://keybase.io/cinder) [![BTC](https://img.shields.io/keybase/btc/cinder)](https://keybase.io/cinder)
**Note:** Microsoft has [dropped support for .NET 5.0](https://devblogs.microsoft.com/dotnet/dotnet-5-end-of-support-update/) as of May 2022, so you will have to use .NET 6.0 or 7.0 instead.

[![LibreMetaverse NuGet-Release](https://img.shields.io/nuget/v/libremetaverse.svg?label=LibreMetaverse)](https://www.nuget.org/packages/LibreMetaverse/)
[![NuGet Downloads](https://img.shields.io/nuget/dt/LibreMetaverse?label=NuGet%20downloads)](https://www.nuget.org/packages/LibreMetaverse/)
[![Build status](https://ci.appveyor.com/api/projects/status/pga5w0qken2k2nnl?svg=true)](https://ci.appveyor.com/project/cinderblocks57647/libremetaverse-ksbcr)
[![Test status](https://img.shields.io/appveyor/tests/cinderblocks57647/libremetaverse-ksbcr?compact_message&svg=true)](https://ci.appveyor.com/project/cinderblocks57647/libremetaverse-ksbcr)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/1cb97cd799c64ba49e2721f2ddda56ab)](https://www.codacy.com/gh/cinderblocks/libremetaverse/dashboard?utm_source=github.com&utm_medium=referral&utm_content=cinderblocks/libremetaverse&utm_campaign=Badge_Grade)
[![.NET](https://github.com/cinderblocks/libremetaverse/actions/workflows/dotnet.yml/badge.svg)](https://github.com/cinderblocks/libremetaverse/actions/workflows/dotnet.yml)
[![CodeQL](https://github.com/cinderblocks/libremetaverse/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/cinderblocks/libremetaverse/actions/workflows/codeql-analysis.yml)
[![BSD Licensed](https://img.shields.io/github/license/cinderblocks/libremetaverse)](https://github.com/cinderblocks/libremetaverse/blob/master/LICENSE.txt)
[![Commits per month](https://img.shields.io/github/commit-activity/m/cinderblocks/libremetaverse/master)](https://www.github.com/cinderblocks/libremetaverse/)
[![ZEC](https://img.shields.io/keybase/zec/cinder)](https://keybase.io/cinder) [![BTC](https://img.shields.io/keybase/btc/cinder)](https://keybase.io/cinder)
26 changes: 26 additions & 0 deletions util/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
charset = utf-8
indent_style = tab
indent_size = tab
tab_width = 2
trim_trailing_whitespace = true

# The property below is not yet universally supported
[*.md]
max_line_length = 108
word_wrap = true
# Markdown sometimes uses two spaces at the end to
# mark soft line breaks
trim_trailing_whitespace = false

[*.yml]
end_of_line = lf
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
Loading