Skip to content

Commit

Permalink
chore - Cleanup an empty issues (#93)
Browse files Browse the repository at this point in the history
* Remove empty RsaUtils

* Move Lidgren-specific code into isolated namespace

* Cleaned up empty de/constructors, catch clauses, statements
  • Loading branch information
lodicolo committed Apr 5, 2020
1 parent 37f3a7b commit 3641c1f
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 84 deletions.
9 changes: 0 additions & 9 deletions Intersect (Core)/Crypto/RsaUtils.cs

This file was deleted.

5 changes: 0 additions & 5 deletions Intersect (Core)/GameObjects/Events/EventMoveRoute.cs
Expand Up @@ -8,11 +8,6 @@ namespace Intersect.GameObjects.Events

public class EventMoveRoute
{

public EventMoveRoute()
{
}

public List<MoveRouteAction> Actions { get; set; } = new List<MoveRouteAction>();

public bool IgnoreIfBlocked { get; set; }
Expand Down
5 changes: 0 additions & 5 deletions Intersect (Core)/GameObjects/Maps/MapAttribute.cs
Expand Up @@ -9,11 +9,6 @@ namespace Intersect.GameObjects.Maps

public abstract class MapAttribute
{

public MapAttribute()
{
}

public abstract MapAttributes Type { get; }

public static MapAttribute CreateAttribute(MapAttributes type)
Expand Down
1 change: 0 additions & 1 deletion Intersect (Core)/Intersect (Core).csproj
Expand Up @@ -220,7 +220,6 @@
<Compile Include="Config\Passability.cs" />
<Compile Include="Console.cs" />
<Compile Include="Config\SmtpSettings.cs" />
<Compile Include="Crypto\RsaUtils.cs" />
<Compile Include="CustomColors.cs" />
<Compile Include="ErrorHandling\ExceptionInfo.cs" />
<Compile Include="Extensions\ArrayExtensions.cs" />
Expand Down
1 change: 0 additions & 1 deletion Intersect (Core)/Logging/Formatting/DefaultFormatter.cs
Expand Up @@ -120,7 +120,6 @@ private string FormatPrefix([NotNull] LogConfiguration configuration, LogLevel l
}

var innerException = exception;
;
while ((innerException = innerException.InnerException) != null)
{
builder.AppendLine(@"Caused By");
Expand Down
5 changes: 0 additions & 5 deletions Intersect (Core)/Network/CerasPacket.cs
Expand Up @@ -10,13 +10,8 @@ namespace Intersect.Network

public abstract class CerasPacket : IPacket
{

[NotNull] private static readonly Ceras sCerasInstance = new Ceras(true);

protected CerasPacket()
{
}

/// <inheritdoc />
public virtual void Dispose()
{
Expand Down
Expand Up @@ -5,6 +5,7 @@

using Intersect.Client.Framework.Audio;
using Intersect.Client.Framework.Graphics;
using Intersect.Logging;

namespace Intersect.Client.Framework.File_Management
{
Expand Down Expand Up @@ -400,8 +401,9 @@ public virtual void SaveUIJson(UI stage, string name, string json, string resolu
{
File.WriteAllText(path, json);
}
catch (Exception)
catch (Exception exception)
{
Log.Debug(exception);
}

return;
Expand All @@ -413,8 +415,9 @@ public virtual void SaveUIJson(UI stage, string name, string json, string resolu
{
File.WriteAllText(path, json);
}
catch (Exception)
catch (Exception exception)
{
Log.Debug(exception);
}
}

Expand Down
5 changes: 0 additions & 5 deletions Intersect.Client.Framework/GenericClasses/OpenFileDialog.cs
Expand Up @@ -10,11 +10,6 @@ public enum DialogResult

public class OpenFileDialog
{

public OpenFileDialog()
{
}

public string Title { get; set; }

public string InitialDirectory { get; set; }
Expand Down
5 changes: 0 additions & 5 deletions Intersect.Client.Framework/GenericClasses/SaveFileDialog.cs
Expand Up @@ -3,11 +3,6 @@

public class SaveFileDialog
{

public SaveFileDialog()
{
}

public string Title { get; set; }

public string InitialDirectory { get; set; }
Expand Down
6 changes: 4 additions & 2 deletions Intersect.Client.Framework/Gwen/Control/Base.cs
Expand Up @@ -11,6 +11,9 @@
using Intersect.Client.Framework.Gwen.ControlInternal;
using Intersect.Client.Framework.Gwen.DragDrop;
using Intersect.Client.Framework.Gwen.Input;
#if DEBUG
using Intersect.Logging;
#endif

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
Expand Down Expand Up @@ -1097,8 +1100,7 @@ private bool HasNamedChildren()
#if DEBUG
~Base()
{
//throw new InvalidOperationException(String.Format("IDisposable object finalized [{1:X}]: {0}", this, GetHashCode()));
////debug.print(String.Format("IDisposable object finalized: {0}", GetType()));
Log.Debug($"IDisposable object finalized: {GetType()}");
}
#endif

Expand Down
12 changes: 7 additions & 5 deletions Intersect.Client.Framework/Gwen/Renderer/Base.cs
@@ -1,7 +1,10 @@
using System;

using Intersect.Client.Framework.GenericClasses;
using Intersect.Client.Framework.GenericClasses;
using Intersect.Client.Framework.Graphics;
#if DEBUG
using Intersect.Logging;
#endif

using System;

namespace Intersect.Client.Framework.Gwen.Renderer
{
Expand Down Expand Up @@ -96,8 +99,7 @@ public virtual void Dispose()
#if DEBUG
~Base()
{
//throw new InvalidOperationException(String.Format("IDisposable object finalized: {0}", GetType()));
////debug.print(String.Format("IDisposable object finalized: {0}", GetType()));
Log.Debug($"IDisposable object finalized: {GetType()}");
}
#endif

Expand Down
13 changes: 8 additions & 5 deletions Intersect.Client.Framework/Gwen/Skin/Base.cs
@@ -1,8 +1,12 @@
using System;

using Intersect.Client.Framework.GenericClasses;
using Intersect.Client.Framework.GenericClasses;
using Intersect.Client.Framework.Graphics;

using System;

#if DEBUG
using Intersect.Logging;
#endif

namespace Intersect.Client.Framework.Gwen.Skin
{

Expand Down Expand Up @@ -56,8 +60,7 @@ public virtual void Dispose()
#if DEBUG
~Base()
{
//throw new InvalidOperationException(String.Format("IDisposable object finalized: {0}", GetType()));
////debug.print(String.Format("IDisposable object finalized: {0}", GetType()));
Log.Debug($"IDisposable object finalized: {GetType()}");
}
#endif

Expand Down
1 change: 0 additions & 1 deletion Intersect.Client/Interface/Game/Draggable.cs
Expand Up @@ -61,7 +61,6 @@ public void Dispose()
Active = null;
}

;
Interface.GameUi.GameCanvas.RemoveChild(mPnl, false);
}

Expand Down
4 changes: 0 additions & 4 deletions Intersect.Client/Items/Item.cs
Expand Up @@ -17,10 +17,6 @@ public class Item

public int[] StatBuffs = new int[(int) Stats.StatCount];

public Item()
{
}

public ItemBase Base => ItemBase.Get(ItemId);

public void Load(Guid id, int quantity, Guid? bagId, int[] statBuffs)
Expand Down
11 changes: 3 additions & 8 deletions Intersect.Client/MonoGame/Graphics/MonoTileBuffer.cs
Expand Up @@ -176,16 +176,11 @@ public override bool SetData()

public override void Dispose()
{
if (vertexBuffer != null)
{
;
}

vertexBuffer.Dispose();
vertexBuffer?.Dispose();
vertexBuffer = null;
indexBuffer.Dispose();
TileBufferCount--;
indexBuffer?.Dispose();
indexBuffer = null;
TileBufferCount--;
disposed = true;
}

Expand Down
4 changes: 0 additions & 4 deletions Intersect.Client/MonoGame/Network/MonoSocket.cs
Expand Up @@ -21,10 +21,6 @@ public class MonoSocket : GameSocket
public static ConcurrentQueue<KeyValuePair<IConnection, IPacket>> PacketQueue =
new ConcurrentQueue<KeyValuePair<IConnection, IPacket>>();

public MonoSocket()
{
}

public override void Connect(string host, int port)
{
if (ClientLidgrenNetwork != null)
Expand Down
1 change: 1 addition & 0 deletions Intersect.Network/ClientNetwork.cs
Expand Up @@ -5,6 +5,7 @@

using Intersect.Logging;
using Intersect.Network.Events;
using Intersect.Network.Lidgren;

using JetBrains.Annotations;

Expand Down
7 changes: 4 additions & 3 deletions Intersect.Network/Intersect.Network.csproj
Expand Up @@ -73,9 +73,9 @@
<Compile Include="Crypto\IKeyEncoder.cs" />
<Compile Include="IServer.cs" />
<Compile Include="KeyFactory.cs" />
<Compile Include="LidgrenConnection.cs" />
<Compile Include="LidgrenBuffer.cs" />
<Compile Include="LidgrenInterface.cs" />
<Compile Include="Lidgren\LidgrenConnection.cs" />
<Compile Include="Lidgren\LidgrenBuffer.cs" />
<Compile Include="Lidgren\LidgrenInterface.cs" />
<Compile Include="NetworkMetaStatus.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
Expand All @@ -89,5 +89,6 @@
<Name>Intersect %28Core%29</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Expand Up @@ -5,7 +5,7 @@

using Lidgren.Network;

namespace Intersect.Network
namespace Intersect.Network.Lidgren
{

public class LidgrenBuffer : IBuffer
Expand Down
Expand Up @@ -7,7 +7,7 @@

using Lidgren.Network;

namespace Intersect.Network
namespace Intersect.Network.Lidgren
{

public sealed class LidgrenConnection : AbstractConnection
Expand Down
Expand Up @@ -15,7 +15,7 @@

using Lidgren.Network;

namespace Intersect.Network
namespace Intersect.Network.Lidgren
{

public sealed class LidgrenInterface : INetworkLayerInterface
Expand Down
Expand Up @@ -204,11 +204,12 @@ private static void ParseJson(JToken obj)
{
try
{
var newJson = FixJson(property.Value.ToString());
var newJson = FixJson(property.Value?.ToString());
property.Value = newJson;
}
catch (Exception ex)
catch
{
// Not important to abort or log
}
}
}
Expand Down Expand Up @@ -695,7 +696,6 @@ private static byte[] ReencodeTileData(byte[] tileData)
}

return mCeras.Compress(Layers);
;
}

private static byte[] Decompress(byte[] data)
Expand Down
2 changes: 0 additions & 2 deletions Intersect.Server/Entities/Player.cs
Expand Up @@ -59,8 +59,6 @@ public partial class Player : Entity

#endregion

public Player() { }

public static int OnlineCount => OnlinePlayers.Count;

[JsonProperty("MaxVitals"), NotMapped]
Expand Down
5 changes: 4 additions & 1 deletion Intersect.Server/Networking/Helpers/PortChecker.cs
Expand Up @@ -2,6 +2,8 @@
using System.Linq;
using System.Net;

using Intersect.Logging;

using WebSocketSharp;

namespace Intersect.Server.Networking.Helpers
Expand Down Expand Up @@ -41,8 +43,9 @@ public static bool CanYouSeeMe(int port, out string externalIp)
}
}
}
catch (Exception ex)
catch (Exception exception)
{
Log.Debug(exception);
}

return false;
Expand Down
1 change: 1 addition & 0 deletions Intersect.Server/Networking/Lidgren/ServerNetwork.cs
Expand Up @@ -6,6 +6,7 @@
using Intersect.Logging;
using Intersect.Network;
using Intersect.Network.Events;
using Intersect.Network.Lidgren;
using Intersect.Server.Entities;

using JetBrains.Annotations;
Expand Down
Expand Up @@ -18,11 +18,6 @@ namespace Intersect.Server.Web.RestApi.Attributes
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false)]
internal class ConfigurableAuthorizeAttribute : AuthorizeAttribute
{

public ConfigurableAuthorizeAttribute() : base()
{
}

[NotNull]
protected IEnumerable<string> InternalRoles =>
Roles?.Split(',').Where(role => !string.IsNullOrWhiteSpace(role)).Select(role => role.Trim()) ??
Expand Down

0 comments on commit 3641c1f

Please sign in to comment.