예제 #1
0
        private static ScenarioString[] FindAllStrings(byte[] File, int StartLocation, int PointerDifference)
        {
            List <ScenarioString> AllStrings = new List <ScenarioString>();

            int Pointer = StartLocation;

            while (true)
            {
                try {
                    int Pointer1 = BitConverter.ToInt32(new byte[] {
                        File[Pointer + 3], File[Pointer + 2], File[Pointer + 1], File[Pointer]
                    }, 0);
                    int Pointer2 = BitConverter.ToInt32(new byte[] {
                        File[Pointer + 7], File[Pointer + 6], File[Pointer + 5], File[Pointer + 4]
                    }, 0);
                    int Pointer3 = BitConverter.ToInt32(new byte[] {
                        File[Pointer + 11], File[Pointer + 10], File[Pointer + 9], File[Pointer + 8]
                    }, 0);
                    int Pointer4 = BitConverter.ToInt32(new byte[] {
                        File[Pointer + 15], File[Pointer + 14], File[Pointer + 13], File[Pointer + 12]
                    }, 0);

                    if (Pointer1 == 0 || Pointer2 == 0 || Pointer3 == 0 || Pointer4 == 0 ||
                        (Pointer1 + PointerDifference) > File.Length ||
                        (Pointer2 + PointerDifference) > File.Length ||
                        (Pointer3 + PointerDifference) > File.Length ||
                        (Pointer4 + PointerDifference) > File.Length
                        )
                    {
                        break;
                    }

                    ScenarioString Name = new ScenarioString(Pointer, Util.GetTextShiftJis(File, Pointer1 + PointerDifference), Util.GetTextShiftJis(File, Pointer3 + PointerDifference));
                    ScenarioString Text = new ScenarioString(Pointer + 4, Util.GetTextShiftJis(File, Pointer2 + PointerDifference), Util.GetTextShiftJis(File, Pointer4 + PointerDifference));

                    AllStrings.Add(Name);
                    AllStrings.Add(Text);

                    Pointer += 0x18;
                } catch (Exception) {
                    break;
                }
            }


            return(AllStrings.ToArray());
        }
예제 #2
0
        private static ScenarioString[] FindAllStrings( byte[] File, int StartLocation, int PointerDifference )
        {
            List<ScenarioString> AllStrings = new List<ScenarioString>();

            int Pointer = StartLocation;

            while ( true ) {
                try {
                    int Pointer1 = BitConverter.ToInt32( new byte[] {
                        File[Pointer+3], File[Pointer+2], File[Pointer+1], File[Pointer]
                    }, 0 );
                    int Pointer2 = BitConverter.ToInt32( new byte[] {
                        File[Pointer+7], File[Pointer+6], File[Pointer+5], File[Pointer+4]
                    }, 0 );
                    int Pointer3 = BitConverter.ToInt32( new byte[] {
                        File[Pointer+11], File[Pointer+10], File[Pointer+9], File[Pointer+8]
                    }, 0 );
                    int Pointer4 = BitConverter.ToInt32( new byte[] {
                        File[Pointer+15], File[Pointer+14], File[Pointer+13], File[Pointer+12]
                    }, 0 );

                    if ( Pointer1 == 0 || Pointer2 == 0 || Pointer3 == 0 || Pointer4 == 0
                        || ( Pointer1 + PointerDifference ) > File.Length
                        || ( Pointer2 + PointerDifference ) > File.Length
                        || ( Pointer3 + PointerDifference ) > File.Length
                        || ( Pointer4 + PointerDifference ) > File.Length
                       ) {
                        break;
                    }

                    ScenarioString Name = new ScenarioString( Pointer, Util.GetTextShiftJis( File, Pointer1 + PointerDifference ), Util.GetTextShiftJis( File, Pointer3 + PointerDifference ) );
                    ScenarioString Text = new ScenarioString( Pointer + 4, Util.GetTextShiftJis( File, Pointer2 + PointerDifference ), Util.GetTextShiftJis( File, Pointer4 + PointerDifference ) );

                    AllStrings.Add( Name );
                    AllStrings.Add( Text );

                    Pointer += 0x18;
                } catch ( Exception ) {
                    break;
                }
            }

            return AllStrings.ToArray();
        }
예제 #3
0
        public static ScenarioString[] GetSQL( String ConnectionString, String GracesJapaneseConnectionString )
        {
            List<ScenarioString> ScenarioFiles = new List<ScenarioString>();

            SQLiteConnection Connection = new SQLiteConnection( ConnectionString );
            Connection.Open();

            using ( SQLiteTransaction Transaction = Connection.BeginTransaction() )
            using ( SQLiteCommand Command = new SQLiteCommand( Connection ) ) {
                Command.CommandText = "SELECT english, ID, StringID FROM Text WHERE status != -1 AND IdentifyString != '(x360)' ORDER BY ID";
                SQLiteDataReader r = Command.ExecuteReader();
                while ( r.Read() ) {
                    String SQLText;

                    try {
                        SQLText = r.GetString( 0 ).Replace( "''", "'" );
                    } catch ( System.InvalidCastException ) {
                        SQLText = null;
                    }

                    int PointerRef = r.GetInt32( 1 );
                    int StringID = r.GetInt32( 2 );

                    String JapaneseString = GetJapanese( GracesJapaneseConnectionString, StringID );
                    String EnglishString;
                    if ( !String.IsNullOrEmpty( SQLText ) ) {
                        EnglishString = SQLText;
                    } else {
                        EnglishString = JapaneseString;
                    }

                    ScenarioString sc = new ScenarioString( PointerRef, JapaneseString, EnglishString );
                    ScenarioFiles.Add( sc );
                }

                Transaction.Rollback();
            }
            return ScenarioFiles.ToArray();
        }