From 1f8dd72606bc5a8d335a715c069cd820db364170 Mon Sep 17 00:00:00 2001 From: appelemac Date: Sun, 5 Jun 2016 19:56:31 +0200 Subject: [PATCH] Code analysis recommended this MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ¯\_(ツ)_/¯ --- NadekoBot/Classes/NadekoStats.cs | 17 ++++++++++++++++- .../Modules/Searches/Commands/EvalCommand.cs | 4 ++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/NadekoBot/Classes/NadekoStats.cs b/NadekoBot/Classes/NadekoStats.cs index 66ef0984..36fe55bd 100644 --- a/NadekoBot/Classes/NadekoStats.cs +++ b/NadekoBot/Classes/NadekoStats.cs @@ -14,7 +14,7 @@ using System.Timers; namespace NadekoBot { - public class NadekoStats + public class NadekoStats : IDisposable { public static NadekoStats Instance { get; } = new NadekoStats(); @@ -231,5 +231,20 @@ namespace NadekoBot } }).ConfigureAwait(false); } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposing) + { + carbonClient.Dispose(); + } + + } } } \ No newline at end of file diff --git a/NadekoBot/Modules/Searches/Commands/EvalCommand.cs b/NadekoBot/Modules/Searches/Commands/EvalCommand.cs index 57f45342..fdb2f1c1 100644 --- a/NadekoBot/Modules/Searches/Commands/EvalCommand.cs +++ b/NadekoBot/Modules/Searches/Commands/EvalCommand.cs @@ -49,11 +49,11 @@ namespace NadekoBot.Modules.Searches.Commands string result = parser.Parse(expression).ToString(); return result; } - catch (OverflowException e) + catch (OverflowException) { return $"Overflow error on {expression}"; } - catch (FormatException e) + catch (FormatException) { return $"\"{expression}\" was not formatted correctly"; }