Skip to content

Commit 326b216

Browse files
authored
Merge pull request #2 from RehmatFalcon/master
Feat: auto input database name if found in file
2 parents ea856e1 + 75838bd commit 326b216

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

MainWindow.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.ComponentModel;
45
using System.Windows.Forms;
56
using postgres_database_restore_tool.Helper;
@@ -60,8 +61,16 @@ private void OnFileOpenClick(object sender, EventArgs e)
6061
var selected = TargetLocation.ShowDialog();
6162
if (selected == DialogResult.OK)
6263
{
63-
MessageBox.Show(TargetLocation.FileName);
64+
MessageBox.Show(TargetLocation.FileName,"File Selected");
6465
SelectedFilelbl.Text = TargetLocation.FileName;
66+
if(string.IsNullOrWhiteSpace(DatabaseElem.Text))
67+
{
68+
var fileName = TargetLocation.FileName.Split(new char[] { '/', '\\' }).LastOrDefault();
69+
if(fileName.Contains("_"))
70+
{
71+
DatabaseElem.Text = fileName.Split('_').FirstOrDefault();
72+
}
73+
}
6574
}
6675
}
6776

0 commit comments

Comments
 (0)