7
7
#endregion
8
8
using System ;
9
9
using System . ComponentModel ;
10
+ using System . IO ;
10
11
using System . Net ;
11
12
using System . Windows . Forms ;
12
13
using DeadLock . Classes ;
@@ -20,6 +21,8 @@ public partial class FrmUpdater : MetroForm
20
21
private readonly Update _update ;
21
22
private readonly WebClient _webClient ;
22
23
private readonly Language _language ;
24
+
25
+ private readonly string _extension ;
23
26
#endregion
24
27
25
28
/// <summary>
@@ -36,6 +39,8 @@ public FrmUpdater(Update update, Language language)
36
39
37
40
_webClient . DownloadFileCompleted += Completed ;
38
41
_webClient . DownloadProgressChanged += ProgressChanged ;
42
+
43
+ _extension = _update . UpdateUrl . Substring ( _update . UpdateUrl . Length - 4 , 4 ) ;
39
44
}
40
45
41
46
/// <summary>
@@ -54,8 +59,12 @@ private void LoadLanguage()
54
59
55
60
private void btnSelectPath_Click ( object sender , EventArgs e )
56
61
{
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
+
59
68
if ( sfd . ShowDialog ( ) == DialogResult . OK )
60
69
{
61
70
txtPath . Text = sfd . FileName ;
@@ -154,6 +163,8 @@ private void FrmUpdater_Load(object sender, EventArgs e)
154
163
{
155
164
LoadLanguage ( ) ;
156
165
LoadTheme ( ) ;
166
+
167
+ txtPath . Text = Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ) + @"\dl_setup" + _extension ;
157
168
}
158
169
}
159
170
}
0 commit comments