개정판 d91efe5c
issue #00000 download plugin 추가
Change-Id: I54fda0acd2594e6978c5ce0f3c28c92ebf899bd6
ConvertService/ServiceBase/ConnectionStringBuild/ConnectionStringBuild.csproj | ||
---|---|---|
19 | 19 |
<DebugSymbols>true</DebugSymbols> |
20 | 20 |
<DebugType>full</DebugType> |
21 | 21 |
<Optimize>false</Optimize> |
22 |
<OutputPath>bin\Debug\</OutputPath>
|
|
22 |
<OutputPath>..\publish\Tools\ConnectionStringBuild\</OutputPath>
|
|
23 | 23 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
24 | 24 |
<ErrorReport>prompt</ErrorReport> |
25 | 25 |
<WarningLevel>4</WarningLevel> |
... | ... | |
29 | 29 |
<PlatformTarget>AnyCPU</PlatformTarget> |
30 | 30 |
<DebugType>pdbonly</DebugType> |
31 | 31 |
<Optimize>true</Optimize> |
32 |
<OutputPath>bin\Release\</OutputPath>
|
|
32 |
<OutputPath>..\publish\Tools\ConnectionStringBuild\</OutputPath>
|
|
33 | 33 |
<DefineConstants>TRACE</DefineConstants> |
34 | 34 |
<ErrorReport>prompt</ErrorReport> |
35 | 35 |
<WarningLevel>4</WarningLevel> |
ConvertService/ServiceBase/DownloadPlugin/BSENGRestDownload/BSENGRestDownload.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 |
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|
4 |
<PropertyGroup> |
|
5 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
6 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
7 |
<ProjectGuid>{AA39EAB7-012E-4D8F-97F1-1C03DF459A6F}</ProjectGuid> |
|
8 |
<OutputType>Library</OutputType> |
|
9 |
<AppDesignerFolder>Properties</AppDesignerFolder> |
|
10 |
<RootNamespace>BSENGRestDownload</RootNamespace> |
|
11 |
<AssemblyName>BSENGRestDownload</AssemblyName> |
|
12 |
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
|
13 |
<FileAlignment>512</FileAlignment> |
|
14 |
<Deterministic>true</Deterministic> |
|
15 |
<TargetFrameworkProfile /> |
|
16 |
</PropertyGroup> |
|
17 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
18 |
<DebugSymbols>true</DebugSymbols> |
|
19 |
<DebugType>full</DebugType> |
|
20 |
<Optimize>false</Optimize> |
|
21 |
<OutputPath>..\..\publish\DownloadPlugin\BSENGRestDownload\</OutputPath> |
|
22 |
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
23 |
<ErrorReport>prompt</ErrorReport> |
|
24 |
<WarningLevel>4</WarningLevel> |
|
25 |
</PropertyGroup> |
|
26 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
27 |
<DebugType>pdbonly</DebugType> |
|
28 |
<Optimize>true</Optimize> |
|
29 |
<OutputPath>..\..\publish\DownloadPlugin\DirectDownload\</OutputPath> |
|
30 |
<DefineConstants>TRACE</DefineConstants> |
|
31 |
<ErrorReport>prompt</ErrorReport> |
|
32 |
<WarningLevel>4</WarningLevel> |
|
33 |
</PropertyGroup> |
|
34 |
<ItemGroup> |
|
35 |
<Reference Include="System" /> |
|
36 |
<Reference Include="System.Core" /> |
|
37 |
<Reference Include="System.Web" /> |
|
38 |
<Reference Include="System.Xml.Linq" /> |
|
39 |
<Reference Include="System.Data.DataSetExtensions" /> |
|
40 |
<Reference Include="Microsoft.CSharp" /> |
|
41 |
<Reference Include="System.Data" /> |
|
42 |
<Reference Include="System.Net.Http" /> |
|
43 |
<Reference Include="System.Xml" /> |
|
44 |
</ItemGroup> |
|
45 |
<ItemGroup> |
|
46 |
<Compile Include="BSENGRestDownloader.cs" /> |
|
47 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
48 |
</ItemGroup> |
|
49 |
<ItemGroup> |
|
50 |
<ProjectReference Include="..\..\Markus.Service.Convert.IPlugin\Markus.Service.Convert.IPlugin.csproj"> |
|
51 |
<Project>{a5ba7325-379c-4ccb-b156-1704fc2175e3}</Project> |
|
52 |
<Name>Markus.Service.Convert.IPlugin</Name> |
|
53 |
</ProjectReference> |
|
54 |
<ProjectReference Include="..\..\Markus.Service.Extensions\Markus.Service.Extensions.csproj"> |
|
55 |
<Project>{5f983789-3e8f-4f9a-a601-138c3a83ca5f}</Project> |
|
56 |
<Name>Markus.Service.Extensions</Name> |
|
57 |
</ProjectReference> |
|
58 |
</ItemGroup> |
|
59 |
<ItemGroup> |
|
60 |
<PackageReference Include="RestSharp"> |
|
61 |
<Version>106.12.0</Version> |
|
62 |
</PackageReference> |
|
63 |
</ItemGroup> |
|
64 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
65 |
</Project> |
ConvertService/ServiceBase/DownloadPlugin/BSENGRestDownload/BSENGRestDownloader.cs | ||
---|---|---|
1 |
using Markus.Service.Helper; |
|
2 |
using RestSharp; |
|
3 |
using System; |
|
4 |
using System.Collections.Generic; |
|
5 |
using System.IO; |
|
6 |
using System.Linq; |
|
7 |
using System.Text; |
|
8 |
using System.Threading.Tasks; |
|
9 |
using System.Web; |
|
10 |
|
|
11 |
namespace BSENGRestDownload |
|
12 |
{ |
|
13 |
public class BSENGRestDownload : Markus.Service.Convert.Plugin.IDownloadPlugin |
|
14 |
{ |
|
15 |
public string Exception { get; set; } |
|
16 |
public string Name => nameof(BSENGRestDownload); |
|
17 |
|
|
18 |
/// <summary> |
|
19 |
/// PdfFileFullPath의 경로를 받아 SaveDirectory하위에 PdfFileFullPath파일명으로 저장 |
|
20 |
/// </summary> |
|
21 |
/// <param name="PdfFilePath">PDF의 full path</param> |
|
22 |
/// <param name="SavePath">pdf를 다운받고자 하는 directory</param> |
|
23 |
public bool Do(string PdfFileFullPath, string SaveDirectory, ref string DownloadFilePath) |
|
24 |
{ |
|
25 |
bool result = false; |
|
26 |
try |
|
27 |
{ |
|
28 |
string _downloadFile = null; |
|
29 |
var client = new RestClient(PdfFileFullPath); |
|
30 |
client.Timeout = -1; |
|
31 |
var request = new RestRequest(Method.GET); |
|
32 |
IRestResponse response = client.Execute(request); |
|
33 |
|
|
34 |
if (response.StatusCode == System.Net.HttpStatusCode.OK) |
|
35 |
{ |
|
36 |
var fileName = DownloadUri.GetFileNameInDisposition(new System.Net.Mime.ContentDisposition(response.Headers.Where(x => x.Name == "Content-Disposition").First().Value.ToString())); |
|
37 |
|
|
38 |
_downloadFile = System.IO.Path.Combine(SaveDirectory, fileName); |
|
39 |
|
|
40 |
var fs = File.Create(_downloadFile); |
|
41 |
|
|
42 |
fs.Write(response.RawBytes, 0, response.RawBytes.Length); |
|
43 |
fs.Close(); |
|
44 |
|
|
45 |
result = true; |
|
46 |
DownloadFilePath = _downloadFile; |
|
47 |
} |
|
48 |
else |
|
49 |
{ |
|
50 |
this.Exception = $"{response.StatusCode.ToString()} {response.ErrorMessage}"; |
|
51 |
} |
|
52 |
} |
|
53 |
catch (Exception ex) |
|
54 |
{ |
|
55 |
this.Exception = ex.ToString(); |
|
56 |
} |
|
57 |
|
|
58 |
return result; |
|
59 |
} |
|
60 |
} |
|
61 |
} |
ConvertService/ServiceBase/DownloadPlugin/BSENGRestDownload/Properties/AssemblyInfo.cs | ||
---|---|---|
1 |
using System.Reflection; |
|
2 |
using System.Runtime.CompilerServices; |
|
3 |
using System.Runtime.InteropServices; |
|
4 |
|
|
5 |
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 |
|
6 |
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 |
|
7 |
// 이러한 특성 값을 변경하세요. |
|
8 |
[assembly: AssemblyTitle("DirectDownload")] |
|
9 |
[assembly: AssemblyDescription("")] |
|
10 |
[assembly: AssemblyConfiguration("")] |
|
11 |
[assembly: AssemblyCompany("")] |
|
12 |
[assembly: AssemblyProduct("DirectDownload")] |
|
13 |
[assembly: AssemblyCopyright("Copyright © 2022")] |
|
14 |
[assembly: AssemblyTrademark("")] |
|
15 |
[assembly: AssemblyCulture("")] |
|
16 |
|
|
17 |
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 |
|
18 |
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 |
|
19 |
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. |
|
20 |
[assembly: ComVisible(false)] |
|
21 |
|
|
22 |
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. |
|
23 |
[assembly: Guid("23271b3d-fe31-4039-b9cd-9f00c43117d8")] |
|
24 |
|
|
25 |
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. |
|
26 |
// |
|
27 |
// 주 버전 |
|
28 |
// 부 버전 |
|
29 |
// 빌드 번호 |
|
30 |
// 수정 버전 |
|
31 |
// |
|
32 |
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 |
|
33 |
// 기본값으로 할 수 있습니다. |
|
34 |
// [assembly: AssemblyVersion("1.0.*")] |
|
35 |
[assembly: AssemblyVersion("1.0.0.0")] |
|
36 |
[assembly: AssemblyFileVersion("1.0.0.0")] |
ConvertService/ServiceBase/DownloadPlugin/DirectDownload/DirectDownload.csproj | ||
---|---|---|
25 | 25 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
26 | 26 |
<DebugType>pdbonly</DebugType> |
27 | 27 |
<Optimize>true</Optimize> |
28 |
<OutputPath>..\publish\DownloadPlugin\DirectDownload\</OutputPath> |
|
28 |
<OutputPath>..\..\publish\DownloadPlugin\DirectDownload\</OutputPath>
|
|
29 | 29 |
<DefineConstants>TRACE</DefineConstants> |
30 | 30 |
<ErrorReport>prompt</ErrorReport> |
31 | 31 |
<WarningLevel>4</WarningLevel> |
ConvertService/ServiceBase/DownloadPlugin/DirectDownload/Downloader.cs | ||
---|---|---|
42 | 42 |
webClient.DownloadFile(originFilePath, downloadFilePath); |
43 | 43 |
|
44 | 44 |
webClient.Dispose(); |
45 |
|
|
45 |
result = true; |
|
46 | 46 |
DownloadFilePath = downloadFilePath; |
47 | 47 |
} |
48 | 48 |
} |
49 | 49 |
catch (Exception ex) |
50 | 50 |
{ |
51 |
this.Exception = ex.ToString(); |
|
51 |
this.Exception = ex.ToString();
|
|
52 | 52 |
} |
53 | 53 |
|
54 | 54 |
return result; |
ConvertService/ServiceBase/DownloadPlugin/DownloadPluginTester/DownloadPluginTester/App.config | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8" ?> |
|
2 |
<configuration> |
|
3 |
<startup> |
|
4 |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> |
|
5 |
</startup> |
|
6 |
</configuration> |
ConvertService/ServiceBase/DownloadPlugin/DownloadPluginTester/DownloadPluginTester/DownloadPluginTester.csproj | ||
---|---|---|
1 |
<?xml version="1.0" encoding="utf-8"?> |
|
2 |
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
3 |
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
|
4 |
<PropertyGroup> |
|
5 |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
6 |
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
7 |
<ProjectGuid>{BA34FEBB-FC25-47DD-A7CF-57239D4EE055}</ProjectGuid> |
|
8 |
<OutputType>Exe</OutputType> |
|
9 |
<RootNamespace>DownloadPluginTester</RootNamespace> |
|
10 |
<AssemblyName>DownloadPluginTester</AssemblyName> |
|
11 |
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |
|
12 |
<FileAlignment>512</FileAlignment> |
|
13 |
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
|
14 |
<Deterministic>true</Deterministic> |
|
15 |
</PropertyGroup> |
|
16 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
17 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
18 |
<DebugSymbols>true</DebugSymbols> |
|
19 |
<DebugType>full</DebugType> |
|
20 |
<Optimize>false</Optimize> |
|
21 |
<OutputPath>bin\Debug\</OutputPath> |
|
22 |
<DefineConstants>TRACE;DEBUG;DOWNLOAD_PLUGIN_TEST</DefineConstants> |
|
23 |
<ErrorReport>prompt</ErrorReport> |
|
24 |
<WarningLevel>4</WarningLevel> |
|
25 |
<Prefer32Bit>false</Prefer32Bit> |
|
26 |
</PropertyGroup> |
|
27 |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
28 |
<PlatformTarget>x64</PlatformTarget> |
|
29 |
<DebugType>pdbonly</DebugType> |
|
30 |
<Optimize>false</Optimize> |
|
31 |
<OutputPath>..\..\publish\DownloadPlugin\</OutputPath> |
|
32 |
<DefineConstants>TRACE</DefineConstants> |
|
33 |
<ErrorReport>prompt</ErrorReport> |
|
34 |
<WarningLevel>4</WarningLevel> |
|
35 |
<Prefer32Bit>false</Prefer32Bit> |
|
36 |
</PropertyGroup> |
|
37 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DownloadPluginTest|AnyCPU'"> |
|
38 |
<DebugSymbols>true</DebugSymbols> |
|
39 |
<OutputPath>bin\Debug\</OutputPath> |
|
40 |
<DefineConstants>TRACE;DEBUG;DOWNLOAD_PLUGIN_TEST</DefineConstants> |
|
41 |
<DebugType>full</DebugType> |
|
42 |
<PlatformTarget>x64</PlatformTarget> |
|
43 |
<LangVersion>7.3</LangVersion> |
|
44 |
<ErrorReport>prompt</ErrorReport> |
|
45 |
</PropertyGroup> |
|
46 |
<ItemGroup> |
|
47 |
<Reference Include="System" /> |
|
48 |
<Reference Include="System.Core" /> |
|
49 |
<Reference Include="System.Xml.Linq" /> |
|
50 |
<Reference Include="System.Data.DataSetExtensions" /> |
|
51 |
<Reference Include="Microsoft.CSharp" /> |
|
52 |
<Reference Include="System.Data" /> |
|
53 |
<Reference Include="System.Net.Http" /> |
|
54 |
<Reference Include="System.Xml" /> |
|
55 |
</ItemGroup> |
|
56 |
<ItemGroup> |
|
57 |
<Compile Include="..\..\..\Markus.Service.Convert\DownloadPlugin.cs"> |
|
58 |
<Link>DownloadPlugin.cs</Link> |
|
59 |
</Compile> |
|
60 |
<Compile Include="Program.cs" /> |
|
61 |
<Compile Include="Properties\AssemblyInfo.cs" /> |
|
62 |
</ItemGroup> |
|
63 |
<ItemGroup> |
|
64 |
<None Include="App.config" /> |
|
65 |
</ItemGroup> |
|
66 |
<ItemGroup> |
|
67 |
<ProjectReference Include="..\..\..\Markus.Service.Convert.IPlugin\Markus.Service.Convert.IPlugin.csproj"> |
|
68 |
<Project>{a5ba7325-379c-4ccb-b156-1704fc2175e3}</Project> |
|
69 |
<Name>Markus.Service.Convert.IPlugin</Name> |
|
70 |
</ProjectReference> |
|
71 |
<ProjectReference Include="..\..\..\Markus.Service.Extensions\Markus.Service.Extensions.csproj"> |
|
72 |
<Project>{5f983789-3e8f-4f9a-a601-138c3a83ca5f}</Project> |
|
73 |
<Name>Markus.Service.Extensions</Name> |
|
74 |
</ProjectReference> |
|
75 |
</ItemGroup> |
|
76 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
|
77 |
<PropertyGroup> |
|
78 |
<PreBuildEvent> |
|
79 |
</PreBuildEvent> |
|
80 |
</PropertyGroup> |
|
81 |
<PropertyGroup> |
|
82 |
<PostBuildEvent>echo $(ConfigurationName) |
|
83 |
if $(ConfigurationName) == DownloadPluginTest ( |
|
84 |
|
|
85 |
echo "$(SolutionDir)\publish\DownloadPlugin" |
|
86 |
echo "$(TargetDir)" |
|
87 |
|
|
88 |
xcopy /s "$(SolutionDir)\publish\DownloadPlugin" "$(TargetDir)\DownloadPlugin\" /Y /F |
|
89 |
)</PostBuildEvent> |
|
90 |
</PropertyGroup> |
|
91 |
</Project> |
ConvertService/ServiceBase/DownloadPlugin/DownloadPluginTester/DownloadPluginTester/Program.cs | ||
---|---|---|
1 |
using Markus.Service; |
|
2 |
using System; |
|
3 |
using System.Collections.Generic; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Threading.Tasks; |
|
7 |
|
|
8 |
namespace DownloadPluginTester |
|
9 |
{ |
|
10 |
class Program |
|
11 |
{ |
|
12 |
static void Main(string[] args) |
|
13 |
{ |
|
14 |
Console.Write("Downlaod PDF Full Path : "); |
|
15 |
var pdfFullPath = Console.ReadLine(); |
|
16 |
|
|
17 |
Console.Write("file Save Directory : "); |
|
18 |
var saveDir = Console.ReadLine(); |
|
19 |
|
|
20 |
string downloadFilePath = ""; |
|
21 |
|
|
22 |
try |
|
23 |
{ |
|
24 |
var result = DownloadPluginService.Download(pdfFullPath, saveDir, ref downloadFilePath); |
|
25 |
|
|
26 |
Console.WriteLine($"{downloadFilePath} 완료"); |
|
27 |
} |
|
28 |
catch (Exception ex) |
|
29 |
{ |
|
30 |
Console.WriteLine(ex.ToString()); |
|
31 |
Console.ReadKey(); |
|
32 |
} |
|
33 |
|
|
34 |
Console.ReadKey(); |
|
35 |
} |
|
36 |
} |
|
37 |
} |
ConvertService/ServiceBase/DownloadPlugin/DownloadPluginTester/DownloadPluginTester/Properties/AssemblyInfo.cs | ||
---|---|---|
1 |
using System.Reflection; |
|
2 |
using System.Runtime.CompilerServices; |
|
3 |
using System.Runtime.InteropServices; |
|
4 |
|
|
5 |
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 |
|
6 |
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 |
|
7 |
// 이러한 특성 값을 변경하세요. |
|
8 |
[assembly: AssemblyTitle("DownloadPluginTester")] |
|
9 |
[assembly: AssemblyDescription("")] |
|
10 |
[assembly: AssemblyConfiguration("")] |
|
11 |
[assembly: AssemblyCompany("")] |
|
12 |
[assembly: AssemblyProduct("DownloadPluginTester")] |
|
13 |
[assembly: AssemblyCopyright("Copyright © 2022")] |
|
14 |
[assembly: AssemblyTrademark("")] |
|
15 |
[assembly: AssemblyCulture("")] |
|
16 |
|
|
17 |
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 |
|
18 |
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 |
|
19 |
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. |
|
20 |
[assembly: ComVisible(false)] |
|
21 |
|
|
22 |
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. |
|
23 |
[assembly: Guid("ba34febb-fc25-47dd-a7cf-57239d4ee055")] |
|
24 |
|
|
25 |
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. |
|
26 |
// |
|
27 |
// 주 버전 |
|
28 |
// 부 버전 |
|
29 |
// 빌드 번호 |
|
30 |
// 수정 버전 |
|
31 |
// |
|
32 |
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 |
|
33 |
// 기본값으로 할 수 있습니다. |
|
34 |
// [assembly: AssemblyVersion("1.0.*")] |
|
35 |
[assembly: AssemblyVersion("1.0.0.0")] |
|
36 |
[assembly: AssemblyFileVersion("1.0.0.0")] |
ConvertService/ServiceBase/ErrorNotice/ErrorNotice.cs | ||
---|---|---|
74 | 74 |
this.Exception = "SendNotice Error : " + ex.ToString(); |
75 | 75 |
} |
76 | 76 |
} |
77 |
else |
|
78 |
{ |
|
79 |
Console.WriteLine($"not contatins - current convert item Status is {convertItem.STATUS}"); |
|
80 |
} |
|
77 | 81 |
} |
78 | 82 |
else |
79 | 83 |
{ |
... | ... | |
126 | 130 |
} |
127 | 131 |
message.Subject = "Convert Notice"; |
128 | 132 |
message.IsBodyHtml = true; |
129 |
var body = string.Join("",System.IO.File.ReadAllLines(mailbody.ToString())); |
|
133 |
|
|
134 |
var assemDir = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).Directory; |
|
135 |
var bodytemplatePath = System.IO.Path.Combine(assemDir.FullName, mailbody.ToString()); |
|
136 |
|
|
137 |
var body = string.Join("",System.IO.File.ReadAllLines(bodytemplatePath)); |
|
130 | 138 |
|
131 | 139 |
body = body.Replace("[TITLE]", "Convert Notice"); |
132 | 140 |
body = body.Replace("[time]", convertItem.CREATE_DATETIME.ToString()); |
133 | 141 |
body = body.Replace("[projectno]", convertItem.PROJECT_NO?.ToString()); |
134 | 142 |
body = body.Replace("[documentid]", convertItem.DOCUMENT_ID?.ToString()); |
135 | 143 |
body = body.Replace("[documenturl]", convertItem.DOCUMENT_URL?.ToString()); |
136 |
body = body.Replace("[errorcode]", convertItem.STATUS.ToString());
|
|
144 |
body = body.Replace("[errorcode]", ((Markus.Message.StatusCodeType)convertItem.STATUS).ToString());
|
|
137 | 145 |
body = body.Replace("[message]", convertItem.EXCEPTION?.ToString()); |
138 | 146 |
|
139 | 147 |
message.Body = body; |
... | ... | |
142 | 150 |
client.Send(message); |
143 | 151 |
message.Dispose(); |
144 | 152 |
} |
153 |
else |
|
154 |
{ |
|
155 |
Console.WriteLine($"Parameters miss"); |
|
156 |
foreach (var item in Parameters) |
|
157 |
{ |
|
158 |
Console.WriteLine($"{item.Key} : {item.Value}"); |
|
159 |
} |
|
160 |
} |
|
145 | 161 |
} |
146 | 162 |
} |
147 | 163 |
} |
ConvertService/ServiceBase/Markus.Service.Convert/ConvertService.cs | ||
---|---|---|
24 | 24 |
protected ILog logger; |
25 | 25 |
|
26 | 26 |
readonly ProcessContext ConvertProcessContext; |
27 |
private string gTempFileName; |
|
28 | 27 |
private Markus.SaveTask gSaveTask; |
29 | 28 |
private Markus.MarkusPDF gMarkusPDF; |
30 | 29 |
private string gFontsFolder; |
... | ... | |
144 | 143 |
break; |
145 | 144 |
} |
146 | 145 |
|
146 |
#if PROCESS_TEST |
|
147 |
Console.WriteLine($"send wcf service {e.SaveItem.Status} currentPage : {e.SaveItem.CurrentPage} error message : {(string.IsNullOrWhiteSpace(e.SaveItem.ErrorMessage)?"null":e.SaveItem.ErrorMessage)}"); |
|
148 |
#endif |
|
147 | 149 |
StationServiceClient.ConvertProcessStateAsync(e.SaveItem.Id, (int)e.SaveItem.Status, e.SaveItem.CurrentPage, e.SaveItem.TotalPages, e.SaveItem.ErrorMessage); |
148 |
|
|
150 |
|
|
149 | 151 |
} |
150 | 152 |
catch (Exception ex) |
151 | 153 |
{ |
... | ... | |
154 | 156 |
} |
155 | 157 |
|
156 | 158 |
[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)] |
157 |
public async Task<SaveResult> SetFileAsync()
|
|
159 |
public async Task<SaveItem> SetFileAsync()
|
|
158 | 160 |
{ |
159 |
SaveResult result = new SaveResult(); |
|
160 |
|
|
161 | 161 |
SaveItem saveitem = new SaveItem |
162 | 162 |
{ |
163 | 163 |
Id = ConvertProcessContext.ConvertID, |
... | ... | |
174 | 174 |
|
175 | 175 |
Console.WriteLine($"ConvertID : {ConvertProcessContext.ConvertID} : {StatusCodeType.Wait.ToString()}"); |
176 | 176 |
|
177 |
#else |
|
178 |
StationServiceClient.ConvertProcessState(ConvertProcessContext.ConvertID, (int)StatusCodeType.Wait, 0, 0, ""); |
|
179 | 177 |
#endif |
180 |
result = await ConvertAsync(saveitem); |
|
181 |
#if PROCESS_TEST |
|
178 |
StationServiceClient.ConvertProcessState(ConvertProcessContext.ConvertID, (int)StatusCodeType.Wait, 0, 0, ""); |
|
182 | 179 |
|
183 |
Console.WriteLine($"finish!!!"); |
|
184 |
#else |
|
185 |
StationServiceClient.ConvertFinish(saveitem.Id, (int)result.StatusCode, saveitem.CurrentPage, saveitem.TotalPages, result.Message); |
|
180 |
var result = await ConvertAsync(saveitem); |
|
186 | 181 |
|
187 |
#endif
|
|
188 |
// 플러그인 실행
|
|
182 |
saveitem.Status = result.StatusCode;
|
|
183 |
saveitem.ErrorMessage = result.Message;
|
|
189 | 184 |
#if PROCESS_TEST |
190 | 185 |
|
191 |
Console.WriteLine($"run Plugin : {saveitem.Id}"); |
|
192 |
#endif |
|
193 |
PluginService.Run(saveitem.Id); |
|
186 |
Console.WriteLine($"finish!!!"); |
|
187 |
#endif |
|
194 | 188 |
|
189 |
StationServiceClient.ConvertFinish(saveitem.Id, (int)saveitem.Status, saveitem.CurrentPage, saveitem.TotalPages, saveitem.ErrorMessage); |
|
190 |
|
|
195 | 191 |
} |
196 | 192 |
catch (Exception ex) |
197 | 193 |
{ |
198 |
result.StatusCode = StatusCodeType.Error; |
|
194 |
saveitem.Status = StatusCodeType.Error; |
|
195 |
saveitem.ErrorMessage = ex.ToString(); |
|
199 | 196 |
logger.Error($"File Convert Error", ex); |
200 | 197 |
|
201 | 198 |
#if PROCESS_TEST |
202 | 199 |
|
203 | 200 |
Console.WriteLine($"run Plugin : {saveitem.Id}"); |
204 |
#else |
|
205 |
StationServiceClient.ConvertFinish(saveitem.Id, (int)result.StatusCode, saveitem.CurrentPage, saveitem.TotalPages, $"ConvertService Error {saveitem.Id} {ex.Message} {ex.InnerException?.ToString()}"); |
|
206 | 201 |
#endif |
202 |
logger.Error($"saveitem.Id : {saveitem.Id} , StatusCode:{(int)saveitem.Status}, CurrentPage : {saveitem.CurrentPage}, TotalPages : {saveitem.TotalPages} , Error : {saveitem.ErrorMessage} , inner error : {ex.Message} {ex.InnerException?.ToString()}"); |
|
203 |
StationServiceClient.ConvertFinish(saveitem.Id, (int)saveitem.Status, saveitem.CurrentPage, saveitem.TotalPages, $"ConvertService Error {saveitem.Id} {ex.Message} {ex.InnerException?.ToString()}"); |
|
204 |
|
|
207 | 205 |
} |
208 | 206 |
finally |
209 | 207 |
{ |
210 | 208 |
this.Dispose(); |
211 | 209 |
} |
212 | 210 |
|
213 |
return result; |
|
211 |
// 플러그인 실행 |
|
212 |
#if PROCESS_TEST |
|
213 |
|
|
214 |
Console.WriteLine($"run Plugin : {saveitem.Id}"); |
|
215 |
#endif |
|
216 |
PluginService.Run(saveitem.Id); |
|
217 |
|
|
218 |
return saveitem; |
|
214 | 219 |
} |
215 | 220 |
|
216 | 221 |
[System.Security.Permissions.FileIOPermission(System.Security.Permissions.SecurityAction.LinkDemand)] |
... | ... | |
253 | 258 |
System.IO.Directory.CreateDirectory(saveitem.SavePath); |
254 | 259 |
|
255 | 260 |
//파일 다운로드 |
256 |
if (await DownloadFileAsync(saveitem))
|
|
261 |
if (DownloadFile(saveitem,out string downloadFilePath))
|
|
257 | 262 |
{ |
258 |
gTempFileName = saveitem.PdfFilePath;
|
|
263 |
var status = gMarkusPDF.pdfLoad(downloadFilePath, saveitem.MinimumFontSize, saveitem.UseResolution, gFontsFolder);
|
|
259 | 264 |
|
260 |
if(gTempFileName.ToCharArray().Any(x=>x.IsKor())) |
|
261 |
{ |
|
262 |
gTempFileName = Path.Combine(Path.GetTempPath(), GuidExtension.shortGuid() + ".pdf"); |
|
263 |
|
|
264 |
File.Copy(saveitem.PdfFilePath, gTempFileName,true); |
|
265 |
|
|
266 |
System.Threading.Thread.Sleep(100); |
|
267 |
} |
|
268 |
|
|
269 |
gMarkusPDF.pdfLoad(gTempFileName, saveitem.MinimumFontSize, saveitem.UseResolution, gFontsFolder); |
|
270 |
|
|
271 |
if(gMarkusPDF.PageCount() > 0) |
|
265 |
if (gMarkusPDF.PageCount() > 0) |
|
272 | 266 |
{ |
273 | 267 |
/// 설정된 MultiThreadMaxPages에 따른 컨버터 분기 |
274 | 268 |
//if (gMarkusPDF.PageCount() > ConvertProcessContext.MultiThreadMaxPages) |
275 | 269 |
//{ |
276 | 270 |
// // 큰 사이즈의 파일 컨버팅 |
277 |
result = ConvertBigFileProcess(saveitem); |
|
271 |
result = ConvertBigFileProcess(saveitem,downloadFilePath);
|
|
278 | 272 |
//} |
279 | 273 |
//else |
280 | 274 |
//{ |
... | ... | |
284 | 278 |
// result = gSaveTask.SaveFile(saveitem); |
285 | 279 |
// }), TaskCreationOptions.LongRunning); |
286 | 280 |
//} |
287 |
|
|
288 |
// 파일 체크 후 갯수가 안맞으면 다시 컨버팅한다. |
|
289 |
if (ReConvert < 1 && (result.PageInfoList.Count() != saveitem.TotalPages |
|
290 |
|| Directory.EnumerateFiles(saveitem.SavePath, "*.png").Count() != saveitem.TotalPages |
|
291 |
|| Directory.EnumerateFiles(saveitem.SavePath, "*.jpg").Count() != saveitem.TotalPages)) |
|
281 |
|
|
282 |
if((int)result.StatusCode <= (int)StatusCodeType.Completed) |
|
292 | 283 |
{ |
293 |
result.StatusCode = StatusCodeType.PageError; |
|
294 |
result.Message = LogHelper.GetStack() + " " +"Page Count Error"; |
|
295 |
ReConvert = 1; |
|
296 |
|
|
297 |
result = ConvertBigFileProcess(saveitem); |
|
298 |
} |
|
284 |
// 파일 체크 후 갯수가 안맞으면 다시 컨버팅한다. |
|
285 |
if (ReConvert < 1 && (result.PageInfoList?.Count() != saveitem.TotalPages |
|
286 |
|| Directory.EnumerateFiles(saveitem.SavePath, "*.png").Count() != saveitem.TotalPages |
|
287 |
|| Directory.EnumerateFiles(saveitem.SavePath, "*.jpg").Count() != saveitem.TotalPages)) |
|
288 |
{ |
|
289 |
|
|
290 |
///statuscode가 완료 또는 정상인데 페이지가 맞지 않는 경우 pageError로 처리 |
|
291 |
if (result.StatusCode <= StatusCodeType.Completed) |
|
292 |
{ |
|
293 |
result.StatusCode = StatusCodeType.PageError; |
|
294 |
result.Message = LogHelper.GetStack() + "Page Error : " + result.Message; |
|
295 |
} |
|
299 | 296 |
|
297 |
ReConvert = 1; |
|
300 | 298 |
|
301 |
/// 페이지 정보 저장 |
|
302 |
if (result.PageInfoList?.Count() > 0) |
|
303 |
{ |
|
304 |
bool docSetResult = false; |
|
299 |
result = ConvertBigFileProcess(saveitem, downloadFilePath); |
|
300 |
} |
|
305 | 301 |
|
306 |
using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(ConvertProcessContext.ConnectionString)) |
|
302 |
/// 페이지 정보 저장 |
|
303 |
if (result.PageInfoList?.Count() > 0) |
|
307 | 304 |
{ |
308 |
List<EntityModel.DOCPAGE> docPageList = new List<EntityModel.DOCPAGE>();
|
|
305 |
bool docSetResult = false;
|
|
309 | 306 |
|
310 |
docPageList = result.PageInfoList.Select(f => new EntityModel.DOCPAGE
|
|
307 |
try
|
|
311 | 308 |
{ |
312 |
ID = GuidExtension.shortGuid(), |
|
313 |
PAGE_WIDTH = f.Width.ToString(), |
|
314 |
PAGE_HEIGHT = f.Height.ToString(), |
|
315 |
PAGE_NUMBER = f.PageNo |
|
316 |
}).ToList(); |
|
317 |
|
|
318 |
docSetResult = database.SetDocumentInfo(saveitem.Id, result.PageInfoList.Count, docPageList); |
|
319 |
} |
|
309 |
using (Markus.Service.DataBase.ConvertDatabase database = new Markus.Service.DataBase.ConvertDatabase(ConvertProcessContext.ConnectionString)) |
|
310 |
{ |
|
311 |
List<EntityModel.DOCPAGE> docPageList = new List<EntityModel.DOCPAGE>(); |
|
312 |
|
|
313 |
docPageList = result.PageInfoList.Select(f => new EntityModel.DOCPAGE |
|
314 |
{ |
|
315 |
ID = GuidExtension.shortGuid(), |
|
316 |
PAGE_WIDTH = f.Width.ToString(), |
|
317 |
PAGE_HEIGHT = f.Height.ToString(), |
|
318 |
PAGE_NUMBER = f.PageNo |
|
319 |
}).ToList(); |
|
320 |
|
|
321 |
docSetResult = database.SetDocumentInfo(saveitem.Id, result.PageInfoList.Count, docPageList); |
|
322 |
} |
|
323 |
} |
|
324 |
catch (Exception ex) |
|
325 |
{ |
|
326 |
result.Message += ex.ToString(); |
|
327 |
} |
|
320 | 328 |
|
321 |
if (docSetResult) |
|
322 |
{ |
|
323 |
result.StatusCode = StatusCodeType.Completed; |
|
329 |
if (docSetResult) |
|
330 |
{ |
|
331 |
result.StatusCode = StatusCodeType.Completed; |
|
332 |
} |
|
333 |
else |
|
334 |
{ |
|
335 |
result.StatusCode = StatusCodeType.FileError; |
|
336 |
result.Message = LogHelper.GetStack() + " " + $"Doc Set Error. {result.Message}"; |
|
337 |
} |
|
324 | 338 |
} |
325 | 339 |
else |
326 | 340 |
{ |
327 | 341 |
result.StatusCode = StatusCodeType.FileError; |
328 |
result.Message = LogHelper.GetStack() + " " + $"Doc Set Error. {result.Message}";
|
|
342 |
result.Message = LogHelper.GetStack() + " " + $"Page List Get Error. {result.Message} ";
|
|
329 | 343 |
} |
330 | 344 |
} |
331 |
else |
|
332 |
{ |
|
333 |
result.StatusCode = StatusCodeType.FileError; |
|
334 |
result.Message = LogHelper.GetStack() + " " + $"Page List Get Error. {result.Message} "; |
|
335 |
} |
|
336 | 345 |
} |
337 | 346 |
else |
338 | 347 |
{ |
339 |
result.Message = $"File Error Page Count:0 - File path : { saveitem.PdfFilePath}";
|
|
340 |
result.StatusCode = StatusCodeType.FileError;
|
|
348 |
result.Message = $"{status.Message}. File path : { saveitem.PdfFilePath}";
|
|
349 |
result.StatusCode = status.StatusCode;
|
|
341 | 350 |
} |
342 |
|
|
343 | 351 |
} |
344 | 352 |
else |
345 | 353 |
{ |
... | ... | |
349 | 357 |
} |
350 | 358 |
catch (Exception ex) |
351 | 359 |
{ |
352 |
result.Message = LogHelper.GetStack() + " " +"ConvertService Convert Error" + ex.Message; |
|
360 |
result.Message = LogHelper.GetStack() + " " +"ConvertService Convert Error " + ex.Message;
|
|
353 | 361 |
result.StatusCode = StatusCodeType.Error; |
354 | 362 |
|
355 | 363 |
logger.Error(ex); |
356 | 364 |
} |
357 | 365 |
finally |
358 | 366 |
{ |
367 |
if (gMarkusPDF != null) |
|
368 |
{ |
|
369 |
gMarkusPDF.Dispose(); |
|
370 |
gMarkusPDF = null; |
|
371 |
} |
|
359 | 372 |
|
360 | 373 |
} |
361 | 374 |
|
362 | 375 |
return result; |
363 | 376 |
} |
364 | 377 |
|
378 |
public bool DownloadFile(SaveItem saveItem,out string DownloadFilePath) |
|
379 |
{ |
|
380 |
bool result = false; |
|
381 |
string downloadFilePath = null; |
|
382 |
try |
|
383 |
{ |
|
384 |
result = DownloadPluginService.Download(saveItem.PdfFilePath, saveItem.SavePath, ref downloadFilePath); |
|
385 |
} |
|
386 |
catch (Exception ex) |
|
387 |
{ |
|
388 |
logger.Error(ex); |
|
389 |
throw new Exception(ex.ToString()); |
|
390 |
} |
|
391 |
|
|
392 |
DownloadFilePath = downloadFilePath; |
|
393 |
return result; |
|
394 |
} |
|
395 |
|
|
365 | 396 |
/// <summary> |
366 | 397 |
/// 파일 다운로드 |
367 | 398 |
/// </summary> |
... | ... | |
521 | 552 |
/// </summary> |
522 | 553 |
/// <param name="saveitem"></param> |
523 | 554 |
/// <returns></returns> |
524 |
private SaveResult ConvertBigFileProcess(SaveItem saveitem) |
|
555 |
private SaveResult ConvertBigFileProcess(SaveItem saveitem,string downloadFilePath)
|
|
525 | 556 |
{ |
526 | 557 |
SaveResult result = new SaveResult(); |
527 | 558 |
|
... | ... | |
536 | 567 |
string saveFile = Path.Combine(saveitem.SavePath, $"{currentPageNo}.png"); |
537 | 568 |
|
538 | 569 |
if (ReConvert < 1 || (ReConvert == 1 && !File.Exists(saveFile))) |
539 |
{ |
|
540 |
|
|
570 |
{ |
|
541 | 571 |
var saveResult = gMarkusPDF.SavePage(currentPageNo, saveFile); |
542 | 572 |
|
543 |
saveitem.Status = StatusCodeType.Saving; |
|
544 |
saveitem.CurrentPage = currentPageNo; |
|
545 |
saveitem.ErrorMessage = saveResult.Message; |
|
573 |
if(saveResult.StatusCode == StatusCodeType.Completed) |
|
574 |
{ |
|
575 |
saveitem.Status = StatusCodeType.Saving; |
|
576 |
saveitem.CurrentPage = currentPageNo; |
|
577 |
saveitem.ErrorMessage = saveResult.Message; |
|
546 | 578 |
|
547 |
int pageListCount = 0; |
|
579 |
int pageListCount = 0;
|
|
548 | 580 |
|
549 |
if(result.PageInfoList != null)
|
|
550 |
{ |
|
551 |
pageListCount = result.PageInfoList.Count(f => f.PageNo == saveResult.SavePageInfo.PageNo); |
|
552 |
} |
|
553 |
|
|
554 |
if (pageListCount == 0) |
|
555 |
{ |
|
556 |
result.PageInfoAdd(saveResult.SavePageInfo); |
|
557 |
} |
|
581 |
if (result.PageInfoList != null)
|
|
582 |
{
|
|
583 |
pageListCount = result.PageInfoList.Count(f => f.PageNo == saveResult.SavePageInfo.PageNo);
|
|
584 |
}
|
|
585 |
|
|
586 |
if (pageListCount == 0)
|
|
587 |
{
|
|
588 |
result.PageInfoAdd(saveResult.SavePageInfo);
|
|
589 |
}
|
|
558 | 590 |
|
559 |
MarkusPdfStateChangeEvent(this, new StateEventArgs(saveitem)); |
|
560 |
Console.WriteLine($"CurrentPage : {currentPageNo}"); |
|
591 |
MarkusPdfStateChangeEvent(this, new StateEventArgs(saveitem));
|
|
592 |
Console.WriteLine($"CurrentPage : {currentPageNo}");
|
|
561 | 593 |
|
562 |
/// 설정된 최대 페이지이거나 설정된 메모리보다 크면 릴리즈 |
|
563 |
if ((currentPageNo % ConvertProcessContext.MultiThreadMaxPages == 0 && ConvertProcessContext.MultiThreadMaxPages > 0)
|
|
564 |
|| ConvertProcessContext.ReleaseWorkMemory < Environment.WorkingSet) |
|
565 |
{ |
|
566 |
Console.WriteLine($"physical memory : {Environment.WorkingSet}"); |
|
594 |
/// 설정된 최대 페이지이거나 설정된 메모리보다 크면 릴리즈
|
|
595 |
if ((currentPageNo % ConvertProcessContext.MultiThreadMaxPages == 0 && ConvertProcessContext.MultiThreadMaxPages > 0)
|
|
596 |
|| ConvertProcessContext.ReleaseWorkMemory < Environment.WorkingSet)
|
|
597 |
{
|
|
598 |
Console.WriteLine($"physical memory : {Environment.WorkingSet}");
|
|
567 | 599 |
|
568 |
gMarkusPDF.Dispose(); |
|
569 |
gMarkusPDF = null; |
|
570 |
System.Threading.Thread.SpinWait(5); |
|
600 |
gMarkusPDF.Dispose();
|
|
601 |
gMarkusPDF = null;
|
|
602 |
System.Threading.Thread.SpinWait(5);
|
|
571 | 603 |
|
572 |
gMarkusPDF = new MarkusPDF(); |
|
573 |
gMarkusPDF.pdfLoad(gTempFileName, saveitem.MinimumFontSize, saveitem.UseResolution, gFontsFolder);
|
|
574 |
} |
|
604 |
gMarkusPDF = new MarkusPDF();
|
|
605 |
gMarkusPDF.pdfLoad(downloadFilePath, saveitem.MinimumFontSize, saveitem.UseResolution, gFontsFolder);
|
|
606 |
}
|
|
575 | 607 |
|
576 |
System.Threading.Thread.SpinWait(2); |
|
608 |
System.Threading.Thread.SpinWait(2); |
|
609 |
} |
|
610 |
else |
|
611 |
{ |
|
612 |
saveitem.Status = saveResult.StatusCode; |
|
613 |
saveitem.CurrentPage = currentPageNo; |
|
614 |
saveitem.ErrorMessage = saveResult.Message; |
|
615 |
|
|
616 |
result.StatusCode = saveitem.Status; |
|
617 |
result.Message = saveitem.ErrorMessage; |
|
618 |
|
|
619 |
MarkusPdfStateChangeEvent(this, new StateEventArgs(saveitem)); |
|
620 |
Console.WriteLine($"CurrentPage : {currentPageNo}"); |
|
621 |
Console.WriteLine($"convert ID : {saveitem.Id}"); |
|
622 |
Console.WriteLine($"pdf file Path : {saveitem.PdfFilePath}"); |
|
623 |
Console.WriteLine($"save file path : {saveitem.SavePath}"); |
|
624 |
Console.WriteLine($"last status code : {saveitem.Status}"); |
|
625 |
Console.WriteLine($"error message : {saveitem.ErrorMessage}"); |
|
626 |
break; |
|
627 |
} |
|
577 | 628 |
} |
578 | 629 |
} |
579 | 630 |
catch (Exception ex) |
... | ... | |
588 | 639 |
} |
589 | 640 |
|
590 | 641 |
gMarkusPDF = new MarkusPDF(); |
591 |
gMarkusPDF.pdfLoad(gTempFileName, saveitem.MinimumFontSize, saveitem.UseResolution, gFontsFolder);
|
|
642 |
gMarkusPDF.pdfLoad(downloadFilePath, saveitem.MinimumFontSize, saveitem.UseResolution, gFontsFolder);
|
|
592 | 643 |
|
593 | 644 |
currentPageNo = currentPageNo - 1; |
594 | 645 |
} |
... | ... | |
597 | 648 |
|
598 | 649 |
} |
599 | 650 |
} |
600 |
|
|
601 |
result.StatusCode = StatusCodeType.Completed; |
|
602 | 651 |
} |
603 | 652 |
catch (Exception ex) |
604 | 653 |
{ |
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 log4net; |
|
10 | 9 |
|
11 | 10 |
namespace Markus.Service |
12 | 11 |
{ |
... | ... | |
33 | 32 |
} |
34 | 33 |
else |
35 | 34 |
{ |
36 |
error += $"plugin : {item.Name}{Environment.NewLine}{item.Exception}"; |
|
35 |
var msg = $" not working {item.Name} {item.Exception}"; |
|
36 |
Console.WriteLine(msg); |
|
37 |
error += msg; |
|
37 | 38 |
} |
38 | 39 |
} |
39 | 40 |
|
40 | 41 |
if (!result) |
41 | 42 |
{ |
42 |
throw new Exception(error); |
|
43 |
throw new Exception("download plugin Error : " + error);
|
|
43 | 44 |
} |
44 | 45 |
} |
46 |
else |
|
47 |
{ |
|
48 |
throw new Exception("plugins is null"); |
|
49 |
} |
|
45 | 50 |
|
46 | 51 |
return result; |
47 | 52 |
} |
ConvertService/ServiceBase/Markus.Service.Convert/Markus.Service.Convert.csproj | ||
---|---|---|
89 | 89 |
<Reference Include="Markus.Message, Version=1.5.5.0, Culture=neutral, processorArchitecture=MSIL"> |
90 | 90 |
<HintPath>..\packages\Markus.Message.1.5.5\lib\net45\Markus.Message.dll</HintPath> |
91 | 91 |
</Reference> |
92 |
<Reference Include="MarkusPDF, Version=1.0.8301.29734, Culture=neutral, processorArchitecture=AMD64">
|
|
93 |
<HintPath>..\packages\MarkusPDF.2.1.0\lib\net45\MarkusPDF.dll</HintPath>
|
|
92 |
<Reference Include="MarkusPDF, Version=1.0.8312.24798, Culture=neutral, processorArchitecture=AMD64">
|
|
93 |
<HintPath>..\packages\MarkusPDF.2.2.0\lib\net45\MarkusPDF.dll</HintPath>
|
|
94 | 94 |
</Reference> |
95 | 95 |
<Reference Include="RestSharp, Version=106.12.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL"> |
96 | 96 |
<HintPath>..\packages\RestSharp.106.12.0\lib\net452\RestSharp.dll</HintPath> |
ConvertService/ServiceBase/Markus.Service.Convert/Plugin.cs | ||
---|---|---|
27 | 27 |
{ |
28 | 28 |
foreach (var item in plugins) |
29 | 29 |
{ |
30 |
Dictionary<string, object> parameters = new Dictionary<string, object>(); |
|
30 |
try |
|
31 |
{ |
|
32 |
Dictionary<string, object> parameters = new Dictionary<string, object>(); |
|
31 | 33 |
|
32 |
var sections = config.Sections.Where(x => x.SectionName == item.Name); |
|
34 |
var sections = config.Sections.Where(x => x.SectionName == item.Name);
|
|
33 | 35 |
|
34 |
if (sections.Count() > 0) |
|
35 |
{ |
|
36 |
foreach (var param in sections.First().Keys) |
|
36 |
if (sections.Count() > 0) |
|
37 | 37 |
{ |
38 |
parameters.Add(param.Name, param.Content); |
|
39 |
} |
|
40 |
} |
|
38 |
foreach (var param in sections.First().Keys) |
|
39 |
{ |
|
40 |
parameters.Add(param.Name, param.Content); |
|
41 |
Console.WriteLine($"{param.Name}: {param.Content}"); |
|
42 |
} |
|
41 | 43 |
|
42 |
var pluginResult = item.Do(ConvertID, parameters); |
|
44 |
Console.WriteLine($"{item.Name}"); |
|
45 |
var pluginResult = item.Do(ConvertID, parameters); |
|
43 | 46 |
|
44 |
if (!pluginResult) |
|
45 |
{ |
|
47 |
Console.WriteLine($"{item.Exception}"); |
|
48 |
if (!pluginResult) |
|
49 |
{ |
|
50 |
Exception innerException = null; |
|
46 | 51 |
|
47 |
throw new Exception($"Markus.Service.ConvertProcess Error ConvertId : {ConvertID} PlugIn Error : ", new Exception(item.Exception.ToString())); |
|
52 |
if (!string.IsNullOrWhiteSpace(item.Exception)) |
|
53 |
{ |
|
54 |
innerException = new Exception(item.Exception); |
|
55 |
} |
|
56 |
|
|
57 |
throw new Exception($"Plugin run Error ConvertId : {ConvertID} {item.Name}", innerException); |
|
58 |
} |
|
59 |
} |
|
60 |
} |
|
61 |
catch (Exception ex) |
|
62 |
{ |
|
63 |
throw new Exception($"PlugIn run Error :{ConvertID} {item.Name}", ex); |
|
48 | 64 |
} |
49 | 65 |
} |
50 | 66 |
} |
ConvertService/ServiceBase/Markus.Service.Convert/Properties/AssemblyInfo.cs | ||
---|---|---|
32 | 32 |
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 |
33 | 33 |
// 기본값으로 할 수 있습니다. |
34 | 34 |
// [assembly: AssemblyVersion("1.0.*")] |
35 |
[assembly: AssemblyVersion("2.5.6.0")]
|
|
36 |
[assembly: AssemblyFileVersion("2.5.6.0")]
|
|
35 |
[assembly: AssemblyVersion("3.0.0.0")]
|
|
36 |
[assembly: AssemblyFileVersion("3.0.0.0")]
|
|
37 | 37 |
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)] |
ConvertService/ServiceBase/Markus.Service.Convert/packages.config | ||
---|---|---|
4 | 4 |
<package id="log4net" version="2.0.8" targetFramework="net45" /> |
5 | 5 |
<package id="Markus.Message" version="1.5.5" targetFramework="net452" /> |
6 | 6 |
<package id="MarkusDatabase" version="1.8.0" targetFramework="net45" developmentDependency="true" /> |
7 |
<package id="MarkusPDF" version="2.1.0" targetFramework="net452" />
|
|
7 |
<package id="MarkusPDF" version="2.2.0" targetFramework="net452" />
|
|
8 | 8 |
<package id="Microsoft.CSharp" version="4.5.0" targetFramework="net45" /> |
9 | 9 |
<package id="RestSharp" version="106.12.0" targetFramework="net452" /> |
10 | 10 |
<package id="Salaros.ConfigParser" version="0.3.4" targetFramework="net45" /> |
ConvertService/ServiceBase/Markus.Service.ConvertProcess/Markus.Service.ConvertProcess.csproj | ||
---|---|---|
70 | 70 |
</PropertyGroup> |
71 | 71 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ConvertProcessTest|x64'"> |
72 | 72 |
<DebugSymbols>true</DebugSymbols> |
73 |
<OutputPath>bin\x64\ConvertProcessTest\</OutputPath>
|
|
73 |
<OutputPath>bin\x64\PROCESS_TEST\</OutputPath>
|
|
74 | 74 |
<DefineConstants>TRACE;DEBUG;PROCESS_TEST</DefineConstants> |
75 | 75 |
<DebugType>full</DebugType> |
76 | 76 |
<PlatformTarget>x64</PlatformTarget> |
... | ... | |
79 | 79 |
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |
80 | 80 |
<Prefer32Bit>true</Prefer32Bit> |
81 | 81 |
</PropertyGroup> |
82 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseAll|AnyCPU'"> |
|
83 |
<OutputPath>bin\ReleaseAll\</OutputPath> |
|
84 |
<DefineConstants>TRACE</DefineConstants> |
|
85 |
<Optimize>true</Optimize> |
|
86 |
<DebugType>pdbonly</DebugType> |
|
87 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
88 |
<LangVersion>7.3</LangVersion> |
|
89 |
<ErrorReport>prompt</ErrorReport> |
|
90 |
<Prefer32Bit>true</Prefer32Bit> |
|
91 |
</PropertyGroup> |
|
92 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseAll|x64'"> |
|
93 |
<OutputPath>..\publish\ConvertProcess\</OutputPath> |
|
94 |
<DefineConstants>TRACE</DefineConstants> |
|
95 |
<DebugType>pdbonly</DebugType> |
|
96 |
<PlatformTarget>x64</PlatformTarget> |
|
97 |
<LangVersion>7.3</LangVersion> |
|
98 |
<ErrorReport>prompt</ErrorReport> |
|
99 |
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |
|
100 |
<Prefer32Bit>true</Prefer32Bit> |
|
101 |
</PropertyGroup> |
|
82 | 102 |
<ItemGroup> |
83 | 103 |
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> |
84 | 104 |
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath> |
... | ... | |
163 | 183 |
</ItemGroup> |
164 | 184 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
165 | 185 |
<PropertyGroup> |
166 |
<PreBuildEvent>if $(ConfigurationName) == ConvertProcessTest ( |
|
167 |
xcopy /y /d "$(ProjectDir)..\libpthread\$(PlatformName)\libpthread.dll" "$(ProjectDir)$(OutDir)" |
|
168 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\Plugin\ErrorNotice\*.*" "$(ProjectDir)$(OutDir)Plugin\ErrorNotice" |
|
186 |
<PreBuildEvent>xcopy /y /d "$(ProjectDir)..\libpthread\$(PlatformName)\libpthread.dll" "$(ProjectDir)$(OutDir)" |
|
187 |
|
|
188 |
if $(ConfigurationName) == ConvertProcessTest ( |
|
189 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\Plugin\*.*" "$(ProjectDir)$(OutDir)Plugin" |
|
190 |
rem xcopy /y /d /I /s "$(ProjectDir)..\publish\Plugin\ErrorNotice\*.*" "$(ProjectDir)$(OutDir)Plugin\ErrorNotice" |
|
169 | 191 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\DownloadPlugin\DirectDownload\*.*" "$(ProjectDir)$(OutDir)DownloadPlugin\DirectDownload" |
170 | 192 |
) ELSE ( |
171 |
xcopy /y /d "$(ProjectDir)..\libpthread\$(PlatformName)\libpthread.dll" "$(ProjectDir)$(OutDir)" |
|
172 | 193 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\Plugin\*.*" "$(ProjectDir)$(OutDir)Plugin" |
173 | 194 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\DownloadPlugin\*.*" "$(ProjectDir)$(OutDir)DownloadPlugin" |
174 | 195 |
)</PreBuildEvent> |
ConvertService/ServiceBase/Markus.Service.ConvertProcess/Program.cs | ||
---|---|---|
26 | 26 |
{ |
27 | 27 |
try |
28 | 28 |
{ |
29 |
logger = LogManager.GetLogger(typeof(Convert));
|
|
30 |
#if DEBUG
|
|
31 |
args = new[] { "11cb3ebc-2323-3b12-1a3e-87a783579ec3", "wFMd/53AD9totL5hkl6/NF+TbGETdz+qAVetxtTABjxpsNuMYwnuvgCxaD7Yj+k9POikXsP/zCg3AUasWZI9JhR5umwx/zcylkulmw2zQr2dm7oI4M5+8TnkUyA6RvXrbgrN8gnpKZJdops80Kf9mHkVy8z36FxbL+lYnIokahZSNbi5RgZlOxHmoH73PnHtjRFQa/f6VsGGD3FzBTHDNpZdJT8zrW8WGQFfTM8QukmzRMg4I+nQD3Qu0AWJVxCkmyJpEbjJIuFEpe13YCv53A0NjXLiNWrBB1cRcZ+Y6Do21bs8kxWQZsSZ3e/3zP5UPrpPpurz7kNGr+kX29v9/ggl2JMnrUOQX1Z1KCKHnI/YB8CbzBkxB0ZimJB4GkXc7kSvovMatP1oAtcjFawPhJXvFma8hwJocByo4YQ2EjJ4tSnJcpPJjKk+0ivMRK9+MOUvVSm1Ysm+IrG7GFTB4UwtmzJX1VKYlFm2iAd2wk4g7/ekwzpvWyiG/QrYjHDFILpI2MIOpMic/P6fvV39EDnpLd5k4j/9Pf2kOdISs+s5i6eeAHdPSP2NulcBCoB3jLZe3VZtrHA944inEPBM70Z/kjhm/21HUoKyzjp+o67eXBFNlPmLFFJ7P+uJOJ8LzrrgIpmPomNS5e5NuRqNgESzhBv5NTY0GCnGeUSVY/lWUgouOR3d/AyHJirsKRAxfIQA1mux4ehr9zLzWSuXA8uJTbf57MYMx3B4ldecQneEovI0gdAgWB1c0HT6Agov44xRjczw18AtGDIDYEWiWjroAAF+AyXZu/4gy3oWGT7QkfsByOguNzNnfWav7x015FJjDRClXnX1iS8/791LJJwQiUDC0VeqfVbIMYUc/YRfzuX3vmOIN6LJ2WoO2aXfd7+bhfln+nmfQ1XADeDDIpV6yjAsvjYR1o4saCTPyTxbrSxbT+nPGnglbD/r0PfckECibCYSfnx1JBNI96+gE3i+oY++leYc5AlnxGX7a+mcrRF7GNe9/0iEU2c8ZO/8A7sAafV7CwSE+FbVkktz1wX+fu/NuruJxUvKKMu7bZtjWMWEK9GIO0EhRcIOHYfds63fiVTAfG2F7HSab2SOnwR17u+1e2Xk01thXYn4Dys=" };
|
|
29 |
logger = LogManager.GetLogger(typeof(Convert)); |
|
30 |
#if PROCESS_TEST
|
|
31 |
args = new[] { "3054E239509C4ECCA223CB0C1FB393F8", "qjFwF/SI2PYVQtpVawnzYgN58eQ4aWgNDwMcLMJYQebeATd6eFMdM+0H1KgpOx8RVD4Sg00Gh+5Dfe+q/qwAeEtEk9++mw0U3tQx6J2M27v9b0WgLdjBR/5SKAqJzJ4uzpsboOQOxLg+sWtT+ttvwLNCLvfqcv9Gyw9nAHpmEbl63QP8Y0mLyLyAERGWkY8yK6f5aabgYUakNZieojJiQcvfFiKE3Oot3qmglXla8C6TG/+iA2dILAUSdIsVtDzR7ZxsjJOxPXhbETZNFSAA8qVDKPAS6MR9bls6XLLoEiRxxO+WKHdsa3QFAD9nxzvsV1GQaY7oTAKLhMBcvMKKtn6FkbNJXLwU0NT+/7RMWJDB6vz7KFzimbz7yRKUf1jvxQn22B8k4uVqtGP2Do6iV3GM2lkYqhvwks3i5euiOaBJYo5M90FkQIXgsd+YqM5g2OvNTfqlTFBurOY4K5LVPEc1ll6VGUApaOwau3TxOYAAf9rKf1UspDJKNWZplThCIgqtxePTa5oyE9h51MdVu5ugv7vzCwqBBa8SiCLbbO0gwMYRhhO+ltZBbx4sghCVUH62pae8wGghOyz8OMvHPA2g6w0nw2lIx7TZ7qbjV9knajzU7IZ9JgGj/PrBatlXRs0FTp+pSl9OwecwmM87X3ezVjjOc+8CULo9OhnH8U/tC2yr9AbbaIUi7HuY832wzpV/H8HOOo9w+19SQ8P6K7SYuB5ZirSwuAJzdkw7Q07Ih80TiaLjJIxCHbPpjAL4+RY5W7VarQEG6GJiIw8vAyDusuctHrfDZQDj5ZEPWC2vJQjA5WWADNYGfXu5iSO4jG9ifjmaI3QHWChfFFXsb6/O+6XSMP43ALGO0XB2o64CV+YmvC0VN3S4naIALh9zb5LEDvcZ1GSAk3AszUjVKehffl9jDE5hmCVIh0wSR4bcX4yqova6mrqiFocaXHmrZEfF62EXiOVcW24fqwMVqkaltMgj2aJThWzWoiSXsPI6dnpVzKL9oibMiB3We0+xIyqNvrRJTW4XaHEegShmGD4KbFFE4OnTaCnoQ4mEI5mpp9V3ZWFortsXL5G6hdQT3dOIffmY/3ha2KYMZQ/k7w==" };
|
|
32 | 32 |
#endif |
33 | 33 |
if (args.Length == 2) |
34 | 34 |
{ |
... | ... | |
37 | 37 |
logger.Info($"Markus.Service.ConvertProcess ConvertID :{args[0]} param : {args[1]}"); |
38 | 38 |
|
39 | 39 |
convetContext = ObjectToBytesStringConvert.BytesStringToObject<ProcessContext>(AESEncrypter.Decrypt(args[1])); |
40 |
#if PROCESS_TEST |
|
41 |
convetContext.ConvertID = "E00FF44FA2994A2F83D095902791B0BE"; |
|
42 |
convetContext.OriginFilePath = "http://192.168.0.67:5977/PDF/000005_app/test3.pdf"; |
|
43 |
convetContext.ServiceStationUri = "http://localhost:9991/StationService"; |
|
44 |
#endif |
|
40 | 45 |
|
41 | 46 |
convert = new Service.Convert.ConvertService(convetContext); |
42 | 47 |
|
43 | 48 |
var convertFile = convert.SetFileAsync(); |
44 | 49 |
convertFile.Wait(); |
45 | 50 |
|
46 |
if(convertFile.Result.StatusCode != StatusCodeType.Completed)
|
|
51 |
if(convertFile.Result.Status != StatusCodeType.Completed) |
|
47 | 52 |
{ |
48 | 53 |
logger.Error($"Markus.Service.ConvertProcess Error ConvertId : {convetContext.ConvertID}"); |
49 | 54 |
} |
... | ... | |
63 | 68 |
GC.Collect(); |
64 | 69 |
GC.WaitForPendingFinalizers(); |
65 | 70 |
GC.Collect(); |
66 |
|
|
71 |
#if PROCESS_TEST |
|
72 |
Console.ReadLine(); |
|
73 |
#else |
|
67 | 74 |
Application.Exit(); |
75 |
#endif |
|
68 | 76 |
} |
69 | 77 |
} |
70 | 78 |
} |
ConvertService/ServiceBase/Markus.Service.ConvertProcess/Properties/AssemblyInfo.cs | ||
---|---|---|
32 | 32 |
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 |
33 | 33 |
// 지정되도록 할 수 있습니다. |
34 | 34 |
// [assembly: AssemblyVersion("1.0.*")] |
35 |
[assembly: AssemblyVersion("2.5.6.0")]
|
|
36 |
[assembly: AssemblyFileVersion("2.5.6.0")]
|
|
35 |
[assembly: AssemblyVersion("3.0.0.0")]
|
|
36 |
[assembly: AssemblyFileVersion("3.0.0.0")]
|
|
37 | 37 |
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)] |
ConvertService/ServiceBase/Markus.Service.DataBase/ConvertDatabase.cs | ||
---|---|---|
63 | 63 |
x => |
64 | 64 |
//projectList.Contains(x.PROJECT_NO) && x.RECONVERTER < 2 && |
65 | 65 |
x.RECONVERTER < 2 && |
66 |
(x.STATUS == (int)StatusCodeType.None || x.STATUS == (int)StatusCodeType.FileError || x.STATUS == (int)StatusCodeType.Error))
|
|
66 |
(x.STATUS == (int)StatusCodeType.None || x.STATUS > (int)StatusCodeType.Completed))
|
|
67 | 67 |
.GroupBy(x => x.DOCUMENT_ID).Select(x => x.FirstOrDefault()) |
68 | 68 |
.Take(TakeCount); |
69 | 69 |
|
... | ... | |
998 | 998 |
|
999 | 999 |
|
1000 | 1000 |
} |
1001 |
else |
|
1002 |
{ |
|
1003 |
throw new Exception($"SetDocumentInfo :{ConvertID} CONVERTER_DOC not found "); |
|
1004 |
} |
|
1001 | 1005 |
|
1002 | 1006 |
return result; |
1003 | 1007 |
} |
ConvertService/ServiceBase/Markus.Service.Extensions/Exntensions/SytemNet.cs | ||
---|---|---|
70 | 70 |
} |
71 | 71 |
} |
72 | 72 |
} |
73 |
catch (Exception) |
|
73 |
catch (Exception ex)
|
|
74 | 74 |
{ |
75 |
|
|
75 |
Console.WriteLine(ex); |
|
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
return result; |
ConvertService/ServiceBase/Markus.Service.Station/Markus.Service.Station.csproj | ||
---|---|---|
75 | 75 |
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |
76 | 76 |
<Prefer32Bit>true</Prefer32Bit> |
77 | 77 |
</PropertyGroup> |
78 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseAll|AnyCPU'"> |
|
79 |
<OutputPath>bin\ReleaseAll\</OutputPath> |
|
80 |
<DefineConstants>TRACE</DefineConstants> |
|
81 |
<Optimize>true</Optimize> |
|
82 |
<DebugType>pdbonly</DebugType> |
|
83 |
<PlatformTarget>AnyCPU</PlatformTarget> |
|
84 |
<LangVersion>7.3</LangVersion> |
|
85 |
<ErrorReport>prompt</ErrorReport> |
|
86 |
</PropertyGroup> |
|
87 |
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseAll|x64'"> |
|
88 |
<OutputPath>..\publish\ServiceStation\</OutputPath> |
|
89 |
<DefineConstants>TRACE</DefineConstants> |
|
90 |
<Optimize>true</Optimize> |
|
91 |
<DebugType>pdbonly</DebugType> |
|
92 |
<PlatformTarget>x64</PlatformTarget> |
|
93 |
<LangVersion>7.3</LangVersion> |
|
94 |
<ErrorReport>prompt</ErrorReport> |
|
95 |
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> |
|
96 |
<Prefer32Bit>true</Prefer32Bit> |
|
97 |
</PropertyGroup> |
|
78 | 98 |
<ItemGroup> |
79 | 99 |
<Reference Include="ConfigParser, Version=0.3.4.3, Culture=neutral, processorArchitecture=MSIL"> |
80 | 100 |
<HintPath>..\packages\Salaros.ConfigParser.0.3.4\lib\net45\ConfigParser.dll</HintPath> |
... | ... | |
160 | 180 |
<None Include="obfuscar.xml"> |
161 | 181 |
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
162 | 182 |
</None> |
163 |
<Content Include="ServiceStation_DEBUG.ini">
|
|
183 |
<None Include="ServiceStation_DEBUG.ini">
|
|
164 | 184 |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
165 |
</Content>
|
|
185 |
</None>
|
|
166 | 186 |
<None Include="Properties\DataSources\Markus.Service.IWcfService.Item.datasource" /> |
167 |
<Content Include="ServiceStation.ini">
|
|
187 |
<None Include="ServiceStation.ini">
|
|
168 | 188 |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
169 |
</Content>
|
|
170 |
<Content Include="Plugin.ini">
|
|
189 |
</None>
|
|
190 |
<None Include="Plugin.ini">
|
|
171 | 191 |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
172 |
</Content>
|
|
192 |
</None>
|
|
173 | 193 |
</ItemGroup> |
174 | 194 |
<ItemGroup> |
175 | 195 |
<EmbeddedResource Include="ProjectInstaller.resx"> |
... | ... | |
225 | 245 |
</ItemGroup> |
226 | 246 |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
227 | 247 |
<PropertyGroup> |
228 |
<PreBuildEvent>xcopy /y /d /I "$(ProjectDir)..\publish\Plugin\*.*" "$(ProjectDir)$(OutDir)Plugin"</PreBuildEvent> |
|
248 |
<PreBuildEvent>if $(ConfigurationName) == Release ( |
|
249 |
xcopy /y /d /I "$(ProjectDir)..\publish\Plugin\*.*" "$(ProjectDir)$(OutDir)Plugin" |
|
250 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\DownloadPlugin\*.*" "$(ProjectDir)$(OutDir)DownloadPlugin" |
|
251 |
) |
|
252 |
|
|
253 |
if $(ConfigurationName) == ReleaseAll ( |
|
254 |
xcopy /y /d /I "$(ProjectDir)..\publish\Plugin\*.*" "$(ProjectDir)$(OutDir)Plugin" |
|
255 |
xcopy /y /d /I /s "$(ProjectDir)..\publish\DownloadPlugin\*.*" "$(ProjectDir)$(OutDir)DownloadPlugin" |
|
256 |
)</PreBuildEvent> |
|
229 | 257 |
</PropertyGroup> |
230 | 258 |
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
231 | 259 |
<PropertyGroup> |
ConvertService/ServiceBase/Markus.Service.Station/Plugin.ini | ||
---|---|---|
1 | 1 |
#해당 플러그인에 전달되는 parameter |
2 |
[PemssDocumentInfo] |
|
3 |
PEMSS_SERVICE = http://localhost:13009/PemssService.svc |
|
2 |
#[PemssDocumentInfo]
|
|
3 |
#PEMSS_SERVICE = http://localhost:13009/PemssService.svc
|
|
4 | 4 |
# remote test MARKUS_V3 |
5 | 5 |
#MARKUS_ConnectionString = ScTg8MgTdbARVQXhb1K9YI3/6emjnMuODvTWZ+UnUZQ8z/Gv4TksSLRn84HTZiC5pT5Vi9KdIFiJ/icpeXrUfa2LTnWdibJ7Oz+4QcYCftqVNPaS3nbiAo67l93XLRVqCpyt4tTSgwhRhdJob48gZhx+zmvoKmAwBR/ofCam3SNjx85gHFWc+gFffVOACIGbvM940SGroUFzK85kDd7Xlg== |
6 | 6 |
|
7 | 7 |
|
8 |
[DocItemCheck] |
|
9 |
MARKUS_ConnectionString = ScTg8MgTdbARVQXhb1K9YI3/6emjnMuODvTWZ+UnUZQ8z/Gv4TksSLRn84HTZiC5q/RkHKkgbsc6TL5EdTsnSwK0ngDgXD0P0yPKObgtPfk0MX0wmEG95SDQzGzbT6sH73Lkzde0AeChQWveAWZGvACoQISpdUwNj96c2AQuTqaUHwSkCwSI84HZCYugjlg3gAF1FpPggKCIeu4r/qFi0w== |
|
8 |
#[DocItemCheck]
|
|
9 |
#MARKUS_ConnectionString = ScTg8MgTdbARVQXhb1K9YI3/6emjnMuODvTWZ+UnUZQ8z/Gv4TksSLRn84HTZiC5q/RkHKkgbsc6TL5EdTsnSwK0ngDgXD0P0yPKObgtPfk0MX0wmEG95SDQzGzbT6sH73Lkzde0AeChQWveAWZGvACoQISpdUwNj96c2AQuTqaUHwSkCwSI84HZCYugjlg3gAF1FpPggKCIeu4r/qFi0w==
|
|
10 | 10 |
|
11 | 11 |
#효성 |
12 | 12 |
#MARKUS_ConnectionString = w0RfRwPwWVzkhKYSFkzqaccCbanjnTfSeig1IFc1IQ2MDThANWCNLmZqA6e2emQZqdM0l2Hsk1Ns/1Bfk6Vy+23gcbZlEDSBfSz7+eQaliiW9b2Wes1FDJ/C1Ho+35kTHGBbQk0tlIA0SWQHbR0KFo8TH5AbCyrLkjI87W6iXJVBpfI1QmTK0guIlTPnEEtCzXnXtgY9e8IHVnRIqT1PDs4tqaDsOZxfDGNNdvIpagA= |
13 | 13 |
|
14 | 14 |
[ErrorNotice] |
15 | 15 |
MARKUS_ConnectionString = ScTg8MgTdbARVQXhb1K9YI3/6emjnMuODvTWZ+UnUZQ8z/Gv4TksSLRn84HTZiC5q/RkHKkgbsc6TL5EdTsnSwK0ngDgXD0P0yPKObgtPfk0MX0wmEG95SDQzGzbT6sH73Lkzde0AeChQWveAWZGvACoQISpdUwNj96c2AQuTqaUHwSkCwSI84HZCYugjlg3gAF1FpPggKCIeu4r/qFi0w== |
16 |
NoticeStatus = 50,55,60,70,77,99 |
|
16 |
NoticeStatus = 4,50,55,60,70,77,99
|
|
17 | 17 |
SMTP_SERVER = outbound.daouoffice.com |
18 | 18 |
SMTP_SERVER_PORT = 25 |
19 | 19 |
IS_SMTP_SERVER_SSL = true |
ConvertService/ServiceBase/Markus.Service.Station/Properties/AssemblyInfo.cs | ||
---|---|---|
32 | 32 |
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 |
33 | 33 |
// 지정되도록 할 수 있습니다. |
34 | 34 |
// [assembly: AssemblyVersion("1.0.*")] |
35 |
[assembly: AssemblyVersion("2.5.6.0")]
|
|
36 |
[assembly: AssemblyFileVersion("2.5.6.0")]
|
|
35 |
[assembly: AssemblyVersion("3.0.0.0")]
|
|
36 |
[assembly: AssemblyFileVersion("3.0.0.0")]
|
|
37 | 37 |
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log.config", Watch = true)] |
ConvertService/ServiceBase/Markus.Service.Station/ServiceStation.cs | ||
---|---|---|
19 | 19 |
using System.ServiceModel.Dispatcher; |
20 | 20 |
using System.ServiceProcess; |
21 | 21 |
using System.Text; |
22 |
using System.Threading; |
|
22 | 23 |
using System.Threading.Tasks; |
23 | 24 |
using System.Timers; |
24 | 25 |
using static Markus.Service.Extensions.Encrypt; |
... | ... | |
31 | 32 |
protected ServiceHost gWcfServiceHost; |
32 | 33 |
private SERVICE_PROPERTIES ServiceProperty; |
33 | 34 |
|
34 |
private static System.Timers.Timer timer; |
|
35 |
|
|
36 | 35 |
private string ServiceID; |
37 | 36 |
private List<SubStationServiceItem> StationServiceList; |
38 | 37 |
private List<string> StationServiceIDList; |
... | ... | |
176 | 175 |
{ |
177 | 176 |
try |
178 | 177 |
{ |
179 |
StartService(); |
|
178 |
if (StartService()) |
|
179 |
{ |
|
180 |
while (stateTimer != null) |
|
181 |
{ |
|
182 |
//Wait until the job is done |
|
183 |
AutoEventInstance.WaitOne(); |
|
184 |
//Wait for 5 minutes before starting the job again. |
|
185 |
stateTimer.Change(1000, Timeout.Infinite); |
|
186 |
} |
|
187 |
} |
|
188 |
else |
|
189 |
{ |
|
190 |
logger.Error("not working StartService"); |
|
191 |
} |
|
180 | 192 |
} |
181 | 193 |
catch (Exception ex) |
182 | 194 |
{ |
183 | 195 |
logger.Error("ServiceStation Start Error - ", ex); |
184 | 196 |
} |
185 | 197 |
} |
186 |
|
|
198 |
|
|
187 | 199 |
/// <summary> |
188 | 200 |
/// alivequeue와 process를 비교하여 정리하고 |
189 | 201 |
/// 대기중인 아이템을 분배한다. |
... | ... | |
194 | 206 |
{ |
195 | 207 |
IsReleaseItems = true; |
196 | 208 |
|
209 |
System.Diagnostics.Debug.WriteLine("CleanUpAliveQueueItems start"); |
|
197 | 210 |
CleanUpAliveQueueItems(); |
211 |
System.Diagnostics.Debug.WriteLine("CleanUpAliveQueueItems end"); |
|
198 | 212 |
|
199 | 213 |
if (IsStation) |
200 | 214 |
{ |
... | ... | |
355 | 369 |
|
356 | 370 |
|
357 | 371 |
logger.Info("Start ServiceStation"); |
358 |
var autoEvent = new System.Threading.AutoResetEvent(false); |
|
359 |
|
|
360 |
stateTimer = new System.Threading.Timer(new System.Threading.TimerCallback(TimerCallBack), null, 0, 500); |
|
361 |
//timer = new System.Timers.Timer(new TimeSpan(0, 0, 0, 10).TotalMilliseconds); |
|
362 |
//timer.Elapsed += Timer_Elapsed; |
|
363 |
//timer.AutoReset = true; |
|
364 |
//timer.Start(); |
|
365 |
//Timer_Elapsed(null, null); |
|
372 |
AutoEventInstance = new System.Threading.AutoResetEvent(false); |
|
373 |
StatusCheckerInstance = new StatusChecker(); |
|
374 |
|
|
375 |
TimerCallback timerDelegate = new TimerCallback(StatusCheckerInstance.CheckStatus); |
|
376 |
|
|
377 |
stateTimer = new System.Threading.Timer(new System.Threading.TimerCallback(TimerCallBack), AutoEventInstance,new TimeSpan(0,0,0,0,10),new TimeSpan(0,0,0,0,10)); |
|
378 |
|
|
366 | 379 |
return true; |
367 | 380 |
} |
368 | 381 |
|
382 |
private bool IsStop = false; |
|
383 |
private AutoResetEvent AutoEventInstance { get; set; } |
|
384 |
private StatusChecker StatusCheckerInstance { get; set; } |
|
369 | 385 |
System.Threading.Timer stateTimer; |
370 | 386 |
DateTime logTime; |
371 | 387 |
DateTime ReleaseTime; |
... | ... | |
373 | 389 |
private void TimerCallBack(object state) |
374 | 390 |
{ |
375 | 391 |
System.Threading.AutoResetEvent autoEvent = (System.Threading.AutoResetEvent)state; |
376 |
//stateTimer.Change(-1, -1);
|
|
392 |
//stateTimer.Change(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, -1));
|
|
377 | 393 |
try |
378 | 394 |
{ |
379 | 395 |
|
380 |
if ((DateTime.Now - ReleaseTime) >= new TimeSpan(0, 0,15))
|
|
396 |
if ((DateTime.Now - ReleaseTime) >= new TimeSpan(0, 0,1)) |
|
381 | 397 |
{ |
382 | 398 |
if (!IsReleaseItems) |
383 | 399 |
{ |
400 |
Console.WriteLine("Release Items"); |
|
384 | 401 |
ReleaseItems(); |
385 | 402 |
} |
403 |
else |
|
404 |
{ |
|
405 |
Console.WriteLine("pass Release Items"); |
|
406 |
} |
|
407 |
|
|
386 | 408 |
ReleaseTime = DateTime.Now; |
387 | 409 |
} |
388 | 410 |
|
389 |
|
|
390 | 411 |
if ((DateTime.Now - logTime) >= new TimeSpan(0, 5,0)) |
391 | 412 |
{ |
392 | 413 |
logTime = DateTime.Now; |
393 | 414 |
logger.Info("StationService Alive Check"); |
394 | 415 |
} |
395 |
|
|
396 |
|
|
397 | 416 |
} |
398 | 417 |
catch (Exception ex) |
399 | 418 |
{ |
400 | 419 |
logger.Error("Timer Error ", ex); |
401 | 420 |
} |
402 |
|
|
403 |
///System.Threading.Thread.SpinWait(100000);
|
|
404 |
//stateTimer.Change(0, 10000);
|
|
421 |
//Console.WriteLine($"time : {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.FFF")}"); |
|
422 |
autoEvent.Set();
|
|
423 |
//stateTimer.Change(new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, 1));
|
|
405 | 424 |
} |
406 | 425 |
|
407 | 426 |
public void SetServiceList(List<string> serviceList) |
... | ... | |
450 | 469 |
{ |
451 | 470 |
try |
452 | 471 |
{ |
453 |
if (timer != null) |
|
454 |
{ |
|
455 |
timer.Stop(); |
|
456 |
} |
|
457 |
|
|
458 |
StopWcfService(); |
|
459 |
Stopprocess(); |
|
460 |
|
|
461 |
logger.Info("ServiceStation Stop"); |
|
472 |
StopService(); |
|
462 | 473 |
} |
463 | 474 |
catch (Exception e) |
464 | 475 |
{ |
... | ... | |
466 | 477 |
} |
467 | 478 |
} |
468 | 479 |
|
480 |
public void StopService() |
|
481 |
{ |
|
482 |
stateTimer.Dispose(); |
|
483 |
|
|
484 |
StopWcfService(); |
|
485 |
Stopprocess(); |
|
486 |
|
|
487 |
logger.Info("ServiceStation Stop"); |
|
488 |
} |
|
489 |
|
|
490 |
class StatusChecker |
|
491 |
{ |
|
492 |
//This job takes time to run. For example purposes, I put a delay in here. |
|
493 |
int milliseconds = 5000; |
|
494 |
|
|
495 |
public StatusChecker() |
|
496 |
{ |
|
497 |
} |
|
498 |
|
|
499 |
// This method is called by the timer delegate. |
|
500 |
public void CheckStatus(Object stateInfo) |
|
501 |
{ |
|
502 |
AutoResetEvent autoEvent = (AutoResetEvent)stateInfo; |
|
503 |
Console.WriteLine("{0} Start Checking status.", |
|
504 |
DateTime.Now.ToString("h:mm:ss.fff")); |
|
505 |
|
|
506 |
Thread.Sleep(milliseconds); |
내보내기 Unified diff