Cleanup some stuff
This commit is contained in:
parent
b69a6cc252
commit
6ac1d92efc
Binary file not shown.
|
@ -15,7 +15,7 @@ namespace CXMLDecompiler
|
||||||
String XMLFilename = "";
|
String XMLFilename = "";
|
||||||
String CXMLFilename = "";
|
String CXMLFilename = "";
|
||||||
String MagicNumber = "";
|
String MagicNumber = "";
|
||||||
|
Int32 Version;
|
||||||
FileStream InfoFile;
|
FileStream InfoFile;
|
||||||
|
|
||||||
MemoryStream TreeTable;
|
MemoryStream TreeTable;
|
||||||
|
@ -37,11 +37,13 @@ namespace CXMLDecompiler
|
||||||
BinaryWriter bIntArrayTable;
|
BinaryWriter bIntArrayTable;
|
||||||
BinaryWriter bHashIDTable;
|
BinaryWriter bHashIDTable;
|
||||||
BinaryWriter bStringIDTable;
|
BinaryWriter bStringIDTable;
|
||||||
|
|
||||||
String SilicaTypingInformation = "";
|
String SilicaTypingInformation = "";
|
||||||
public void Init(string XMLFile, string CxmlFile, string Magic)
|
public void Init(string XMLFile, string CxmlFile)
|
||||||
{
|
{
|
||||||
MagicNumber = Magic;
|
GetSilicaTypingInformation(XMLFile);
|
||||||
|
MagicNumber = GetTypingInformation("MAGIC");
|
||||||
|
Version = int.Parse(GetTypingInformation("VERSION"));
|
||||||
|
|
||||||
InfoFile = File.Open(CxmlFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
InfoFile = File.Open(CxmlFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||||
InfoFile.SetLength(0);
|
InfoFile.SetLength(0);
|
||||||
|
|
||||||
|
@ -332,7 +334,7 @@ namespace CXMLDecompiler
|
||||||
return ent.offset;
|
return ent.offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AttributeType DetermineType(string ElementName, string AttributeName) // This is what i was worried about...
|
public AttributeType DetermineType(string ElementName, string AttributeName)
|
||||||
{
|
{
|
||||||
return (AttributeType)int.Parse(GetTypingInformation(ElementName + ":" + AttributeName));
|
return (AttributeType)int.Parse(GetTypingInformation(ElementName + ":" + AttributeName));
|
||||||
}
|
}
|
||||||
|
@ -526,19 +528,50 @@ namespace CXMLDecompiler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Term()
|
||||||
|
{
|
||||||
|
InfoFile.Close();
|
||||||
|
TreeTable.Close();
|
||||||
|
StringIDTable.Close();
|
||||||
|
IntIDTable.Close();
|
||||||
|
StringTable.Close();
|
||||||
|
CharTable.Close();
|
||||||
|
HashIDTable.Close();
|
||||||
|
IntArrayTable.Close();
|
||||||
|
FloatArrayTable.Close();
|
||||||
|
FileTable.Close();
|
||||||
|
|
||||||
|
bTreeTable.Close();
|
||||||
|
bIntIDTable.Close();
|
||||||
|
bFloatArrayTable.Close();
|
||||||
|
bIntArrayTable.Close();
|
||||||
|
bHashIDTable.Close();
|
||||||
|
|
||||||
|
TreeTableEntries.Clear();
|
||||||
|
StringTableEntries.Clear();
|
||||||
|
CharTableEntries.Clear();
|
||||||
|
HashIdTableEntries.Clear();
|
||||||
|
IntArrayTableEntries.Clear();
|
||||||
|
FloatArrayTableEntries.Clear();
|
||||||
|
FileTableEntries.Clear();
|
||||||
|
StringIDTableEntries.Clear();
|
||||||
|
IntIDTableEntries.Clear();
|
||||||
|
|
||||||
|
IsInitalized = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void BuildCXML(string XmlFile, string CxmlFile)
|
public void BuildCXML(string XmlFile, string CxmlFile)
|
||||||
{
|
{
|
||||||
GetSilicaTypingInformation(XmlFile);
|
|
||||||
string Magic = GetTypingInformation("MAGIC");
|
|
||||||
int Version = int.Parse(GetTypingInformation("VERSION"));
|
|
||||||
Console.WriteLine("Magic Number: " + Magic);
|
|
||||||
Console.WriteLine("Version: " + Version.ToString("X"));
|
|
||||||
if (!IsInitalized)
|
if (!IsInitalized)
|
||||||
Init(XmlFile, CxmlFile, Magic);
|
Init(XmlFile, CxmlFile);
|
||||||
|
Console.WriteLine("Magic Number: " + MagicNumber);
|
||||||
|
Console.WriteLine("Version: " + Version.ToString("X"));
|
||||||
|
|
||||||
XmlDocument XMLFile = new XmlDocument();
|
XmlDocument XMLFile = new XmlDocument();
|
||||||
XMLFile.Load(XmlFile);
|
XMLFile.Load(XmlFile);
|
||||||
|
|
||||||
Tools.WriteStringToStream(InfoFile, Magic);
|
Tools.WriteStringToStream(InfoFile, MagicNumber);
|
||||||
bInfoFile.Write((Int32)Version);
|
bInfoFile.Write((Int32)Version);
|
||||||
byte[] headerPlaceholder = new byte[0x48];
|
byte[] headerPlaceholder = new byte[0x48];
|
||||||
InfoFile.Write(headerPlaceholder, 0x00, headerPlaceholder.Length);
|
InfoFile.Write(headerPlaceholder, 0x00, headerPlaceholder.Length);
|
||||||
|
@ -623,8 +656,7 @@ namespace CXMLDecompiler
|
||||||
bInfoFile.Write(FileTableOffset);
|
bInfoFile.Write(FileTableOffset);
|
||||||
bInfoFile.Write(FileTableSize);
|
bInfoFile.Write(FileTableSize);
|
||||||
|
|
||||||
InfoFile.Close();
|
Term();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,7 @@ namespace CXMLCli
|
||||||
{
|
{
|
||||||
Console.WriteLine("Compiling.");
|
Console.WriteLine("Compiling.");
|
||||||
CXMLBuilder builder = new CXMLBuilder();
|
CXMLBuilder builder = new CXMLBuilder();
|
||||||
|
builder.Init(path, args[1]);
|
||||||
builder.BuildCXML(path, args[1]);
|
builder.BuildCXML(path, args[1]);
|
||||||
Console.WriteLine("\n\nCOMPILATION COMPLETE!");
|
Console.WriteLine("\n\nCOMPILATION COMPLETE!");
|
||||||
if (cxmlParser.WaitExit)
|
if (cxmlParser.WaitExit)
|
||||||
|
|
Loading…
Reference in New Issue