Пример #1
0
        private void cb_xbb_SelectedIndexChanged(object sender, EventArgs e)
        {
            label2.Text = ppFile.getSelectedData(cb_xbb.SelectedIndex).Length + " byte";

            DynamicFileByteProvider dynamicFileByteProvider = null;

            try
            {
                dynamicFileByteProvider = new DynamicFileByteProvider(new MemoryStream(ppFile.getSelectedData(cb_xbb.SelectedIndex)));
            }
            catch
            {
            }

            hexBox1.ByteProvider = dynamicFileByteProvider;
        }
Пример #2
0
        private void RefreshLViewList(int indexselected = 0)
        {
            StringBuilder build = new StringBuilder();

            list_pp.Items.Clear();
            //1132

            for (int i = 0; i < papaFile.Count; i++)
            {
                uniConfigSOS2JP sp = new uniConfigSOS2JP(papaFile.getSelectedData(i));
                build.Append(sp.getDataStr()).Append(Environment.NewLine);
                list_pp.Items.Add(i);
            }
            textBox2.Text = build.ToString();
            Clipboard.SetText(build.ToString());
            list_pp.SelectedIndex = indexselected;
        }
Пример #3
0
        private void RefreshLViewList(int indexselected = 0)
        {
            StringBuilder build = new StringBuilder();

            list_pp.Items.Clear();
            //1132
            for (int i = 0; i < 1132; i++)
            {
                Format.gformat.ppItemData mtemp = new Format.gformat.ppItemData(papaFile.getSelectedData(i), getSeries(comboBox1.SelectedIndex));

                build.Append(mtemp.InfoVariableConfig).Append(",");
                build.Append(mtemp.TextVar).Append(",");
                build.Append(mtemp.ModelVar).Append(",");
                build.Append(mtemp.unkw[0]);

                list_pp.Items.Add(mtemp.InfoVariableConfig.Replace("INFO_", ""));
                build.Append(Environment.NewLine);
                Console.WriteLine(i);
            }
            Clipboard.SetText(build.ToString());
            list_pp.SelectedIndex = indexselected;
        }
Пример #4
0
        public uInformation()
        {
            InitializeComponent();
            label4.Text = label4.Text.Replace("<file>", Path.GetFileName(Program.AConfig.FilePath[0]));

            textBox1.Text = Program.AConfig.FilePath[0];
            label11.Text  = "";

            comboBox5.Items.Clear();

            for (int i = 0; i < Program.mainXBB.getCount(); i++)
            {
                comboBox5.Items.Add(Program.mainXBB.getFileName(i));
            }

            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 1;
            comboBox4.SelectedIndex = 2;
            comboBox5.SelectedIndex = 0;

            textBox13.TextAlign = HorizontalAlignment.Center;
            textBox14.TextAlign = HorizontalAlignment.Center;
            textBox15.TextAlign = HorizontalAlignment.Center;

            FileInfo fileinfo = new FileInfo(textBox1.Text);

            textBox2.Text = fileinfo.Name;
            textBox3.Text = fileinfo.Directory.ToString();
            textBox4.Text = fileinfo.Length + " byte";

            textBox5.Text = Program.mainXBB.getCount() + " file";

            comboBox1.SelectedIndex = 0;

            progressBar1.Value   = 0;
            progressBar1.Maximum = (int)Program.mainXBB.getCount();

            GameSeries indexcombo = Utils.getSeries(Program.mainf.cb_method.SelectedIndex);

            Thread nTh = new Thread(
                new ThreadStart(() =>
            {
                int counted      = 0;
                int countblank   = 0;
                int countmsgdata = 0;
                int countspace   = 0;
                int countnewline = 0;
                int countlineall = 0;

                for (int i = 0; i < Program.mainXBB.getCount(); i++)
                {
                    papa inputpapatemp = new papa(Program.mainXBB.getSelectedfile(i));

                    counted += (int)inputpapatemp.Count;
                    countblank++;

                    for (int j = 0; j < (inputpapatemp.Count - 1); j++)
                    {
                        msg4u msgtemp  = new msg4u(inputpapatemp.getSelectedData(j), indexcombo);
                        string strtemp = msgtemp.GetTextSection();

                        countlineall += strtemp.Length - strtemp.Replace(Environment.NewLine, string.Empty).Length;
                        countmsgdata += strtemp.Length;
                        countspace   += strtemp.Count(Char.IsWhiteSpace);
                        countnewline += strtemp.Count(Char.IsControl);
                    }

                    if (IsHandleCreated)
                    {
                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value += 1;
                        }));
                    }
                }

                this.BeginInvoke(new Action(() =>
                {
                    progressBar1.Value = 0;
                    textBox6.Text      = (counted - countblank) + " message, " + countblank + " blank";
                    textBox7.Text      = countmsgdata + " character";

                    textBox13.Text = (countmsgdata - countspace - countnewline) + "";
                    textBox14.Text = countspace + "";
                    textBox15.Text = countnewline + "";

                    //textBox8.Text = (countmsgdata - countspace - countnewline) + " character without "+countspace+" space and "+countnewline+" controls";
                    textBox9.Text = countlineall + "";
                }));

                GC.Collect(9, GCCollectionMode.Forced);
            }));

            nTh.Start();
        }
Пример #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            Ookii.Dialogs.VistaFolderBrowserDialog folderdialog = new Ookii.Dialogs.VistaFolderBrowserDialog();
            VistaSaveFileDialog folderdialog2 = new VistaSaveFileDialog();
            string filename = "";

            GameSeries indexcombo = Utils.getSeries(Program.mainf.cb_method.SelectedIndex);

            switch (comboBox1.SelectedIndex)
            {
            case 6:
                folderdialog.SelectedPath = Program.AConfig.FilePath[0];

                if (folderdialog.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;
                    string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainXBB.getCount();

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainXBB.getCount(); i++)
                        {
                            filename     = Program.mainXBB.getFileName(i).Replace("\0", "");
                            papa tempapa = new papa(Program.mainXBB.getSelectedfile(i));

                            StringBuilder buildstr = new StringBuilder();

                            for (int j = 0; j < tempapa.Count - 1; j++)
                            {
                                msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo);

                                buildstr.AppendLine("============================================");
                                buildstr.AppendLine(newMsg.GetVariableSection()).Append("\n");
                                buildstr.AppendLine("--------------------------------------------");
                                buildstr.AppendLine(newMsg.GetTextSection()).Append("\n");
                            }

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                label11.Text = "Progress : " + (i + 1) + " of " + Program.mainXBB.getCount();
                            }));

                            File.WriteAllText(pathe + @"\" + filename + ".txt", buildstr.ToString(), Encoding.UTF8);
                        }

                        label11.BeginInvoke(new Action(() =>
                        {
                            label11.Text = "";
                        }));

                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value = 0;
                        }));
                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));
                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();
                }
                break;

            case 0:
                folderdialog.SelectedPath = Program.AConfig.FilePath[0];

                if (folderdialog.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;

                    string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainXBB.getCount();

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainXBB.getCount(); i++)
                        {
                            File.WriteAllBytes(pathe + Program.mainXBB.getFileName(i).Replace("\0", "") + ".pp", Program.mainXBB.getSelectedfile(i));

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Text = "Progress : " + i + " of " + Program.mainXBB.getCount();
                            }));
                        }

                        label11.BeginInvoke(new Action(() =>
                        {
                            label11.Text = "";
                        }));

                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value = 0;
                        }));
                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));
                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();
                }
                break;

            case 1:
                folderdialog.SelectedPath = Program.AConfig.FilePath[0];

                if (folderdialog.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;
                    string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainXBB.getCount();

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainXBB.getCount(); i++)
                        {
                            filename     = Program.mainXBB.getFileName(i).Replace("\0", "");
                            papa tempapa = new papa(Program.mainXBB.getSelectedfile(i));

                            ppmsg4 newtempjson  = new ppmsg4();
                            newtempjson.Date    = DateTime.Now;
                            newtempjson.Author  = "BokujoMessage4 JSON generated files";
                            newtempjson.Content = new pmsg4[tempapa.Count - 1];

                            for (int j = 0; j < tempapa.Count - 1; j++)
                            {
                                msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo);

                                newtempjson.Content[j].VardId = newMsg.GetVariableSection();
                                newtempjson.Content[j].Text   = newMsg.GetTextSection();
                            }

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                label11.Text = "Progress : " + i + " of " + Program.mainXBB.getCount();
                            }));

                            File.WriteAllText(pathe + @"\" + filename + ".json", JsonConvert.SerializeObject(newtempjson, Formatting.Indented), Encoding.UTF8);
                        }

                        label11.BeginInvoke(new Action(() =>
                        {
                            label11.Text = "";
                        }));

                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value = 0;
                        }));
                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));
                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();
                }
                break;

            case 2:
                filename = Program.mainf.cb_xbb.Text;
                folderdialog.SelectedPath = Program.AConfig.FilePath[0];

                if (folderdialog.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;
                    string pathe = folderdialog.SelectedPath + @"\" + filename + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainPP.Count;

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainPP.Count - 1; i++)
                        {
                            msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo);

                            File.WriteAllText(pathe + newMsg.GetVariableSection() + ".txt", newMsg.GetTextSection(), Encoding.UTF8);

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                label11.Text = "Progress : " + i + " of " + Program.mainPP.Count;
                            }));
                        }

                        label11.BeginInvoke(new Action(() =>
                        {
                            label11.Text = "";
                        }));

                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value = 0;
                        }));
                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));
                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();
                }
                break;

            case 3:
                filename     = Program.mainf.cb_xbb.Text;
                folderdialog = new Ookii.Dialogs.VistaFolderBrowserDialog();
                folderdialog.SelectedPath = Program.AConfig.FilePath[0];

                if (folderdialog.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;
                    string pathe = folderdialog.SelectedPath + @"\" + filename + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainPP.Count;

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainPP.Count - 1; i++)
                        {
                            msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo);

                            File.WriteAllBytes(pathe + newMsg.GetVariableSection() + ".msg4", newMsg.GetMSGData());

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                label11.Text = "Progress : " + i + " of " + Program.mainPP.Count;
                            }));
                        }

                        label11.BeginInvoke(new Action(() =>
                        {
                            label11.Text = "";
                        }));

                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value = 0;
                        }));
                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));
                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();
                }
                break;

            case 5:
                folderdialog.SelectedPath = Program.AConfig.FilePath[0];

                if (folderdialog.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;
                    string pathe = folderdialog.SelectedPath + @"\" + Path.GetFileName(Program.AConfig.FilePath[0]).Replace(Path.GetExtension(Program.AConfig.FilePath[0]), "") + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainXBB.getCount();

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainXBB.getCount(); i++)
                        {
                            filename     = Program.mainXBB.getFileName(i).Replace("\0", "");
                            papa tempapa = new papa(Program.mainXBB.getSelectedfile(i));

                            FileInfo newFile = new FileInfo(pathe + @"\" + filename + ".xlsx");
                            ExcelPackage pck = new ExcelPackage(newFile);

                            if (File.Exists(newFile.FullName))
                            {
                                File.Delete(newFile.FullName);
                            }

                            var ws = pck.Workbook.Worksheets.Add(filename);

                            for (int j = 0; j < tempapa.Count - 1; j++)
                            {
                                msg4u newMsg = new msg4u(tempapa.getSelectedData(j), indexcombo);

                                ws.Cells["A" + (j + 1)].Value = newMsg.GetVariableSection();
                                ws.Cells["B" + (j + 1)].Value = newMsg.GetTextSection();
                            }

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                label11.Text = "Progress : " + (i + 1) + " of " + Program.mainXBB.getCount();
                            }));

                            pck.Save();
                        }

                        label11.BeginInvoke(new Action(() =>
                        {
                            label11.Text = "";
                        }));

                        progressBar1.BeginInvoke(new Action(() =>
                        {
                            progressBar1.Value = 0;
                        }));
                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));
                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();
                }
                break;

            case 4:
                filename = Program.mainf.cb_xbb.Text;
                folderdialog2.FileName         = filename + ".json";
                folderdialog2.Filter           = "JSON files (*.json) | *.json";
                folderdialog2.InitialDirectory = Program.AConfig.FilePath[0];

                if (folderdialog2.ShowDialog() == DialogResult.OK)
                {
                    uxTabControl1.Enabled = false;
                    string pathe = Path.GetDirectoryName(folderdialog2.InitialDirectory) + @"\";

                    if (!Directory.Exists(pathe))
                    {
                        Directory.CreateDirectory(pathe);
                    }

                    ppmsg4 newtempjson = new ppmsg4();
                    newtempjson.Date    = DateTime.Now;
                    newtempjson.Author  = "BokujoMessage4 JSON generated files";
                    newtempjson.Content = new pmsg4[Program.mainPP.Count - 1];

                    progressBar1.Value   = 0;
                    progressBar1.Maximum = (int)Program.mainPP.Count;

                    Thread nTh = new Thread(
                        new ThreadStart(() =>
                    {
                        for (int i = 0; i < Program.mainPP.Count - 1; i++)
                        {
                            msg4u newMsg = new msg4u(Program.mainPP.getSelectedData(i), indexcombo);

                            newtempjson.Content[i].VardId = newMsg.GetVariableSection();
                            newtempjson.Content[i].Text   = newMsg.GetTextSection();

                            progressBar1.BeginInvoke(new Action(() =>
                            {
                                progressBar1.Value += 1;
                            }));

                            label11.BeginInvoke(new Action(() =>
                            {
                                label11.Text = "Progress : " + i + " of " + Program.mainPP.Count;
                            }));
                        }

                        uxTabControl1.BeginInvoke(new Action(() =>
                        {
                            uxTabControl1.Enabled = true;
                        }));


                        GC.Collect(9, GCCollectionMode.Forced);
                    }));

                    nTh.Start();

                    File.WriteAllText(folderdialog2.FileName, JsonConvert.SerializeObject(newtempjson, Formatting.Indented), Encoding.UTF8);
                }

                break;
            }
        }