개정판 264c9309
issue #660: Smart Updater 수정중
Change-Id: I573a5f58b4f34a4fddb68dc670aaf5c770cf5d07
KCOM/App.xaml.cs | ||
---|---|---|
75 | 75 |
|
76 | 76 |
public static RestSharp.RestClient BaseClient { get; set; } |
77 | 77 |
public static IKCOM.KCOM_SystemInfo SystemInfo { get; set; } |
78 |
|
|
79 |
|
|
78 | 80 |
private static OpenProperties ParamDecoding(string DecodingText, System.Text.Encoding oEncoding = null) |
79 | 81 |
{ |
80 | 82 |
if (oEncoding == null) |
... | ... | |
156 | 158 |
|
157 | 159 |
//App.ViewInfo.CreateFinalPDFPermission = false; |
158 | 160 |
//App.ViewInfo.NewCommentPermission = false; |
159 |
|
|
160 | 161 |
//GetQueryStringParameters(); |
161 | 162 |
_binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly); |
162 | 163 |
_binding.MaxBufferSize = 2147483647; |
... | ... | |
187 | 188 |
{ |
188 | 189 |
System.Diagnostics.Debug.WriteLine(ex.ToString()); |
189 | 190 |
} |
190 |
|
|
191 | 191 |
#if DEBUG |
192 | 192 |
//sBaseServiceURL = CommonLib.Common.GetConfigString("BaseClientAddress", "URL", "", isExternal); |
193 | 193 |
sBaseServiceURL = CommonLib.Common.GetConfigString("Debug_BaseClientAddress", "URL", "",isExternal); |
... | ... | |
196 | 196 |
#endif |
197 | 197 |
|
198 | 198 |
_EndPoint = new EndpointAddress(string.Format("{0}/ServiceDeepView.svc", sBaseServiceURL)); |
199 |
|
|
200 |
if (Environment.Is64BitProcess == true) //64 bit machine |
|
201 |
{ |
|
202 |
versionPath = CommonLib.Common.GetConfigString("UpdateVer64", "URL", "", isExternal); |
|
203 |
} |
|
204 |
else //32 bit machine |
|
205 |
{ |
|
206 |
versionPath = CommonLib.Common.GetConfigString("UpdateVer86", "URL", "", isExternal); |
|
207 |
} |
|
208 |
|
|
209 |
if (File.Exists(versionPath)) |
|
199 |
|
|
200 |
Task.Factory.StartNew(() => |
|
210 | 201 |
{ |
211 |
// 20180921 version.xml check로 변경 |
|
212 |
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
|
213 |
try |
|
202 |
int value = 100 / ISplashMessage.SplashMessageCnt; |
|
203 |
for (int i = 1; i <= ISplashMessage.SplashMessageCnt; i++) |
|
214 | 204 |
{ |
215 |
XmlDocument xdoc = new XmlDocument(); |
|
216 |
xdoc.Load(versionPath); |
|
217 |
XmlNode node = xdoc.SelectSingleNode("/RootElement/version"); |
|
218 |
|
|
219 |
if (assemblyVersion != node.InnerText) // node.InnerText 가 null이면 catch로 빠짐 |
|
220 |
{ |
|
221 |
//if(MessageBox.Show("Ver. " + node.InnerText + " 업데이트가 있습니다.\r\nSmartUpdate를 실행합니다.", "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK) |
|
222 |
//{ |
|
223 |
if (MessageBox.Show("Ver. " + node.InnerText, "MARKUS", MessageBoxButton.OKCancel) == MessageBoxResult.OK) |
|
224 |
{ |
|
225 |
UpdateCheck(e); |
|
226 |
} |
|
227 |
else |
|
228 |
{ |
|
229 |
base.Shutdown(); |
|
230 |
//현재 실행되고 있는 자기 자신 프로세스의 정보 // 위에꺼랑 두개 다 써줄필요가 있는..가? |
|
231 |
Process proc = Process.GetCurrentProcess(); |
|
232 |
proc.Kill(); |
|
233 |
} |
|
234 |
} |
|
235 |
else |
|
236 |
{ |
|
237 |
// splash.Close(new TimeSpan(0, 0, 2)); |
|
238 |
Task.Factory.StartNew(() => |
|
239 |
{ |
|
240 |
int value = 100 / ISplashMessage.SplashMessageCnt; |
|
241 |
for (int i = 1; i <= ISplashMessage.SplashMessageCnt ; i++) |
|
242 |
{ |
|
243 |
System.Threading.Thread.Sleep(3); |
|
244 |
splashScreen.Dispatcher.Invoke(() => splashScreen.Progress = i * value); |
|
245 |
} |
|
246 |
this.Dispatcher.Invoke(() => |
|
247 |
{ |
|
248 |
base.OnStartup(e); |
|
249 |
splashScreen.Close(); |
|
250 |
}); |
|
251 |
|
|
252 |
}); |
|
253 |
} |
|
205 |
System.Threading.Thread.Sleep(3); |
|
206 |
splashScreen.Dispatcher.Invoke(() => splashScreen.Progress = i * value); |
|
254 | 207 |
} |
255 |
catch (Exception ex) //2. 파일이 없거나 파일내에 version의 값이 없다면 KCOM 실행하기 |
|
208 |
|
|
209 |
this.Dispatcher.Invoke(() => |
|
256 | 210 |
{ |
257 |
ErrorLogFileWrite("KCOM//UpdateCheck ERR : " + ex); |
|
258 |
|
|
259 |
Task.Factory.StartNew(() => |
|
260 |
{ |
|
261 |
int value = 100 / ISplashMessage.SplashMessageCnt; |
|
262 |
for (int i = 1; i <= ISplashMessage.SplashMessageCnt; i++) |
|
263 |
{ |
|
264 |
System.Threading.Thread.Sleep(3); |
|
265 |
splashScreen.Dispatcher.Invoke(() => splashScreen.Progress = i * value); |
|
266 |
} |
|
267 |
|
|
268 |
this.Dispatcher.Invoke(() => |
|
269 |
{ |
|
270 |
base.OnStartup(e); |
|
271 |
splashScreen.Close(); |
|
272 |
}); |
|
273 |
}); |
|
274 |
} |
|
275 |
} |
|
211 |
base.OnStartup(e); |
|
212 |
splashScreen.Close(); |
|
213 |
}); |
|
214 |
}); |
|
276 | 215 |
} |
277 | 216 |
catch (Exception ex) |
278 | 217 |
{ |
... | ... | |
285 | 224 |
int value = 100 / ISplashMessage.SplashMessageCnt; |
286 | 225 |
for (int i = 1; i < ISplashMessage.SplashMessageCnt; i++) |
287 | 226 |
{ |
288 |
System.Threading.Thread.Sleep(3); |
|
289 |
|
|
290 |
splashScreen.Dispatcher.Invoke(() => splashScreen.Progress = i * value); |
|
291 |
|
|
292 |
//App. |
|
227 |
System.Threading.Thread.Sleep(3); |
|
228 |
splashScreen.Dispatcher.Invoke(() => splashScreen.Progress = i * value); |
|
293 | 229 |
} |
294 | 230 |
this.Dispatcher.Invoke(() => |
295 | 231 |
{ |
... | ... | |
297 | 233 |
splashScreen.Close(); |
298 | 234 |
}); |
299 | 235 |
}); |
300 |
} |
|
301 |
|
|
236 |
} |
|
302 | 237 |
} |
303 | 238 |
|
304 | 239 |
public static void splashString(string text) |
... | ... | |
310 | 245 |
} |
311 | 246 |
|
312 | 247 |
|
313 |
|
|
314 | 248 |
/// <summary> |
315 | 249 |
/// log unhandled exception |
316 | 250 |
/// </summary> |
... | ... | |
334 | 268 |
} |
335 | 269 |
} |
336 | 270 |
|
337 |
protected void UpdateCheck(StartupEventArgs e) |
|
338 |
{ |
|
339 |
try |
|
340 |
{ |
|
341 |
if (e.Args.Count() > 0) |
|
342 |
{ |
|
343 |
ProcessStartInfo proInfo = new ProcessStartInfo(); |
|
344 |
var FileName = AppDomain.CurrentDomain.BaseDirectory + "SmartUpdate.exe"; |
|
345 |
|
|
346 |
Process.Start(FileName, e.Args[0]); |
|
347 |
|
|
348 |
base.Shutdown(); |
|
349 |
//현재 실행되고 있는 자기 자신 프로세스의 정보 |
|
350 |
Process proc = Process.GetCurrentProcess(); |
|
351 |
proc.Kill(); |
|
352 |
} |
|
353 |
} |
|
354 |
catch(Exception ee) |
|
355 |
{ |
|
356 |
ErrorLogFileWrite("KCOM//UpdateCheck ERR : " + ee); |
|
357 |
} |
|
358 |
} |
|
359 |
|
|
360 | 271 |
private void ErrorLogFileWrite(string Err) |
361 | 272 |
{ |
362 | 273 |
App.FileLogger.Debug(Err); |
363 |
/* |
|
364 |
try |
|
365 |
{ |
|
366 |
string pathString = AppDataFolder + "\\Err"; |
|
367 |
|
|
368 |
if (!File.Exists(pathString)) |
|
369 |
{ |
|
370 |
Directory.CreateDirectory(pathString); |
|
371 |
} |
|
372 |
|
|
373 |
Err = Err + " " + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "\r\n"; |
|
374 |
string path = pathString + "\\" + "Log_" + DateTime.Now.ToString("yyyy-MM-dd hh-mm") + ".txt"; |
|
375 |
File.AppendAllText(path, Err); |
|
376 |
} |
|
377 |
catch (Exception er) |
|
378 |
{ |
|
379 |
string strError = er.ToString(); |
|
380 |
} |
|
381 |
*/ |
|
382 | 274 |
} |
383 | 275 |
} |
384 | 276 |
} |
내보내기 Unified diff