コード例 #1
0
ファイル: AddString.cs プロジェクト: cnbatch/TS4-STBL-Editor
        private void copyStrFldsValues_Click(object sender, EventArgs e)
        {
            StringHolder sh = new StringHolder();

            sh.textIDFld      = textIDFld.Text;
            sh.displayTextFld = displayTextFld.Text;

            MainUI.copiedValuesStrHolders.Add(sh);
        }
コード例 #2
0
 private void reloadListView()
 {
     listView1.Items.Clear();
     listView1.View = View.List;
     for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++)
     {
         StringHolder sh = MainUI.copiedValuesStrHolders[x];
         listView1.Items.Add(sh.textIDFld + " - " + sh.displayTextFld);
     }
 }
コード例 #3
0
ファイル: AddString.cs プロジェクト: cnbatch/TS4-STBL-Editor
        public void setFldsValues(StringHolder sh)
        {
            stopOnChangeEvent = true;

            displayTextFld.Text = sh.displayTextFld;

            stopOnChangeEvent = false;

            textIDFld.Text = sh.textIDFld.Replace("0x", "");
        }
コード例 #4
0
ファイル: Editor.cs プロジェクト: Amilman1/TS4-STBL-Editor
        private void copyThisRowToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var          cell = contextMenuStrip1.Tag as DataGridViewCell;
            var          row  = cell.OwningRow;
            StringHolder sh   = new StringHolder();

            sh.textIDFld      = row.Cells[0].Value.ToString();
            sh.displayTextFld = row.Cells[1].Value.ToString();

            MainUI.copiedValuesStrHolders.Add(sh);
        }
コード例 #5
0
ファイル: Editor.cs プロジェクト: Amilman1/TS4-STBL-Editor
        private void CopySelectedRows()
        {
            for (int x = 0; x < dataGridView1.SelectedRows.Count; x++)
            {
                StringHolder sh = new StringHolder();
                sh.textIDFld      = dataGridView1.SelectedRows[x].Cells[0].Value.ToString();
                sh.displayTextFld = dataGridView1.SelectedRows[x].Cells[1].Value.ToString();

                MainUI.copiedValuesStrHolders.Add(sh);
            }

            MessageBox.Show(dataGridView1.SelectedRows.Count + " rows copied!");
        }
コード例 #6
0
ファイル: Editor.cs プロジェクト: Amilman1/TS4-STBL-Editor
        private void Paste_ALL_copied_values_Click(object sender, EventArgs e)
        {
            for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++)
            {
                StringHolder sh = MainUI.copiedValuesStrHolders[x];

                DataTable dt = (DataTable)dataGridView1.DataSource;
                DataRow   dr;
                dr    = dt.NewRow();
                dr[0] = sh.textIDFld;
                dr[2] = sh.displayTextFld;
                dt.Rows.Add(dr);
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString();
            }
        }
コード例 #7
0
ファイル: Editor.cs プロジェクト: Amilman1/TS4-STBL-Editor
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                MessageBox.Show("Value " +
                                dataGridView1.SelectedRows[0].Cells[0].Value.ToString() +
                                " - " + dataGridView1.SelectedRows[0].Cells[1].Value.ToString() +
                                " copied!");

                StringHolder sh = new StringHolder();
                sh.textIDFld      = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                sh.displayTextFld = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();

                MainUI.copiedValuesStrHolders.Add(sh);
            }
        }
コード例 #8
0
ファイル: MainUI.cs プロジェクト: Amilman1/TS4-STBL-Editor
        private void packageFilesMassInsertOfCopiedValuesToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (pathOpened)
            {
                saveSTBL();
                closeSTBL();
                SavePackage();
                closePackage();
            }

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            switch (Thread.CurrentThread.CurrentUICulture.ThreeLetterWindowsLanguageName)
            {
            case "CHS":
            case "ZHI":
                openFileDialog1.Filter      = "STBL文件 (*.package)|*.package|所有文件 (*.*)|*.*";
                openFileDialog1.FilterIndex = 1;
                openFileDialog1.Title       = "选择STBL文件";
                break;

            case "CHT":
            case "ZHH":
            case "ZHM":
                openFileDialog1.Filter      = "STBL檔案 (*.package)|*.package|所有檔案 (*.*)|*.*";
                openFileDialog1.FilterIndex = 1;
                openFileDialog1.Title       = "選取STBL檔案";
                break;

            default:
                openFileDialog1.Filter      = "STBL Files (*.package)|*.package|All Files (*.*)|*.*";
                openFileDialog1.FilterIndex = 1;
                openFileDialog1.Title       = "Choose .package File";
                break;
            }

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                openPackageFile(openFileDialog1.FileName);

                var f = selectSTBLfileinPackage(true);

                openedFromSTBL_File = false;
                foreach (string idStr in f.selectedSTBLObjects)
                {
                    packageElId = BigInteger.Parse(idStr.Replace("0x", ""), NumberStyles.AllowHexSpecifier);

                    var el = lrie.Find(x =>
                    {
                        return(x.Instance == packageElId);
                    });

                    res = WrapperDealer.GetResource(0, imppkg, el, true);
                    ArrayList tempList = ReadAndAnalyzeStream(res.Stream);
                    STBLToDataGridView(tempList);

                    for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++)
                    {
                        StringHolder copiedStrElement = MainUI.copiedValuesStrHolders[x];

                        DataTable dt = (DataTable)dataGridView1.DataSource;

                        var drArr = (from rowEl in dt.AsEnumerable()
                                     where rowEl.Field <string>(0) == copiedStrElement.textIDFld
                                     select rowEl);

                        if (drArr.Count() == 0)
                        {
                            DataRow dr = dt.NewRow();
                            dr[0] = copiedStrElement.textIDFld;
                            dr[1] = copiedStrElement.displayTextFld;
                            dt.Rows.Add(dr);
                            dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString();
                        }
                        else
                        {
                            DataRow dr = drArr.First();
                            dr[1] = copiedStrElement.displayTextFld;
                        }
                    }

                    dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.RowCount - 1;

                    canAlsoSave   = true;
                    isTextChanged = true;
                    pathOpened    = true;
                    saveSTBL();
                    closeSTBL();
                }
                SavePackage();
                closePackage();
                MessageBox.Show("Done!");
            }
            else
            {
                switch (Thread.CurrentThread.CurrentUICulture.ThreeLetterWindowsLanguageName)
                {
                case "CHS":
                case "ZHI":
                    filenameLabel.Text = "未打开任何文件。";
                    break;

                case "CHT":
                case "ZHH":
                case "ZHM":
                    filenameLabel.Text = "未開啟任何檔案。";
                    break;

                default:
                    filenameLabel.Text = "No file is opened.";
                    break;
                }
                pathOpened = false;
            }
        }
コード例 #9
0
ファイル: MainUI.cs プロジェクト: Amilman1/TS4-STBL-Editor
        private void sTBLFilesMassInsertOfCopiedValuesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (pathOpened)
            {
                saveSTBL();
                closeSTBL();
                SavePackage();
                closePackage();
            }

            if (MainUI.copiedValuesStrHolders.Count > 0)
            {
                isTextChanged = false;
                //closeAndSavePackage(false, false);

                OpenFileDialog openFileDialog1 = new OpenFileDialog();

                openFileDialog1.Multiselect = true;

                switch (Thread.CurrentThread.CurrentUICulture.ThreeLetterWindowsLanguageName)
                {
                case "CHS":
                case "ZHI":
                    openFileDialog1.Filter      = "STBL文件 (*.stbl)|*.stbl|所有文件 (*.*)|*.*";
                    openFileDialog1.FilterIndex = 1;
                    openFileDialog1.Title       = "选择STBL文件";
                    break;

                case "CHT":
                case "ZHH":
                case "ZHM":
                    openFileDialog1.Filter      = "STBL檔案 (*.stbl)|*.stbl|所有檔案 (*.*)|*.*";
                    openFileDialog1.FilterIndex = 1;
                    openFileDialog1.Title       = "選取STBL檔案";
                    break;

                default:
                    openFileDialog1.Filter      = "STBL Files (*.stbl)|*.stbl|All Files (*.*)|*.*";
                    openFileDialog1.FilterIndex = 1;
                    openFileDialog1.Title       = "Choose STBL File";
                    break;
                }

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string fileName in openFileDialog1.FileNames)
                    {
                        openSTBLfile(fileName);

                        isTextChanged = true;

                        for (int x = 0; x < MainUI.copiedValuesStrHolders.Count; x++)
                        {
                            StringHolder copiedStrElement = MainUI.copiedValuesStrHolders[x];

                            DataTable dt = (DataTable)dataGridView1.DataSource;

                            var drArr = (from rowEl in dt.AsEnumerable()
                                         where rowEl.Field <string>(0) == copiedStrElement.textIDFld
                                         select rowEl);

                            if (drArr.Count() == 0)
                            {
                                DataRow dr = dt.NewRow();
                                dr[0] = copiedStrElement.textIDFld;
                                dr[1] = copiedStrElement.displayTextFld;
                                dt.Rows.Add(dr);
                                dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = (dataGridView1.Rows.Count).ToString();
                            }
                            else
                            {
                                DataRow dr = drArr.First();
                                dr[1] = copiedStrElement.displayTextFld;
                            }
                        }

                        saveSTBL();
                        closeSTBL();
                    }
                    SavePackage();
                    closePackage();
                    isTextChanged = false;
                }
                MessageBox.Show("Done!");
            }
            else
            {
                switch (Thread.CurrentThread.CurrentUICulture.ThreeLetterWindowsLanguageName)
                {
                case "CHS":
                case "ZHI":
                    MessageBox.Show("您未复制任何字串。\r\n请先复制字串,然后再使用该选项向STBL文件大量插入已复制的字串!");
                    break;

                case "CHT":
                case "ZHH":
                case "ZHM":
                    MessageBox.Show("您未複製任何字串。\r\n請先複製字串,然後再使用該選項向STBL文件大量插入已複製的字串!");
                    break;

                default:
                    MessageBox.Show("You have not copied any string. \r\nCopy strings and use this option for mass insert of copied strings into STBL files!");
                    break;
                }
            }
        }