Skip to content

Commit

Permalink
WIp
Browse files Browse the repository at this point in the history
  • Loading branch information
cosullivan committed Aug 7, 2020
1 parent ec415a0 commit 683cd96
Show file tree
Hide file tree
Showing 36 changed files with 3,726 additions and 5,475 deletions.
3 changes: 1 addition & 2 deletions Src/SampleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static void Main(string[] args)
// .Append(ToByteArray("pqrstu"))
// .Append(ToByteArray("vwxyz"));

//var sequence = new ReadOnlySequence<byte>(start, 0, end, end.Memory.Length); ;
//var sequence = new ReadOnlySequence<byte>(start, 0, end, end.Memory.Length);

//Span<byte> pattern = stackalloc byte[3];
//pattern[0] = (byte)'s';
Expand All @@ -43,7 +43,6 @@ static void Main(string[] args)
// Console.WriteLine(StringUtil.Create(found));
//}

HERE: fix DotStuffing
SimpleExample.Run();

//////var text = new ReadOnlySequence<byte>(Encoding.ASCII.GetBytes("EHLO abc-1-def.mail.com"));
Expand Down
42 changes: 21 additions & 21 deletions Src/SmtpServer/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
using System;
//using System;

namespace SmtpServer
{
public static class StringExtensions
{
/// <summary>
/// Returns a value indicating whether or not the given string is equal on a case insensitive comparisson.
/// </summary>
/// <param name="str">The string to compare.</param>
/// <param name="test">The string to test against.</param>
/// <returns>true if the strings are equal on a case insensitive comparisson.</returns>
public static bool CaseInsensitiveEquals(this string str, string test)
{
if (str == null)
{
throw new ArgumentNullException(nameof(str));
}
//namespace SmtpServer
//{
// public static class StringExtensions
// {
// /// <summary>
// /// Returns a value indicating whether or not the given string is equal on a case insensitive comparisson.
// /// </summary>
// /// <param name="str">The string to compare.</param>
// /// <param name="test">The string to test against.</param>
// /// <returns>true if the strings are equal on a case insensitive comparisson.</returns>
// public static bool CaseInsensitiveEquals(this string str, string test)
// {
// if (str == null)
// {
// throw new ArgumentNullException(nameof(str));
// }

return String.Equals(str, test, StringComparison.OrdinalIgnoreCase);
}
}
}
// return string.Equals(str, test, StringComparison.OrdinalIgnoreCase);
// }
// }
//}
2 changes: 1 addition & 1 deletion Src/SmtpServer/Extensions/TaskExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ public static async Task<T> WithCancellation<T>(this Task<T> task, CancellationT
return await task.ConfigureAwait(false);
}
}
}
}
39 changes: 39 additions & 0 deletions Src/SmtpServer/IO/ByteArraySegment.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Buffers;

namespace SmtpServer.IO
{
internal sealed class ByteArraySegment : ReadOnlySequenceSegment<byte>
{
internal ByteArraySegment(ReadOnlyMemory<byte> memory)
{
Memory = memory;
}

internal ByteArraySegment Append(ref ReadOnlySequence<byte> sequence)
{
var segment = this;

var position = sequence.GetPosition(0);

while (sequence.TryGet(ref position, out var memory))
{
segment = segment.Append(memory);
}

return segment;
}

internal ByteArraySegment Append(ReadOnlyMemory<byte> memory)
{
var segment = new ByteArraySegment(memory)
{
RunningIndex = RunningIndex + Memory.Length
};

Next = segment;

return segment;
}
}
}
163 changes: 0 additions & 163 deletions Src/SmtpServer/IO/ByteArrayStream.cs

This file was deleted.

Loading

0 comments on commit 683cd96

Please sign in to comment.