Make corrections: https://forum.devchroma.nl/index.php/topic,272.0.html
This commit is contained in:
parent
28787c9bd2
commit
a160c05a42
|
@ -18,7 +18,7 @@ namespace CXML
|
|||
TYPE_FLOAT,
|
||||
TYPE_STRING,
|
||||
TYPE_CHAR,
|
||||
TYPE_STYLE_ID,
|
||||
TYPE_HASH_ID,
|
||||
TYPE_INTEGER_ARRAY,
|
||||
TYPE_FLOAT_ARRAY,
|
||||
TYPE_FILE,
|
||||
|
@ -67,7 +67,7 @@ namespace CXML
|
|||
static MemoryStream IntIDTable;
|
||||
static MemoryStream StringTable;
|
||||
static MemoryStream CharTable;
|
||||
static MemoryStream StylesIDTable;
|
||||
static MemoryStream HashIDTable;
|
||||
static MemoryStream IntArrayTable;
|
||||
static MemoryStream FloatArrayTable;
|
||||
static MemoryStream FileTable;
|
||||
|
@ -77,7 +77,7 @@ namespace CXML
|
|||
static BinaryReader bIntIDTable;
|
||||
static BinaryReader bFloatArrayTable;
|
||||
static BinaryReader bIntArrayTable;
|
||||
static BinaryReader bStylesIDTable;
|
||||
static BinaryReader bHashIDTable;
|
||||
static BinaryReader bStringIDTable;
|
||||
|
||||
static XmlWriter XMLFile;
|
||||
|
@ -100,7 +100,7 @@ namespace CXML
|
|||
IntIDTable = Tools.ByteToStream(GetIntIDTable());
|
||||
StringTable = Tools.ByteToStream(GetStringTable());
|
||||
CharTable = Tools.ByteToStream(GetCharTable());
|
||||
StylesIDTable = Tools.ByteToStream(GetStyleIDTable());
|
||||
HashIDTable = Tools.ByteToStream(GetStyleIDTable());
|
||||
IntArrayTable = Tools.ByteToStream(GetIntArrayTable());
|
||||
FloatArrayTable = Tools.ByteToStream(GetFloatArrayTable());
|
||||
FileTable = Tools.ByteToStream(GetFileTable());
|
||||
|
@ -109,7 +109,7 @@ namespace CXML
|
|||
bIntIDTable = new BinaryReader(IntIDTable);
|
||||
bFloatArrayTable = new BinaryReader(FloatArrayTable);
|
||||
bIntArrayTable = new BinaryReader(IntArrayTable);
|
||||
bStylesIDTable = new BinaryReader(StylesIDTable);
|
||||
bHashIDTable = new BinaryReader(HashIDTable);
|
||||
bStringIDTable = new BinaryReader(StringIDTable);
|
||||
|
||||
MainDir = Path.GetFileNameWithoutExtension(path);
|
||||
|
@ -133,7 +133,7 @@ namespace CXML
|
|||
IntIDTable.Close();
|
||||
StringTable.Close();
|
||||
CharTable.Close();
|
||||
StylesIDTable.Close();
|
||||
HashIDTable.Close();
|
||||
IntArrayTable.Close();
|
||||
FloatArrayTable.Close();
|
||||
FileTable.Close();
|
||||
|
@ -142,7 +142,7 @@ namespace CXML
|
|||
bIntIDTable.Close();
|
||||
bFloatArrayTable.Close();
|
||||
bIntArrayTable.Close();
|
||||
bStylesIDTable.Close();
|
||||
bHashIDTable.Close();
|
||||
}
|
||||
|
||||
public static int GetTreeTableOffset()
|
||||
|
@ -450,20 +450,18 @@ namespace CXML
|
|||
|
||||
AttributeValue = Encoding.Unicode.GetString(CharBytes);
|
||||
break;
|
||||
case AttributeType.TYPE_STYLE_ID:
|
||||
int StyleTableOffset = bTreeTable.ReadInt32();
|
||||
int StyleTableSize = bTreeTable.ReadInt32();
|
||||
case AttributeType.TYPE_HASH_ID:
|
||||
int HashTableOffset = bTreeTable.ReadInt32();
|
||||
int HashTableSize = bTreeTable.ReadInt32();
|
||||
HashIDTable.Seek(HashTableOffset*4, SeekOrigin.Begin);
|
||||
|
||||
byte[] StyleTableData = new byte[StyleTableSize];
|
||||
|
||||
StylesIDTable.Seek(StyleTableOffset, SeekOrigin.Begin);
|
||||
StylesIDTable.Read(StyleTableData, 0x00, StyleTableSize);
|
||||
AttributeValue = BitConverter.ToString(StyleTableData).Replace("-","");
|
||||
int HashID = bHashIDTable.ReadInt32();
|
||||
AttributeValue = HashID.ToString("X8");
|
||||
break;
|
||||
case AttributeType.TYPE_INTEGER_ARRAY:
|
||||
int IntArrayOffset = bTreeTable.ReadInt32();
|
||||
int IntArraySize = bTreeTable.ReadInt32();
|
||||
IntArrayTable.Seek(IntArrayOffset, SeekOrigin.Begin);
|
||||
IntArrayTable.Seek(IntArrayOffset*4, SeekOrigin.Begin);
|
||||
|
||||
List<int> IntList = new List<int>();
|
||||
|
||||
|
@ -478,14 +476,14 @@ namespace CXML
|
|||
case AttributeType.TYPE_FLOAT_ARRAY:
|
||||
int FloatArrayOffset = bTreeTable.ReadInt32();
|
||||
int FloatArraySize = bTreeTable.ReadInt32();
|
||||
FloatArrayTable.Seek(FloatArrayOffset, SeekOrigin.Begin);
|
||||
FloatArrayTable.Seek(FloatArrayOffset*4, SeekOrigin.Begin);
|
||||
|
||||
List<string> StrList = new List<string>();
|
||||
|
||||
for(int i = 0; i < FloatArraySize; i++)
|
||||
{
|
||||
FloatValue = bFloatArrayTable.ReadSingle();
|
||||
StrList.Add(Tools.RemoveDecimals(FloatValue));
|
||||
StrList.Add(FloatValue.ToString());
|
||||
}
|
||||
string[] StrArray = StrList.ToArray();
|
||||
AttributeValue = String.Join(", ", StrArray);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace CXMLCli
|
|||
Console.WriteLine("\t-iit --dump-int-id Dump int ID table.");
|
||||
Console.WriteLine("\t-st --dump-string Dump string table.");
|
||||
Console.WriteLine("\t-ct --dump-char Dump char table.");
|
||||
Console.WriteLine("\t-sit --dump-style-id Dump style ID table.");
|
||||
Console.WriteLine("\t-hit --dump-hash-id Dump hash ID table.");
|
||||
Console.WriteLine("\t-iat --dump-int-array Dump int array table.");
|
||||
Console.WriteLine("\t-fat --dump-float-array Dump float array table.");
|
||||
Console.WriteLine("\t-ft --dump-file Dump file table.");
|
||||
|
@ -97,10 +97,10 @@ namespace CXMLCli
|
|||
File.WriteAllBytes("char-table.bin", CXML.CXMLParser.GetCharTable());
|
||||
}
|
||||
|
||||
if (ArgsFull.Contains("-sit") || ArgsFull.Contains("--dump-style-id"))
|
||||
if ((ArgsFull.Contains("-sit") || ArgsFull.Contains("--dump-style-id")) /*kept for backwards comp*/ || (ArgsFull.Contains("-hit") || ArgsFull.Contains("--dump-hash-id")))
|
||||
{
|
||||
Console.WriteLine("Dumping style ID table.");
|
||||
File.WriteAllBytes("style-id-table.bin", CXML.CXMLParser.GetStyleIDTable());
|
||||
Console.WriteLine("Dumping hash ID table.");
|
||||
File.WriteAllBytes("hash-id-table.bin", CXML.CXMLParser.GetStyleIDTable());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue