private void kryptonCommandSave_Execute(object sender, EventArgs e) { if (!_textData.IsOpened) { return; } var sfd = new SaveFileDialog { Filter = "*.sav|*.sav", FileName = Path.GetFileName(_textData.Filename) + ".sav", InitialDirectory = Utilities.GetAbsolutePath(Properties.Settings.Default.SavedPath), }; if (sfd.ShowDialog() == DialogResult.Cancel) { return; } SavedTranslationFormatProvider.MakeSavedTranslation( sfd.FileName, _textData.Filename, _textData.Library.GetLibraryInfo(), _totalTime, _textData.Library.GetDefaultEncoding(), dataGridViewText.FirstSelectedRowIndex, _textData.GetLineInfoAll() ); _isModified = false; }
private void kryptonButtonOutput_Click(object sender, EventArgs e) { if (DialogResult.No == KryptonMessageBox.Show( "本操作将会覆盖目录下已存在的文件,要开始神一般的杀戮吗?", "哦死你开挂?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)) { return; } int count = 0; try { var textData = new TextData(); foreach (var file in Directory.GetFiles(kryptonTextBox1.Text, "*." + textData.Library.GetSupportExtension())) { count++; textData.OpenScript(file); SavedTranslationFormatProvider.MakeSavedTranslation( Path.Combine(kryptonTextBox2.Text, Path.GetFileName(file) + ".sav"), file, textData.Library.GetLibraryInfo(), TimeSpan.Zero, textData.Library.GetDefaultEncoding(), 0, textData.GetLineInfoAll() ); } } catch (Exception ea) { KryptonMessageBox.Show(ea.Message); } KryptonMessageBox.Show(string.Format("已导入 {0} 个文件。", count)); }
private void CheckAutoSave() { _autoSaveCount++; if (_autoSaveCount >= Properties.Settings.Default.AutoSaveDuration) { SavedTranslationFormatProvider.MakeSavedTranslation( Utilities.GetAbsolutePath( Properties.Settings.Default.AutoSavePath + "\\" + Path.GetFileNameWithoutExtension(_textData.Filename) + ".sav"), _textData.Filename, _textData.Library.GetLibraryInfo(), _totalTime, _textData.Library.GetDefaultEncoding(), dataGridViewText.FirstSelectedRowIndex, _textData.GetLineInfoAll() ); _autoSaveCount = 0; } }