From f4e44dbe27533f5c85ec4d825d7e3f748332c63a Mon Sep 17 00:00:00 2001 From: candywater Date: Sat, 30 Apr 2022 17:53:44 +0800 Subject: [PATCH] add feature : can edit txt path now. --- .../FormMain.Designer.cs | 3 ++- ChineseSubtitleConversionTool/FormMain.cs | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ChineseSubtitleConversionTool/FormMain.Designer.cs b/ChineseSubtitleConversionTool/FormMain.Designer.cs index 3049078..1baddbb 100644 --- a/ChineseSubtitleConversionTool/FormMain.Designer.cs +++ b/ChineseSubtitleConversionTool/FormMain.Designer.cs @@ -173,9 +173,10 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.txtPath.Location = new System.Drawing.Point(41, 8); this.txtPath.Name = "txtPath"; - this.txtPath.ReadOnly = true; + this.txtPath.ReadOnly = false; this.txtPath.Size = new System.Drawing.Size(383, 21); this.txtPath.TabIndex = 1; + this.txtPath.TextChanged += txtPath_TextChanged; // // label2 // diff --git a/ChineseSubtitleConversionTool/FormMain.cs b/ChineseSubtitleConversionTool/FormMain.cs index e0522c4..135017a 100644 --- a/ChineseSubtitleConversionTool/FormMain.cs +++ b/ChineseSubtitleConversionTool/FormMain.cs @@ -473,6 +473,7 @@ private void AddFileListView(ListView listView, params FileInfo[] arrPath) case ".srt": case ".lrc": case ".txt": + case ".yaml": try { ListViewItem listViewItem = listView.Items.Cast().First(x => x.SubItems[2].Text == file.FullName); @@ -804,9 +805,23 @@ public bool SaveFile(string path, string text, string encode = "UTF-8") return false; } } - #endregion - + /// + /// auto load whenever textpath has changed + /// + /// + /// + private void txtPath_TextChanged(object sender, EventArgs e) + { + string path = ((TextBox)sender).Text; + if (Directory.Exists(path)) + { + txtPath.Text = path; + LoadDirectoryFile(txtPath.Text.Trim(), listViewFile); + UpdataListViewFileName(listViewFile, txtFileName.Text.Trim()); + } + } + #endregion } ///