-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified writers by passing around binary writer instead of stream
- Loading branch information
1 parent
382bb8d
commit 27cd984
Showing
11 changed files
with
79 additions
and
91 deletions.
There are no files selected for viewing
32 changes: 14 additions & 18 deletions
32
RePKG.Application/Texture/Writer/TexFrameInfoContainerWriter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,23 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
using RePKG.Core.Texture; | ||
|
||
namespace RePKG.Application.Texture | ||
{ | ||
public class TexHeaderWriter : ITexHeaderWriter | ||
{ | ||
public void WriteToStream(TexHeader header, Stream stream) | ||
public void WriteTo(BinaryWriter writer, TexHeader header) | ||
{ | ||
if (writer == null) throw new ArgumentNullException(nameof(writer)); | ||
if (header == null) throw new ArgumentNullException(nameof(header)); | ||
if (stream == null) throw new ArgumentNullException(nameof(stream)); | ||
|
||
using (var writer = new BinaryWriter(stream, Encoding.UTF8, true)) | ||
{ | ||
writer.Write((int) header.Format); | ||
writer.Write((int) header.Flags); | ||
writer.Write(header.TextureWidth); | ||
writer.Write(header.TextureHeight); | ||
writer.Write(header.ImageWidth); | ||
writer.Write(header.ImageHeight); | ||
writer.Write(header.UnkInt0); | ||
} | ||
|
||
writer.Write((int) header.Format); | ||
writer.Write((int) header.Flags); | ||
writer.Write(header.TextureWidth); | ||
writer.Write(header.TextureHeight); | ||
writer.Write(header.ImageWidth); | ||
writer.Write(header.ImageHeight); | ||
writer.Write(header.UnkInt0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
using System.IO; | ||
|
||
namespace RePKG.Core.Texture | ||
{ | ||
public interface ITexWriter | ||
{ | ||
|
||
void WriteTo(BinaryWriter writer, Tex tex); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters