From 0b34a4ccee4cddae541ad650d6ebbf47b5bdb002 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 17 Dec 2021 11:21:14 +0100 Subject: [PATCH] Fix errors and warnings --- MustacheSharp/GtTagDefinition.cs | 2 +- MustacheSharp/GteTagDefinition.cs | 6 +----- MustacheSharp/LtTagDefinition.cs | 2 +- MustacheSharp/LteTagDefinition.cs | 3 +-- MustacheSharp/UrlDecodeTagDefinition.cs | 11 ++++------- MustacheSharp/UrlEncodeTagDefinition.cs | 13 +++++-------- 6 files changed, 13 insertions(+), 24 deletions(-) diff --git a/MustacheSharp/GtTagDefinition.cs b/MustacheSharp/GtTagDefinition.cs index 25980a9..eb5601f 100644 --- a/MustacheSharp/GtTagDefinition.cs +++ b/MustacheSharp/GtTagDefinition.cs @@ -57,7 +57,7 @@ namespace Mustache { try { return Convert.ToDouble(condition) > Convert.ToDouble(targetValue); - } catch (Exception exception) { + } catch (Exception /* ex */) { return false; } diff --git a/MustacheSharp/GteTagDefinition.cs b/MustacheSharp/GteTagDefinition.cs index eb407ec..1e68af6 100644 --- a/MustacheSharp/GteTagDefinition.cs +++ b/MustacheSharp/GteTagDefinition.cs @@ -57,13 +57,9 @@ namespace Mustache { try { return Convert.ToDouble(condition) >= Convert.ToDouble(targetValue); - } catch (Exception exception) { + } catch (Exception /* ex */) { return false; } - - - - return false; } /// diff --git a/MustacheSharp/LtTagDefinition.cs b/MustacheSharp/LtTagDefinition.cs index 8a70479..7d69863 100644 --- a/MustacheSharp/LtTagDefinition.cs +++ b/MustacheSharp/LtTagDefinition.cs @@ -59,7 +59,7 @@ namespace Mustache { try { return Convert.ToDouble(condition) < Convert.ToDouble(targetValue); } - catch (Exception exception) { + catch (Exception /* ex */) { return false; } diff --git a/MustacheSharp/LteTagDefinition.cs b/MustacheSharp/LteTagDefinition.cs index 32c9183..c111522 100644 --- a/MustacheSharp/LteTagDefinition.cs +++ b/MustacheSharp/LteTagDefinition.cs @@ -57,11 +57,10 @@ namespace Mustache { try { return Convert.ToDouble(condition) <= Convert.ToDouble(targetValue); - } catch (Exception exception) { + } catch (Exception /* ex */) { return false; } - return false; } /// diff --git a/MustacheSharp/UrlDecodeTagDefinition.cs b/MustacheSharp/UrlDecodeTagDefinition.cs index 2bbdfc5..3a71277 100644 --- a/MustacheSharp/UrlDecodeTagDefinition.cs +++ b/MustacheSharp/UrlDecodeTagDefinition.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Web; -namespace Mustache { +namespace Mustache +{ class UrlDecodeTagDefinition: ContentTagDefinition { public UrlDecodeTagDefinition() : base("urldecode") { @@ -25,7 +22,7 @@ namespace Mustache { } public override string ConsolidateWriter(TextWriter writer, Dictionary arguments) { - return HttpUtility.UrlDecode(writer.ToString()); + return System.Net.WebUtility.UrlDecode(writer.ToString()); } } } diff --git a/MustacheSharp/UrlEncodeTagDefinition.cs b/MustacheSharp/UrlEncodeTagDefinition.cs index 8f698d1..6089b20 100644 --- a/MustacheSharp/UrlEncodeTagDefinition.cs +++ b/MustacheSharp/UrlEncodeTagDefinition.cs @@ -1,11 +1,8 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text; -using System.Web; -namespace Mustache { +namespace Mustache +{ public class UrlEncodeTagDefinition : ContentTagDefinition { public UrlEncodeTagDefinition() @@ -19,14 +16,14 @@ namespace Mustache { WriterNeedsConsidated = true, }; yield return context; - } + } public override IEnumerable GetChildContextParameters() { return new TagParameter[] { new TagParameter("collection") }; } public override string ConsolidateWriter(TextWriter writer, Dictionary arguments) { - return HttpUtility.UrlEncode(writer.ToString()); + return System.Net.WebUtility.UrlEncode(writer.ToString()); } } } \ No newline at end of file