Fixed saving bug
Yaz0Stream was the culprit (was the only thing that wasn't flushing as expected)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
|
||||
@@ -69,11 +69,8 @@ namespace BMGEditor
|
||||
private void InitRW()
|
||||
{
|
||||
//Original code
|
||||
//Reader = m_BigEndian ? new BinaryReaderBE(m_Stream, m_Encoding) : new BinaryReader(m_Stream, m_Encoding);
|
||||
//Writer = m_BigEndian ? new BinaryWriterBE(m_Stream, m_Encoding) : new BinaryWriter(m_Stream, m_Encoding);
|
||||
|
||||
Reader = Tests.isBE ? new BinaryReaderBE(m_Stream, m_Encoding) : new BinaryReader(m_Stream, m_Encoding);
|
||||
Writer = Tests.isBE ? new BinaryWriterBE(m_Stream, m_Encoding) : new BinaryWriter(m_Stream, m_Encoding);
|
||||
Reader = m_BigEndian ? new BinaryReaderBE(m_Stream, m_Encoding) : new BinaryReader(m_Stream, m_Encoding);
|
||||
Writer = m_BigEndian ? new BinaryWriterBE(m_Stream, m_Encoding) : new BinaryWriter(m_Stream, m_Encoding);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Drawing.Text;
|
||||
|
||||
namespace BMGEditor
|
||||
{
|
||||
@@ -107,7 +108,7 @@ namespace BMGEditor
|
||||
|
||||
public void Flush()
|
||||
{
|
||||
m_File.Flush();
|
||||
m_File.Stream.Flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,19 @@ namespace BMGEditor
|
||||
Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
override public void Flush()
|
||||
{
|
||||
m_Backend.SetLength(Length);
|
||||
Position = 0x00;
|
||||
m_Backend.Position = 0x00;
|
||||
|
||||
while (Position < Length)
|
||||
{
|
||||
m_Backend.WriteByte((byte)ReadByte());
|
||||
}
|
||||
|
||||
m_Backend.Flush();
|
||||
}
|
||||
|
||||
private Stream m_Backend;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user