Esempio n. 1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var lstModInfos = _gridUiHelper.ParseAllTables();

            bool success;

            try
            {
                // start the process
                WaitingForm.ShowForm(this);

                success = TranslationManager.SaveGridData(_configHelper.GetLastPathOfDataFiles(), lstModInfos);

                WaitingForm.CloseForm();
            }
            catch (Exception exception)
            {
                Logger.Log(exception.Message);
                throw;
            }

            if (success)
            {
                Logger.Log(Resources.GridUI_saveToolStripMenuItem_Click_Successfully_saved);
            }
        }
Esempio n. 2
0
        private void openModFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string curPath = "";

            DirectoryInfo lastPath = ConfigHelper.GetLastPathOfDataFiles();

            if (lastPath != null)
            {
                curPath = lastPath.FullName;
            }

            if (string.IsNullOrEmpty(curPath) == false)
            {
                folderBrowserDialog1.SelectedPath = curPath;
            }
            folderBrowserDialog1.ShowNewFolderButton = true;


            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                m_tbModFolder.Text = folderBrowserDialog1.SelectedPath;
                try
                {
                    // start the process
                    TranslationComponents tc = TranslationManager.GetGridData(new DirectoryInfo(folderBrowserDialog1.SelectedPath));

                    if (tc == null)
                    {
                        MessageBox.Show("No 'stringtable.xml' files found.");
                        return;
                    }


                    _gridUiHelper = new GridUiHelper(this);
                    _gridUiHelper.ShowData(tc);

                    openModFolderToolStripMenuItem.Enabled = false;
                    saveToolStripMenuItem.Enabled          = true;
                    addLanguageToolStripMenuItem.Enabled   = true;
                    statisticsToolStripMenuItem.Enabled    = true;

                    ConfigHelper.SetLastPathOfDataFiles(new DirectoryInfo(folderBrowserDialog1.SelectedPath));
                }
                catch (DuplicateKeyException duplicateKeyException)
                {
                    MessageBox.Show(String.Format("Duplicate Key found.\nName: \"{0}\" \nFile: \"{1}\"", duplicateKeyException.KeyName, duplicateKeyException.FileName), "Duplicate Key Error");
                }
            }
        }
Esempio n. 3
0
        private void openModFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string curPath = "";

            DirectoryInfo lastPath = ConfigHelper.GetLastPathOfDataFiles();

            if (lastPath != null)
            {
                curPath = lastPath.FullName;
            }

            if (string.IsNullOrEmpty(curPath) == false)
            {
                folderBrowserDialog1.SelectedPath = curPath;
            }
            folderBrowserDialog1.ShowNewFolderButton = true;


            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                m_tbModFolder.Text = folderBrowserDialog1.SelectedPath;
                try {
                    // start the process
                    TranslationComponents tc = TranslationManager.GetGridData(new DirectoryInfo(folderBrowserDialog1.SelectedPath));

                    if (tc == null)
                    {
                        MessageBox.Show(Resources.GridUI_No_stringtable_xml_files_found);
                        return;
                    }


                    _gridUiHelper = new GridUiHelper(this);
                    _gridUiHelper.ShowData(tc);

                    openModFolderToolStripMenuItem.Enabled = false;
                    saveToolStripMenuItem.Enabled          = true;
                    addLanguageToolStripMenuItem.Enabled   = true;
                    statisticsToolStripMenuItem.Enabled    = true;

                    ConfigHelper.SetLastPathOfDataFiles(new DirectoryInfo(folderBrowserDialog1.SelectedPath));
                } catch (DuplicateKeyException duplicateKeyException) {
                    MessageBox.Show(String.Format(Resources.GridUI_Duplicate_key_found, duplicateKeyException.KeyName, duplicateKeyException.FileName, duplicateKeyException.EntryName), Resources.GridUI_Duplicate_key_found_title);
                } catch (GenericXmlException xmlException) {
                    MessageBox.Show(String.Format(Resources.GridUI_Generic_xml_exception, xmlException.KeyName, xmlException.FileName, xmlException.EntryName), Resources.GridUI_Generic_xml_exception_title);
                }
            }
        }