Skip to content

Commit

Permalink
Small code cleanup & fix CodeQA alerts.
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan130200 committed May 11, 2024
1 parent da1838e commit d39d9a4
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 25 deletions.
3 changes: 0 additions & 3 deletions XmppSharp/Dom/Element.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System.Globalization;
using System.Security;
using System.Text;
using System.Web;
using System.Xml;
using XmppSharp.Factory;

Expand Down Expand Up @@ -223,7 +221,6 @@ internal void WriteToInternal(XmlWriter writer, in XmlFormatting formatting, boo

if (includeChildren)
{

lock (this._childNodes)
{
foreach (var node in this._childNodes)
Expand Down
4 changes: 1 addition & 3 deletions XmppSharp/Parsers/XmppStreamParser.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml;
using System.Xml;
using System.Xml.Schema;
using XmppSharp.Exceptions;
using XmppSharp.Factory;
Expand Down
3 changes: 1 addition & 2 deletions XmppSharp/Protocol/Sasl/Abort.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Xml.Linq;
using XmppSharp.Attributes;
using XmppSharp.Attributes;

namespace XmppSharp.Protocol.Sasl;

Expand Down
3 changes: 1 addition & 2 deletions XmppSharp/Protocol/Sasl/Challenge.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Xml.Linq;
using XmppSharp.Attributes;
using XmppSharp.Attributes;

namespace XmppSharp.Protocol.Sasl;

Expand Down
3 changes: 1 addition & 2 deletions XmppSharp/Protocol/Sasl/Failure.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Xml.Linq;
using XmppSharp.Attributes;
using XmppSharp.Attributes;

namespace XmppSharp.Protocol.Sasl;

Expand Down
3 changes: 1 addition & 2 deletions XmppSharp/Protocol/Sasl/Mechanism.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Xml.Linq;
using XmppSharp.Attributes;
using XmppSharp.Attributes;

namespace XmppSharp.Protocol.Sasl;

Expand Down
7 changes: 1 addition & 6 deletions XmppSharp/TryParseHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ public static class TryParseHelpers
};

public static Delegate GetConverter(Type type)
{
if (_typeMap.TryGetValue(type, out var func))
return func;

else return null;
}
=> _typeMap.TryGetValue(type, out var func) ? func : null;

/// <summary>
/// Parser implementation for the <see cref="System.UInt16"/> type.
Expand Down
5 changes: 2 additions & 3 deletions XmppSharp/Xml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Globalization;
using System.Net.Http.Headers;
using System.Text;
using System.Xml;
using XmppSharp.Parser;
Expand Down Expand Up @@ -37,14 +36,14 @@ public static XmlQualifiedName ExtractQualifiedName(string source)
};
}

public static async Task<Element> FromStringAsync(string xml, CancellationToken token = default)
public static async Task<Element> ParseFromStringAsync(string xml, CancellationToken token = default)
{
using (var ms = new MemoryStream(xml.GetBytes()))
using (var parser = new XmppStreamParser(ms))
return await parser.GetNextElementAsync(token);
}

public static async Task<Element> FromStreamAsync(Stream stream, CancellationToken token = default)
public static async Task<Element> ParseFromStreamAsync(Stream stream, CancellationToken token = default)
{
using (var parser = new XmppStreamParser(stream))
return await parser.GetNextElementAsync(token);
Expand Down
3 changes: 1 addition & 2 deletions XmppSharp/XmlFormatting.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Diagnostics;
using System.Xml;
using System.Xml;

namespace XmppSharp;

Expand Down

0 comments on commit d39d9a4

Please sign in to comment.