Commit Description:
Loads of new ideas, many from thinking about when I'm not coding and some from just now....
Commit Description:
Loads of new ideas, many from thinking about when I'm not coding and some from just now. Note that instead of doing leisure next, I'm doing events next. I honestly might switch back but I have ideas for dialog that fit nicely into a focus on events.
File last commit:
Show/Diff file:
Action:
SpriteFontPlus/src/Utility/IOUtils.cs
27 lines | 467 B | text/x-csharp | CSharpLexer
using System.IO;
namespace SpriteFontPlus.Utility
{
internal static class IOUtils
{
public static byte[] ToByteArray(this Stream stream)
{
byte[] bytes;
// Rewind stream if it is at end
if (stream.CanSeek && stream.Length == stream.Position)
{
stream.Seek(0, SeekOrigin.Begin);
}
// Copy it's data to memory
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
bytes = ms.ToArray();
}
return bytes;
}
}
}