diff --git a/ChineseSubtitleConversionTool/FormMain.Designer.cs b/ChineseSubtitleConversionTool/FormMain.Designer.cs index e69f5fa..6b0752d 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 99c7bc4..79b9ac1 100644 --- a/ChineseSubtitleConversionTool/FormMain.cs +++ b/ChineseSubtitleConversionTool/FormMain.cs @@ -477,6 +477,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); @@ -816,9 +817,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 } ///