개정판 1d79913e
issue #00000 error notice mail 안 되는 문제 수정
Change-Id: I307236bdea2ca63347b99a174c02e1e53f05a3a7
ConvertService/ServiceBase/Markus.Service.Convert/DownloadPlugin.cs | ||
---|---|---|
6 | 6 |
using System.Text; |
7 | 7 |
using System.Threading.Tasks; |
8 | 8 |
using Markus.Service.Convert.Plugin; |
9 |
using Markus.Message; |
|
9 | 10 |
|
10 | 11 |
namespace Markus.Service |
11 | 12 |
{ |
... | ... | |
13 | 14 |
{ |
14 | 15 |
private const string BasePath = "DownloadPlugin"; |
15 | 16 |
|
16 |
public static bool Download(string PdfFileFullPath, string SaveDirectory, ref string DownloadFilePath)
|
|
17 |
public static FileDownloadResult Download(string PdfFileFullPath, string SaveDirectory)
|
|
17 | 18 |
{ |
18 |
bool result = false; |
|
19 |
FileDownloadResult result = new FileDownloadResult(); |
|
20 |
|
|
19 | 21 |
string error = ""; |
20 | 22 |
var baseDir = new System.IO.DirectoryInfo(AppDomain.CurrentDomain.SetupInformation.ApplicationBase).Parent.FullName; |
21 | 23 |
var pluginPath = System.IO.Path.Combine(baseDir, BasePath); |
... | ... | |
27 | 29 |
{ |
28 | 30 |
foreach (var item in plugins) |
29 | 31 |
{ |
30 |
if (item.Do(PdfFileFullPath, SaveDirectory, ref DownloadFilePath)) |
|
32 |
string downloadFilePath = null; |
|
33 |
|
|
34 |
bool pluginResult = false; |
|
35 |
|
|
36 |
try |
|
31 | 37 |
{ |
32 |
result = true; |
|
33 |
break; |
|
38 |
pluginResult = item.Do(PdfFileFullPath, SaveDirectory, ref downloadFilePath); |
|
39 |
|
|
40 |
if (pluginResult) |
|
41 |
{ |
|
42 |
result.DownloadFilePath = downloadFilePath; |
|
43 |
result.IsSuccess = true; |
|
44 |
break; |
|
45 |
} |
|
46 |
else |
|
47 |
{ |
|
48 |
var msg = $" not working {item.Name} {item.Exception}"; |
|
49 |
Console.WriteLine(msg); |
|
50 |
error += msg; |
|
51 |
} |
|
34 | 52 |
} |
35 |
else
|
|
53 |
catch (Exception ex)
|
|
36 | 54 |
{ |
37 |
var msg = $" not working {item.Name} {item.Exception}";
|
|
55 |
var msg = $"plugin Error : {item.Name} {ex.ToString()}";
|
|
38 | 56 |
Console.WriteLine(msg); |
39 |
error += msg;
|
|
57 |
error += ex.ToString();
|
|
40 | 58 |
} |
59 |
|
|
41 | 60 |
} |
42 | 61 |
|
43 |
if (!result) |
|
62 |
if (!result.IsSuccess)
|
|
44 | 63 |
{ |
45 |
throw new Exception("download plugin Error : " + error);
|
|
64 |
result.Exception = new Exception("download plugin Error : " + error);
|
|
46 | 65 |
} |
47 | 66 |
} |
48 | 67 |
else |
49 | 68 |
{ |
50 |
throw new Exception("plugins is null"); |
|
69 |
result.Exception = new Exception("plugins is null"); |
|
70 |
|
|
51 | 71 |
} |
52 | 72 |
|
53 | 73 |
return result; |
내보내기 Unified diff