public static int Check( String Filename ) { Byte[] OriginalFile = System.IO.File.ReadAllBytes( Filename ); LIN lin = new LIN( OriginalFile ); Byte[] RecreatedFile = lin.CreateFile( 1024 ); LIN linOrig = new LIN( OriginalFile ); return Compare( OriginalFile, RecreatedFile, lin.UnalignedFilesize, Filename + ".fail" ); }
public static int Export( String InFilename, String OutFilename, String DB, int Alignment, bool RefreshNames, bool RefreshCode ) { LIN lin; try { lin = new LIN( InFilename ); if ( RefreshNames ) { lin.ReinsertNamesIntoDatabase( "Data Source=" + DB ); } if ( RefreshCode ) { lin.ReinsertCodeIntoDatabase( "Data Source=" + DB ); } lin.GetSQL( "Data Source=" + DB ); } catch ( Exception ex ) { Console.WriteLine( ex.Message ); Console.WriteLine( "Failed loading text file!" ); return -1; } byte[] newfile = lin.CreateFile( Alignment ); System.IO.File.WriteAllBytes( OutFilename, newfile ); return 0; }
public static int Execute( List<string> args ) { if ( args.Count < 1 ) { Console.WriteLine( "Usage: DanganRonpaText_GraceNote -dumptxt text.lin out.txt" ); return -1; } if ( args[0] == "-check" ) { return Check( args[1] ); } else if ( args[0] == "-dumpinsertcheck" ) { int Alignment = 16; LinImport.Importer.Import( args[1], args[2], args[3] ); LinExport.Exporter.Export( args[1], args[1] + ".new", args[2], Alignment, false, false ); Byte[] OriginalFile = System.IO.File.ReadAllBytes( args[1] ); LIN lin = new LIN( OriginalFile ); lin.CreateFile( Alignment ); return Compare( OriginalFile, System.IO.File.ReadAllBytes( args[1] + ".new" ), lin.UnalignedFilesize, args[1] + ".fail" ); } else if ( args[0] == "-dumptxt" ) { return DumpTxt( args[1], args[2] ); } return -1; }