diff options
| author | Michael <[email protected]> | 2017-04-21 19:42:41 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-04-21 19:42:41 -0400 |
| commit | f9f834b1c31f2b6c611f44b2eba8d7ec816145f5 (patch) | |
| tree | 6d4084dfd38ebf11e68647f2a88d3d94e4d76157 /ShiftOS.WinForms/Applications/FileDialog.cs | |
| parent | 1e74f09670a89d8fdf51215aa7a275c335e80211 (diff) | |
| download | shiftos_thereturn-f9f834b1c31f2b6c611f44b2eba8d7ec816145f5.tar.gz shiftos_thereturn-f9f834b1c31f2b6c611f44b2eba8d7ec816145f5.tar.bz2 shiftos_thereturn-f9f834b1c31f2b6c611f44b2eba8d7ec816145f5.zip | |
Add copying/moving of files/dirs
Diffstat (limited to 'ShiftOS.WinForms/Applications/FileDialog.cs')
| -rw-r--r-- | ShiftOS.WinForms/Applications/FileDialog.cs | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/ShiftOS.WinForms/Applications/FileDialog.cs b/ShiftOS.WinForms/Applications/FileDialog.cs index 308be7d..ba92f08 100644 --- a/ShiftOS.WinForms/Applications/FileDialog.cs +++ b/ShiftOS.WinForms/Applications/FileDialog.cs @@ -60,9 +60,20 @@ namespace ShiftOS.WinForms.Applications try { var itm = lvitems.SelectedItems[0]; - if (FileExists(currentdir + "/" + itm.Text)) + if (cbfiletypes.Text != "Directory") { - txtfilename.Text = itm.Text; + if (FileExists(currentdir + "/" + itm.Text)) + { + txtfilename.Text = itm.Text; + } + } + else + { + if (DirectoryExists(currentdir + "/" + itm.Text)) + { + txtfilename.Text = itm.Text; + } + } } catch { } @@ -72,23 +83,41 @@ namespace ShiftOS.WinForms.Applications { string fname = ""; fname = (!string.IsNullOrWhiteSpace(txtfilename.Text)) ? txtfilename.Text : ""; - fname = (!fname.EndsWith(cbfiletypes.SelectedItem.ToString())) ? fname + cbfiletypes.SelectedItem.ToString() : fname; - fname = (fname == cbfiletypes.SelectedItem.ToString()) ? "" : fname; + if (cbfiletypes.Text != "Directory") + { + fname = (!fname.EndsWith(cbfiletypes.SelectedItem.ToString())) ? fname + cbfiletypes.SelectedItem.ToString() : fname; + fname = (fname == cbfiletypes.SelectedItem.ToString()) ? "" : fname; + } switch (style) { case FileOpenerStyle.Open: - - if(FileExists(currentdir + "/" + fname)) + if (cbfiletypes.Text == "Directory") { - callback?.Invoke(currentdir + "/" + fname); - this.Close(); + if (DirectoryExists(currentdir + "/" + fname)) + { + callback?.Invoke(currentdir + "/" + fname); + this.Close(); + } + else + { + Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}"); + } + } else { - Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}"); + if (FileExists(currentdir + "/" + fname)) + { + callback?.Invoke(currentdir + "/" + fname); + this.Close(); + } + else + { + Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}"); + } } break; case FileOpenerStyle.Save: |
