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 CXMLFilename = "";
|
||||
String MagicNumber = "";
|
||||
|
||||
Int32 Version;
|
||||
FileStream InfoFile;
|
||||
|
||||
MemoryStream TreeTable;
|
||||
|
@ -37,11 +37,13 @@ namespace CXMLDecompiler
|
|||
BinaryWriter bIntArrayTable;
|
||||
BinaryWriter bHashIDTable;
|
||||
BinaryWriter bStringIDTable;
|
||||
|
||||
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.SetLength(0);
|
||||
|
||||
|
@ -332,7 +334,7 @@ namespace CXMLDecompiler
|
|||
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));
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
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)
|
||||
Init(XmlFile, CxmlFile, Magic);
|
||||
Init(XmlFile, CxmlFile);
|
||||
Console.WriteLine("Magic Number: " + MagicNumber);
|
||||
Console.WriteLine("Version: " + Version.ToString("X"));
|
||||
|
||||
XmlDocument XMLFile = new XmlDocument();
|
||||
XMLFile.Load(XmlFile);
|
||||
|
||||
Tools.WriteStringToStream(InfoFile, Magic);
|
||||
Tools.WriteStringToStream(InfoFile, MagicNumber);
|
||||
bInfoFile.Write((Int32)Version);
|
||||
byte[] headerPlaceholder = new byte[0x48];
|
||||
InfoFile.Write(headerPlaceholder, 0x00, headerPlaceholder.Length);
|
||||
|
@ -623,8 +656,7 @@ namespace CXMLDecompiler
|
|||
bInfoFile.Write(FileTableOffset);
|
||||
bInfoFile.Write(FileTableSize);
|
||||
|
||||
InfoFile.Close();
|
||||
|
||||
Term();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ namespace CXMLCli
|
|||
{
|
||||
Console.WriteLine("Compiling.");
|
||||
CXMLBuilder builder = new CXMLBuilder();
|
||||
builder.Init(path, args[1]);
|
||||
builder.BuildCXML(path, args[1]);
|
||||
Console.WriteLine("\n\nCOMPILATION COMPLETE!");
|
||||
if (cxmlParser.WaitExit)
|
||||
|
|
Loading…
Reference in New Issue