Exemple #1
0
        private static void Dump(string inFile, string outFile, bool eventOnly = false, bool raw = false)
        {
            List <dialog> dlist;

            if (eventOnly)
            {
                dlist = ASBTools.getDialogList(inFile, true, true);
            }
            else
            {
                if (raw)
                {
                    dlist = ASBTools.getDialogListRAW(inFile, true);
                }
                else
                {
                    dlist = ASBTools.getDialogList(inFile, true);
                }
            }
            using (BinaryWriter writer = new BinaryWriter(File.Open(outFile, FileMode.Create)))
            {
                foreach (dialog dl in dlist)
                {
                    writer.Write(Encoding.UTF8.GetBytes(dl.offset.ToString()));
                    writer.Write(Encoding.UTF8.GetBytes(";"));
                    writer.Write(Encoding.UTF8.GetBytes(dl.size.ToString()));
                    writer.Write(Encoding.UTF8.GetBytes(";"));
                    writer.Write(Encoding.UTF8.GetBytes(dl.text));
                    writer.Write(Encoding.UTF8.GetBytes(Environment.NewLine));
                }
            }
        }
Exemple #2
0
        private static void FolderDump(string asbFolder, string outFolder, bool eventOnly = false, bool raw = false)
        {
            string[] asbFiles = Directory.GetFiles(asbFolder);
            int      total    = asbFiles.Count();
            int      current  = 1;

            Parallel.ForEach(asbFiles, asbfileName =>
            {
                try
                {
                    List <dialog> dlist;
                    if (eventOnly)
                    {
                        dlist = ASBTools.getDialogList(asbfileName, true, true);
                    }
                    else
                    {
                        if (raw)
                        {
                            dlist = ASBTools.getDialogListRAW(asbfileName, true);
                        }
                        else
                        {
                            dlist = ASBTools.getDialogList(asbfileName, true);
                        }
                    }
                    string outfile = outFolder + "\\" + Path.GetFileNameWithoutExtension(asbfileName) + ".txt";
                    using (BinaryWriter writer = new BinaryWriter(File.Open(outfile, FileMode.Create)))
                    {
                        foreach (dialog dl in dlist)
                        {
                            writer.Write(Encoding.UTF8.GetBytes(dl.offset.ToString()));
                            writer.Write(Encoding.UTF8.GetBytes(";"));
                            writer.Write(Encoding.UTF8.GetBytes(dl.size.ToString()));
                            writer.Write(Encoding.UTF8.GetBytes(";"));
                            writer.Write(Encoding.UTF8.GetBytes(dl.text));
                            writer.Write(Encoding.UTF8.GetBytes(Environment.NewLine));
                        }
                    }
                }
                finally
                {
                    Interlocked.Increment(ref current);
                    lock (fLock)
                    {
                        Console.SetCursorPosition(0, 0);
                        Console.CursorTop       = 0;
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("FILE: {0}\r", asbfileName);
                        DrawProgressBar(current, total, 36, '■');
                    }
                }
            });
        }
        private void loadDialog()
        {
            // Create an instance of the open file dialog box.
            var openFileDialog1 = new OpenFileDialog();

            // Set filter options and filter index.
            openFileDialog1.Filter      = "AKB 1/48 Guam ASB File (.asb)|*.asb";
            openFileDialog1.FilterIndex = 1;

            // Process input if the user clicked OK.
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                currentFile = openFileDialog1.FileName;
                var dlist = ASBTools.getDialogList(openFileDialog1.FileName, true, checkBox1.Checked);
                dataGridView1.ReadOnly   = true;
                dataGridView1.DataSource = dlist;
                dataGridView1.AutoResizeColumns();
            }
        }