mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Start work on restructuring based on hashes (will not compile)
This set of changes is the start of turning over to a Hash based system instead of a Rom/Dat based system. It's a long process but it will be worth it in the end.
This commit is contained in:
@@ -74,7 +74,7 @@ namespace SabreTools.Helper
|
||||
Rules = new List<SkipperRule>(),
|
||||
};
|
||||
|
||||
if (!System.IO.File.Exists(filename))
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return skipper;
|
||||
}
|
||||
@@ -319,7 +319,7 @@ namespace SabreTools.Helper
|
||||
SkipperRule skipperRule = new SkipperRule();
|
||||
|
||||
// If the file doesn't exist, return a blank skipper rule
|
||||
if (!System.IO.File.Exists(input))
|
||||
if (!File.Exists(input))
|
||||
{
|
||||
logger.Error("The file '" + input + "' does not exist so it cannot be tested");
|
||||
return skipperRule;
|
||||
@@ -332,7 +332,7 @@ namespace SabreTools.Helper
|
||||
if (String.IsNullOrEmpty(skippername) || (!String.IsNullOrEmpty(skipper.Name) && skippername.ToLowerInvariant() == skipper.Name.ToLowerInvariant()))
|
||||
{
|
||||
// Loop through the rules until one is found that works
|
||||
using (BinaryReader br = new BinaryReader(System.IO.File.OpenRead(input)))
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(input)))
|
||||
{
|
||||
foreach (SkipperRule rule in skipper.Rules)
|
||||
{
|
||||
@@ -495,7 +495,7 @@ namespace SabreTools.Helper
|
||||
bool success = true;
|
||||
|
||||
// If the input file doesn't exist, fail
|
||||
if (!System.IO.File.Exists(input))
|
||||
if (!File.Exists(input))
|
||||
{
|
||||
logger.Error("I'm sorry but '" + input + "' doesn't exist!");
|
||||
return false;
|
||||
@@ -521,8 +521,8 @@ namespace SabreTools.Helper
|
||||
try
|
||||
{
|
||||
logger.User("Applying found rule to file '" + input + "'");
|
||||
using (BinaryWriter bw = new BinaryWriter(System.IO.File.OpenWrite(output)))
|
||||
using (BinaryReader br = new BinaryReader(System.IO.File.OpenRead(input)))
|
||||
using (BinaryWriter bw = new BinaryWriter(File.OpenWrite(output)))
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(input)))
|
||||
{
|
||||
// Seek to the beginning offset
|
||||
if (rule.StartOffset == null)
|
||||
@@ -619,7 +619,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
try
|
||||
{
|
||||
System.IO.File.Delete(output);
|
||||
File.Delete(output);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -663,7 +663,7 @@ namespace SabreTools.Helper
|
||||
XmlDocument doc = new XmlDocument();
|
||||
try
|
||||
{
|
||||
doc.LoadXml(System.IO.File.ReadAllText(System.IO.Path.Combine(Path, skipper + ".xml")));
|
||||
doc.LoadXml(File.ReadAllText(System.IO.Path.Combine(Path, skipper + ".xml")));
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
@@ -726,7 +726,7 @@ namespace SabreTools.Helper
|
||||
public static HeaderType GetFileHeaderType(string input, out int hs, Logger logger)
|
||||
{
|
||||
// Open the file in read mode
|
||||
BinaryReader br = new BinaryReader(System.IO.File.OpenRead(input));
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(input));
|
||||
|
||||
// Extract the first 1024 bytes of the file
|
||||
byte[] hbin = br.ReadBytes(1024);
|
||||
|
||||
Reference in New Issue
Block a user