-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from minishmaker/name-change
Ability to change save file names.
- Loading branch information
Showing
8 changed files
with
376 additions
and
67 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.CodeDom; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using SaveEditor.Utilities; | ||
|
||
namespace SaveEditor.Core | ||
{ | ||
public class SaveFile | ||
{ | ||
public uint checksum { get; private set; } | ||
public byte[] data { get; private set; } | ||
|
||
private readonly Reader reader_; | ||
private readonly Writer writer_; | ||
|
||
public SaveFile(uint fileChecksum, byte[] fileData) | ||
{ | ||
checksum = fileChecksum; | ||
data = fileData; | ||
|
||
Stream stream = Stream.Synchronized(new MemoryStream(data)); | ||
reader_ = new Reader(stream); | ||
writer_ = new Writer(stream); | ||
} | ||
|
||
public string GetName() | ||
{ | ||
return Encoding.Default.GetString(reader_.ReadBytes(6, 0x80)); | ||
} | ||
|
||
public void WriteName(string name) | ||
{ | ||
writer_.WriteBytes(Encoding.ASCII.GetBytes(name.PadRight(6, (char)0x00).Substring(0, 6)), 0x80); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.