This commit is contained in:
Razmoth
2023-09-22 20:31:55 +04:00
parent d594f90fec
commit 6ebeaeee3f
48 changed files with 5886 additions and 81 deletions

View File

@@ -20,5 +20,29 @@ namespace AssetStudio
}
}
}
public static void AlignStream(this Stream stream)
{
stream.AlignStream(4);
}
public static void AlignStream(this Stream stream, int alignment)
{
var pos = stream.Position;
var mod = pos % alignment;
if (mod != 0)
{
var rem = alignment - mod;
for (int _ = 0; _ < rem; _++)
{
if (!stream.CanWrite)
{
throw new IOException("End of stream");
}
stream.WriteByte(0);
}
}
}
}
}