Compare commits

...

21 Commits

Author SHA1 Message Date
00b3a5e643 Revert "Setup Setting"
This reverts commit 3e9339195e.
2025-03-14 09:07:45 +09:00
f43ffb1e30 Merge branch 'master' into 20250203_SFTP 2025-03-14 09:06:40 +09:00
9be4b773a5 F1 Change 2025-03-07 11:57:24 +09:00
0790ae42f9 FDC MongoDB 패치(컬럼추가) 2025-03-06 09:40:18 +09:00
0b7f4ba366 HSMS, Workflow Download 2025-03-05 17:08:54 +09:00
933519164e EISLog OpenWindow 2025-03-05 12:59:00 +09:00
f92e560e87 EquipmentList.OrderBy 2025-03-05 11:07:18 +09:00
fb46e2b17a 추가패치 2025-03-05 10:00:08 +09:00
8b39c28efb MES Log Download 2025-02-28 16:47:40 +09:00
f6d430550f Merge branch '20250203_SFTP' of https://git.e1soft.co.kr/T001084/DDUtility into 20250203_SFTP
# Conflicts:
#	DDUtilityApp/Program.cs
2025-02-28 15:50:07 +09:00
t001310
54fe8b0156 jhlim 20250202_2 2025-02-28 15:21:27 +09:00
t001310
801057076f 20250202 jhlim_3 2025-02-28 15:20:26 +09:00
t001310
a4169bb683 jhlim 20240202_2 2025-02-28 15:00:32 +09:00
b44ffb7305 Use MES (MES DB 연결옵션) 삭제 2025-02-28 11:01:58 +09:00
99363e9ee9 dll 참조경로 설정 (..\Library\...) 2025-02-28 10:22:05 +09:00
e5543e8113 Package 등록 2025-02-28 09:58:45 +09:00
t001310
8fddc5bca4 Merge branch '20250203_SFTP' of https://git.e1soft.co.kr/T001084/DDUtility into 20250203_SFTP 2025-02-28 09:36:32 +09:00
929eeeefb7 Revert "CheckPoint 추가"
This reverts commit 8de25775f7.
2025-02-28 08:42:56 +09:00
t001310
5cf740318e 20250202_1 jhlim 2025-02-28 08:40:40 +09:00
8de25775f7 CheckPoint 추가 2025-02-03 16:40:32 +09:00
402df7997b CheckPoint 등록 2025-02-03 15:15:05 +09:00
34 changed files with 2760 additions and 7948 deletions

View File

@@ -1,37 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<appSettings>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
<appSettings>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
<add key="BULK_VIEWER" value="ViewList.xml" />
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -145,12 +145,18 @@
<Reference Include="AWSSDK.SecurityToken, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
<HintPath>..\packages\AWSSDK.SecurityToken.3.7.100.14\lib\net45\AWSSDK.SecurityToken.dll</HintPath>
</Reference>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="DnsClient, Version=1.6.1.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
<HintPath>..\packages\DnsClient.1.6.1\lib\net471\DnsClient.dll</HintPath>
</Reference>
<Reference Include="EIS.Framework">
<HintPath>..\Library\EIS.Framework.dll</HintPath>
</Reference>
<Reference Include="FluentFTP, Version=35.0.0.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.35.0.0\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="JWH.SECS, Version=2022.2.4.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Library\JWH.SECS.dll</HintPath>
@@ -179,6 +185,9 @@
<Reference Include="MongoDB.Libmongocrypt, Version=1.8.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDB.Libmongocrypt.1.8.2\lib\netstandard2.0\MongoDB.Libmongocrypt.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2024.2.0.1, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2024.2.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.30.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>..\packages\SharpCompress.0.30.1\lib\net461\SharpCompress.dll</HintPath>
</Reference>
@@ -192,6 +201,9 @@
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Formats.Asn1, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll</HintPath>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
@@ -254,6 +266,9 @@
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms.DataVisualization" />
@@ -298,6 +313,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DEFINE.cs" />
<Compile Include="ETC\FrmTIbcoConfig.cs">
<SubType>Form</SubType>
</Compile>
@@ -388,6 +404,20 @@
<Compile Include="LOGPARSER\FrmEqSelector.Designer.cs">
<DependentUpon>FrmEqSelector.cs</DependentUpon>
</Compile>
<Compile Include="MESDOWNLOADER\ProgressForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MESDOWNLOADER\ProgressForm.Designer.cs">
<DependentUpon>ProgressForm.cs</DependentUpon>
</Compile>
<Compile Include="MESDOWNLOADER\ServerLog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MESDOWNLOADER\ServerLog.Designer.cs">
<DependentUpon>ServerLog.cs</DependentUpon>
</Compile>
<Compile Include="MESDOWNLOADER\Utili.cs" />
<Compile Include="MESDOWNLOADER\XmlToDsConverter.cs" />
<Compile Include="MONGO\FDCMongoDB.cs" />
<Compile Include="MONGO\FrmFDCMongo.cs">
<SubType>Form</SubType>
@@ -450,6 +480,9 @@
<Content Include="tibrvcm.dll" />
<Content Include="tibrvcmq.dll" />
<Content Include="tibrvft.dll" />
<Content Include="ViewList.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<EmbeddedResource Include="ETC\FrmTIbcoConfig.resx">
<DependentUpon>FrmTIbcoConfig.cs</DependentUpon>
</EmbeddedResource>

12
DDUtilityApp/DEFINE.cs Normal file
View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DDUtilityApp
{
public enum AccessType { SMB, FTP, FTPS, SFTP };
}

View File

@@ -28,6 +28,11 @@ namespace DDUtilityApp
/// </summary>
public string DownloadPath { get; set; }
/// <summary>
/// 로그파일 다운로드 경로 jhlim 20250202
/// </summary>
public string MesDownloadPath { get; set; }
/// <summary>
/// Workflow 다운로드 경로
/// </summary>
@@ -109,6 +114,7 @@ namespace DDUtilityApp
this.DefaultPath = defaultPath.Replace("%MyDocuments%", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
this.DownloadPath = $@"{this.DefaultPath}Download\";
this.WorkflowPath = $@"{this.DefaultPath}Workflow\";
this.MesDownloadPath = $@"{this.DefaultPath}MesDownload\"; //jhlim 20250202
}
public void LoadSetting()

View File

@@ -19,6 +19,9 @@ namespace DDUtilityApp.LOGPARSER.DATA
/// <summary>MES.FacilityName</summary>
public string Facility { get; set; }
/// <summary>MES.FacilityName</summary>
public string OrderByKey { get { return string.IsNullOrEmpty(this.Facility) ? "" : this.Facility.Substring(0, 2); } }
/// <summary>EIS.Line</summary>
public string Line { get; set; }

View File

@@ -1,4 +1,7 @@
using System;
using System.IO;
using System.Windows.Forms.DataVisualization.Charting;
using DDUtilityApp.DATA;
using JWH.DATA;
namespace DDUtilityApp.LOGPARSER.DATA
@@ -10,31 +13,74 @@ namespace DDUtilityApp.LOGPARSER.DATA
public class LogFile : DataTableBase
{
public string Name { get; set; }
private string m_FullName = string.Empty;
public Account Account { get; set; } = null;
public string FullName
{
get { return this.m_FullName; }
set
{
this.m_FullName = value;
this.DirectoryName = Path.GetDirectoryName(value);
this.FileName = Path.GetFileName(value);
this.Name = Path.GetFileNameWithoutExtension(value);
this.Extension = Path.GetExtension(value);
}
}
public string DirectoryName { get; private set; }
public string FileName { get; private set; }
public string Name { get; private set; }
public string Extension { get; private set; }
public long Length { get; set; }
public string Extension { get; set; }
public string FullName { get; set; }
public DateTime CreationTime { get; set; }
public DateTime LastAccessTime { get; set; }
public DateTime LastWriteTime { get; set; }
public string DestFullName { get; set; }
public LogFile()
{
}
public LogFile(string fullName)
{
this.Name = System.IO.Path.GetFileNameWithoutExtension(fullName);
this.FullName = fullName;
this.Extension = System.IO.Path.GetExtension(fullName);
}
public string GetFileSize(FileSizeType format = FileSizeType.Auto)
{
int index = 0;
int nFormat = (int)format;
double value = this.Length;
for (index = 0; index < nFormat; index++)
{
if (format == FileSizeType.Auto && value < 1024) break;
value /= 1024;
}
return $"{value.ToString("N2")} {(FileSizeType)index}";
}
}
public enum FileSizeType
{
Bt = 0,
KB = 1,
MB = 2,
GB = 3,
TB = 4,
Auto = 9,
}
}

View File

@@ -31,6 +31,8 @@
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition1 = new Telerik.WinControls.UI.TableViewDefinition();
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition2 = new Telerik.WinControls.UI.TableViewDefinition();
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition3 = new Telerik.WinControls.UI.TableViewDefinition();
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition4 = new Telerik.WinControls.UI.TableViewDefinition();
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition5 = new Telerik.WinControls.UI.TableViewDefinition();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmEqSelector));
this.panel1 = new System.Windows.Forms.Panel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
@@ -43,7 +45,7 @@
this.tboxEquipmentID = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.chkAllEquipment = new System.Windows.Forms.CheckBox();
this.chkUseMesDB = new System.Windows.Forms.CheckBox();
this.chkUseSMB = new System.Windows.Forms.CheckBox();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.panel4 = new System.Windows.Forms.Panel();
this.cboxServer = new System.Windows.Forms.ComboBox();
@@ -56,15 +58,18 @@
this.panel5 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabLogFiles = new System.Windows.Forms.TabPage();
this.gridLogFiles = new JWH.CONTROL.GridViewEx();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabModelHistory = new System.Windows.Forms.TabPage();
this.gridModelDetail = new JWH.CONTROL.GridViewEx();
this.panel10 = new System.Windows.Forms.Panel();
this.tboxModelDescription = new System.Windows.Forms.TextBox();
this.tabWorkflow = new System.Windows.Forms.TabPage();
this.gridWorkflow = new JWH.CONTROL.GridViewEx();
this.tabHSMS = new System.Windows.Forms.TabPage();
this.gridHsms = new JWH.CONTROL.GridViewEx();
this.radStatusStrip1 = new Telerik.WinControls.UI.RadStatusStrip();
this.rstatus1 = new Telerik.WinControls.UI.RadLabelElement();
this.chkUseSMB = new System.Windows.Forms.CheckBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@@ -87,13 +92,19 @@
this.panel5.SuspendLayout();
this.panel7.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.tabLogFiles.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles.MasterTemplate)).BeginInit();
this.tabPage2.SuspendLayout();
this.tabModelHistory.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail.MasterTemplate)).BeginInit();
this.panel10.SuspendLayout();
this.tabWorkflow.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow.MasterTemplate)).BeginInit();
this.tabHSMS.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridHsms)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridHsms.MasterTemplate)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).BeginInit();
this.SuspendLayout();
//
@@ -147,7 +158,6 @@
this.flowLayoutPanel2.Controls.Add(this.panel8);
this.flowLayoutPanel2.Controls.Add(this.panel9);
this.flowLayoutPanel2.Controls.Add(this.chkAllEquipment);
this.flowLayoutPanel2.Controls.Add(this.chkUseMesDB);
this.flowLayoutPanel2.Controls.Add(this.chkUseSMB);
this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Top;
this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 34);
@@ -225,15 +235,15 @@
this.chkAllEquipment.Text = "모든설비";
this.chkAllEquipment.UseVisualStyleBackColor = true;
//
// chkUseMesDB
// chkUseSMB
//
this.chkUseMesDB.AutoSize = true;
this.chkUseMesDB.Location = new System.Drawing.Point(802, 6);
this.chkUseMesDB.Name = "chkUseMesDB";
this.chkUseMesDB.Size = new System.Drawing.Size(71, 16);
this.chkUseMesDB.TabIndex = 4;
this.chkUseMesDB.Text = "MES DB";
this.chkUseMesDB.UseVisualStyleBackColor = true;
this.chkUseSMB.AutoSize = true;
this.chkUseSMB.Location = new System.Drawing.Point(802, 6);
this.chkUseSMB.Name = "chkUseSMB";
this.chkUseSMB.Size = new System.Drawing.Size(118, 16);
this.chkUseSMB.TabIndex = 5;
this.chkUseSMB.Text = "Use SMB(Local)";
this.chkUseSMB.UseVisualStyleBackColor = true;
//
// flowLayoutPanel1
//
@@ -374,8 +384,10 @@
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabLogFiles);
this.tabControl1.Controls.Add(this.tabModelHistory);
this.tabControl1.Controls.Add(this.tabWorkflow);
this.tabControl1.Controls.Add(this.tabHSMS);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
@@ -383,17 +395,18 @@
this.tabControl1.Size = new System.Drawing.Size(547, 489);
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.tabControl1.TabIndex = 6;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
//
// tabPage1
// tabLogFiles
//
this.tabPage1.Controls.Add(this.gridLogFiles);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(539, 463);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Log Files";
this.tabPage1.UseVisualStyleBackColor = true;
this.tabLogFiles.Controls.Add(this.gridLogFiles);
this.tabLogFiles.Location = new System.Drawing.Point(4, 22);
this.tabLogFiles.Name = "tabLogFiles";
this.tabLogFiles.Padding = new System.Windows.Forms.Padding(3);
this.tabLogFiles.Size = new System.Drawing.Size(539, 463);
this.tabLogFiles.TabIndex = 0;
this.tabLogFiles.Text = "Log Files";
this.tabLogFiles.UseVisualStyleBackColor = true;
//
// gridLogFiles
//
@@ -414,17 +427,17 @@
this.gridLogFiles.Size = new System.Drawing.Size(533, 457);
this.gridLogFiles.TabIndex = 3;
//
// tabPage2
// tabModelHistory
//
this.tabPage2.Controls.Add(this.gridModelDetail);
this.tabPage2.Controls.Add(this.panel10);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(539, 463);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Model History";
this.tabPage2.UseVisualStyleBackColor = true;
this.tabModelHistory.Controls.Add(this.gridModelDetail);
this.tabModelHistory.Controls.Add(this.panel10);
this.tabModelHistory.Location = new System.Drawing.Point(4, 22);
this.tabModelHistory.Name = "tabModelHistory";
this.tabModelHistory.Padding = new System.Windows.Forms.Padding(3);
this.tabModelHistory.Size = new System.Drawing.Size(539, 463);
this.tabModelHistory.TabIndex = 1;
this.tabModelHistory.Text = "Model History";
this.tabModelHistory.UseVisualStyleBackColor = true;
//
// gridModelDetail
//
@@ -465,12 +478,78 @@
this.tboxModelDescription.Size = new System.Drawing.Size(533, 96);
this.tboxModelDescription.TabIndex = 0;
//
// tabWorkflow
//
this.tabWorkflow.Controls.Add(this.gridWorkflow);
this.tabWorkflow.Location = new System.Drawing.Point(4, 22);
this.tabWorkflow.Name = "tabWorkflow";
this.tabWorkflow.Padding = new System.Windows.Forms.Padding(3);
this.tabWorkflow.Size = new System.Drawing.Size(539, 463);
this.tabWorkflow.TabIndex = 3;
this.tabWorkflow.Text = "Workflow";
this.tabWorkflow.UseVisualStyleBackColor = true;
//
// gridWorkflow
//
this.gridWorkflow.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.gridWorkflow.ColumnResizeKey = System.Windows.Forms.Keys.F6;
this.gridWorkflow.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridWorkflow.Location = new System.Drawing.Point(3, 3);
this.gridWorkflow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
//
//
//
this.gridWorkflow.MasterTemplate.ViewDefinition = tableViewDefinition4;
this.gridWorkflow.Name = "gridWorkflow";
//
//
//
this.gridWorkflow.RootElement.ControlBounds = new System.Drawing.Rectangle(3, 3, 240, 150);
this.gridWorkflow.Size = new System.Drawing.Size(533, 457);
this.gridWorkflow.TabIndex = 4;
//
// tabHSMS
//
this.tabHSMS.Controls.Add(this.gridHsms);
this.tabHSMS.Location = new System.Drawing.Point(4, 22);
this.tabHSMS.Name = "tabHSMS";
this.tabHSMS.Padding = new System.Windows.Forms.Padding(3);
this.tabHSMS.Size = new System.Drawing.Size(539, 463);
this.tabHSMS.TabIndex = 2;
this.tabHSMS.Text = "HSMS";
this.tabHSMS.UseVisualStyleBackColor = true;
//
// gridHsms
//
this.gridHsms.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.gridHsms.ColumnResizeKey = System.Windows.Forms.Keys.F6;
this.gridHsms.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridHsms.Location = new System.Drawing.Point(3, 3);
this.gridHsms.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
//
//
//
this.gridHsms.MasterTemplate.ViewDefinition = tableViewDefinition5;
this.gridHsms.Name = "gridHsms";
//
//
//
this.gridHsms.RootElement.ControlBounds = new System.Drawing.Rectangle(3, 3, 240, 150);
this.gridHsms.Size = new System.Drawing.Size(533, 457);
this.gridHsms.TabIndex = 4;
//
// radStatusStrip1
//
this.radStatusStrip1.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.radStatusStrip1.Items.AddRange(new Telerik.WinControls.RadItem[] {
this.rstatus1});
this.radStatusStrip1.Location = new System.Drawing.Point(3, 574);
this.radStatusStrip1.Name = "radStatusStrip1";
//
//
//
this.radStatusStrip1.RootElement.ControlBounds = new System.Drawing.Rectangle(3, 574, 300, 24);
this.radStatusStrip1.RootElement.StretchVertically = true;
this.radStatusStrip1.Size = new System.Drawing.Size(1014, 26);
this.radStatusStrip1.TabIndex = 1;
//
@@ -481,16 +560,6 @@
this.rstatus1.Text = "";
this.rstatus1.TextWrap = true;
//
// chkSMB
//
this.chkUseSMB.AutoSize = true;
this.chkUseSMB.Location = new System.Drawing.Point(879, 6);
this.chkUseSMB.Name = "chkSMB";
this.chkUseSMB.Size = new System.Drawing.Size(77, 16);
this.chkUseSMB.TabIndex = 5;
this.chkUseSMB.Text = "Use SMB";
this.chkUseSMB.UseVisualStyleBackColor = true;
//
// FrmEqSelector
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -529,14 +598,20 @@
this.panel5.ResumeLayout(false);
this.panel7.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabLogFiles.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tabModelHistory.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).EndInit();
this.panel10.ResumeLayout(false);
this.panel10.PerformLayout();
this.tabWorkflow.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow)).EndInit();
this.tabHSMS.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridHsms.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridHsms)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -567,16 +642,19 @@
private System.Windows.Forms.TextBox tboxEquipmentID;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox chkAllEquipment;
private System.Windows.Forms.CheckBox chkUseMesDB;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabLogFiles;
private JWH.CONTROL.GridViewEx gridLogFiles;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabModelHistory;
private JWH.CONTROL.GridViewEx gridModelDetail;
private System.Windows.Forms.Panel panel10;
private System.Windows.Forms.TextBox tboxModelDescription;
private Telerik.WinControls.UI.RadStatusStrip radStatusStrip1;
private Telerik.WinControls.UI.RadLabelElement rstatus1;
private System.Windows.Forms.CheckBox chkUseSMB;
private System.Windows.Forms.TabPage tabHSMS;
private System.Windows.Forms.TabPage tabWorkflow;
private JWH.CONTROL.GridViewEx gridHsms;
private JWH.CONTROL.GridViewEx gridWorkflow;
}
}

View File

@@ -1,4 +1,16 @@
using System;
using DDUtilityApp.DATA;
using DDUtilityApp.LOGPARSER.DATA;
using DDUtilityApp.SECS;
using FluentFTP;
using FluentFTP.Helpers;
using JWH;
using JWH.CONTROL;
using JWH.DATA;
using JWH.NETWORK;
using Org.BouncyCastle.Tls.Crypto;
using Renci.SshNet;
using Renci.SshNet.Sftp;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
@@ -9,14 +21,9 @@ using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using DDUtilityApp.DATA;
using DDUtilityApp.LOGPARSER.DATA;
using DDUtilityApp.SECS;
using JWH;
using JWH.CONTROL;
using JWH.DATA;
using System.Windows.Forms.DataVisualization.Charting;
using Telerik.WinControls.UI;
using static Telerik.WinControls.UI.ValueMapper;
namespace DDUtilityApp.LOGPARSER
{
@@ -30,16 +37,22 @@ namespace DDUtilityApp.LOGPARSER
public eServerType ServerType { get; set; } = eServerType.EIS;
/// <summary>
/// 로그서버 접속정보
/// </summary>
public Account Account { get; set; } = null;
/// <summary>
/// 선택된 로그파일
/// </summary>
public LogFile[] SelectedLogFiles { get; set; } = null;
public LogServer LogServer { get; set; } = null;
private LogServer LogServer { get; set; } = null;
public EisEquipment Equipment { get; set; } = null;
public string ServerName { get; set; } = string.Empty;
public string EquipmentID { get; set; } = string.Empty;
public SECSDefine SECSDefine { get; set; } = null;
#endregion
@@ -49,7 +62,6 @@ namespace DDUtilityApp.LOGPARSER
public FrmEqSelector()
{
InitializeComponent();
this.SetLayout();
this.SetEventHandler();
}
@@ -66,14 +78,15 @@ namespace DDUtilityApp.LOGPARSER
this.tboxName.ImeMode = ImeMode.Hangul;
this.tboxEquipmentID.ImeMode = ImeMode.Alpha;
this.chkAllEquipment.Checked = GlobalVariable.Instance.FrmEqSelector_AllEquipment;
this.chkUseMesDB.Checked = true; // GlobalVariable.Instance.FrmEqSelector_UseMesDB;
this.chkUseMesDB.Visible = false;
this.chkUseSMB.Checked = GlobalVariable.Instance.FrmEqSelector_UseSMB;
this.chkUseSMB.Checked = true; // = GlobalVariable.Instance.FrmEqSelector_UseSMB
this.chkUseSMB.Visible = false;
this.tabControl1.SelectedIndex = 0;
this.tboxModelDescription.Font = font;
this.GridEquipments_Setting();
this.GridLogFiles_Setting();
this.GridLogFiles_Setting(this.gridLogFiles); //jhlim 20250202
this.GridLogFiles_Setting(this.gridHsms); //jhlim 20250202
this.GridLogFiles_Setting(this.gridWorkflow); //jhlim 20250202
this.GridModelDetail_Setting();
}
@@ -99,6 +112,13 @@ namespace DDUtilityApp.LOGPARSER
this.gridLogFiles.CellDoubleClick += GridLogFiles_CellDoubleClick;
this.gridLogFiles.KeyDown += GridLogFiles_KeyDown;
//jhlim 20250202 start
this.gridWorkflow.CellDoubleClick += Grid_CellDoubleClick;
this.gridWorkflow.KeyDown += Grid_KeyDown;
this.gridHsms.CellDoubleClick += Grid_CellDoubleClick;
this.gridHsms.KeyDown += Grid_KeyDown;
//jhlim 20250202 end
}
private void FrmEqSelector_Disposed(object sender, EventArgs e)
@@ -120,7 +140,7 @@ namespace DDUtilityApp.LOGPARSER
switch (keyData)
{
case Keys.F1:
Process.Start($"http://jungwoois.dothome.co.kr");
Process.Start("IEXPLORE.EXE", "http://pms.e1soft.co.kr:8090/Deploy/eqview/");
break;
case Keys.F6:
this.gridEquipments.BestFitColumns(BestFitColumnMode.DisplayedCells);
@@ -141,7 +161,7 @@ namespace DDUtilityApp.LOGPARSER
{
this.SetLogServer();
if (this.Equipment != null) this.SetEquipment(this.Equipment);
else this.SetEquipment(this.ServerName, this.EquipmentID);
else this.SetEquipment(this.ServerName, this.Equipment?.EquipmentID);
this.SetSelectedLogFiles(this.SelectedLogFiles);
}
@@ -155,7 +175,6 @@ namespace DDUtilityApp.LOGPARSER
foreach (GridViewColumn column in this.gridEquipments.Columns.OrderBy(x => x.Index))
if (column.IsVisible) sb.AppendFormat($"{column.Name};");
GlobalVariable.Instance.FrmEqSelector_GridEquipmentHeader = sb.ToString();
GlobalVariable.Instance.FrmEqSelector_UseMesDB = this.chkUseMesDB.Checked;
GlobalVariable.Instance.FrmEqSelector_UseSMB = this.chkUseSMB.Checked;
GlobalVariable.Instance.SaveSetting();
@@ -175,7 +194,7 @@ namespace DDUtilityApp.LOGPARSER
EisEquipment[] equipments = this.GetEquipments();
if (this.chkAllEquipment.Checked == false)
equipments = equipments.Where(x => x.MesRegistration).ToArray();
this.gridEquipments.AutoBinding(equipments);
}
catch (Exception ex)
@@ -188,6 +207,86 @@ namespace DDUtilityApp.LOGPARSER
}
}
/// <summary>
/// jhlim 20250202
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
if (this.tabControl1.SelectedTab == this.tabHSMS)
{
if (this.gridHsms.DataSource == null) return;
string remotePath = $"/{this.Account.DefaultPath}/{this.Equipment.EquipmentID}/THiRA_SECSGEM/HSMS";
switch (this.Account.Access)
{
case AccessType.SMB:
break;
case AccessType.FTPS:
{
FtpsClient.Connect();
FtpListItem[] items = FtpsClient.GetFtpsList(remotePath);
this.gridHsms.AutoBinding(this.GetLogFiles(items));
FtpsClient.Disconnect();
}
break;
case AccessType.SFTP:
{
StpClientWrap.Connect();
ISftpFile[] items = (ISftpFile[])StpClientWrap.GetSftpList(remotePath);
this.gridHsms.AutoBinding(this.GetLogFiles(items));
StpClientWrap.Disconnect();
}
break;
case AccessType.FTP:
break;
}
}
else if (this.tabControl1.SelectedTab == this.tabWorkflow)
{
if (this.gridWorkflow.DataSource != null) return;
string remotePath = $"/{this.Account.DefaultPath}/{this.Equipment.EquipmentID}/Workflow";
switch (this.Account.Access)
{
case AccessType.SMB:
break;
case AccessType.FTPS:
{
FtpsClient.Connect();
FtpListItem[] items = FtpsClient.GetFtpsList(remotePath);
LogFile[] logFiles = this.GetLogFiles(items);
this.gridWorkflow.AutoBinding(logFiles);
FtpsClient.Disconnect();
}
break;
case AccessType.SFTP:
{
StpClientWrap.Connect();
ISftpFile[] items = (ISftpFile[])StpClientWrap.GetSftpList(remotePath);
this.gridWorkflow.AutoBinding(this.GetLogFiles(items));
StpClientWrap.Disconnect();
}
break;
case AccessType.FTP:
break;
}
}
}
catch (Exception ex)
{
XLogger.Instance.Fatal(ex, true);
}
}
/// <summary>
/// [CheckPoint] 로그파일 목록을 반환한다
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnOK_Click(object sender, EventArgs e)
{
try
@@ -259,7 +358,7 @@ namespace DDUtilityApp.LOGPARSER
grid.TableElement.RowHeight = 20;
grid.MultiSelect = true;
Dictionary<string,string> dicColumnText = new Dictionary<string,string>();
Dictionary<string, string> dicColumnText = new Dictionary<string, string>();
dicColumnText.Add("Facility", "");
dicColumnText.Add("Line", "");
dicColumnText.Add("EquipmentID", "");
@@ -286,11 +385,12 @@ namespace DDUtilityApp.LOGPARSER
dicColumnText.Add("PMDate", "PM Date");
dicColumnText.Add("PlcType", "PLC Type");
#region [ ]
string columnNames = GlobalVariable.Instance.FrmEqSelector_GridEquipmentHeader;
string columnText = string.Empty;
if (string.IsNullOrEmpty(columnNames) == false)
{
foreach (string columnName in columnNames.Split(new string[] {";"}, StringSplitOptions.RemoveEmptyEntries))
foreach (string columnName in columnNames.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
{
columnText = columnName;
if (dicColumnText.ContainsKey(columnName))
@@ -303,18 +403,179 @@ namespace DDUtilityApp.LOGPARSER
}
}
foreach(string columnName in dicColumnText.Keys)
foreach (string columnName in dicColumnText.Keys)
{
columnText = columnName;
if (string.IsNullOrEmpty(dicColumnText[columnName]) == false) columnText = dicColumnText[columnName];
grid.AddColumn(columnName, columnText).IsVisible = false;
}
#endregion
grid.AddContextMenu("");
grid.AddContextMenu("Open Windows", GridEquipments_OpenWindows);
grid.AddContextMenu("Open Windows", this.GridEquipments_OpenWindows);
}
/// <summary>
/// [CheckPoint] 선택된 설비의 로그파일 목록을 표시한다.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GridEquipments_SelectionChanged(object sender, EventArgs e)
{
try
{
if (this.gridEquipments.SelectedRows.Count < 1) return;
this.gridLogFiles.DataSource = null;
this.gridModelDetail.DataSource = null;
this.gridWorkflow.DataSource = null;
this.gridHsms.DataSource = null;
//if (this.tabControl1.TabPages.Contains(this.tabHSMS)) this.tabControl1.TabPages.Remove(this.tabHSMS);
EisEquipment equipment = this.gridEquipments.SelectedRows[0].DataBoundItem as EisEquipment;
if (equipment == null) return;
this.Cursor = Cursors.WaitCursor;
this.Equipment = equipment;
LogServer logServer = this.cboxServer.SelectedItem as LogServer;
string path = string.Empty;
#region [ Model Details ]
// 모델 버전 정보
EisModelDetails[] modelDetails = this.GetModelDetails(equipment);
this.gridModelDetail.AutoBinding(modelDetails);
this.gridModelDetail.SetRowForeColor("LockState", $"LockState = 'BLOCKED'", Color.LightGray);
foreach (GridViewRowInfo row in this.gridModelDetail.Rows)
{
EisModelDetails item = row.DataBoundItem as EisModelDetails;
if (item == null) continue;
if (item.Version == equipment.Version)
{
row.IsSelected = true;
row.IsCurrent = true;
break;
}
}
// 모델 정보
EisModelInfo[] modelInfo = this.GetModelInfo(equipment);
if (modelInfo?.Length > 0)
{
this.tboxModelDescription.Text = modelInfo[0].Description;
}
#endregion
#region [ LogFiles ]
if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP) == false) return;
{
this.Account = logServer.NetworkAccount[equipment.LogServerIP];
switch (this.Account.Access)
{
case AccessType.SMB:
{
// Checking Local IP-Address
bool isLocal = false;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses)
if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
if (ip.Address.ToString() == this.Account.IPAddress) { isLocal = true; break; }
if (this.chkUseSMB.Checked)
{
if (isLocal) path = $@"{equipment.LogPath}\{equipment.EquipmentID}";
else return;
}
else
{
if (isLocal) path = $@"{equipment.LogPath}\{equipment.EquipmentID}";
else path = $@"\\{this.Account.IPAddress}\{this.Account.DefaultPath}{equipment.EquipmentID}\";
}
int result = ExtensionAPI.ConnectRemoteServer(this.Account.IPAddress, this.Account.UserID, this.Account.Password);
if (result != 0 && result != 1219) { MessageBox.Show($@"네트워크 접근에 실패하였습니다. (Code:{result})"); return; }
DirectoryInfo directory = new DirectoryInfo(path);
if (directory.Exists == false) { MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}"); return; }
this.gridLogFiles.AutoBinding(this.GetLogFiles(directory.GetFiles()));
this.rstatus1.Text = $"Path={path}";
}
break;
case AccessType.FTPS:
{
FtpsClient.Initialize(this.Account.IPAddress, this.Account.UserID, this.Account.Password);
FtpsClient.Connect();
path = $"/{this.Account.DefaultPath}/{equipment.EquipmentID}";
FtpListItem[] ftpFiles = FtpsClient.GetFtpsList(path);
if (ftpFiles != null) this.gridLogFiles.AutoBinding(this.GetLogFiles(ftpFiles));
this.rstatus1.Text = $"Path={this.Account.IPAddress}{path}";
//if (FtpsClient.IsDirExists($"{path}/THiRA_SECSGEM/HSMS") && !this.tabControl1.TabPages.Contains(tabHSMS))
// this.tabControl1.TabPages.Add(this.tabHSMS);
FtpsClient.Disconnect();
}
break;
case AccessType.SFTP:
{
StpClientWrap.Initialize(this.Account.IPAddress, this.Account.UserID, this.Account.Password);
StpClientWrap.Connect();
path = $"/{this.Account.DefaultPath}/{equipment.EquipmentID}";
ISftpFile[] ftpFiles = (ISftpFile[])StpClientWrap.GetSftpList(path);
if (ftpFiles != null) this.gridLogFiles.AutoBinding(this.GetLogFiles(ftpFiles));
this.rstatus1.Text = $"Path={this.Account.IPAddress}{path}";
//if (StpClientWrap.IsDirExists($"{path}/THiRA_SECSGEM/HSMS") && !this.tabControl1.TabPages.Contains(tabHSMS))
// this.tabControl1.TabPages.Add(this.tabHSMS);
StpClientWrap.Disconnect();
}
break;
case AccessType.FTP:
{
}
break;
}
}
#endregion
#region [ Workflow & HSMS ]
this.tabControl1_SelectedIndexChanged(this.tabControl1, new EventArgs());
#endregion
}
catch (Exception ex)
{
if (this.LogServer.NetworkAccount.ContainsKey(this.Equipment.LogServerIP))
{
// 해당 접속정보를 삭제한다
this.LogServer.NetworkAccount.Remove(this.Equipment.LogServerIP);
ExpressionFormattingObject formatting = new ExpressionFormattingObject($"Marking", $"ServerIP = '{this.Equipment.LogServerIP}'", true);
formatting.RowBackColor = Color.FromArgb(88, 255, 0, 0);
this.gridEquipments.Columns["ServerIP"].ConditionalFormattingObjectList.Add(formatting);
}
XLogger.Instance.Fatal(ex, true);
}
finally
{
this.Cursor = Cursors.Default;
}
}
/// <summary>
/// [CheckPoint] 선택된 설비의 로그파일 목록을 표시한다.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void xGridEquipments_SelectionChanged(object sender, EventArgs e)
{
try
{
@@ -352,16 +613,11 @@ namespace DDUtilityApp.LOGPARSER
if (modelInfo?.Length > 0)
{
this.tboxModelDescription.Text = modelInfo[0].Description;
//Console.WriteLine(modelInfo[0].Description);
//foreach(string splitValue in modelInfo[0].Description.Split(new char[] { (char)0x0D }, StringSplitOptions.RemoveEmptyEntries))
//{
// splitValue.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
//}
}
#endregion
#region [ LogFiles ]
if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP))
if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP)) //jhlim 20250202 jj
{
// Checking Local IP-Address
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
@@ -380,12 +636,69 @@ namespace DDUtilityApp.LOGPARSER
}
// SMB (Server Message Block)
if (string.IsNullOrEmpty(path) && this.chkUseSMB.Checked)
//if (string.IsNullOrEmpty(path) && this.chkUseSMB.Checked)
//{
// Account account = logServer.NetworkAccount[equipment.LogServerIP];
// int result = ExtensionAPI.ConnectRemoteServer(account.IPAddress, account.UserID, account.Password);
// if (result != 0 && result != 1219) { MessageBox.Show($@"네트워크 접근에 실패하였습니다. (Code:{result})"); return; }
// path = logServer.GetLogPath(equipment.LogServerIP, equipment.EquipmentID);
//}
if (string.IsNullOrEmpty(path) && this.chkUseSMB.Checked) //jhlim 20250202
{
Account account = logServer.NetworkAccount[equipment.LogServerIP];
int result = ExtensionAPI.ConnectRemoteServer(account.IPAddress, account.UserID, account.Password);
if (result != 0 && result != 1219) { MessageBox.Show($@"네트워크 접근에 실패하였습니다. (Code:{result})"); return; }
path = logServer.GetLogPath(equipment.LogServerIP, equipment.EquipmentID);
object rtnObj = null;
// StpClientWrap 사용
//StpClientWrap.Initialize(equipment?.LogServerIP, "test", "daeduck!1");
//StpClientWrap.Connect();
var svrInfo = (DDUtilityApp.DATA.Account)GetNetworkAccount(equipment?.LogServerIP);
FtpsClient.Initialize(equipment?.LogServerIP, svrInfo.UserID, svrInfo.Password);
FtpsClient.Connect();
var remotePath = $"/{svrInfo.DefaultPath}/{equipment.EquipmentID}";
//var remotePath = $"{equipment.EquipmentID}";
// SFTP 파일 목록 가져오기
//rtnObj = StpClientWrap.GetSftpList(remotePath);
rtnObj = FtpsClient.GetFtpsList(remotePath);
if (rtnObj == null) return;
//StpClientWrap.IsDirectory( "/302304/THiRA_SECSGEM/HSMS")
//var hsmsEnabled = (StpClientWrap.IsDirExists( $"{remotePath}/THiRA_SECSGEM/HSMS"));
var hsmsEnabled = (FtpsClient.IsDirExists($"{remotePath}/THiRA_SECSGEM/HSMS"));
if (hsmsEnabled == false)
{
if (tabControl1.TabPages.Contains(tabHSMS))
{
tabControl1.TabPages.Remove(tabHSMS);
}
}
else
{
if (!tabControl1.TabPages.Contains(tabHSMS))
{
tabControl1.TabPages.Add(tabHSMS);
}
}
this.gridLogFiles.AutoBinding(GetFtpslogFiles(rtnObj));
// 연결 종료 //jhlim 20250202
//StpClientWrap.Disconnect();
FtpsClient.Disconnect();
}
else if (string.IsNullOrEmpty(path) == false)
{
// 로그 파일 목록
DirectoryInfo directory = new DirectoryInfo(path);
if (directory.Exists == false)
{
MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}");
return;
}
LogFile[] logFiles = directory.GetFiles().ToClass<LogFile>().OrderByDescending(x => x.Name).ToArray();
this.gridLogFiles.AutoBinding(logFiles);
}
}
else
@@ -396,15 +709,15 @@ namespace DDUtilityApp.LOGPARSER
if (string.IsNullOrEmpty(path)) return;
#endregion
// 로그 파일 목록
DirectoryInfo directory = new DirectoryInfo(path);
if (directory.Exists == false)
{
MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}");
return;
}
LogFile[] logFiles = directory.GetFiles().ToClass<LogFile>().OrderByDescending(x => x.Name).ToArray();
this.gridLogFiles.AutoBinding(logFiles);
//// 로그 파일 목록
//DirectoryInfo directory = new DirectoryInfo(path);
//if (directory.Exists == false)
//{
// MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}");
// return;
//}
//LogFile[] logFiles = directory.GetFiles().ToClass<LogFile>().OrderByDescending(x => x.Name).ToArray();
//this.gridLogFiles.AutoBinding(logFiles);
}
catch (Exception ex)
{
@@ -468,13 +781,14 @@ namespace DDUtilityApp.LOGPARSER
if (e.KeyCode == Keys.Enter) this.BtnOK_Click(this.btnOK, null);
}
private void GridLogFiles_OpenWindows(object sender, params object[] args)
private void GridEquipments_OpenWindows(object sender, params object[] args)
{
try
{
if (this.gridEquipments.SelectedRows.Count < 1) return;
string serverID = this.cboxServer.Text;
string equipmentID = this.gridEquipments.SelectedRows[0].Cells["EquipmentID"].Value.ToString();
//this.gridLogFiles.SelectedRows;
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = Application.ExecutablePath;
@@ -495,9 +809,9 @@ namespace DDUtilityApp.LOGPARSER
#region [ GridLogFiles ] ----------------------------------------------
private void GridLogFiles_Setting()
private void GridLogFiles_Setting(GridViewEx grid)
{
GridViewEx grid = this.gridLogFiles;
//GridViewEx grid = this.gridLogFiles; jhlim 20250202
grid.TableElement.RowHeight = 20;
grid.MultiSelect = true;
@@ -505,7 +819,7 @@ namespace DDUtilityApp.LOGPARSER
grid.AddColumn("Length");
grid.AddColumn("LastWriteTime");
grid.AddContextMenu("");
//grid.AddContextMenu("");
//grid.AddContextMenu("Open Log", GridEquipments_OpenWindows);
}
@@ -513,19 +827,7 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
LogFile logFile = null;
List<LogFile> list = new List<LogFile>();
foreach (GridViewRowInfo row in this.gridLogFiles.SelectedRows)
{
logFile = row.DataBoundItem as LogFile;
if (logFile == null) continue;
list.Add(logFile);
}
if (logFile == null) return;
this.SelectedLogFiles = list.ToArray();
this.DialogResult = DialogResult.OK;
this.Close();
this.BtnOK_Click(this.btnOK, null);
}
catch (Exception ex)
{
@@ -538,14 +840,94 @@ namespace DDUtilityApp.LOGPARSER
if (e.KeyCode == Keys.Enter) this.BtnOK_Click(this.btnOK, null);
}
private void GridEquipments_OpenWindows(object sender, params object[] args)
#endregion
#region [ Grid Worflow & HSMS ] ----------------------------------------------
/// <summary>
/// Workflow, HSMS 파일목록 Grid
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Grid_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Grid_CellDoubleClick((GridViewEx)sender, null);
}
}
/// <summary>
/// Workflow, HSMS 파일 Download
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Grid_CellDoubleClick(object sender, GridViewCellEventArgs e)
{
try
{
string destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
RadGridView grid = sender as RadGridView;
if (grid == null && sender.GetType() == typeof(GridDataCellElement))
{
GridDataCellElement element = sender as GridDataCellElement;
grid = element.RowElement.GridControl;
}
if (grid == null) return;
if (grid == this.gridHsms) destPath = Path.Combine(destPath, "HSMS");
else if (grid == this.gridWorkflow) destPath = Path.Combine(destPath, "Workflow");
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
List<string> downfiles = new List<string>();
foreach (GridViewRowInfo row in grid.SelectedRows)
{
LogFile logFile = row.DataBoundItem as LogFile;
string destFileName = Path.Combine(destPath, logFile.FileName);
switch (this.Account.Access)
{
case AccessType.SMB:
{ }
break;
case AccessType.FTPS:
{
FtpsClient.DownloadFtpsFile(logFile.FullName, destFileName);
downfiles.Add(destFileName);
logFile.DestFullName = destFileName;
}
break;
case AccessType.SFTP:
{
StpClientWrap.DownloadSftpFile(logFile.FullName, destFileName);
downfiles.Add(destFileName);
logFile.DestFullName = destFileName;
}
break;
case AccessType.FTP:
{ }
break;
}
}
MessageBox.Show($"{grid.SelectedRows.Count}개의 파일을 저장하였습니다.");
foreach (string file in downfiles)
System.Diagnostics.Process.Start(file);
}
catch (Exception ex)
{
XLogger.Instance.Fatal(ex, true);
}
}
private void GridLogFiles_OpenWindows(object sender, params object[] args)
{
try
{
if (this.gridEquipments.SelectedRows.Count < 1) return;
string serverID = this.cboxServer.Text;
string equipmentID = this.gridEquipments.SelectedRows[0].Cells["EquipmentID"].Value.ToString();
//this.gridLogFiles.SelectedRows;
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = Application.ExecutablePath;
@@ -593,7 +975,7 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
LogServer logServer = this.cboxServer.SelectedItem as LogServer;
if (logServer == null) return null;
this.LogServer = logServer;
@@ -705,37 +1087,43 @@ namespace DDUtilityApp.LOGPARSER
logServer.DBGetModelDetails = sbModelDetails.ToString();
logServer.DBGetModelInfo = sbModelInfo.ToString();
logServer.NetworkAccount.Add("192.168.7.214", new Account("192.168.7.214", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.7.215", new Account("192.168.7.215", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.7.216", new Account("192.168.7.216", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.7.217", new Account("192.168.7.217", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.7.218", new Account("192.168.7.218", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.7.219", new Account("192.168.7.219", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.235.214", new Account("192.168.7.214", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.235.215", new Account("192.168.7.215", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.235.216", new Account("192.168.7.216", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.235.217", new Account("192.168.7.217", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.235.218", new Account("192.168.7.218", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.235.219", new Account("192.168.7.219", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.115.214", new Account("192.168.7.214", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.115.215", new Account("192.168.7.215", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.115.216", new Account("192.168.7.216", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.115.217", new Account("192.168.7.217", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.115.218", new Account("192.168.7.218", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.115.219", new Account("192.168.7.219", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.7.150", new Account("192.168.7.150", "T001084@DAEDUCK.COM", "daeduck!1", @"Vol2\EIS서버\"));
// B1
logServer.NetworkAccount.Add("192.168.7.214", new Account("192.168.7.214", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.7.215", new Account("192.168.7.215", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.7.216", new Account("192.168.7.216", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.7.217", new Account("192.168.7.217", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.7.218", new Account("192.168.7.218", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.7.219", new Account("192.168.7.219", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
//logServer.NetworkAccount.Add("192.168.7.150", new Account("192.168.7.150", "T001084@DAEDUCK.COM", "daeduck!1", @"Vol2\EIS서버\"));
logServer.NetworkAccount.Add("192.168.113.231", new Account("192.168.113.231", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.113.232", new Account("192.168.113.232", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.113.233", new Account("192.168.113.233", "serviceadmin", "daeduck!1", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.113.236", new Account("192.168.113.236", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.143.231", new Account("192.168.143.231", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.143.232", new Account("192.168.143.232", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.143.233", new Account("192.168.143.233", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.143.235", new Account("192.168.143.235", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.233.231", new Account("192.168.233.231", "serviceadmin", "daeduck!1", @"d\EISLog\"));
logServer.NetworkAccount.Add("192.168.233.232", new Account("192.168.233.232", "serviceadmin", "daeduck!1", @"e\EISLog\"));
logServer.NetworkAccount.Add("192.168.233.233", new Account("192.168.233.233", "serviceadmin", "daeduck!1", @"d\EISLog\"));
// B1 (Multi-NIC)
logServer.NetworkAccount.Add("192.168.115.214", new Account("192.168.7.214", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.115.215", new Account("192.168.7.215", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.115.216", new Account("192.168.7.216", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.115.217", new Account("192.168.7.217", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.115.218", new Account("192.168.7.218", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.115.219", new Account("192.168.7.219", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.235.214", new Account("192.168.7.214", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.235.215", new Account("192.168.7.215", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.235.216", new Account("192.168.7.216", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.235.217", new Account("192.168.7.217", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.235.218", new Account("192.168.7.218", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.235.219", new Account("192.168.7.219", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
// B1.PLC
logServer.NetworkAccount.Add("192.168.113.231", new Account("192.168.113.231", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.113.232", new Account("192.168.113.232", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.113.233", new Account("192.168.113.233", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.113.236", new Account("192.168.113.236", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.233.231", new Account("192.168.233.231", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.233.232", new Account("192.168.233.232", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.233.233", new Account("192.168.233.233", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
// M1
logServer.NetworkAccount.Add("192.168.143.231", new Account("192.168.143.231", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.143.232", new Account("192.168.143.232", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.143.233", new Account("192.168.143.233", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.143.235", new Account("192.168.143.235", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.FTPAddress = "192.168.7.208";
logServer.FTPPort = 7000;
@@ -752,9 +1140,9 @@ namespace DDUtilityApp.LOGPARSER
logServer.DBGetEquipments = sbEquipments.ToString();
logServer.DBGetModelDetails = sbModelDetails.ToString();
logServer.DBGetModelInfo = sbModelInfo.ToString();
logServer.NetworkAccount.Add("192.168.8.215", new Account("192.168.8.215", "DDB2EISLOG", "SJwmseYUExFAP%^", @"eisap01_eislog\log\"));
logServer.NetworkAccount.Add("192.168.8.216", new Account("192.168.8.216", "DDB2EISLOG", "SJwmseYUExFAP%^", @"eisap02_eislog\"));
logServer.NetworkAccount.Add("192.168.8.217", new Account("192.168.8.217", "DDB2EISLOG", "SJwmseYUExFAP%^", @"eisap03_eislog\"));
logServer.NetworkAccount.Add("192.168.8.215", new Account("192.168.8.215", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.8.216", new Account("192.168.8.216", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.NetworkAccount.Add("192.168.8.217", new Account("192.168.8.217", "loguser", "Daeduck!1", @"EISLog", AccessType.FTPS));
logServer.FTPAddress = "192.168.8.217";
logServer.FTPPort = 21;
logServer.FTPUserID = "anonymous";
@@ -821,7 +1209,7 @@ namespace DDUtilityApp.LOGPARSER
equipment.LastTrackOutLotID = row["LASTTRACKOUTLOTID"].ToString();
equipment.Maker = row["MAKER"].ToString();
DateTime pmDateTime = DateTime.MinValue;
if (DateTime.TryParseExact(row["PLANDATE"].ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out pmDateTime))
if (DateTime.TryParseExact(row["PLANDATE"].ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out pmDateTime))
equipment.PMDate = pmDateTime;
equipment.MesRegistration = true;
}
@@ -834,7 +1222,7 @@ namespace DDUtilityApp.LOGPARSER
}
return equipments.OrderBy(x => x.Line).ThenBy(x => x.ProcessSegmentID).ThenBy(x => x.MesName).ToArray();
return equipments.OrderBy(x => x.OrderByKey).ThenBy(x => x.Line).ThenBy(x => x.ProcessSegmentID).ThenBy(x => x.MesName).ToArray();
}
catch (Exception ex)
{
@@ -923,7 +1311,7 @@ namespace DDUtilityApp.LOGPARSER
foreach (LogFile logFile in logFiles)
{
if (string.Compare(item.FullName, logFile.FullName, true) == 0)
if (string.Compare(item.FileName, logFile.FileName, true) == 0)
{
if (current == null)
{
@@ -937,6 +1325,14 @@ namespace DDUtilityApp.LOGPARSER
}
}
private object GetNetworkAccount(string logserverIP) //jhim 20250202
{
return ((LogServer)this.cboxServer.SelectedItem)?.NetworkAccount[logserverIP];
}
/// <summary>
/// DB에서 GEM 정보 수집
/// </summary>
private void GetGEMSetting()
{
try
@@ -964,6 +1360,10 @@ namespace DDUtilityApp.LOGPARSER
}
}
/// <summary>
/// MES DB에서 설비정보 수집
/// </summary>
/// <returns></returns>
private DataTable GetMesEquipment()
{
SqlConnection sqlConnection = null;
@@ -972,6 +1372,8 @@ namespace DDUtilityApp.LOGPARSER
try
{
string connectionString = string.Empty;
connectionString = $@"server=192.168.8.232;database=ddmes;uid=DDB2MESAdmin;pwd=Yhqe4csJXJ4W5$%;";
StringBuilder query = new StringBuilder();
query.AppendLine($" SELECT A.SITEID, ");
query.AppendLine($" A.FACILITYID, ");
@@ -991,30 +1393,13 @@ namespace DDUtilityApp.LOGPARSER
query.AppendLine($" A.MAKER, ");
query.AppendLine($" A.EQPSTATE, ");
query.AppendLine($" A.LOCATION ");
if (this.chkUseMesDB.Checked)
{
connectionString = $@"server=192.168.8.232;database=ddmes;uid=DDB2MESAdmin;pwd=Yhqe4csJXJ4W5$%;";
query.AppendLine($" , E.PLANDATE ");
query.AppendLine($" FROM CIM_EQUIPMENT A (nolock) ");
query.AppendLine($" LEFT JOIN CIM_PROCESSSEGMENT B (nolock) ON A.PROCESSSEGMENTID = B.PROCESSSEGMENTID AND A.SITEID = B.SITEID ");
query.AppendLine($" LEFT JOIN CIM_EQUIPMENT C (nolock) ON A.PARENTID = C.EQUIPMENTID AND A.SITEID = C.SITEID ");
query.AppendLine($" LEFT JOIN CIM_FACILITY D (nolock) ON A.PHYSICALLOCATION = D.FACILITYID AND A.SITEID = D.SITEID ");
query.AppendLine($" LEFT JOIN (SELECT SITEID, EQUIPMENTID, MIN(PLANSTART) PLANDATE FROM DD_SEGMENTPMDETAIL (nolock) WHERE PLANSTART >= '{DateTime.Now.ToString("yyyyMMdd")}' GROUP BY SITEID, EQUIPMENTID) E ON A.EQUIPMENTID = E.EQUIPMENTID AND A.SITEID = E.SITEID ");
//query.AppendLine($" WHERE A.SITEID='1130' ");
}
else
{
connectionString = this.LogServer.DBConnectionString;
query.AppendLine($" , '' PLANDATE ");
query.AppendLine($" FROM [DBLINKMES].[ddmes].[dbo].[CIM_EQUIPMENT] A ");
query.AppendLine($" LEFT JOIN [DBLINKMES].[ddmes].[dbo].[CIM_PROCESSSEGMENT] B (nolock) ON A.PROCESSSEGMENTID = B.PROCESSSEGMENTID AND A.SITEID = B.SITEID ");
query.AppendLine($" LEFT JOIN [DBLINKMES].[ddmes].[dbo].[CIM_EQUIPMENT] C (nolock) ON A.PARENTID = C.EQUIPMENTID AND A.SITEID = C.SITEID ");
query.AppendLine($" LEFT JOIN [DBLINKMES].[ddmes].[dbo].[CIM_FACILITY] D (nolock) ON A.PHYSICALLOCATION = D.FACILITYID AND A.SITEID = D.SITEID ");
//query.AppendLine($" WHERE A.SITEID='1130' ");
}
query.AppendLine($" , E.PLANDATE ");
query.AppendLine($" FROM CIM_EQUIPMENT A (nolock) ");
query.AppendLine($" LEFT JOIN CIM_PROCESSSEGMENT B (nolock) ON A.PROCESSSEGMENTID = B.PROCESSSEGMENTID AND A.SITEID = B.SITEID ");
query.AppendLine($" LEFT JOIN CIM_EQUIPMENT C (nolock) ON A.PARENTID = C.EQUIPMENTID AND A.SITEID = C.SITEID ");
query.AppendLine($" LEFT JOIN CIM_FACILITY D (nolock) ON A.PHYSICALLOCATION = D.FACILITYID AND A.SITEID = D.SITEID ");
query.AppendLine($" LEFT JOIN (SELECT SITEID, EQUIPMENTID, MIN(PLANSTART) PLANDATE FROM DD_SEGMENTPMDETAIL (nolock) WHERE PLANSTART >= '{DateTime.Now.ToString("yyyyMMdd")}' GROUP BY SITEID, EQUIPMENTID) E ON A.EQUIPMENTID = E.EQUIPMENTID AND A.SITEID = E.SITEID ");
//query.AppendLine($" WHERE A.SITEID='1130' ");
sqlConnection = new SqlConnection();
sqlConnection.ConnectionString = connectionString;
@@ -1048,6 +1433,98 @@ namespace DDUtilityApp.LOGPARSER
}
}
/// <summary>
/// SMB Log Files
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>
private LogFile[] GetLogFiles(FileInfo[] fileItems)
{
LogFile[] logFiles = fileItems
.Select(item => new LogFile
{
Account = this.Account,
FullName = item.FullName,
Length = item.Length,
CreationTime = item.CreationTime,
LastAccessTime = item.LastAccessTime,
LastWriteTime = item.LastWriteTime
})
.OrderByDescending(x => x.Name)
.ToArray();
return logFiles;
}
/// <summary>
/// FTPS Log Files
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>
private LogFile[] GetLogFiles(FtpListItem[] fileItems)
{
LogFile[] logFiles = fileItems.Where(item => item.Type == FtpFileSystemObjectType.File)
.Select(item => new LogFile
{
Account = this.Account,
FullName = item.FullName,
Length = item.Size,
CreationTime = item.Modified,
LastAccessTime = item.Modified,
LastWriteTime = item.Modified
})
.OrderByDescending(x => x.Name)
.ToArray();
return logFiles;
}
/// <summary>
/// SFTP Log Files
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>
private LogFile[] GetLogFiles(ISftpFile[] fileItems)
{
LogFile[] logFiles = fileItems.Where(item => !item.IsDirectory && item.Name != "." && item.Name != "..")
.Select(item => new LogFile
{
Account = this.Account,
FullName = item.FullName,
Length = item.Length,
CreationTime = item.LastAccessTime,
LastAccessTime = item.LastAccessTime,
LastWriteTime = item.LastWriteTime
})
.OrderByDescending(x => x.Name)
.ToArray();
return logFiles;
}
/// <summary>
/// Fts Log Files jhlim 20250202
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>
private LogFile[] GetFtpslogFiles(object fileItems)
{
LogFile[] logFiles = ((FtpListItem[])fileItems).Where(item => item.Type == FtpFileSystemObjectType.File)
.Select(item => new LogFile
{
Account = this.Account,
FullName = item.FullName,
Length = item.Size,
CreationTime = item.Modified,
LastAccessTime = item.Modified,
LastWriteTime = item.Modified
})
.OrderByDescending(x => x.Name)
.ToArray();
return logFiles;
}
#endregion
}

View File

@@ -117,6 +117,24 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="gridEquipments.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="gridLogFiles.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>155, 17</value>
</metadata>
<metadata name="gridModelDetail.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>273, 17</value>
</metadata>
<metadata name="gridWorkflow.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>413, 17</value>
</metadata>
<metadata name="gridHsms.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>539, 17</value>
</metadata>
<metadata name="radStatusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>644, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

View File

@@ -8,12 +8,15 @@ using System.Linq;
using System.Net.NetworkInformation;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using DDUtilityApp.DATA;
using DDUtilityApp.LOGPARSER.DATA;
using DDUtilityApp.LOGPARSER.PARSER;
using DDUtilityApp.MONGO;
using DDUtilityApp.SECS;
using FluentFTP;
using JWH;
using JWH.CONTROL;
using JWH.NETWORK;
using Telerik.WinControls.UI;
using ContentAlignment = System.Drawing.ContentAlignment;
@@ -249,7 +252,7 @@ namespace DDUtilityApp.LOGPARSER
switch (keyData)
{
case Keys.F1:
Process.Start($"http://192.168.7.221:8081/");
Process.Start("IEXPLORE.EXE", "http://pms.e1soft.co.kr:8090/Deploy/eqview/");
break;
case Keys.F2:
this.Location = new Point(0, 0);
@@ -353,9 +356,11 @@ namespace DDUtilityApp.LOGPARSER
int index = -1;
index = this.lviewFiles.SelectedItems[0].Index;
LogFile logFile = this.lviewFiles.Items[index].Tag as LogFile;
if (logFile == null) return;
this.tboxFilename.Text = Path.GetFileName(this.lviewFiles.Items[index].Tag as string);
this.tboxFilename.Tag = Path.GetDirectoryName(this.lviewFiles.Items[index].Tag as string);
this.tboxFilename.Text = logFile.FileName;
this.tboxFilename.Tag = logFile;
if (string.IsNullOrEmpty(this.tboxFilename.Text) == false && this.tboxFilename.Text.Length > 6)
{
this.tboxFilename.SelectionStart = this.tboxFilename.Text.Length - 6;
@@ -452,14 +457,25 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
string path = this.tboxFilename.Tag as string;
string fileName = this.tboxFilename.Text;
if (string.IsNullOrEmpty(fileName)) return;
foreach (ListViewItem item in this.lviewFiles.Items)
if (string.Compare(item.Text, fileName, true) == 0) return;
ListViewItem lviewItem = this.lviewFiles.Items.Add(fileName);
lviewItem.Tag = $"{path}{Path.DirectorySeparatorChar}{fileName}";
LogFile srcLogFile = this.tboxFilename.Tag as LogFile;
if (srcLogFile == null)
{
if (this.lviewFiles.Items.Count < 1) return;
srcLogFile = this.lviewFiles.Items[0].Tag as LogFile;
if (srcLogFile == null) return;
}
string fullName = Path.Combine(srcLogFile.DirectoryName, fileName);
LogFile newLogFile = new LogFile(fullName) { Account = srcLogFile.Account };
ListViewItem lviewItem = this.lviewFiles.Items.Add(newLogFile.FileName);
lviewItem.Tag = newLogFile;
lviewItem.Checked = true;
}
catch (Exception ex)
@@ -501,7 +517,7 @@ namespace DDUtilityApp.LOGPARSER
this.Cursor = Cursors.WaitCursor;
System.GC.Collect();
this.Parsing();
this.DownLoad_Parsing();
StandardData[] array = this.Filtering(this.StandardCollection.ToArray());
this.grid.AutoBinding(array);
@@ -551,14 +567,16 @@ namespace DDUtilityApp.LOGPARSER
{
if (this.LogParser == null) return;
List<string> lstFileNames = new List<string>();
List<LogFile> lstLogFile = new List<LogFile>();
foreach (ListViewItem item in this.lviewFiles.Items)
{
if (item.Tag != null && item.Tag.GetType() == typeof(string))
lstFileNames.Add(item.Tag.ToString());
if (item.Tag != null && item.Tag.GetType() == typeof(LogFile))
lstLogFile.Add((LogFile)item.Tag);
}
string[] selectedFiles = this.LogParser.FileSelector(this, lstFileNames.ToArray());
if (selectedFiles == null || selectedFiles.Length < 1) return;
// LogPaser > FrmEqSelector
LogFile[] logfiles = this.LogParser.FileSelector(this, lstLogFile.ToArray());
if (logfiles == null || logfiles.Length < 1) return;
if (this.chkAutoClear.Checked) this.BtnFileClear_Click(this.btnFileClear, new EventArgs());
this.cboxLineNumber.Items.Clear();
@@ -576,12 +594,13 @@ namespace DDUtilityApp.LOGPARSER
this.LogParser.ModelID = this.Equipment.ModelID;
}
foreach (string filename in selectedFiles)
foreach (LogFile logfile in logfiles)
{
this.tboxFilename.Tag = Path.GetDirectoryName(filename);
this.tboxFilename.Text = Path.GetFileName(filename);
this.tboxFilename.Tag = logfile;
this.tboxFilename.Text = logfile.FileName;
this.BtnFileAdd_Click(this.btnFileAdd, new EventArgs());
}
this.tboxFilename.Tag = null;
if (this.chkAutoClear.Checked)
this.BtnParsing_Click(this.btnParsing, new EventArgs());
@@ -789,25 +808,20 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
List<string> lstFileName = new List<string>();
List<string> lstFullName = new List<string>();
foreach (ListViewItem lviewItem in this.lviewFiles.Items)
{
if (lviewItem.Checked == false) continue;
XLogger.Instance.Info(lviewItem.Text);
string sourceFileName = lviewItem.Tag as string;
string destPath = GlobalVariable.Instance.DownloadPath;
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
LogFile logFile = lviewItem.Tag as LogFile;
if (logFile == null) continue;
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(sourceFileName)}";
if (this.chkDownload.Checked == false) System.IO.File.Copy(sourceFileName, destFileName, true);
sourceFileName = destFileName;
lstFileName.Add(sourceFileName);
lstFullName.Add(logFile.DestFullName);
}
foreach (string filename in lstFileName)
Process.Start(filename);
foreach (string fullName in lstFullName)
Process.Start(fullName);
}
catch (Exception ex)
{
@@ -1273,7 +1287,105 @@ namespace DDUtilityApp.LOGPARSER
#region [ Method ] ----------------------------------------------------
private StandardCollection Parsing()
/// <summary>
/// [CheckPoint] 로그파일을 로컬에 복제(다운로드)후, 데이터를 생성한다
/// </summary>
/// <returns></returns>
private StandardCollection DownLoad_Parsing()
{
try
{
this.tboxLog.Clear();
this.tboxException.Clear();
this.StandardCollection.Clear();
List<string> lstFileName = new List<string>();
string strTitle = string.Empty;
string destPath = string.Empty;
// Process Unit: File
foreach (ListViewItem lviewItem in this.lviewFiles.Items) //jhlim 20250202
{
if (lviewItem.Checked == false) continue;
XLogger.Instance.Info(lviewItem.Text);
LogFile logFile = lviewItem.Tag as LogFile;
switch(logFile.Account.Access)
{
case AccessType.SMB:
{
FileInfo fileInfo = new FileInfo(logFile.FullName);
if (fileInfo.Exists == false) continue;
logFile.Length = fileInfo.Length;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add(logFile.GetFileSize());
else lviewItem.SubItems[1].Text = logFile.GetFileSize();
if (this.chkDownload.Checked)
{
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (Directory.Exists(destPath) == false) Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = this.Equipment.MesName;
logFile.DestFullName = Path.Combine(destPath, logFile.FileName);
File.Copy(logFile.FullName, logFile.DestFullName, true);
}
}
break;
case AccessType.FTPS:
{
if (FtpsClient._host != logFile.Account.IPAddress)
FtpsClient.Initialize(logFile.Account.IPAddress, logFile.Account.UserID, logFile.Account.Password);
FtpListItem ftpsFileInfo = FtpsClient.GetFileInfo(logFile.FullName);
if (ftpsFileInfo == null) continue;
logFile.Length = ftpsFileInfo.Size;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add(logFile.GetFileSize());
else lviewItem.SubItems[1].Text = logFile.GetFileSize();
if (this.chkDownload.Checked)
{
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (Directory.Exists(destPath) == false) Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = this.Equipment.MesName;
logFile.DestFullName = Path.Combine(destPath, logFile.FileName);
FtpsClient.DownloadFtpsFile(logFile.FullName, logFile.DestFullName);
}
}
break;
case AccessType.SFTP:
break;
case AccessType.FTP:
break;
}
lstFileName.Add(logFile.DestFullName);
}
if (!string.IsNullOrEmpty(this.tboxEISInfo04.Text)) this.LogParser.ModelID = this.tboxEISInfo04.Text;
if (this.SECSDefine != null) this.LogParser.SECSDefine = this.SECSDefine;
this.LogParser.Parsing(lstFileName.ToArray());
this.Text = $"{strTitle} - Ver. {Application.ProductVersion}";
this.tboxLog.Text = this.LogParser.LogString.ToString();
this.StandardCollection.AddRange(this.LogParser.StandardCollection);
return this.StandardCollection;
}
catch (Exception ex)
{
XLogger.Instance.Fatal(ex);
return this.StandardCollection;
}
}
/// <summary>
/// [CheckPoint] 로그파일을 로컬에 복제후, 데이터를 생성한다
/// </summary>
/// <returns></returns>
private StandardCollection xParsing()
{
try
{
@@ -1285,29 +1397,59 @@ namespace DDUtilityApp.LOGPARSER
string strTitle = string.Empty;
// Process Unit: File
foreach (ListViewItem lviewItem in this.lviewFiles.Items)
foreach (ListViewItem lviewItem in this.lviewFiles.Items) //jhlim 20250202
{
if (lviewItem.Checked == false) continue;
XLogger.Instance.Info(lviewItem.Text);
string fullPath = lviewItem.Tag as string;
FileInfo fileInfo = new FileInfo(fullPath);
if (fileInfo.Exists == false) continue;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB");
else lviewItem.SubItems[1].Text = $"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB";
if (this.chkDownload.Checked)
//var sftpFileInfo = SftpClientWrapper.GetFileInfo(fullPath);
var ftpsFileInfo = FtpsClient.GetFileInfo(fullPath);
//if (sftpFileInfo != null)
if (ftpsFileInfo != null)
{
string destPath = GlobalVariable.Instance.DownloadPath;
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = System.IO.Path.GetFileNameWithoutExtension(fullPath);
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
System.IO.File.Copy(fullPath, destFileName, true);
fullPath = destFileName;
//if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)sftpFileInfo.Size / 1024 / 1024).ToString("F2")} MB");
//else lviewItem.SubItems[1].Text = $"{((float)sftpFileInfo.Size / 1024 / 1024).ToString("F2")} MB";
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)ftpsFileInfo.Size / 1024 / 1024).ToString("F2")} MB");
else lviewItem.SubItems[1].Text = $"{((float)ftpsFileInfo.Size / 1024 / 1024).ToString("F2")} MB";
if (this.chkDownload.Checked)
{
string destPath = GlobalVariable.Instance.DownloadPath;
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = System.IO.Path.GetFileNameWithoutExtension(fullPath);
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
//SftpClientWrapper.DownloadSftpFile(fullPath, destFileName);
FtpsClient.DownloadFtpsFile(fullPath, destFileName);
fullPath = destFileName;
}
}
else
{
FileInfo fileInfo = new FileInfo(fullPath); //
if (fileInfo.Exists == false) continue;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB");
else lviewItem.SubItems[1].Text = $"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB";
if (this.chkDownload.Checked)
{
string destPath = GlobalVariable.Instance.DownloadPath;
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = System.IO.Path.GetFileNameWithoutExtension(fullPath);
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
if (fullPath != destFileName)
{
System.IO.File.Copy(fullPath, destFileName, true);
}
fullPath = destFileName;
}
}
lstFileName.Add(fullPath);
} // Process Unit: File

View File

@@ -252,6 +252,8 @@ namespace DDUtilityApp.DATA
public class Account
{
public AccessType Access { get; set; } = AccessType.FTPS;
public string IPAddress { get; set; }
public string UserID { get; set; }
@@ -264,12 +266,13 @@ namespace DDUtilityApp.DATA
{
}
public Account(string ipAddress, string uid, string pwd, string defaultPath = "")
public Account(string ipAddress, string uid, string pwd, string defaultPath = "", AccessType access = AccessType.SMB)
{
this.IPAddress = ipAddress;
this.UserID = uid;
this.Password = pwd;
this.DefaultPath = defaultPath;
this.Access = access;
}
}

View File

@@ -311,23 +311,20 @@ namespace DDUtilityApp.LOGPARSER.PARSER
grid.AddColumn("Column5");
}
public override string[] FileSelector(FrmLogParser sender, params string[] args)
public override LogFile[] FileSelector(FrmLogParser sender, params LogFile[] args)
{
FrmEqSelector dlg = null;
try
{
List<LogFile> lstLogFile = new List<LogFile>();
foreach (string filename in args)
{
LogFile logFile = new LogFile(filename);
lstLogFile.Add(logFile);
}
List<LogFile> logFiles = new List<LogFile>();
logFiles.AddRange(args);
FrmEqSelector dlg = new FrmEqSelector();
dlg = new FrmEqSelector();
dlg.Owner = sender;
dlg.Size = sender.Size;
dlg.StartPosition = FormStartPosition.CenterParent;
dlg.Equipment = sender.Equipment;
dlg.SelectedLogFiles = lstLogFile.ToArray();
dlg.SelectedLogFiles = logFiles.ToArray();
DialogResult dlgResult = dlg.ShowDialog();
if (dlgResult != DialogResult.OK) return null;
@@ -336,17 +333,18 @@ namespace DDUtilityApp.LOGPARSER.PARSER
sender.Equipment = equipment;
sender.SECSDefine = dlg.SECSDefine;
List<string> lstFilename = new List<string>();
foreach (LogFile logFile in dlg.SelectedLogFiles)
lstFilename.Add(logFile.FullName);
return lstFilename.ToArray();
return dlg.SelectedLogFiles;
}
catch (Exception ex)
{
XLogger.Instance.Fatal(ex, true);
return null;
}
finally
{
if (dlg != null) dlg.Dispose();
}
}
#endregion

View File

@@ -7,6 +7,7 @@ using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using DDUtilityApp.DATA;
using DDUtilityApp.LOGPARSER.DATA;
using DDUtilityApp.SECS;
using JWH;
@@ -361,49 +362,48 @@ namespace DDUtilityApp.LOGPARSER.PARSER
GlobalVariable.Instance.SaveSetting();
}
public override string[] FileSelector(FrmLogParser sender, params string[] args)
/// <summary>
/// [CheckPoint] 로그파일 선택창을 표시한 후, 선택된 목록을 반환한다
/// </summary>
/// <param name="sender"></param>
/// <param name="args"></param>
/// <returns></returns>
public override LogFile[] FileSelector(FrmLogParser sender, params LogFile[] args)
{
FrmEqSelector dlg = null;
try
{
List<LogFile> lstLogFile = new List<LogFile>();
foreach (string filename in args)
{
LogFile logFile = new LogFile(filename);
lstLogFile.Add(logFile);
}
lstLogFile.AddRange(args);
FrmEqSelector dlg = new FrmEqSelector();
dlg = new FrmEqSelector();
dlg.Owner = sender;
dlg.Size = sender.Size;
dlg.Size = new System.Drawing.Size(sender.Width - 60, sender.Height - 60);
dlg.StartPosition = FormStartPosition.CenterParent;
dlg.Equipment = sender.Equipment;
dlg.ServerName = this.ServerName;
dlg.EquipmentID = this.EquipmentID;
dlg.Equipment = sender.Equipment == null ? new EisEquipment() { EquipmentID = this.EquipmentID, Server = new LogServer(this.ServerName)} : sender.Equipment;
dlg.SelectedLogFiles = lstLogFile.ToArray();
DialogResult dlgResult = dlg.ShowDialog();
if (dlgResult != DialogResult.OK)
{
dlg.Dispose();
return null;
}
if (dlgResult != DialogResult.OK) return null;
this.Account = dlg.Account;
EisEquipment equipment = dlg.Equipment as EisEquipment;
if (equipment == null) return null;
sender.Equipment = equipment;
sender.SECSDefine = dlg.SECSDefine;
List<string> lstFilename = new List<string>();
foreach (LogFile logFile in dlg.SelectedLogFiles)
lstFilename.Add(logFile.FullName);
dlg.Dispose();
return lstFilename.ToArray();
return dlg.SelectedLogFiles;
}
catch (Exception ex)
{
XLogger.Instance.Fatal(ex, true);
return null;
}
finally
{
if (dlg != null) dlg.Dispose();
}
}
#endregion

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Windows.Forms;
using DDUtilityApp.DATA;
using DDUtilityApp.LOGPARSER.DATA;
using DDUtilityApp.SECS;
using JWH;
@@ -30,6 +31,11 @@ namespace DDUtilityApp.LOGPARSER.PARSER
public List<string> Files { get; set; } = new List<string>();
/// <summary>
/// 로그서버 접속정보
/// </summary>
public Account Account { get; set; } = null;
public StandardCollection StandardCollection { get; set; } = new StandardCollection();
public StringBuilder LogString { get; set; } = new StringBuilder();
@@ -100,14 +106,14 @@ namespace DDUtilityApp.LOGPARSER.PARSER
{
}
public virtual string[] FileSelector(FrmLogParser sender, params string[] args)
public virtual LogFile[] FileSelector(FrmLogParser sender, params LogFile[] args)
{
string directoryName = string.Empty;
string fileName = string.Empty;
if (args != null && args.Length > 0)
{
directoryName = Path.GetDirectoryName(args[0]);
fileName = Path.GetFileName(args[0]);
directoryName = args[0].DirectoryName;
fileName = args[0].FileName;
}
OpenFileDialog dlg = new OpenFileDialog();
@@ -116,7 +122,16 @@ namespace DDUtilityApp.LOGPARSER.PARSER
dlg.FileName = fileName;
if (dlg.ShowDialog() == DialogResult.OK)
return dlg.FileNames;
{
List<LogFile> lstFiles = new List<LogFile>();
foreach (string name in dlg.FileNames)
{
FileInfo fileInfo = new FileInfo(name);
lstFiles.Add(fileInfo.ToClass<LogFile>());
}
return lstFiles.ToArray();
}
return null;
}

View File

@@ -0,0 +1,75 @@

namespace DDUtilityApp.MESDOWNLOADER
{
partial class ProgressForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.progressBar = new System.Windows.Forms.ProgressBar();
this.lblStatus = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(20, 20);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(250, 20);
this.progressBar.TabIndex = 0;
//
// lblStatus
//
this.lblStatus.AutoSize = true;
this.lblStatus.Location = new System.Drawing.Point(28, 54);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(38, 12);
this.lblStatus.TabIndex = 1;
this.lblStatus.Text = "label1";
this.lblStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// ProgressForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 93);
this.ControlBox = false;
this.Controls.Add(this.lblStatus);
this.Controls.Add(this.progressBar);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "ProgressForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "다운로드 진행 중";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.Label lblStatus;
}
}

View File

@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
namespace DDUtilityApp.MESDOWNLOADER
{
public partial class ProgressForm : Form
{
public ProgressForm(int maxFiles)
{
InitializeComponent();
progressBar.Maximum = maxFiles + 1;
lblStatus.Text = string.Empty;
}
public void UpdateProgress(string fileName, int current)
{
if (this.InvokeRequired)
{
this.Invoke(new Action(() => UpdateProgress(fileName, current)));
}
else
{
lblStatus.Text = $"{fileName}\r\n{current} / {progressBar.Maximum - 1}";
progressBar.Value = current;
}
}
}
}

View File

@@ -0,0 +1,376 @@

namespace DDUtilityApp.MESDOWNLOADER
{
partial class ServerLog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition1 = new Telerik.WinControls.UI.TableViewDefinition();
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition2 = new Telerik.WinControls.UI.TableViewDefinition();
this.cboxServer = new System.Windows.Forms.ComboBox();
this.btnConnect = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.btnFoder = new System.Windows.Forms.Button();
this.panel4 = new System.Windows.Forms.FlowLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.txtPath = new System.Windows.Forms.TextBox();
this.panel2 = new System.Windows.Forms.Panel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.panel3 = new System.Windows.Forms.Panel();
this.panel6 = new System.Windows.Forms.Panel();
this.gridServer = new JWH.CONTROL.GridViewEx();
this.panel5 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.gridLogFiles = new JWH.CONTROL.GridViewEx();
this.panel1 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.plSubPart = new System.Windows.Forms.FlowLayoutPanel();
this.btnPath = new System.Windows.Forms.Button();
this.panel4.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
this.splitContainer2.SuspendLayout();
this.panel3.SuspendLayout();
this.panel6.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridServer)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridServer.MasterTemplate)).BeginInit();
this.panel5.SuspendLayout();
this.panel7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles.MasterTemplate)).BeginInit();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// cboxServer
//
this.cboxServer.FormattingEnabled = true;
this.cboxServer.Location = new System.Drawing.Point(100, 4);
this.cboxServer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cboxServer.Name = "cboxServer";
this.cboxServer.Size = new System.Drawing.Size(215, 20);
this.cboxServer.TabIndex = 1;
this.cboxServer.SelectedIndexChanged += new System.EventHandler(this.cboxServer_SelectedIndexChanged);
//
// btnConnect
//
this.btnConnect.Location = new System.Drawing.Point(321, 4);
this.btnConnect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnConnect.Name = "btnConnect";
this.btnConnect.Size = new System.Drawing.Size(87, 23);
this.btnConnect.TabIndex = 1;
this.btnConnect.Text = "연결";
this.btnConnect.UseVisualStyleBackColor = true;
this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
//
// label2
//
this.label2.Dock = System.Windows.Forms.DockStyle.Left;
this.label2.Location = new System.Drawing.Point(414, 2);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(88, 27);
this.label2.TabIndex = 5;
this.label2.Text = "로컬디렉토리 :";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnFoder
//
this.btnFoder.Location = new System.Drawing.Point(855, 4);
this.btnFoder.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnFoder.Name = "btnFoder";
this.btnFoder.Size = new System.Drawing.Size(66, 23);
this.btnFoder.TabIndex = 4;
this.btnFoder.Text = "폴더";
this.btnFoder.UseVisualStyleBackColor = true;
this.btnFoder.Click += new System.EventHandler(this.btnFoder_Click);
//
// panel4
//
this.panel4.Controls.Add(this.label1);
this.panel4.Controls.Add(this.cboxServer);
this.panel4.Controls.Add(this.btnConnect);
this.panel4.Controls.Add(this.label2);
this.panel4.Controls.Add(this.txtPath);
this.panel4.Controls.Add(this.btnFoder);
this.panel4.Controls.Add(this.btnPath);
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(0, 0);
this.panel4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel4.MinimumSize = new System.Drawing.Size(0, 19);
this.panel4.Name = "panel4";
this.panel4.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel4.Size = new System.Drawing.Size(1007, 31);
this.panel4.TabIndex = 0;
//
// label1
//
this.label1.Dock = System.Windows.Forms.DockStyle.Left;
this.label1.Location = new System.Drawing.Point(6, 2);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 27);
this.label1.TabIndex = 0;
this.label1.Text = "Server : ";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// txtPath
//
this.txtPath.Location = new System.Drawing.Point(508, 5);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(341, 21);
this.txtPath.TabIndex = 2;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.plSubPart);
this.panel2.Controls.Add(this.panel8);
this.panel2.Controls.Add(this.panel4);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1009, 73);
this.panel2.TabIndex = 2;
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(3, 2);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel2);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
this.splitContainer1.Size = new System.Drawing.Size(1009, 622);
this.splitContainer1.SplitterDistance = 73;
this.splitContainer1.SplitterWidth = 2;
this.splitContainer1.TabIndex = 1;
//
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.splitContainer2.Name = "splitContainer2";
//
// splitContainer2.Panel1
//
this.splitContainer2.Panel1.Controls.Add(this.panel3);
//
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.panel5);
this.splitContainer2.Size = new System.Drawing.Size(1009, 547);
this.splitContainer2.SplitterDistance = 570;
this.splitContainer2.TabIndex = 1;
//
// panel3
//
this.panel3.Controls.Add(this.panel6);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel3.Name = "panel3";
this.panel3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel3.Size = new System.Drawing.Size(570, 547);
this.panel3.TabIndex = 1;
//
// panel6
//
this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel6.Controls.Add(this.gridServer);
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel6.Location = new System.Drawing.Point(3, 2);
this.panel6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(564, 543);
this.panel6.TabIndex = 3;
//
// gridServer
//
this.gridServer.ColumnResizeKey = System.Windows.Forms.Keys.F6;
this.gridServer.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridServer.Location = new System.Drawing.Point(0, 0);
this.gridServer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
//
//
//
this.gridServer.MasterTemplate.ViewDefinition = tableViewDefinition1;
this.gridServer.Name = "gridServer";
this.gridServer.Size = new System.Drawing.Size(562, 541);
this.gridServer.TabIndex = 0;
//
// panel5
//
this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel5.Controls.Add(this.panel7);
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel5.Location = new System.Drawing.Point(0, 0);
this.panel5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(435, 547);
this.panel5.TabIndex = 3;
//
// panel7
//
this.panel7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel7.Controls.Add(this.gridLogFiles);
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel7.Location = new System.Drawing.Point(0, 0);
this.panel7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(433, 545);
this.panel7.TabIndex = 4;
//
// gridLogFiles
//
this.gridLogFiles.ColumnResizeKey = System.Windows.Forms.Keys.F6;
this.gridLogFiles.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridLogFiles.Location = new System.Drawing.Point(0, 0);
this.gridLogFiles.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
//
//
//
this.gridLogFiles.MasterTemplate.ViewDefinition = tableViewDefinition2;
this.gridLogFiles.Name = "gridLogFiles";
this.gridLogFiles.Size = new System.Drawing.Size(431, 543);
this.gridLogFiles.TabIndex = 1;
//
// panel1
//
this.panel1.Controls.Add(this.splitContainer1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel1.Name = "panel1";
this.panel1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel1.Size = new System.Drawing.Size(1015, 626);
this.panel1.TabIndex = 2;
//
// panel8
//
this.panel8.Dock = System.Windows.Forms.DockStyle.Left;
this.panel8.Location = new System.Drawing.Point(0, 31);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(46, 40);
this.panel8.TabIndex = 1;
//
// plSubPart
//
this.plSubPart.Dock = System.Windows.Forms.DockStyle.Fill;
this.plSubPart.Location = new System.Drawing.Point(46, 31);
this.plSubPart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.plSubPart.MinimumSize = new System.Drawing.Size(0, 19);
this.plSubPart.Name = "plSubPart";
this.plSubPart.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.plSubPart.Size = new System.Drawing.Size(961, 40);
this.plSubPart.TabIndex = 2;
//
// btnPath
//
this.btnPath.Location = new System.Drawing.Point(927, 4);
this.btnPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPath.Name = "btnPath";
this.btnPath.Size = new System.Drawing.Size(66, 23);
this.btnPath.TabIndex = 6;
this.btnPath.Text = "경로열기";
this.btnPath.UseVisualStyleBackColor = true;
this.btnPath.Click += new System.EventHandler(this.btnPath_Click);
//
// ServerLog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1015, 626);
this.Controls.Add(this.panel1);
this.Name = "ServerLog";
this.Text = "ServerLog";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.Shown += new System.EventHandler(this.ServerLog_Shown);
this.Resize += new System.EventHandler(this.ServerLog_Resize);
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel2.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
this.splitContainer2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel6.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridServer.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridServer)).EndInit();
this.panel5.ResumeLayout(false);
this.panel7.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles.MasterTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridLogFiles)).EndInit();
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ComboBox cboxServer;
private System.Windows.Forms.Button btnConnect;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnFoder;
private System.Windows.Forms.FlowLayoutPanel panel4;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtPath;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel6;
private JWH.CONTROL.GridViewEx gridServer;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.Panel panel7;
private JWH.CONTROL.GridViewEx gridLogFiles;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.FlowLayoutPanel plSubPart;
private System.Windows.Forms.Panel panel8;
private System.Windows.Forms.Button btnPath;
}
}

View File

@@ -0,0 +1,385 @@
using JWH.CONTROL;
using JWH.NETWORK;
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls.Data;
using Telerik.WinControls.UI;
namespace DDUtilityApp.MESDOWNLOADER
{
public partial class ServerLog : Form
{
DataSet dsXml;
DataTable dtFiles;
public ServerLog()
{
InitializeComponent();
SetDataTable();
GetXmlFile();
gridLogFiles.CellDoubleClick += Grid_CellDoubleClick;
gridLogFiles.KeyDown += Grid_KeyDown;
}
private void ServerLog_Shown(object sender, EventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
txtPath.Text = GlobalVariable.Instance.MesDownloadPath; //Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
SetGridView();
}
private void ServerLog_Resize(object sender, EventArgs e)
{
splitContainer2.SplitterDistance = splitContainer2.ClientSize.Width / 2;
}
private void btnConnect_Click(object sender, EventArgs e)
{
gridLogFiles.DataSource = null;
dtFiles.Rows.Clear();
LoadFiles(gridServer.ChildRows);
}
private void btnFoder_Click(object sender, EventArgs e)
{
// 폴더 선택 대화 상자를 생성
using (FolderBrowserDialog folderDialog = new FolderBrowserDialog())
{
// txtPath.Text에 값이 있으면 해당 경로로 설정, 없으면 문서 폴더로 설정
if (!string.IsNullOrEmpty(txtPath.Text))
{
folderDialog.SelectedPath = txtPath.Text;
}
else
{
// 초기값이 없으면 문서 폴더를 기본 경로로 설정
folderDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
}
// 폴더 선택 대화 상자가 "확인" 버튼을 클릭했을 경우
if (folderDialog.ShowDialog() == DialogResult.OK)
{
// 선택한 경로를 텍스트 박스에 표시
txtPath.Text = folderDialog.SelectedPath;
GlobalVariable.Instance.MesDownloadPath = folderDialog.SelectedPath;
}
}
}
private void btnPath_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("explorer.exe", txtPath.Text);
}
private void cboxServer_SelectedIndexChanged(object sender, EventArgs e)
{
gridServer.DataSource = null;
if (dsXml == null || !dsXml.Tables.Contains("Item")) return;
int serverId = 0;
if (cboxServer.SelectedValue == null) return;
if (cboxServer.SelectedValue is DataRowView dataRowView)
{
serverId = Convert.ToInt32(dataRowView["Server_Id"]); // Replace "ColumnName" with the actual column name
}
else
{
serverId = Convert.ToInt32(cboxServer.SelectedValue);
}
DataTable filteredTable = dsXml.Tables["Item"].Clone();
// LINQ를 사용하여 Server Item Server_Id 기준으로 조인
var query = from table1 in dsXml.Tables["Server"].AsEnumerable()
join table2 in dsXml.Tables["Item"].AsEnumerable()
on table1.Field<int>("Server_Id") equals table2.Field<int>("Server_Id")
where table2.Field<int>("Server_Id") == serverId // 필터 조건을 추가
select new
{
name = table1.Field<string>("name"),
nameap = table2.Field<string>("name"),
url = table2.Field<string>("url"),
dir = table2.Field<string>("dir"),
conkey = table2.Field<string>("conkey"),
Server_Id = table2.Field<int>("Server_Id")
};
gridServer.DataSource = query;
var uniqueNames = query.Select(x => x.nameap).Distinct();
UpdateCheckBoxes(uniqueNames);
SetGridView();
}
private void Grid_KeyDown(object sender, KeyEventArgs e) //jhlim 20250202
{
if (e.KeyCode == Keys.Enter)
{
Grid_CellDoubleClick((GridViewEx)sender, null);
}
}
private bool isProcessing = false; // 중복 실행 방지 플래그
private async void Grid_CellDoubleClick(object sender, GridViewCellEventArgs e) // jhlim 20250202
{
if (isProcessing) return; // 이미 실행 중이면 종료
isProcessing = true; // 실행 상태 설정
RadGridView gd = sender.GetType().Name.Contains("GridDataCellElement") ?
((GridDataCellElement)sender)?.RowElement?.GridControl : (GridViewEx)sender;
try
{
List<string> mergefileList = new List<string>();
bool rtnBool = false;
int totalFiles = gd.SelectedRows.Count;
if (totalFiles == 0)
{
MessageBox.Show("선택된 파일이 없습니다.");
isProcessing = false;
return;
}
// 프로그래스 바 폼 생성 및 표시
using (ProgressForm progressForm = new ProgressForm(totalFiles))
{
progressForm.Show();
progressForm.UpdateProgress(string.Empty, 0); // 초기 상태 업데이트
int processedCount = 0;
// 파일 다운로드 비동기 처리
foreach (GridViewRowInfo row in gd.SelectedRows)
{
var host = Util.GetStr(row.Cells["url"].Value);
var dir = row.Cells["dir"].Value;
var fileName = row.Cells["FileName"].Value;
var userId = Util.GetStr(row.Cells["userId"].Value);
var password = Util.GetStr(row.Cells["password"].Value);
// 진행 상태 업데이트
processedCount++;
progressForm.UpdateProgress(fileName?.ToString(), processedCount);
FtpsClient.Disconnect();
FtpsClient.Initialize(host, userId, password);
rtnBool = await Task.Run(() =>
FtpsClient.DownloadFtpsFile($"{dir}/{fileName}", $"{txtPath.Text}\\{fileName}")
);
if (!rtnBool)
{
MessageBox.Show($"{fileName} 다운로드에 실패했습니다.");
break;
}
mergefileList.Add($"{txtPath.Text}\\{fileName}");
}
progressForm.Close(); // 프로그래스 바 폼 닫기
}
// 다운로드 완료 후 병합 처리
if (rtnBool)
{
if (totalFiles > 1)
{
string filename = Util.GetFileMerge(mergefileList);
MessageBox.Show($"{totalFiles}개의 파일을 머지 하였습니다.");
System.Diagnostics.Process.Start(filename);
}
else
{
MessageBox.Show($"{gd.SelectedRows[0].Cells["Name"].Value} 파일을 저장 하였습니다.");
string fileName = mergefileList[0];
string extension = Path.GetExtension(fileName);
if (string.Compare(extension, ".Log", true) != 0)
{
fileName += ".Log";
File.Move(mergefileList[0], fileName);
}
System.Diagnostics.Process.Start(fileName);
}
}
}
catch (Exception ex)
{
MessageBox.Show($"에러 발생: {ex.Message}");
}
finally
{
isProcessing = false; // 실행 완료 후 플래그 해제
}
}
private void GetXmlFile()
{
string xmlPath = ConfigurationManager.AppSettings["BULK_VIEWER"];
dsXml = XmlToDsConverter.ConvertXmlToDataSet(xmlPath);
if (dsXml == null || dsXml.Tables.Count == 0)
{
MessageBox.Show("XML 데이터를 불러올 수 없습니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
PopulateComboBox();
}
private void PopulateComboBox()
{
if (dsXml == null || !dsXml.Tables.Contains("Server")) return;
cboxServer.DataSource = dsXml.Tables["Server"];
cboxServer.DisplayMember = "name"; // 사용자가 볼 값 (서버 이름)
cboxServer.ValueMember = "Server_Id"; // 내부적으로 사용할 값 (서버 ID)
cboxServer.SelectedIndex = 0;
}
private void SetDataTable()
{
dtFiles = new DataTable();
dtFiles.Columns.Add("Name", typeof(string));
dtFiles.Columns.Add("nameap", typeof(string));
dtFiles.Columns.Add("FileName", typeof(string));
dtFiles.Columns.Add("Size", typeof(string));
dtFiles.Columns.Add("Modified", typeof(string));
dtFiles.Columns.Add("Type", typeof(string));
dtFiles.Columns.Add("url", typeof(string));
dtFiles.Columns.Add("dir", typeof(string));
dtFiles.Columns.Add("userId", typeof(string));
dtFiles.Columns.Add("password", typeof(string));
}
private void SetGridView()
{
gridServer.Columns.Clear();
gridLogFiles.Columns.Clear();
gridLogFiles.MultiSelect = true;
gridLogFiles.SelectionMode = GridViewSelectionMode.FullRowSelect;
gridServer.AutoGenerateColumns = false;
gridServer.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; // 컬럼 크기 자동 조정 끄기
// 컬럼 추가
gridServer.Columns.Add(new GridViewTextBoxColumn("name") { HeaderText = "시스템명", Width = 100, ReadOnly = true });
gridServer.Columns.Add(new GridViewTextBoxColumn("nameap") { HeaderText = "서버명", Width = 100, ReadOnly = true });
gridServer.Columns.Add(new GridViewTextBoxColumn("url") { HeaderText = "FTP 서버", Width = 300, ReadOnly = true });
gridServer.Columns.Add(new GridViewTextBoxColumn("dir") { HeaderText = "FTP 폴더", Width = 300, ReadOnly = true });
gridServer.Columns.Add(new GridViewTextBoxColumn("conkey") { IsVisible = false });
gridLogFiles.AutoGenerateColumns = false;
gridLogFiles.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None; // 컬럼 크기 자동 조정 끄기
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("name") { HeaderText = "시스템", Width = 100, ReadOnly = true });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("nameap") { HeaderText = "서버", Width = 100, ReadOnly = true });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("FileName") { HeaderText = "파일명", Width = 300, ReadOnly = true });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("Size") { HeaderText = "파일 크기", Width = 100, TextAlignment = ContentAlignment.MiddleRight, ReadOnly = true });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("Modified") { HeaderText = "수정 날짜", Width = 150, TextAlignment = ContentAlignment.MiddleCenter, ReadOnly = true });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("Type") { HeaderText = "파일 유형", Width = 100, ReadOnly = true });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("url") { IsVisible = false });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("dir") { IsVisible = false });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("userId") { IsVisible = false });
gridLogFiles.Columns.Add(new GridViewTextBoxColumn("password") { IsVisible = false });
FilterGridByNameap();
}
private void FilterGridByNameap()
{
var checkedNames = plSubPart.Controls.OfType<CheckBox>()
.Where(c => c.Checked)
.Select(c => c.Text)
.ToList();
// 기존 필터 제거
gridServer.FilterDescriptors.Clear();
gridLogFiles.FilterDescriptors.Clear();
// 체크된 항목이 없으면 전체 표시
if (checkedNames == null || checkedNames.Count == 0)
return;
// 필터 생성
CompositeFilterDescriptor compositeFilter = new CompositeFilterDescriptor();
compositeFilter.LogicalOperator = FilterLogicalOperator.Or;
foreach (var name in checkedNames)
{
compositeFilter.FilterDescriptors.Add(new FilterDescriptor("nameap", FilterOperator.IsEqualTo, name));
}
// 필터 적용
gridServer.FilterDescriptors.Add(compositeFilter);
gridLogFiles.FilterDescriptors.Add(compositeFilter);
}
private void UpdateCheckBoxes(IEnumerable<string> uniqueNames)
{
// 기존 체크박스 삭제
plSubPart.Controls.Clear();
// 이름을 정렬
var sortedNames = uniqueNames.OrderBy(name => name);
// 체크박스 동적 생성
foreach (var name in sortedNames)
{
CheckBox checkBox = new CheckBox();
checkBox.Text = name;
checkBox.AutoSize = true;
checkBox.Checked = true; // 기본값 체크 상태
// 체크박스 이벤트
checkBox.CheckedChanged += (s, ev) =>
{
FilterGridByNameap();
};
// 패널에 추가
plSubPart.Controls.Add(checkBox);
}
}
private void LoadFiles(GridViewChildRowCollection rows)
{
try
{
foreach (GridViewRowInfo row in gridServer.ChildRows) // 필터된 행 제외
{
if (row.IsVisible && row.Cells.Count > 1) // 표시된 행만 처리
{
var path = Util.GetStr(row.Cells[3].Value);
string[] userInfo = Util.GetUser(Util.GetStr(row.Cells[4].Value));
if (userInfo != null)
{
FtpsClient.Initialize(Util.GetStr(row.Cells[2].Value), userInfo[0], userInfo[1]);
// FTPS 서버에서 파일 목록 가져오기
var fileList = FtpsClient.GetFtpsList(path);
if (fileList == null || fileList.Length == 0)
{
MessageBox.Show("파일 목록을 가져올 수 없습니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
// 데이터 테이블 생성 후 바인딩
foreach (var item in fileList)
{
dtFiles.Rows.Add(row.Cells["name"].Value, row.Cells["nameap"].Value, item.Name, item.Size.ToString("N0")
, item.Modified.ToString("yyyy-MM-dd HH:mm:ss"), item.Type, row.Cells["url"].Value, row.Cells["dir"].Value, userInfo[0], userInfo[1]);
}
}
}
}
gridLogFiles.DataSource = dtFiles;
SetGridView();
}
catch (Exception ex)
{
MessageBox.Show($"파일 목록 로드 오류: {ex.Message}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
namespace DDUtilityApp.MESDOWNLOADER
{
public static class Util
{
public static string GetFileMerge(List<string> filePaths)
{
string mergedFilePath = string.Empty;
if (filePaths.Count == 0)
{
Console.WriteLine("병합할 파일이 없습니다.");
return mergedFilePath;
}
// 실행 시간 측정을 위한 Stopwatch 시작
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
// 첫 번째 파일명에서 경로 제외
string firstFileName = Path.GetFileName(filePaths.First());
string mergedFileName = "merge_" + firstFileName;
// 병합된 파일을 저장할 경로 (첫 번째 파일과 동일한 폴더)
mergedFilePath = Path.Combine(Path.GetDirectoryName(filePaths.First()), mergedFileName);
string extension = Path.GetExtension(mergedFilePath);
if (string.Compare(extension, ".Log", true) != 0) mergedFilePath = mergedFilePath + ".Log";
try
{
using (StreamWriter writer = new StreamWriter(mergedFilePath, false)) // false: 새 파일 생성
{
foreach (string file in filePaths)
{
if (File.Exists(file))
{
using (StreamReader reader = new StreamReader(file))
{
writer.Write(reader.ReadToEnd());
}
Console.WriteLine($"{file} -> 병합 완료");
}
else
{
Console.WriteLine($"파일 없음: {file}");
}
}
}
// 실행 시간 측정 종료
stopwatch.Stop();
Console.WriteLine($"모든 파일이 {mergedFileName}로 병합되었습니다.");
Console.WriteLine($"병합 실행 시간: {stopwatch.ElapsedMilliseconds} ms");
return mergedFilePath;
}
catch (Exception ex)
{
Console.WriteLine($"오류 발생: {ex.Message}");
}
return mergedFilePath;
}
public static string GetStr(object str )
{
return string.IsNullOrEmpty(str.ToString())?"": str.ToString();
}
public static string GetBase64(string base64, string type = "decoded")
{
string rtnStr = string.Empty;
if (string.IsNullOrEmpty(base64) == false)
{
if (type == "decoded")
// Base64 디코딩
rtnStr = Encoding.UTF8.GetString(Convert.FromBase64String(base64));
else
// Base64 디코딩
rtnStr = Convert.ToBase64String(Encoding.UTF8.GetBytes(base64));
}
return rtnStr;
}
public static string[] GetUser(string userInfo)
{
string[] rtnArry = null;
if (string.IsNullOrEmpty(userInfo) == false)
{
rtnArry = GetBase64(userInfo).Split(':');
}
return rtnArry;
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Data;
using System.IO;
using System.Xml;
namespace DDUtilityApp.MESDOWNLOADER
{
public static class XmlToDsConverter
{
public static DataSet ConvertXmlToDataSet(string xmlFilePath)
{
try
{
DataSet dataSet = new DataSet();
using (StreamReader reader = new StreamReader(xmlFilePath, System.Text.Encoding.UTF8))
{
dataSet.ReadXml(reader);
}
return dataSet;
}
catch (Exception ex)
{
Console.WriteLine($"XML 변환 오류: {ex.Message}");
return null;
}
}
public static void PrintDataSet(DataSet dataSet)
{
if (dataSet == null)
{
Console.WriteLine("데이터셋이 비어 있습니다.");
return;
}
foreach (DataTable table in dataSet.Tables)
{
Console.WriteLine($"테이블: {table.TableName}");
foreach (DataRow row in table.Rows)
{
foreach (DataColumn column in table.Columns)
{
Console.WriteLine($"{column.ColumnName}: {row[column]}");
}
}
}
}
}
}
// 사용 예제
// string xmlPath = "ViewList.xml";
// DataSet ds = XmlToDataSetConverter.ConvertXmlToDataSet(xmlPath);
// XmlToDataSetConverter.PrintDataSet(ds);

View File

@@ -28,38 +28,71 @@ namespace JWH.MONGODB
return item;
}
public static List<TraceCollection> GetCollectionData(string collectionName, DateTime dtStart, DateTime dtEnd, TraceCollection condition = null)
public static async void GetCollectionColumns(string collectionName)
{
MongoClient client = new MongoClient(ConnectionString);
IMongoDatabase database = client.GetDatabase(DatabaseName);
IMongoCollection<TraceCollection> collection = database.GetCollection<TraceCollection>(collectionName);
var collection = database.GetCollection<BsonDocument>(collectionName);
// # ALL Data
//var lst = collection.Find(_ => true).ToList();
// # Use BsonDocument
//var filter = new BsonDocument("LotID", "13089570006B");
// # Use Builders.Filter
//var filterBuilder = Builders<TraceCollection>.Filter;
//var filter = filterBuilder.Eq(x => x.LotID, "13109360026B");
var pipeline = new[]
{
new BsonDocument("$project", new BsonDocument("fields", new BsonDocument("$objectToArray", "$$ROOT"))),
new BsonDocument("$unwind", "$fields"),
new BsonDocument("$group", new BsonDocument("_id", BsonNull.Value).Add("uniqueFields", new BsonDocument("$addToSet", "$fields.k")))
};
FilterDefinitionBuilder<TraceCollection> filterBuilder = Builders<TraceCollection>.Filter;
FilterDefinition<TraceCollection> filter = filterBuilder.Gte(x => x.EVENTTIME, dtStart) & filterBuilder.Lt(x => x.EVENTTIME, dtEnd);
if (condition != null)
var result = await collection.Aggregate<BsonDocument>(pipeline).FirstOrDefaultAsync();
if (result != null && result.Contains("uniqueFields"))
{
string[] SkipPropertys = new string[] { "_id", "EVENTTIME" };
foreach (PropertyInfo property in condition.GetType().GetProperties())
var fields = result["uniqueFields"].AsBsonArray.Select(f => f.AsString);
Console.WriteLine("컬렉션의 필드 목록:");
foreach (var field in fields)
{
object value = property.GetValue(condition);
if (value != null)
{
if (property.Name.Equals("LotID")) filter &= filterBuilder.Eq(x => x.LotID, value);
continue;
}
Console.WriteLine(field);
}
}
List<TraceCollection> document = collection.Find(filter).ToList();
}
return document;
public static List<TraceCollection> GetCollectionData(string collectionName, DateTime dtStart, DateTime dtEnd, TraceCollection condition = null)
{
try
{
MongoClient client = new MongoClient(ConnectionString);
IMongoDatabase database = client.GetDatabase(DatabaseName);
IMongoCollection<TraceCollection> collection = database.GetCollection<TraceCollection>(collectionName);
// # ALL Data
//var lst = collection.Find(_ => true).ToList();
// # Use BsonDocument
//var filter = new BsonDocument("LotID", "13089570006B");
// # Use Builders.Filter
//var filterBuilder = Builders<TraceCollection>.Filter;
//var filter = filterBuilder.Eq(x => x.LotID, "13109360026B");
FilterDefinitionBuilder<TraceCollection> filterBuilder = Builders<TraceCollection>.Filter;
FilterDefinition<TraceCollection> filter = filterBuilder.Gte(x => x.EVENTTIME, dtStart) & filterBuilder.Lt(x => x.EVENTTIME, dtEnd);
if (condition != null)
{
string[] SkipPropertys = new string[] { "_id", "EVENTTIME" };
foreach (PropertyInfo property in condition.GetType().GetProperties())
{
object value = property.GetValue(condition);
if (value != null)
{
if (property.Name.Equals("LotID")) filter &= filterBuilder.Eq(x => x.LotID, value);
continue;
}
}
}
List<TraceCollection> document = collection.Find(filter).ToList();
return document;
}
catch (Exception ex)
{
throw ex;
}
}
public static bool GetCollectionSize_Flag = false;
@@ -150,35 +183,52 @@ namespace JWH.MONGODB
public ObjectId _id { get; set; }
public List<object> LotList { get; set; }
[BsonDateTimeOptions(Kind = DateTimeKind.Local)]
public DateTime EVENTTIME { get; set; }
public string ProcessID { get; set; }
public string UnitState { get; set; }
public string VIDName { get; set; }
public object Value { get; set; }
public string LotID { get; set; }
public string Sign { get; set; }
public string MaterialID { get; set; }
public List<object> LotList { get; set; }
public string LotID { get; set; }
public string ProductID { get; set; }
public object UnitNO { get; set; }
public string Recipe { get; set; }
public string ProcessID { get; set; }
public object UnitNO { get; set; }
public string VORNR { get; set; }
public string UnitState { get; set; }
public string MaterialID { get; set; }
public string Sign { get; set; }
public string CarrierId { get; set; }
public string PanelId { get; set; }
public string Position { get; set; }
public string MarkingId { get; set; }
public string Step { get; set; }
public double LowerSV { get; set; }
public double UpperSV { get; set; }
public string MongGoUnitName { get; set; }
}
}
}

View File

@@ -10,6 +10,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using JWH;
using JWH.MONGODB;
using MongoDB.Bson;
@@ -101,19 +102,22 @@ namespace DDUtilityApp.MONGO
List<TraceCollection> data = null;
try
{
string collectionName = $"{this.EquipmentID}.{this.VID}";
//FDCMongoDB.GetCollectionColumns(collectionName);
this.Cursor = Cursors.WaitCursor;
this.ssName.Text = "GRID";
DateTime dtStart = this.DateTimeStart;
DateTime dtEnd = this.DateTimeEnd;
data = FDCMongoDB.GetCollectionData($"{this.EquipmentID}.{this.VID}", dtStart, dtEnd);
data = FDCMongoDB.GetCollectionData(collectionName, dtStart, dtEnd);
timeStart = this.StatusLabelDisplay(this.ssStatus01, "수집", timeStart, DateTime.Now);
this.grid.AutoBinding(data.ToArray());
}
catch (Exception ex)
{
throw ex;
XLogger.Instance.Fatal(ex, true);
}
finally
{
@@ -369,6 +373,7 @@ namespace DDUtilityApp.MONGO
this.grid.AddColumn("EVENTTIME", "EventTime");
this.grid.AddColumn("VIDName");
this.grid.AddColumn("Value");
this.grid.AddColumn("Sign");
this.grid.AddColumn("LotID");
this.grid.AddColumn("MaterialID");
this.grid.AddColumn("ProductID");
@@ -377,7 +382,14 @@ namespace DDUtilityApp.MONGO
this.grid.AddColumn("ProcessID");
this.grid.AddColumn("VORNR");
this.grid.AddColumn("UnitState");
this.grid.AddColumn("Sign");
this.grid.AddColumn("Step");
this.grid.AddColumn("LowerSV");
this.grid.AddColumn("UpperSV");
this.grid.AddColumn("CarrierId");
this.grid.AddColumn("PanelId");
this.grid.AddColumn("Position");
this.grid.AddColumn("MarkingId");
this.grid.AddColumn("MongGoUnitName");
}
#endregion

View File

@@ -70,10 +70,11 @@ namespace DDUtilityApp
#region [ ]
frmMain.Buttons.Add("EIS Log Viewer", new EisParser0());
frmMain.Buttons.Add("MIS Log Viewer", new AgvParser());
frmMain.Buttons.Add("MES Log Download", typeof(MESDOWNLOADER.ServerLog));
//frmMain.Buttons.Add("MIS Log Viewer", new AgvParser()); // 제거
frmMain.Buttons.Add("FDC Mongo Viewer", typeof(MONGO.FrmFDCMongo));
frmMain.Buttons.Add("TIB Simulator", typeof(TIBRENDEZVOUS.FrmSimulator01));
frmMain.Buttons.Add("HSMS Converter", typeof(LOGPARSER.FrmHsmsViewer));
frmMain.Buttons.Add("TIB Simulator", typeof(TIBRENDEZVOUS.FrmSimulator01));
frmMain.Buttons.Add("TibcoConfig.Xml", typeof(ETC.FrmTIbcoConfig));
#if DEBUG
frmMain.Buttons.Add("FTP Test", typeof(SPECDOCUMENT.FrmSpecDocument));
@@ -87,7 +88,7 @@ namespace DDUtilityApp
if (frmMain.SelectedObject is Type)
{
Type frmType = frmMain.SelectedObject as Type;
// 관리자 권한으로 실행
// 목록에 등록된 클래스는 관리자 권한으로 실행
if (new string[] { "FRMTIBCOCONFIG" }.Contains(frmType.Name.ToUpper()))
{
if (IsAdministrator() == false)

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2025.01.07.0")]
[assembly: AssemblyFileVersion("2025.01.07.0")]
[assembly: AssemblyVersion("2025.02.28.0")]
[assembly: AssemblyFileVersion("2025.02.28.0")]

22
DDUtilityApp/ViewList.xml Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<Viewer>
<Server name="MES">
<Item name="AP01" url="192.168.8.223" dir="/MESLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
<Item name="AP02" url="192.168.8.224" dir="/MESLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
</Server>
<Server name="MES(Backup)">
<Item name="AP01" url="192.168.8.223" dir="/MESLogBU" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
<Item name="AP02" url="192.168.8.224" dir="/MESLogBU" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
</Server>
<Server name="RMS">
<Item name="AP01" url="192.168.8.223" dir="/RMSLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
<Item name="AP02" url="192.168.8.224" dir="/RMSLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
</Server>
<Server name="FDC">
<Item name="AP01" url="192.168.8.212" dir="/FDCLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
</Server>
<Server name="RMS">
<Item name="AP01" url="192.168.8.221" dir="/RTDLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
<Item name="AP02" url="192.168.8.222" dir="/RTDLog" conkey="bG9ndXNlcjpEYWVkdWNrITE="/>
</Server>
</Viewer>

View File

@@ -2,7 +2,9 @@
<packages>
<package id="AWSSDK.Core" version="3.7.100.14" targetFramework="net472" />
<package id="AWSSDK.SecurityToken" version="3.7.100.14" targetFramework="net472" />
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
<package id="DnsClient" version="1.6.1" targetFramework="net472" />
<package id="FluentFTP" version="35.0.0" targetFramework="net472" />
<package id="log4net" version="2.0.12" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.0.0" targetFramework="net472" />
@@ -14,7 +16,9 @@
<package id="SharpCompress" version="0.30.1" targetFramework="net472" />
<package id="SharpZipLib" version="1.3.3" targetFramework="net461" />
<package id="Snappier" version="1.0.0" targetFramework="net472" />
<package id="SSH.NET" version="2024.2.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Formats.Asn1" version="8.0.1" targetFramework="net472" />
<package id="System.IO" version="4.3.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
@@ -30,5 +34,6 @@
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net472" />
<package id="System.Text.Encoding.CodePages" version="5.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="ZstdSharp.Port" version="0.7.3" targetFramework="net472" />
</packages>

View File

@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDUtilityApp", "DDUtilityAp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWH", "JWH\JWH.csproj", "{004BC1F3-B24A-402D-92ED-C5FC501E915A}"
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "SetupProject", "SetupProject\SetupProject.vdproj", "{F621D799-1E03-4885-A9B5-CB1CB48FC67E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -17,28 +15,22 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|Any CPU.ActiveCfg = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|Any CPU.Build.0 = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|x64.ActiveCfg = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Debug|x64.Build.0 = Debug|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.Build.0 = Release|Any CPU
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.ActiveCfg = Release|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|Any CPU.Build.0 = Release|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|x64.ActiveCfg = Release|x64
{B8459F14-92D3-482C-A932-65E76E6D11F6}.Release|x64.Build.0 = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|Any CPU.ActiveCfg = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|Any CPU.Build.0 = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|x64.ActiveCfg = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Debug|x64.Build.0 = Debug|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.Build.0 = Release|Any CPU
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.ActiveCfg = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|Any CPU.Build.0 = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|x64.ActiveCfg = Release|x64
{004BC1F3-B24A-402D-92ED-C5FC501E915A}.Release|x64.Build.0 = Release|x64
{F621D799-1E03-4885-A9B5-CB1CB48FC67E}.Debug|Any CPU.ActiveCfg = Debug
{F621D799-1E03-4885-A9B5-CB1CB48FC67E}.Debug|x64.ActiveCfg = Debug
{F621D799-1E03-4885-A9B5-CB1CB48FC67E}.Debug|x64.Build.0 = Debug
{F621D799-1E03-4885-A9B5-CB1CB48FC67E}.Release|Any CPU.ActiveCfg = Release
{F621D799-1E03-4885-A9B5-CB1CB48FC67E}.Release|x64.ActiveCfg = Release
{F621D799-1E03-4885-A9B5-CB1CB48FC67E}.Release|x64.Build.0 = Release
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -397,6 +397,46 @@ namespace JWH
catch { throw; }
}
/// <summary>
/// Converts a object to a list with generic objects
/// dataTable.ToClass<Employee>();
/// </summary>
/// <typeparam name="T">Generic object</typeparam>
/// <param name="src">DataTable</param>
/// <returns>List with generic objects</returns>
public static T ToClass<T>(this object src) where T : class, new()
{
try
{
T des = new T();
Type desType = des.GetType();
Type srcType = src.GetType();
foreach (PropertyInfo srcProperty in srcType.GetProperties())
{
try
{
PropertyInfo desProperty = desType.GetProperty(srcProperty.Name);
if (desProperty == null) continue;
var srcValue = srcProperty.GetValue(src);
if (srcProperty.PropertyType != desProperty.PropertyType)
{
srcValue = Convert.ChangeType(srcValue, desProperty.PropertyType);
}
desProperty.SetValue(des, srcValue);
}
catch (Exception ex)
{
XLogger.Instance.Warn(ex);
}
}
return des;
}
catch { throw; }
}
/// <summary>
/// Converts a object to a list with generic objects
/// dataTable.ToClass<Employee>();

View File

@@ -674,7 +674,7 @@ namespace JWH
SetMDC(eMDCKey.Class, strClassFullName);
SetMDC(eMDCKey.Method, strMethod);
result = $"{strConsole}" + (e != null ? Environment.NewLine + e.ToString() : "");
result = $"{strConsole}" + (e != null ? string.Format("{0}{2}", Environment.NewLine, e.Message, e.ToString()) : "");
switch (level)
{
case eXLogLevel.Debug:

View File

@@ -86,17 +86,51 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.4.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="FluentFTP, Version=35.0.0.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f, processorArchitecture=MSIL">
<HintPath>..\packages\FluentFTP.35.0.0\lib\net45\FluentFTP.dll</HintPath>
</Reference>
<Reference Include="JWH.SECS">
<HintPath>..\Library\JWH.SECS.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2024.2.0.1, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2024.2.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Formats.Asn1, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Formats.Asn1.8.0.1\lib\net462\System.Formats.Asn1.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
@@ -105,12 +139,24 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Telerik.WinControls, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
<Reference Include="Telerik.WinControls.ChartView, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
<Reference Include="Telerik.WinControls.GridView, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
<Reference Include="Telerik.WinControls.UI, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
<Reference Include="TelerikCommon, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
<Reference Include="TelerikExport, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
<Reference Include="Telerik.WinControls, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\Library\TelerikWinForms-R1-2019_Bin40\Telerik.WinControls.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.ChartView, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\Library\TelerikWinForms-R1-2019_Bin40\Telerik.WinControls.ChartView.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.GridView, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\Library\TelerikWinForms-R1-2019_Bin40\Telerik.WinControls.GridView.dll</HintPath>
</Reference>
<Reference Include="Telerik.WinControls.UI, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\Library\TelerikWinForms-R1-2019_Bin40\Telerik.WinControls.UI.dll</HintPath>
</Reference>
<Reference Include="TelerikCommon, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\Library\TelerikWinForms-R1-2019_Bin40\TelerikCommon.dll</HintPath>
</Reference>
<Reference Include="TelerikExport, Version=2019.1.219.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
<HintPath>..\Library\TelerikWinForms-R1-2019_Bin40\TelerikExport.dll</HintPath>
</Reference>
<Reference Include="TIBCO.Rendezvous, Version=1.0.5155.23393, Culture=neutral, PublicKeyToken=1a696d1f90f6158a, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Library\TIBCO 8.4.2\TIBCO.Rendezvous.dll</HintPath>
@@ -129,7 +175,9 @@
<Compile Include="EXTENSIONS\ExtensionXml.cs" />
<Compile Include="EXTENSIONS\XLogger.cs" />
<Compile Include="NETWORK\AsyncSocket.cs" />
<Compile Include="NETWORK\FtpsClient.cs" />
<Compile Include="NETWORK\FtpClient.cs" />
<Compile Include="NETWORK\SFtpClient.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TIB\ListenerData.cs" />
<Compile Include="TIB\ListenerInfo.cs" />

214
JWH/NETWORK/FtpsClient.cs Normal file
View File

@@ -0,0 +1,214 @@
using System;
using System.Net;
using FluentFTP;
using Org.BouncyCastle.Crypto.Agreement.JPake;
namespace JWH.NETWORK
{
public static class FtpsClient
{
private static FluentFTP.FtpClient _ftpClient;
public static string _host { get; private set; }
private static int _port = 990; // FTPS 기본 포트
private static string _userId;
private static string _password;
public static void Initialize(string host, string userId, string password, int port = 990)
{
try
{
_host = host;
_userId = userId;
_password = password;
_port = port;
_ftpClient = new FluentFTP.FtpClient(_host, _port, new NetworkCredential(_userId, _password))
{
//EncryptionMode = FtpEncryptionMode.Explicit,
EncryptionMode = FtpEncryptionMode.Implicit,
SslProtocols = System.Security.Authentication.SslProtocols.Tls12,
ConnectTimeout = 500 // 타임아웃 설정 (0.5초)
};
_ftpClient.ValidateCertificate += (control, args) => args.Accept = true; // 인증서 검증 비활성화 (운영 확인 필요!)
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
public static void Connect()
{
try
{
if (_ftpClient == null)
throw new InvalidOperationException("FTPS client is not initialized. Call Initialize() first.");
if (!_ftpClient.IsConnected)
_ftpClient.Connect();
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
public static void Disconnect()
{
try
{
if (_ftpClient != null && _ftpClient.IsConnected)
_ftpClient.Disconnect();
}
catch (Exception ex)
{
throw ex;
}
finally
{
}
}
public static bool IsFileExists(string path)
{
try
{
Connect();
return _ftpClient.FileExists(path);
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static bool IsDirExists(string path)
{
try
{
Connect();
return _ftpClient.DirectoryExists(path);
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static FtpListItem[] GetFtpsList(string path)
{
try
{
Connect();
return _ftpClient.GetListing(path);
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static object GetObjectInfo(string filePath)
{
try
{
Connect();
return _ftpClient.GetObjectInfo(filePath);
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static FtpListItem GetFileInfo(string remoteFilePath)
{
try
{
Connect();
if (!_ftpClient.IsConnected)
throw new InvalidOperationException("FTPS 서버에 연결되지 않았습니다.");
// Passive Mode 설정 (필요한 경우)
// _ftpClient.SetPassiveMode(true);
if (!FtpsClient.IsFileExists(remoteFilePath))
throw new InvalidOperationException("파일이 존재하지 않습니다.");
var fileInfo = FtpsClient.GetObjectInfo(remoteFilePath);
if (fileInfo == null)
throw new InvalidOperationException("파일 정보를 가져오는 데 실패했습니다.");
return (FtpListItem)fileInfo;
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static bool DownloadFtpsFile(string remotePath, string localPath)
{
try
{
Connect();
_ftpClient.DownloadFile(localPath, remotePath);
return true;
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static bool UploadFtpsFile(string localPath, string remotePath)
{
try
{
Connect();
_ftpClient.UploadFile(localPath, remotePath);
return true;
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
}
}

155
JWH/NETWORK/SFtpClient.cs Normal file
View File

@@ -0,0 +1,155 @@
using Renci.SshNet;
using System;
using File = System.IO.File;
namespace JWH.NETWORK
{
public static class StpClientWrap
{
private static SftpClient _sftpClient;
private static string _host;
private static int _port = 22;
private static string _userId;
private static string _password;
public static void Initialize(string host, string userId, string password, int port = 22)
{
_host = host;
_userId = userId;
_password = password;
_port = port;
_sftpClient = new SftpClient(_host, _port, _userId, _password);
}
public static void Connect()
{
if (_sftpClient == null)
{
throw new InvalidOperationException("SFTP client is not initialized. Call Initialize() first.");
}
if (!_sftpClient.IsConnected)
{
_sftpClient.Connect();
}
}
public static void Disconnect()
{
if (_sftpClient != null && _sftpClient.IsConnected)
{
_sftpClient.Disconnect();
}
}
public static bool IsDirExists(string path)
{
return IsFileExists(path) && _sftpClient.GetAttributes(path).IsDirectory;
}
public static bool IsFileExists(string path)
{
try
{
Connect();
return _sftpClient.Exists(path);
}
catch
{
return false;
}
finally
{
Disconnect();
}
}
public static Renci.SshNet.Sftp.SftpFileAttributes GetFileInfo(string remoteFilePath)
{
try
{
Connect();
if (_sftpClient.Exists(remoteFilePath))
{
return _sftpClient.GetAttributes(remoteFilePath);
}
else
{
Console.WriteLine("파일이 존재하지 않습니다.");
return null;
}
}
catch (Exception ex)
{
Console.WriteLine($"파일 정보 조회 오류: {ex.Message}");
return null;
}
finally
{
Disconnect();
}
}
public static object GetSftpList(string path)
{
try
{
Connect();
return _sftpClient.ListDirectory(path);
}
catch (Exception ex)
{
throw ex;
}
finally
{
Disconnect();
}
}
public static bool DownloadSftpFile(string remotePath, string localPath)
{
try
{
Connect();
using (var fileStream = File.OpenWrite(localPath))
{
_sftpClient.DownloadFile(remotePath, fileStream);
}
return true;
}
catch (Exception ex)
{
Console.WriteLine($"Download error: {ex.Message}");
return false;
}
finally
{
Disconnect();
}
}
public static bool UploadSftpFile(string localPath, string remotePath)
{
try
{
Connect();
using (var fileStream = File.OpenRead(localPath))
{
_sftpClient.UploadFile(fileStream, remotePath);
}
return true;
}
catch (Exception ex)
{
Console.WriteLine($"Upload error: {ex.Message}");
return false;
}
finally
{
Disconnect();
}
}
}
}

View File

@@ -1,4 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BouncyCastle.Cryptography" version="2.4.0" targetFramework="net472" />
<package id="FluentFTP" version="35.0.0" targetFramework="net472" />
<package id="log4net" version="2.0.12" targetFramework="net461" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net472" />
<package id="SSH.NET" version="2024.2.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Formats.Asn1" version="8.0.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>

File diff suppressed because it is too large Load Diff