개정판 9d5b4bc2
auto Update 기능 추가
Change-Id: I195d4506bd1dd9cfd58dbdeada74e89a1b9d307e
KCOM/Extensions/DownloadProcess.cs | ||
---|---|---|
1 |
using System; |
|
1 |
using Salaros.Configuration; |
|
2 |
using System; |
|
2 | 3 |
using System.Collections.Generic; |
3 | 4 |
using System.Diagnostics; |
5 |
using System.Globalization; |
|
4 | 6 |
using System.Linq; |
5 | 7 |
using System.Reflection; |
6 | 8 |
using System.Text; |
... | ... | |
10 | 12 |
{ |
11 | 13 |
public static class DownloadProcess |
12 | 14 |
{ |
15 |
|
|
13 | 16 |
private static List<int> processId = new List<int>(); |
14 | 17 |
|
15 | 18 |
private static string PROCESS_FILE_NAME = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"plugin\DownloadManager.exe"); |
... | ... | |
24 | 27 |
|
25 | 28 |
ProcessStartInfo startInfo = new ProcessStartInfo |
26 | 29 |
{ |
27 |
UseShellExecute = false,
|
|
30 |
UseShellExecute = isDebug,
|
|
28 | 31 |
FileName = PROCESS_FILE_NAME, |
29 | 32 |
WindowStyle = (isDebug) ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden, |
30 | 33 |
CreateNoWindow = true, |
31 | 34 |
ErrorDialog = false, |
32 | 35 |
RedirectStandardError = false, |
33 |
Arguments = $"THUMBNAIL {endpoint} {isDebug} {BaseUri} {localStoragePath} {fileExt} {totalPages}"
|
|
36 |
Arguments = $"{IIpc.ProcessTypeDefine.DEFINE_THUMBNAIL} {endpoint} {isDebug} {BaseUri} {localStoragePath} {fileExt} {totalPages}"
|
|
34 | 37 |
}; |
35 | 38 |
|
36 | 39 |
DownloadProcess.StartInfo = startInfo; |
... | ... | |
58 | 61 |
|
59 | 62 |
ProcessStartInfo startInfo = new ProcessStartInfo |
60 | 63 |
{ |
61 |
UseShellExecute = false,
|
|
64 |
UseShellExecute = isDebug,
|
|
62 | 65 |
FileName = PROCESS_FILE_NAME, |
63 | 66 |
WindowStyle = (isDebug) ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden, |
64 | 67 |
CreateNoWindow = true, |
65 | 68 |
ErrorDialog = false, |
66 | 69 |
RedirectStandardError = false, |
67 |
Arguments = $"FILE {endpoint} {isDebug} {OriginalUri} {localPath}"
|
|
70 |
Arguments = $"{IIpc.ProcessTypeDefine.DEFINE_FILE} {endpoint} {isDebug} {OriginalUri} {localPath}"
|
|
68 | 71 |
}; |
69 | 72 |
|
70 | 73 |
DownloadProcess.StartInfo = startInfo; |
... | ... | |
82 | 85 |
return result; |
83 | 86 |
} |
84 | 87 |
|
88 |
public static bool ProcessMonitor(bool isDebug,string thumbnailFolder) |
|
89 |
{ |
|
90 |
bool result = false; |
|
91 |
|
|
92 |
try |
|
93 |
{ |
|
94 |
Process DownloadProcess = new Process(); |
|
95 |
|
|
96 |
ProcessStartInfo startInfo = new ProcessStartInfo |
|
97 |
{ |
|
98 |
UseShellExecute = isDebug, |
|
99 |
FileName = PROCESS_FILE_NAME, |
|
100 |
WindowStyle = (isDebug) ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden, |
|
101 |
CreateNoWindow = true, |
|
102 |
ErrorDialog = false, |
|
103 |
RedirectStandardError = false, |
|
104 |
Arguments = $"{IIpc.ProcessTypeDefine.DEFINE_MONITOR} {isDebug} {Process.GetCurrentProcess().Id} {string.Join(" ",processId)} {thumbnailFolder} {App.PageStorage.LocalStorage} {Common.ViewerDataModel.Instance.OriginalTempFile}" |
|
105 |
}; |
|
106 |
|
|
107 |
DownloadProcess.StartInfo = startInfo; |
|
108 |
DownloadProcess.EnableRaisingEvents = false; |
|
109 |
|
|
110 |
result = DownloadProcess.Start(); |
|
111 |
} |
|
112 |
catch (Exception ex) |
|
113 |
{ |
|
114 |
result = false; |
|
115 |
} |
|
116 |
|
|
117 |
return result; |
|
118 |
} |
|
119 |
|
|
85 | 120 |
public static void ProcessKill() |
86 | 121 |
{ |
87 | 122 |
for (int i = 0; i < processId.Count; i++) |
... | ... | |
89 | 124 |
try |
90 | 125 |
{ |
91 | 126 |
|
92 |
Process.GetProcessById(processId[i]).Kill(); |
|
127 |
Process process = Process.GetProcessById(processId[i]); |
|
128 |
process.Kill(); |
|
93 | 129 |
} |
94 | 130 |
catch (Exception ex) |
95 | 131 |
{ |
내보내기 Unified diff