2019-05-28 22:11:40 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2019-05-28 22:53:02 +02:00
|
|
|
|
using System.IO;
|
2019-05-28 22:11:40 +02:00
|
|
|
|
using System.Threading.Tasks;
|
2019-05-28 22:53:02 +02:00
|
|
|
|
using System.Text.RegularExpressions;
|
2019-05-28 22:11:40 +02:00
|
|
|
|
|
|
|
|
|
namespace Switch_Toolbox.Library.IO
|
|
|
|
|
{
|
|
|
|
|
public static class IOExtensions
|
|
|
|
|
{
|
|
|
|
|
public static uint Reverse(this uint x)
|
|
|
|
|
{
|
|
|
|
|
// swap adjacent 16-bit blocks
|
|
|
|
|
x = (x >> 16) | (x << 16);
|
|
|
|
|
// swap adjacent 8-bit blocks
|
|
|
|
|
return ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8);
|
|
|
|
|
}
|
2019-05-28 22:53:02 +02:00
|
|
|
|
|
|
|
|
|
public static string RemoveIllegaleCharacters(this string str)
|
|
|
|
|
{
|
|
|
|
|
string illegal = "\"M\"\\a/ry/ h**ad:>> a\\/:*?\"| li*tt|le|| la\"mb.?";
|
|
|
|
|
Regex r = new Regex(string.Format("[{0}]", Regex.Escape(str)));
|
|
|
|
|
illegal = r.Replace(illegal, "");
|
|
|
|
|
return illegal;
|
|
|
|
|
}
|
2019-05-28 22:11:40 +02:00
|
|
|
|
}
|
|
|
|
|
}
|