markus / ConvertService / ServiceBase / PlugInTest / Program_1.cs @ 42d49521
이력 | 보기 | 이력해설 | 다운로드 (3.24 KB)
1 |
using Markus.Service.Convert.Plugin; |
---|---|
2 |
using Markus.Service.Extensions; |
3 |
using Markus.Service.Helper; |
4 |
using System; |
5 |
using System.Collections.Generic; |
6 |
using System.Linq; |
7 |
using System.Text; |
8 |
using System.Threading.Tasks; |
9 |
|
10 |
namespace PlugInTest |
11 |
{ |
12 |
class Program_1 |
13 |
{ |
14 |
static void Main_(string[] args) |
15 |
{ |
16 |
string ConfigFileName = "Plugin.ini"; |
17 |
string BasePath = "Plugin"; |
18 |
|
19 |
Console.WriteLine("PlugIn Load............"); |
20 |
Console.Write("테스트용 Convert Doc ID : "); |
21 |
var convertID = Console.ReadLine(); |
22 |
|
23 |
try |
24 |
{ |
25 |
TestDocumentInfo.DocumentInfoProcess documentInfoProcess = new TestDocumentInfo.DocumentInfoProcess(); |
26 |
|
27 |
var pluginPath = System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, BasePath); |
28 |
var plugins = GenericPluginLoader<IPlugin>.LoadPlugins(pluginPath); |
29 |
var config = ConfigHelper.AppConfig(ConfigFileName); |
30 |
|
31 |
Console.Write("Plugin Path : " + pluginPath); |
32 |
|
33 |
if (plugins != null) |
34 |
{ |
35 |
Console.WriteLine(""); |
36 |
Console.WriteLine(""); |
37 |
Console.Write("Plugin Count : " + plugins.Count()); |
38 |
|
39 |
foreach (var item in plugins) |
40 |
{ |
41 |
Dictionary<string, object> parameters = new Dictionary<string, object>(); |
42 |
|
43 |
var sections = config.Sections.Where(x => x.SectionName == item.Name); |
44 |
|
45 |
if (sections.Count() > 0) |
46 |
{ |
47 |
foreach (var param in sections.First().Keys) |
48 |
{ |
49 |
parameters.Add(param.Name, param.Content); |
50 |
|
51 |
Console.WriteLine($"Parameter [{param.Name}] : [{param.Content}]"); |
52 |
} |
53 |
} |
54 |
|
55 |
Console.WriteLine(""); |
56 |
Console.WriteLine(""); |
57 |
Console.WriteLine("Plugin Type : " + item.Name); |
58 |
|
59 |
#region Docinfo Test |
60 |
//if (item.Name == documentInfoProcess.Name) |
61 |
//{ |
62 |
// Console.Write("Call : " + item.Name); |
63 |
|
64 |
// ((Markus.Service.Convert.Plugin.IPlugin)documentInfoProcess).Do(convertID, parameters); |
65 |
//} |
66 |
#endregion |
67 |
|
68 |
|
69 |
if (item.Name == "DocItemCheck") |
70 |
{ |
71 |
Console.Write("Call : " + item.Name); |
72 |
|
73 |
((Markus.Service.Convert.Plugin.IPlugin)item).Do(convertID, parameters); |
74 |
} |
75 |
|
76 |
Console.WriteLine(""); |
77 |
Console.WriteLine(""); |
78 |
} |
79 |
} |
80 |
|
81 |
Console.WriteLine("Call Plug In"); |
82 |
} |
83 |
catch (Exception ex) |
84 |
{ |
85 |
Console.WriteLine(ex.ToString()); |
86 |
|
87 |
if (ex.InnerException != null) |
88 |
{ |
89 |
Console.WriteLine(ex.InnerException.ToString()); |
90 |
} |
91 |
} |
92 |
|
93 |
Console.ReadLine(); |
94 |
} |
95 |
} |
96 |
} |