|
@ -40,5 +40,21 @@ namespace Hack.Xenosaga.Common |
|
|
|
|
|
|
|
|
return value; |
|
|
return value; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Pad a MemoryStream with a byte
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="modulo">Modulo to use for the padding (default: 4)</param>
|
|
|
|
|
|
/// <param name="value">Value of the byte (default: 0)</param>
|
|
|
|
|
|
public static void Padding(this MemoryStream ms, int modulo = 4, byte value = 0) |
|
|
|
|
|
{ |
|
|
|
|
|
long size = ms.Length; |
|
|
|
|
|
|
|
|
|
|
|
while (size % modulo != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
ms.WriteByte(value); |
|
|
|
|
|
size++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |