private void button1_Click(object sender, EventArgs e)
        {
            if (
                MessageBox.Show("Are you sure you want to overwrite:\n'" + currentFile + "'?", "WARNING!!",
                                MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                var dlist = new List <dialog>();
                foreach (DataGridViewRow dr in dataGridView1.Rows)
                {
                    var item = new dialog();
                    item.offset = (long)dr.Cells["offset"].Value;
                    item.size   = (int)dr.Cells["size"].Value;
                    item.text   = dr.Cells["text"].Value.ToString();
                    item.text   = item.text.Replace("<LINEEND>", Encoding.UTF8.GetString(new byte[] { 0x0A }));
                    item.text   = item.text.Replace("<END>", Encoding.UTF8.GetString(new byte[] { 0x00 }));
                    dlist.Add(item);
                }

                if (!ASBTools.injectDialogList(currentFile, dlist))
                {
                    MessageBox.Show("An error occurred while inserting!", "ERROR", MessageBoxButtons.OK);
                }
            }
            MessageBox.Show("Done.", "Done.", MessageBoxButtons.OK);
        }
Exemple #2
0
        private static void Insert(string cmdFile, string inFile)
        {
            List <dialog> dList = new List <dialog>();

            using (StreamReader file = new StreamReader(cmdFile))
            {
                while (!file.EndOfStream)
                {
                    dialog d1 = new dialog();

                    string   s     = file.ReadLine();
                    string[] split = s.Split(';');
                    d1.offset = Convert.ToInt64(split[0]);
                    d1.size   = Convert.ToInt32(split[1]);
                    d1.text   = split[2];
                    d1.text   = d1.text.Replace("<LINEEND>", Encoding.UTF8.GetString(new byte[] { 0x0A }));
                    d1.text   = d1.text.Replace("<END>", Encoding.UTF8.GetString(new byte[] { 0x00 }));
                    dList.Add(d1);
                }
            }
            Console.WriteLine("Writing to {0}", inFile);
            if (!ASBTools.injectDialogList(inFile, dList))
            {
                Console.WriteLine("ERROR!!!!!! - Inject failed...\n");
            }
        }
Exemple #3
0
        private static void FolderInsert(string cmdFolder, string asbFolder)
        {
            string[] cmdFiles = Directory.GetFiles(cmdFolder);
            int      total    = cmdFiles.Count();
            int      current  = 0;

            Parallel.ForEach(cmdFiles, cmdfileName =>
            {
                try
                {
                    List <dialog> dList = new List <dialog>();
                    using (StreamReader file = new StreamReader(cmdfileName))
                    {
                        while (!file.EndOfStream)
                        {
                            dialog d1 = new dialog();

                            string s       = file.ReadLine();
                            string[] split = s.Split(';');
                            d1.offset      = Convert.ToInt64(split[0]);
                            d1.size        = Convert.ToInt32(split[1]);
                            d1.text        = split[2];
                            d1.text        = d1.text.Replace("<LINEEND>", Encoding.UTF8.GetString(new byte[] { 0x0A }));
                            d1.text        = d1.text.Replace("<END>", Encoding.UTF8.GetString(new byte[] { 0x00 }));
                            dList.Add(d1);
                        }
                    }
                    string outfile = asbFolder + "\\" + Path.GetFileNameWithoutExtension(cmdfileName) + ".asb";
                    Console.WriteLine("Writing to {0}", outfile);

                    if (!ASBTools.injectDialogList(outfile, dList))
                    {
                        Console.WriteLine("ERROR!!!!!! - Inject failed...\n");
                    }
                }
                finally
                {
                    Interlocked.Increment(ref current);
                    Console.SetCursorPosition(0, 0);
                    Console.CursorTop       = 0;
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.Write("FILE: {0}\r", cmdfileName);
                    DrawProgressBar(current, total, 36, '■');
                }
            });
        }