개정판 a1e2ba68
markus 외부주소 오류 수정
Change-Id: I03bd3df4edb78472d7d45f7a8c5db87fdfda226b
DownloadManager/CheckAutoUpdate.cs | ||
---|---|---|
15 | 15 |
{ |
16 | 16 |
const string MarkusUpdateDir = @"C:\Program Files\Doftech\MarkusUpdate"; |
17 | 17 |
|
18 |
public static void Validation() |
|
18 |
public static void Validation(string baseUri)
|
|
19 | 19 |
{ |
20 | 20 |
var configFilePath = $"{System.IO.Path.Combine(MarkusUpdateDir, "Markus.AppUpdate.ini")}"; |
21 | 21 |
|
... | ... | |
35 | 35 |
|
36 | 36 |
var oldversion = Version.Parse(config.GetValue("VERSION", "VERSION", "0.0.0")); |
37 | 37 |
|
38 |
var version = CheckVersion(checkuri); |
|
38 |
var version = CheckVersion(checkuri, baseUri);
|
|
39 | 39 |
|
40 | 40 |
if (oldversion < version) |
41 | 41 |
{ |
42 |
if (DownloadUpdate(downloadUri)) |
|
42 |
if (DownloadUpdate(downloadUri, baseUri))
|
|
43 | 43 |
{ |
44 | 44 |
config.SetValue("VERSION", "VERSION", version.ToString()); |
45 | 45 |
config.Save(configFilePath); |
... | ... | |
48 | 48 |
} |
49 | 49 |
} |
50 | 50 |
|
51 |
public static Version CheckVersion(string uri) |
|
51 |
public static Version CheckVersion(string uri,string baseUri)
|
|
52 | 52 |
{ |
53 | 53 |
Version version = new Version(0,0,0); |
54 | 54 |
|
... | ... | |
64 | 64 |
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials; |
65 | 65 |
} |
66 | 66 |
|
67 |
var data = client.DownloadString(new Uri(uri)); |
|
67 |
UriBuilder baseHost = new UriBuilder(baseUri); |
|
68 |
UriBuilder downloadUri = new UriBuilder(uri); |
|
69 |
|
|
70 |
downloadUri.Host = baseHost.Host; |
|
71 |
downloadUri.Port = baseHost.Port; |
|
72 |
|
|
73 |
var data = client.DownloadString(downloadUri.Uri); |
|
68 | 74 |
|
69 | 75 |
if(data != null) |
70 | 76 |
{ |
... | ... | |
81 | 87 |
|
82 | 88 |
} |
83 | 89 |
|
84 |
public static bool DownloadUpdate(string uri) |
|
90 |
public static bool DownloadUpdate(string uri, string baseUri)
|
|
85 | 91 |
{ |
86 | 92 |
bool result = false; |
87 | 93 |
|
... | ... | |
99 | 105 |
|
100 | 106 |
var filename = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); |
101 | 107 |
|
102 |
client.DownloadFile(new Uri(uri), filename); |
|
108 |
UriBuilder baseHost = new UriBuilder(baseUri); |
|
109 |
UriBuilder downloadUri = new UriBuilder(uri); |
|
110 |
|
|
111 |
downloadUri.Host = baseHost.Host; |
|
112 |
downloadUri.Port = baseHost.Port; |
|
113 |
|
|
114 |
client.DownloadFile(downloadUri.Uri, filename); |
|
103 | 115 |
|
104 | 116 |
if(File.Exists(filename)) |
105 | 117 |
{ |
내보내기 Unified diff