121 lines
4.9 KiB
C#
121 lines
4.9 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
|
|
namespace CXMLCli
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
|
|
bool Check = true;
|
|
|
|
if (args.Length == 0)
|
|
{
|
|
Console.WriteLine("-- app.info/CXML Decompiler --");
|
|
Console.WriteLine("I like to see girls die :3");
|
|
Console.WriteLine("Required Arguments:");
|
|
Console.WriteLine("\t<file>");
|
|
Console.WriteLine("Optional Arguments:");
|
|
Console.WriteLine("\t-f --force Dont check magic number.");
|
|
Console.WriteLine("\t-dt --dump-tables Dump ALL tables.");
|
|
Console.WriteLine("\t-tt --dump-tree Dump tree table.");
|
|
Console.WriteLine("\t-ist --dump-string-id Dump string ID table.");
|
|
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-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.");
|
|
Console.WriteLine("\t-d --decompile Decompile CXML.");
|
|
Console.WriteLine("Example: " + Path.GetFileName(Assembly.GetEntryAssembly().Location) + " app.info -f -s -t -f -d");
|
|
Console.WriteLine("Default functonality is to Decompile,\ntThis is canceled if any other arguments passed.");
|
|
return;
|
|
}
|
|
|
|
String ArgsFull = String.Join(" ", args);
|
|
String path = args[0];
|
|
CXML.Parser.Init(path, Check);
|
|
|
|
if (ArgsFull.Contains("-f") || ArgsFull.Contains("--force"))
|
|
{
|
|
Check = false;
|
|
}
|
|
|
|
if (ArgsFull.Contains("-dt") || ArgsFull.Contains("--dump-tables"))
|
|
{
|
|
ArgsFull += "-tt -ist -iit -st -ct -sit -iat -fat -ft";
|
|
}
|
|
|
|
if (ArgsFull.Contains("-tt") || ArgsFull.Contains("--dump-tree"))
|
|
{
|
|
Console.WriteLine("Dumping tree table.");
|
|
File.WriteAllBytes("tree-table.bin", CXML.Parser.GetTreeTable());
|
|
|
|
}
|
|
|
|
if (ArgsFull.Contains("-ist") || ArgsFull.Contains("--dump-string-id"))
|
|
{
|
|
Console.WriteLine("Dumping string ID table.");
|
|
File.WriteAllBytes("string-id-table.bin", CXML.Parser.GetStringIDTable());
|
|
|
|
}
|
|
|
|
if (ArgsFull.Contains("-iit") || ArgsFull.Contains("--dump-int-id"))
|
|
{
|
|
Console.WriteLine("Dumping int ID table.");
|
|
File.WriteAllBytes("int-id-table.bin", CXML.Parser.GetIntIDTable());
|
|
}
|
|
|
|
if (ArgsFull.Contains("-st") || ArgsFull.Contains("--dump-string"))
|
|
{
|
|
Console.WriteLine("Dumping string table.");
|
|
File.WriteAllBytes("string-table.bin",CXML.Parser.GetStringTable());
|
|
|
|
}
|
|
|
|
if (ArgsFull.Contains("-ct") || ArgsFull.Contains("--dump-char"))
|
|
{
|
|
Console.WriteLine("Dumping char table.");
|
|
File.WriteAllBytes("char-table.bin", CXML.Parser.GetCharTable());
|
|
}
|
|
|
|
if (ArgsFull.Contains("-sit") || ArgsFull.Contains("--dump-style-id"))
|
|
{
|
|
Console.WriteLine("Dumping style ID table.");
|
|
File.WriteAllBytes("style-id-table.bin", CXML.Parser.GetStyleIDTable());
|
|
}
|
|
|
|
|
|
if (ArgsFull.Contains("-iat") || ArgsFull.Contains("--dump-int-array"))
|
|
{
|
|
Console.WriteLine("Dumping int array table.");
|
|
File.WriteAllBytes("int-array-table.bin", CXML.Parser.GetIntArrayTable());
|
|
}
|
|
|
|
if (ArgsFull.Contains("-fat") || ArgsFull.Contains("--dump-float-array"))
|
|
{
|
|
Console.WriteLine("Dumping float array table.");
|
|
File.WriteAllBytes("float-array-table.bin", CXML.Parser.GetFloatArrayTable());
|
|
}
|
|
|
|
|
|
if (ArgsFull.Contains("-ft") || ArgsFull.Contains("--dump-tree"))
|
|
{
|
|
Console.WriteLine("Dumping file table.");
|
|
File.WriteAllBytes("file-table.bin", CXML.Parser.GetTreeTable());
|
|
}
|
|
|
|
if (ArgsFull.Contains("-d") || ArgsFull.Contains("--decompile") || args.Length == 1)
|
|
{
|
|
Console.WriteLine("Decompiling.");
|
|
CXML.Parser.DecompileCXML(path, Check);
|
|
Console.WriteLine("\n\nDECOMPILATION COMPLETE!");
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|
|
}
|