fix bugs in some ancient ReadFromHex overloads that never got used
This commit is contained in:
parent
eebdf7d84e
commit
8f668ee75d
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
@ -387,17 +388,23 @@ namespace BizHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReadFromHex(this int[] buffer, BinaryWriter bw)
|
public static void ReadFromHex(this int[] buffer, string hex)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < buffer.Length; i++)
|
if (hex.Length % 8 != 0)
|
||||||
bw.Write(buffer[i]);
|
throw new Exception("Hex value string does not appear to be properly formatted.");
|
||||||
|
for (int i = 0; i < buffer.Length && i * 8 < hex.Length; i++)
|
||||||
|
{
|
||||||
|
//string inthex = "" + hex[i * 8] + hex[(i * 8) + 1] + hex[(i * 4) + 2] + hex[(i * 4) + 3] + hex[(i*4
|
||||||
|
string inthex = hex.Substring(i*8,8);
|
||||||
|
buffer[i] = int.Parse(inthex, NumberStyles.HexNumber);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveAsHex(this uint[] buffer, BinaryWriter bw)
|
//public static void SaveAsHex(this uint[] buffer, BinaryWriter bw)
|
||||||
{
|
//{
|
||||||
for (int i = 0; i < buffer.Length; i++)
|
// for (int i = 0; i < buffer.Length; i++)
|
||||||
bw.Write(buffer[i]);
|
// bw.Write(buffer[i]);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//these don't work??? they dont get chosen by compiler
|
//these don't work??? they dont get chosen by compiler
|
||||||
public static void WriteBit(this BinaryWriter bw, Bit bit) { bw.Write((bool)bit); }
|
public static void WriteBit(this BinaryWriter bw, Bit bit) { bw.Write((bool)bit); }
|
||||||
|
|
Loading…
Reference in New Issue