Exemplo n.º 1
0
        private bool OpenFile()
        {
            OpenFileDialog FileDialog = new OpenFileDialog();

            FileDialog.DefaultExt = ".so";
            FileDialog.Filter     = "TSS files|*.*";
            FileDialog.FileName   = "STRING_DIC.SO";
            if (FileDialog.ShowDialog() != DialogResult.OK)
            {
                return(false);
            }

            byte[] MaybeTSSFile;
            try
            {
                MaybeTSSFile           = System.IO.File.ReadAllBytes(FileDialog.FileName);
                TSS                    = new TSSFile(MaybeTSSFile);
                numericUpDown1.Maximum = TSS.Entries.Length - 1;
                CurrentFilename        = FileDialog.FileName;
                return(true);
            }
            catch (Exception e)
            {
                Util.DisplayException(e);
                return(false);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            int     argc = args.Length;
            TSSFile TSS;

            switch (argc)
            {
            case 4:
                TSS = new TSSFile(System.IO.File.ReadAllBytes(args[0]));
                TSS.ImportText(System.IO.File.ReadAllBytes(args[1]));
                if (args[3] == "-erase")
                {
                    foreach (TSSEntry e in TSS.Entries)
                    {
                        if (e.StringENG != null)
                        {
                            e.StringENG = "";
                        }
                    }
                }
                System.IO.File.WriteAllBytes(args[2], TSS.Serialize());
                break;

            case 3:
                TSS = new TSSFile(System.IO.File.ReadAllBytes(args[0]));
                TSS.ImportText(System.IO.File.ReadAllBytes(args[1]));
                System.IO.File.WriteAllBytes(args[2], TSS.Serialize());
                break;

            default:
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
                break;
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            bool UseInsaneNames = false;

            if (args.Length == 1)
            {
                if (args[0] == "-insane")
                {
                    Console.WriteLine("Wesker-Dumbledore Mode Activated!");
                    UseInsaneNames = true;
                }
            }


            Console.WriteLine("Opening STRING_DIC.SO...");
            TSSFile TSS;

            try
            {
                TSS = new TSSFile(System.IO.File.ReadAllBytes("STRING_DIC.SO"));
            }
            catch (System.IO.FileNotFoundException)
            {
                Console.WriteLine("Could not open STRING_DIC.SO, exiting.");
                return;
            }


            if (args.Length == 1)
            {
                if (args[0] == "-engorigdmp")
                {
                    Console.WriteLine("Exporting original text (english)...");
                    System.IO.File.WriteAllBytes("STRING_DIC_original_eng_export.txt", TSS.ExportTextForEnglishDump());
                }
                else if (args[0] == "-origdmp")
                {
                    Console.WriteLine("Exporting original text (all)...");
                    System.IO.File.WriteAllBytes("STRING_DIC_original_export.txt", TSS.ExportText());
                }
            }


            Console.WriteLine("Importing databases...");
            if (!TSS.ImportSQL())
            {
                Console.WriteLine("Could not import all databases! Exiting...");
                return;
            }


            // Empty unused strings, alter names if wanted
            foreach (TSSEntry e in TSS.Entries)
            {
                if (e.StringENG != null)
                {
                    e.StringENG = "";
                }

                if (UseInsaneNames)
                {
                    e.StringJPN = Util.ReplaceWithInsaneNames(e.StringJPN);
                }
            }


            Console.WriteLine("Writing translated file...");
            System.IO.File.WriteAllBytes("STRING_DIC_translated.SO", TSS.Serialize());


            Console.WriteLine("Writing text dump...");
            System.IO.File.WriteAllBytes("STRING_DIC_translated_export.txt", TSS.ExportText());


            Console.WriteLine("Done!");
            return;
        }