Skip to content

Commit ce68b18

Browse files
committed
Added default download directory
1 parent d2dab94 commit ce68b18

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

DeadLock/Forms/FrmUpdater.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#endregion
88
using System;
99
using System.ComponentModel;
10+
using System.IO;
1011
using System.Net;
1112
using System.Windows.Forms;
1213
using DeadLock.Classes;
@@ -20,6 +21,8 @@ public partial class FrmUpdater : MetroForm
2021
private readonly Update _update;
2122
private readonly WebClient _webClient;
2223
private readonly Language _language;
24+
25+
private readonly string _extension;
2326
#endregion
2427

2528
/// <summary>
@@ -36,6 +39,8 @@ public FrmUpdater(Update update, Language language)
3639

3740
_webClient.DownloadFileCompleted += Completed;
3841
_webClient.DownloadProgressChanged += ProgressChanged;
42+
43+
_extension = _update.UpdateUrl.Substring(_update.UpdateUrl.Length - 4, 4);
3944
}
4045

4146
/// <summary>
@@ -54,8 +59,12 @@ private void LoadLanguage()
5459

5560
private void btnSelectPath_Click(object sender, EventArgs e)
5661
{
57-
string extension = _update.UpdateUrl.Substring(_update.UpdateUrl.Length - 4, 4);
58-
SaveFileDialog sfd = new SaveFileDialog {Filter = extension.ToUpper() + @" (*" + extension + @")|*" + extension};
62+
SaveFileDialog sfd = new SaveFileDialog { Filter = _extension.ToUpper() + @" (*" + _extension + @")|*" + _extension };
63+
if (Directory.Exists(txtPath.Text))
64+
{
65+
sfd.InitialDirectory = txtPath.Text;
66+
}
67+
5968
if (sfd.ShowDialog() == DialogResult.OK)
6069
{
6170
txtPath.Text = sfd.FileName;
@@ -154,6 +163,8 @@ private void FrmUpdater_Load(object sender, EventArgs e)
154163
{
155164
LoadLanguage();
156165
LoadTheme();
166+
167+
txtPath.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\dl_setup" + _extension;
157168
}
158169
}
159170
}

0 commit comments

Comments
 (0)