Example #1
0
        public static int Execute( List<string> args )
        {
            if ( args.Count != 2 ) {
                Console.WriteLine( "Usage: GN_DRM Outfile DB" );
                return -1;
            }

            // templateDB must contain:
            /***
             * CREATE TABLE Text(ID int primary key, StringID int, english text, comment text, updated tinyint, status tinyint, PointerRef integer, IdentifyString text, IdentifyPointerRef integer);
             ***/

            //*
            String Filename = args[0];
            String DB = args[1];
            //String GracesDB = args[2];
            //*/

            /*
            String Filename = @"c:\Users\Georg\Downloads\Xillia Script files\69753.SDBJPN";
            String NewDB = @"c:\Users\Georg\Downloads\Xillia Script files\X69753";
            String TemplateDB = @"c:\Users\Georg\Downloads\Xillia Script files\XTemplate";
            String GracesDB = @"c:\Users\Georg\Downloads\Xillia Script files\GracesJapanese";
            //*/

            PakText DRMF;
            try {
                DRMF = new PakText();
                DRMF.GetSQL( "Data Source=" + DB );
            } catch ( Exception ex ) {
                Console.WriteLine( ex.Message );
                Console.WriteLine( "Failed loading menu file!" );
                return -1;
            }
            byte[] newfile = DRMF.CreateFile();
            System.IO.File.WriteAllBytes( Filename, newfile );

            //System.IO.File.WriteAllBytes(@"C:\TROPHY\newTrophyConf.trp", Encoding.UTF8.GetBytes(TROPSFM.ExportTropSFM(true)));
            //System.IO.File.WriteAllBytes(@"C:\TROPHY\newTrophy.trp", Encoding.UTF8.GetBytes(TROPSFM.ExportTropSFM(false)));

            return 0;
        }
Example #2
0
        public static int Execute( List<string> args )
        {
            if ( args.Count != 3 ) {
                Console.WriteLine( "Usage: menu.pak NewDBFile GracesJapanese" );
                return -1;
            }

            String Filename = args[0];
            String NewDB = args[1];
            String GracesDB = args[2];

            PakText DRMF;
            try {
                DRMF = new PakText( Filename );
            } catch ( Exception ex ) {
                Console.WriteLine( ex.Message );
                Console.WriteLine( "Failed loading menu file!" );
                return -1;
            }
            Console.WriteLine( "Found " + DRMF.TextList.Count + " entries, importing..." );
            System.IO.File.WriteAllBytes( NewDB, Properties.Resources.gndb_template );

            List<GraceNoteDatabaseEntry> Entries = new List<GraceNoteDatabaseEntry>( DRMF.TextList.Count );
            foreach ( PakTextEntry entry in DRMF.TextList ) {
                GraceNoteDatabaseEntry gn = new GraceNoteDatabaseEntry( entry.Text, entry.Text, "", 0, entry.OffsetLocation, "", 0 );
                Entries.Add( gn );
            }
            GraceNoteDatabaseEntry.InsertSQL( Entries.ToArray(), "Data Source=" + NewDB, "Data Source=" + GracesDB );

            Console.WriteLine( "Successfully imported entries!" );

            //byte[] newfile = DRMF.CreateFile();
            //System.IO.File.WriteAllBytes(Filename + ".new", newfile);

            return 0;
        }