20250202_1 jhlim
This commit is contained in:
@@ -145,12 +145,17 @@
|
|||||||
<Reference Include="AWSSDK.SecurityToken, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\AWSSDK.SecurityToken.3.7.100.14\lib\net45\AWSSDK.SecurityToken.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\SftpTest\WindowsFormsApp1\bin\Debug\BouncyCastle.Cryptography.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="DnsClient, Version=1.6.1.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\DnsClient.1.6.1\lib\net471\DnsClient.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="EIS.Framework">
|
<Reference Include="EIS.Framework">
|
||||||
<HintPath>..\Library\EIS.Framework.dll</HintPath>
|
<HintPath>..\Library\EIS.Framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="FluentFTP, Version=35.0.0.0, Culture=neutral, PublicKeyToken=f4af092b1d8df44f" />
|
||||||
<Reference Include="JWH.SECS, Version=2022.2.4.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="JWH.SECS, Version=2022.2.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\Library\JWH.SECS.dll</HintPath>
|
<HintPath>..\Library\JWH.SECS.dll</HintPath>
|
||||||
@@ -179,6 +184,10 @@
|
|||||||
<Reference Include="MongoDB.Libmongocrypt, Version=1.8.2.0, Culture=neutral, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\MongoDB.Libmongocrypt.1.8.2\lib\netstandard2.0\MongoDB.Libmongocrypt.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Renci.SshNet, Version=2024.2.0.1, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\SftpTest\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">
|
<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>
|
<HintPath>..\packages\SharpCompress.0.30.1\lib\net461\SharpCompress.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
107
DDUtilityApp/LOGPARSER/FrmEqSelector.Designer.cs
generated
107
DDUtilityApp/LOGPARSER/FrmEqSelector.Designer.cs
generated
@@ -31,6 +31,8 @@
|
|||||||
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition1 = new Telerik.WinControls.UI.TableViewDefinition();
|
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition1 = new Telerik.WinControls.UI.TableViewDefinition();
|
||||||
Telerik.WinControls.UI.TableViewDefinition tableViewDefinition2 = 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 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));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmEqSelector));
|
||||||
this.panel1 = new System.Windows.Forms.Panel();
|
this.panel1 = new System.Windows.Forms.Panel();
|
||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||||
@@ -44,6 +46,7 @@
|
|||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
this.chkAllEquipment = new System.Windows.Forms.CheckBox();
|
this.chkAllEquipment = new System.Windows.Forms.CheckBox();
|
||||||
this.chkUseMesDB = 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.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.panel4 = new System.Windows.Forms.Panel();
|
this.panel4 = new System.Windows.Forms.Panel();
|
||||||
this.cboxServer = new System.Windows.Forms.ComboBox();
|
this.cboxServer = new System.Windows.Forms.ComboBox();
|
||||||
@@ -62,9 +65,12 @@
|
|||||||
this.gridModelDetail = new JWH.CONTROL.GridViewEx();
|
this.gridModelDetail = new JWH.CONTROL.GridViewEx();
|
||||||
this.panel10 = new System.Windows.Forms.Panel();
|
this.panel10 = new System.Windows.Forms.Panel();
|
||||||
this.tboxModelDescription = new System.Windows.Forms.TextBox();
|
this.tboxModelDescription = new System.Windows.Forms.TextBox();
|
||||||
|
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||||
|
this.gridWorkflow = new JWH.CONTROL.GridViewEx();
|
||||||
|
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||||
|
this.gridHsms = new JWH.CONTROL.GridViewEx();
|
||||||
this.radStatusStrip1 = new Telerik.WinControls.UI.RadStatusStrip();
|
this.radStatusStrip1 = new Telerik.WinControls.UI.RadStatusStrip();
|
||||||
this.rstatus1 = new Telerik.WinControls.UI.RadLabelElement();
|
this.rstatus1 = new Telerik.WinControls.UI.RadLabelElement();
|
||||||
this.chkUseSMB = new System.Windows.Forms.CheckBox();
|
|
||||||
this.panel1.SuspendLayout();
|
this.panel1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||||
this.splitContainer1.Panel1.SuspendLayout();
|
this.splitContainer1.Panel1.SuspendLayout();
|
||||||
@@ -94,6 +100,12 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail.MasterTemplate)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail.MasterTemplate)).BeginInit();
|
||||||
this.panel10.SuspendLayout();
|
this.panel10.SuspendLayout();
|
||||||
|
this.tabPage3.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow.MasterTemplate)).BeginInit();
|
||||||
|
this.tabPage4.SuspendLayout();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridHsms)).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridHsms.MasterTemplate)).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -235,6 +247,16 @@
|
|||||||
this.chkUseMesDB.Text = "MES DB";
|
this.chkUseMesDB.Text = "MES DB";
|
||||||
this.chkUseMesDB.UseVisualStyleBackColor = true;
|
this.chkUseMesDB.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// chkUseSMB
|
||||||
|
//
|
||||||
|
this.chkUseSMB.AutoSize = true;
|
||||||
|
this.chkUseSMB.Location = new System.Drawing.Point(879, 6);
|
||||||
|
this.chkUseSMB.Name = "chkUseSMB";
|
||||||
|
this.chkUseSMB.Size = new System.Drawing.Size(77, 16);
|
||||||
|
this.chkUseSMB.TabIndex = 5;
|
||||||
|
this.chkUseSMB.Text = "Use SMB";
|
||||||
|
this.chkUseSMB.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
// flowLayoutPanel1
|
// flowLayoutPanel1
|
||||||
//
|
//
|
||||||
this.flowLayoutPanel1.AutoSize = true;
|
this.flowLayoutPanel1.AutoSize = true;
|
||||||
@@ -376,6 +398,8 @@
|
|||||||
//
|
//
|
||||||
this.tabControl1.Controls.Add(this.tabPage1);
|
this.tabControl1.Controls.Add(this.tabPage1);
|
||||||
this.tabControl1.Controls.Add(this.tabPage2);
|
this.tabControl1.Controls.Add(this.tabPage2);
|
||||||
|
this.tabControl1.Controls.Add(this.tabPage3);
|
||||||
|
this.tabControl1.Controls.Add(this.tabPage4);
|
||||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.tabControl1.Name = "tabControl1";
|
this.tabControl1.Name = "tabControl1";
|
||||||
@@ -383,6 +407,7 @@
|
|||||||
this.tabControl1.Size = new System.Drawing.Size(547, 489);
|
this.tabControl1.Size = new System.Drawing.Size(547, 489);
|
||||||
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
this.tabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
|
||||||
this.tabControl1.TabIndex = 6;
|
this.tabControl1.TabIndex = 6;
|
||||||
|
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// tabPage1
|
// tabPage1
|
||||||
//
|
//
|
||||||
@@ -465,6 +490,66 @@
|
|||||||
this.tboxModelDescription.Size = new System.Drawing.Size(533, 96);
|
this.tboxModelDescription.Size = new System.Drawing.Size(533, 96);
|
||||||
this.tboxModelDescription.TabIndex = 0;
|
this.tboxModelDescription.TabIndex = 0;
|
||||||
//
|
//
|
||||||
|
// tabPage3
|
||||||
|
//
|
||||||
|
this.tabPage3.Controls.Add(this.gridWorkflow);
|
||||||
|
this.tabPage3.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabPage3.Name = "tabPage3";
|
||||||
|
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabPage3.Size = new System.Drawing.Size(539, 463);
|
||||||
|
this.tabPage3.TabIndex = 3;
|
||||||
|
this.tabPage3.Text = "Workflow";
|
||||||
|
this.tabPage3.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;
|
||||||
|
//
|
||||||
|
// tabPage4
|
||||||
|
//
|
||||||
|
this.tabPage4.Controls.Add(this.gridHsms);
|
||||||
|
this.tabPage4.Location = new System.Drawing.Point(4, 22);
|
||||||
|
this.tabPage4.Name = "tabPage4";
|
||||||
|
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.tabPage4.Size = new System.Drawing.Size(539, 463);
|
||||||
|
this.tabPage4.TabIndex = 2;
|
||||||
|
this.tabPage4.Text = "HSMS";
|
||||||
|
this.tabPage4.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
|
// radStatusStrip1
|
||||||
//
|
//
|
||||||
this.radStatusStrip1.Items.AddRange(new Telerik.WinControls.RadItem[] {
|
this.radStatusStrip1.Items.AddRange(new Telerik.WinControls.RadItem[] {
|
||||||
@@ -481,16 +566,6 @@
|
|||||||
this.rstatus1.Text = "";
|
this.rstatus1.Text = "";
|
||||||
this.rstatus1.TextWrap = true;
|
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
|
// FrmEqSelector
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||||
@@ -537,6 +612,12 @@
|
|||||||
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.gridModelDetail)).EndInit();
|
||||||
this.panel10.ResumeLayout(false);
|
this.panel10.ResumeLayout(false);
|
||||||
this.panel10.PerformLayout();
|
this.panel10.PerformLayout();
|
||||||
|
this.tabPage3.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow.MasterTemplate)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridWorkflow)).EndInit();
|
||||||
|
this.tabPage4.ResumeLayout(false);
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridHsms.MasterTemplate)).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)(this.gridHsms)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
this.PerformLayout();
|
this.PerformLayout();
|
||||||
@@ -578,5 +659,9 @@
|
|||||||
private Telerik.WinControls.UI.RadStatusStrip radStatusStrip1;
|
private Telerik.WinControls.UI.RadStatusStrip radStatusStrip1;
|
||||||
private Telerik.WinControls.UI.RadLabelElement rstatus1;
|
private Telerik.WinControls.UI.RadLabelElement rstatus1;
|
||||||
private System.Windows.Forms.CheckBox chkUseSMB;
|
private System.Windows.Forms.CheckBox chkUseSMB;
|
||||||
|
private System.Windows.Forms.TabPage tabPage4;
|
||||||
|
private System.Windows.Forms.TabPage tabPage3;
|
||||||
|
private JWH.CONTROL.GridViewEx gridHsms;
|
||||||
|
private JWH.CONTROL.GridViewEx gridWorkflow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,12 @@ using JWH;
|
|||||||
using JWH.CONTROL;
|
using JWH.CONTROL;
|
||||||
using JWH.DATA;
|
using JWH.DATA;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
//jhlim 20250202 start
|
||||||
|
using FluentFTP;
|
||||||
|
using JWH.NETWORK;
|
||||||
|
using Renci.SshNet;
|
||||||
|
using Renci.SshNet.Sftp;
|
||||||
|
//jhlim 20250202 end
|
||||||
|
|
||||||
namespace DDUtilityApp.LOGPARSER
|
namespace DDUtilityApp.LOGPARSER
|
||||||
{
|
{
|
||||||
@@ -40,7 +46,7 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
|
|
||||||
public string EquipmentID { get; set; } = string.Empty;
|
public string EquipmentID { get; set; } = string.Empty;
|
||||||
|
|
||||||
public SECSDefine SECSDefine { get; set; } = null;
|
public SECSDefine SECSDefine { get; set; } = null;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -49,7 +55,6 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
public FrmEqSelector()
|
public FrmEqSelector()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.SetLayout();
|
this.SetLayout();
|
||||||
this.SetEventHandler();
|
this.SetEventHandler();
|
||||||
}
|
}
|
||||||
@@ -73,7 +78,9 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
this.tboxModelDescription.Font = font;
|
this.tboxModelDescription.Font = font;
|
||||||
|
|
||||||
this.GridEquipments_Setting();
|
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();
|
this.GridModelDetail_Setting();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +106,13 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
|
|
||||||
this.gridLogFiles.CellDoubleClick += GridLogFiles_CellDoubleClick;
|
this.gridLogFiles.CellDoubleClick += GridLogFiles_CellDoubleClick;
|
||||||
this.gridLogFiles.KeyDown += GridLogFiles_KeyDown;
|
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)
|
private void FrmEqSelector_Disposed(object sender, EventArgs e)
|
||||||
@@ -188,6 +202,37 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// jhlim 20250202
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (tabControl1.SelectedIndex >= 2)
|
||||||
|
{
|
||||||
|
int selectIdx = tabControl1.SelectedIndex;
|
||||||
|
string subPath = tabControl1.SelectedTab.Text.Contains("Workflow") ? "Workflow" : "THiRA_SECSGEM/HSMS";
|
||||||
|
|
||||||
|
var equipment = this.Equipment;
|
||||||
|
|
||||||
|
//StpClientWrap.Connect();
|
||||||
|
FtpsClient.Connect();
|
||||||
|
|
||||||
|
// SFTP 파일 목록 가져오기
|
||||||
|
// var rtnObj = StpClientWrap.GetSftpList($"/{equipment.EquipmentID}/{subPath}");
|
||||||
|
var rtnObj = FtpsClient.GetFtpsList($"/EISLog/{equipment.EquipmentID}/{subPath}");
|
||||||
|
if (rtnObj == null) return;
|
||||||
|
|
||||||
|
GridViewEx grid = tabControl1.SelectedTab.Controls.OfType<GridViewEx>().FirstOrDefault();
|
||||||
|
if (grid != null)
|
||||||
|
{
|
||||||
|
//grid.AutoBinding(GetSftplogFiles(rtnObj));
|
||||||
|
grid.AutoBinding(GetFtpslogFiles(rtnObj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// [CheckPoint] 로그파일 목록을 반환한다
|
/// [CheckPoint] 로그파일 목록을 반환한다
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -362,16 +407,11 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
if (modelInfo?.Length > 0)
|
if (modelInfo?.Length > 0)
|
||||||
{
|
{
|
||||||
this.tboxModelDescription.Text = modelInfo[0].Description;
|
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
|
#endregion
|
||||||
|
|
||||||
#region [ LogFiles ]
|
#region [ LogFiles ]
|
||||||
if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP))
|
if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP)) //jhlim 20250202 jj
|
||||||
{
|
{
|
||||||
// Checking Local IP-Address
|
// Checking Local IP-Address
|
||||||
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
|
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
|
||||||
@@ -390,12 +430,69 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SMB (Server Message Block)
|
// 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];
|
Account account = logServer.NetworkAccount[equipment.LogServerIP];
|
||||||
int result = ExtensionAPI.ConnectRemoteServer(account.IPAddress, account.UserID, account.Password);
|
object rtnObj = null;
|
||||||
if (result != 0 && result != 1219) { MessageBox.Show($@"네트워크 접근에 실패하였습니다. (Code:{result})"); return; }
|
|
||||||
path = logServer.GetLogPath(equipment.LogServerIP, equipment.EquipmentID);
|
// 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(tabPage4))
|
||||||
|
{
|
||||||
|
tabControl1.TabPages.Remove(tabPage4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!tabControl1.TabPages.Contains(tabPage4))
|
||||||
|
{
|
||||||
|
tabControl1.TabPages.Add(tabPage4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
else
|
||||||
@@ -406,15 +503,15 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
if (string.IsNullOrEmpty(path)) return;
|
if (string.IsNullOrEmpty(path)) return;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// 로그 파일 목록
|
//// 로그 파일 목록
|
||||||
DirectoryInfo directory = new DirectoryInfo(path);
|
//DirectoryInfo directory = new DirectoryInfo(path);
|
||||||
if (directory.Exists == false)
|
//if (directory.Exists == false)
|
||||||
{
|
//{
|
||||||
MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}");
|
// MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}");
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
LogFile[] logFiles = directory.GetFiles().ToClass<LogFile>().OrderByDescending(x => x.Name).ToArray();
|
//LogFile[] logFiles = directory.GetFiles().ToClass<LogFile>().OrderByDescending(x => x.Name).ToArray();
|
||||||
this.gridLogFiles.AutoBinding(logFiles);
|
//this.gridLogFiles.AutoBinding(logFiles);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -505,9 +602,9 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
|
|
||||||
#region [ GridLogFiles ] ----------------------------------------------
|
#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.TableElement.RowHeight = 20;
|
||||||
grid.MultiSelect = true;
|
grid.MultiSelect = true;
|
||||||
|
|
||||||
@@ -571,7 +668,38 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
XLogger.Instance.Fatal(ex);
|
XLogger.Instance.Fatal(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void Grid_KeyDown(object sender, KeyEventArgs e) //jhlim 20250202
|
||||||
|
{
|
||||||
|
if (e.KeyCode == Keys.Enter)
|
||||||
|
{
|
||||||
|
Grid_CellDoubleClick((GridViewEx)sender, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Grid_CellDoubleClick(object sender, GridViewCellEventArgs e) //jhlim 20250202
|
||||||
|
{
|
||||||
|
RadGridView gd = sender.GetType().Name.Contains("GridDataCellElement") ?
|
||||||
|
((GridDataCellElement)sender)?.RowElement?.GridControl : (GridViewEx)sender;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach (GridViewRowInfo row in gd.SelectedRows)
|
||||||
|
{
|
||||||
|
LogFile item = row.DataBoundItem as LogFile;
|
||||||
|
var fullPath = item.FullName;
|
||||||
|
string destPath = GlobalVariable.Instance.DownloadPath;
|
||||||
|
|
||||||
|
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
|
||||||
|
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
|
||||||
|
FtpsClient.DownloadFtpsFile(fullPath, destFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show($"{gd.SelectedRows.Count}개의 파일을 저장하였습니다.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
XLogger.Instance.Fatal(ex, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region [ GridModelDetail ] -------------------------------------------
|
#region [ GridModelDetail ] -------------------------------------------
|
||||||
@@ -642,6 +770,53 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sftp Log Files jhlim 20250202
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private LogFile[] GetlogFiles(object obj)
|
||||||
|
{
|
||||||
|
LogFile[] logFiles = ((List<ISftpFile>)obj).Where(item => !item.IsDirectory && item.Name != "." && item.Name != "..") //
|
||||||
|
.Select(item => new LogFile
|
||||||
|
{
|
||||||
|
Name = Path.GetFileNameWithoutExtension(item.Name),
|
||||||
|
FullName = item.FullName,
|
||||||
|
Extension = Path.GetExtension(item.Name),
|
||||||
|
Length = item.Length,
|
||||||
|
CreationTime = item.LastAccessTime,
|
||||||
|
LastAccessTime = item.LastAccessTime,
|
||||||
|
LastWriteTime = item.LastWriteTime
|
||||||
|
})
|
||||||
|
.OrderByDescending(x => x.Name)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
return logFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ftps Log Files jhlim 20250202
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="obj"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private LogFile[] GetFtpslogFiles(object obj)
|
||||||
|
{
|
||||||
|
LogFile[] logFiles = ((FtpListItem[])obj).Where(item => item.Type == FtpFileSystemObjectType.File)
|
||||||
|
.Select(item => new LogFile
|
||||||
|
{
|
||||||
|
Name = Path.GetFileNameWithoutExtension(item.Name),
|
||||||
|
FullName = item.FullName,
|
||||||
|
Extension = Path.GetExtension(item.Name),
|
||||||
|
Length = item.Size,
|
||||||
|
CreationTime = item.Modified,
|
||||||
|
LastAccessTime = item.Modified,
|
||||||
|
LastWriteTime = item.Modified
|
||||||
|
})
|
||||||
|
.OrderByDescending(x => x.Name)
|
||||||
|
.ToArray();
|
||||||
|
|
||||||
|
return logFiles;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region [ Method ] ----------------------------------------------------
|
#region [ Method ] ----------------------------------------------------
|
||||||
@@ -715,37 +890,38 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
logServer.DBGetModelDetails = sbModelDetails.ToString();
|
logServer.DBGetModelDetails = sbModelDetails.ToString();
|
||||||
logServer.DBGetModelInfo = sbModelInfo.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.214", new Account("192.168.7.214", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.7.215", new Account("192.168.7.215", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.7.215", new Account("192.168.7.215", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.7.216", new Account("192.168.7.216", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.7.216", new Account("192.168.7.216", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.7.217", new Account("192.168.7.217", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.7.217", new Account("192.168.7.217", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.7.218", new Account("192.168.7.218", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.7.218", new Account("192.168.7.218", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.7.219", new Account("192.168.7.219", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.7.219", new Account("192.168.7.219", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.235.214", new Account("192.168.7.214", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.235.214", new Account("192.168.7.214", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.235.215", new Account("192.168.7.215", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.235.215", new Account("192.168.7.215", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.235.216", new Account("192.168.7.216", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.235.216", new Account("192.168.7.216", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.235.217", new Account("192.168.7.217", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.235.217", new Account("192.168.7.217", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.235.218", new Account("192.168.7.218", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.235.218", new Account("192.168.7.218", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.235.219", new Account("192.168.7.219", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.235.219", new Account("192.168.7.219", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.115.214", new Account("192.168.7.214", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.115.214", new Account("192.168.7.214", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.115.215", new Account("192.168.7.215", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.115.215", new Account("192.168.7.215", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.115.216", new Account("192.168.7.216", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.115.216", new Account("192.168.7.216", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.115.217", new Account("192.168.7.217", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.115.217", new Account("192.168.7.217", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.115.218", new Account("192.168.7.218", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.115.218", new Account("192.168.7.218", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.115.219", new Account("192.168.7.219", "DDECAdmin", "kL5QLMRxMXzrV#", @"e\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.115.219", new Account("192.168.7.219", "test", "daeduck!1", @"EISLog"));
|
||||||
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.7.150", new Account("192.168.7.150", "test", "daeduck!1", @"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.231", new Account("192.168.113.231", "test", "daeduck!1", @"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.232", new Account("192.168.113.232", "test", "daeduck!1", @"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.233", new Account("192.168.113.233", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.113.236", new Account("192.168.113.236", "serviceadmin", "daeduck!1", @"d\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.113.236", new Account("192.168.113.236", "test", "daeduck!1", @"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.231", new Account("192.168.143.231", "test", "daeduck!1", @"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.232", new Account("192.168.143.232", "test", "daeduck!1", @"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.233", new Account("192.168.143.233", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.143.235", new Account("192.168.143.235", "serviceadmin", "daeduck!1", @"d\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.143.235", new Account("192.168.143.235", "test", "daeduck!1", @"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.231", new Account("192.168.233.231", "test", "daeduck!1", @"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.232", new Account("192.168.233.232", "test", "daeduck!1", @"EISLog"));
|
||||||
logServer.NetworkAccount.Add("192.168.233.233", new Account("192.168.233.233", "serviceadmin", "daeduck!1", @"d\EISLog\"));
|
logServer.NetworkAccount.Add("192.168.233.233", new Account("192.168.233.233", "test", "daeduck!1", @"EISLog"));
|
||||||
|
|
||||||
logServer.FTPAddress = "192.168.7.208";
|
logServer.FTPAddress = "192.168.7.208";
|
||||||
logServer.FTPPort = 7000;
|
logServer.FTPPort = 7000;
|
||||||
@@ -762,9 +938,9 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
logServer.DBGetEquipments = sbEquipments.ToString();
|
logServer.DBGetEquipments = sbEquipments.ToString();
|
||||||
logServer.DBGetModelDetails = sbModelDetails.ToString();
|
logServer.DBGetModelDetails = sbModelDetails.ToString();
|
||||||
logServer.DBGetModelInfo = sbModelInfo.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.215", new Account("192.168.8.215", "test", "daeduck!1", @"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.216", new Account("192.168.8.216", "test", "daeduck!1", "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.217", new Account("192.168.8.217", "test", "daeduck!1", "eisap03_eislog"));
|
||||||
logServer.FTPAddress = "192.168.8.217";
|
logServer.FTPAddress = "192.168.8.217";
|
||||||
logServer.FTPPort = 21;
|
logServer.FTPPort = 21;
|
||||||
logServer.FTPUserID = "anonymous";
|
logServer.FTPUserID = "anonymous";
|
||||||
@@ -947,6 +1123,11 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private object GetNetworkAccount(string logserverIP) //jhim 20250202
|
||||||
|
{
|
||||||
|
return ((LogServer) this.cboxServer.SelectedItem)?.NetworkAccount[logserverIP];
|
||||||
|
}
|
||||||
|
|
||||||
private void GetGEMSetting()
|
private void GetGEMSetting()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -1058,6 +1239,8 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using DDUtilityApp.MONGO;
|
|||||||
using DDUtilityApp.SECS;
|
using DDUtilityApp.SECS;
|
||||||
using JWH;
|
using JWH;
|
||||||
using JWH.CONTROL;
|
using JWH.CONTROL;
|
||||||
|
using JWH.NETWORK;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
using ContentAlignment = System.Drawing.ContentAlignment;
|
using ContentAlignment = System.Drawing.ContentAlignment;
|
||||||
|
|
||||||
@@ -1289,29 +1290,59 @@ namespace DDUtilityApp.LOGPARSER
|
|||||||
string strTitle = string.Empty;
|
string strTitle = string.Empty;
|
||||||
|
|
||||||
// Process Unit: File
|
// Process Unit: File
|
||||||
foreach (ListViewItem lviewItem in this.lviewFiles.Items)
|
foreach (ListViewItem lviewItem in this.lviewFiles.Items) //jhlim 20250202
|
||||||
{
|
{
|
||||||
if (lviewItem.Checked == false) continue;
|
if (lviewItem.Checked == false) continue;
|
||||||
XLogger.Instance.Info(lviewItem.Text);
|
XLogger.Instance.Info(lviewItem.Text);
|
||||||
|
|
||||||
string fullPath = lviewItem.Tag as string;
|
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");
|
//var sftpFileInfo = SftpClientWrapper.GetFileInfo(fullPath);
|
||||||
else lviewItem.SubItems[1].Text = $"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB";
|
var ftpsFileInfo = FtpsClient.GetFileInfo(fullPath);
|
||||||
|
//if (sftpFileInfo != null)
|
||||||
if (this.chkDownload.Checked)
|
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);
|
//if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)sftpFileInfo.Size / 1024 / 1024).ToString("F2")} MB");
|
||||||
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
|
//else lviewItem.SubItems[1].Text = $"{((float)sftpFileInfo.Size / 1024 / 1024).ToString("F2")} MB";
|
||||||
System.IO.File.Copy(fullPath, destFileName, true);
|
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)ftpsFileInfo.Size / 1024 / 1024).ToString("F2")} MB");
|
||||||
fullPath = destFileName;
|
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);
|
lstFileName.Add(fullPath);
|
||||||
} // Process Unit: File
|
} // Process Unit: File
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,10 @@ namespace DDUtilityApp.DATA
|
|||||||
public class Account
|
public class Account
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public enum AccessType { SMB, FTP ,FTPS, SFTP };
|
||||||
|
|
||||||
|
public AccessType Access { get; set; } = Account.AccessType.FTPS;
|
||||||
|
|
||||||
public string IPAddress { get; set; }
|
public string IPAddress { get; set; }
|
||||||
|
|
||||||
public string UserID { get; set; }
|
public string UserID { get; set; }
|
||||||
@@ -264,12 +268,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.FTPS)
|
||||||
{
|
{
|
||||||
this.IPAddress = ipAddress;
|
this.IPAddress = ipAddress;
|
||||||
this.UserID = uid;
|
this.UserID = uid;
|
||||||
this.Password = pwd;
|
this.Password = pwd;
|
||||||
this.DefaultPath = defaultPath;
|
this.DefaultPath = defaultPath;
|
||||||
|
this.Access = access;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,13 +70,15 @@ namespace DDUtilityApp
|
|||||||
|
|
||||||
#region [ 버튼 생성 정보 ]
|
#region [ 버튼 생성 정보 ]
|
||||||
frmMain.Buttons.Add("EIS Log Viewer", new EisParser0());
|
frmMain.Buttons.Add("EIS Log Viewer", new EisParser0());
|
||||||
frmMain.Buttons.Add("MIS Log Viewer", new AgvParser());
|
//frmMain.Buttons.Add("MES Log Download", typeof(SPECDOCUMENT.FrmSpecDocument)); // 위치
|
||||||
|
//frmMain.Buttons.Add("MIS Log Viewer", new AgvParser()); // 제거
|
||||||
frmMain.Buttons.Add("FDC Mongo Viewer", typeof(MONGO.FrmFDCMongo));
|
frmMain.Buttons.Add("FDC Mongo Viewer", typeof(MONGO.FrmFDCMongo));
|
||||||
frmMain.Buttons.Add("TIB Simulator", typeof(TIBRENDEZVOUS.FrmSimulator01));
|
frmMain.Buttons.Add("TIB Simulator", typeof(TIBRENDEZVOUS.FrmSimulator01));
|
||||||
frmMain.Buttons.Add("HSMS Converter", typeof(LOGPARSER.FrmHsmsViewer));
|
frmMain.Buttons.Add("HSMS Converter", typeof(LOGPARSER.FrmHsmsViewer));
|
||||||
frmMain.Buttons.Add("TibcoConfig.Xml", typeof(ETC.FrmTIbcoConfig));
|
frmMain.Buttons.Add("TibcoConfig.Xml", typeof(ETC.FrmTIbcoConfig));
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
frmMain.Buttons.Add("FTP Test", typeof(SPECDOCUMENT.FrmSpecDocument));
|
frmMain.Buttons.Add("FTP Test", typeof(SPECDOCUMENT.FrmSpecDocument));
|
||||||
|
frmMain.Buttons.Add("MES Log Download", typeof(SPECDOCUMENT.FrmSpecDocument));
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -86,12 +86,25 @@
|
|||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="BouncyCastle.Cryptography">
|
||||||
|
<HintPath>..\..\SftpTest\WindowsFormsApp1\bin\Debug\BouncyCastle.Cryptography.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="FluentFTP">
|
||||||
|
<HintPath>..\DDUtilityApp\bin\Debug\FluentFTP.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="JWH.SECS">
|
<Reference Include="JWH.SECS">
|
||||||
<HintPath>..\Library\JWH.SECS.dll</HintPath>
|
<HintPath>..\Library\JWH.SECS.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\SftpTest\WindowsFormsApp1\bin\Debug\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Renci.SshNet">
|
||||||
|
<HintPath>..\..\SftpTest\packages\SSH.NET.2024.2.0\lib\net462\Renci.SshNet.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
@@ -129,7 +142,9 @@
|
|||||||
<Compile Include="EXTENSIONS\ExtensionXml.cs" />
|
<Compile Include="EXTENSIONS\ExtensionXml.cs" />
|
||||||
<Compile Include="EXTENSIONS\XLogger.cs" />
|
<Compile Include="EXTENSIONS\XLogger.cs" />
|
||||||
<Compile Include="NETWORK\AsyncSocket.cs" />
|
<Compile Include="NETWORK\AsyncSocket.cs" />
|
||||||
|
<Compile Include="NETWORK\FtpsClient.cs" />
|
||||||
<Compile Include="NETWORK\FtpClient.cs" />
|
<Compile Include="NETWORK\FtpClient.cs" />
|
||||||
|
<Compile Include="NETWORK\SFtpClient.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="TIB\ListenerData.cs" />
|
<Compile Include="TIB\ListenerData.cs" />
|
||||||
<Compile Include="TIB\ListenerInfo.cs" />
|
<Compile Include="TIB\ListenerInfo.cs" />
|
||||||
|
|||||||
146
JWH/NETWORK/FtpsClient.cs
Normal file
146
JWH/NETWORK/FtpsClient.cs
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
using System;
|
||||||
|
using System.Net;
|
||||||
|
using FluentFTP;
|
||||||
|
|
||||||
|
namespace JWH.NETWORK
|
||||||
|
{
|
||||||
|
public static class FtpsClient
|
||||||
|
{
|
||||||
|
private static FluentFTP.FtpClient _ftpClient;
|
||||||
|
private static string _host;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
_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; // 인증서 검증 비활성화 (운영 확인 필요!)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Connect()
|
||||||
|
{
|
||||||
|
if (_ftpClient == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("FTPS client is not initialized. Call Initialize() first.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_ftpClient.IsConnected)
|
||||||
|
{
|
||||||
|
_ftpClient.Connect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Disconnect()
|
||||||
|
{
|
||||||
|
if (_ftpClient != null && _ftpClient.IsConnected)
|
||||||
|
{
|
||||||
|
_ftpClient.Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsFileExists(string path)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
return _ftpClient.FileExists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsDirExists(string path)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
return _ftpClient.DirectoryExists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FtpListItem[] GetFtpsList(string path)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
return _ftpClient.GetListing(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object GetObjectInfo(string filePath)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
return _ftpClient.GetObjectInfo(filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FtpListItem GetFileInfo(string remoteFilePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FtpsClient.Connect();
|
||||||
|
|
||||||
|
if (!_ftpClient.IsConnected)
|
||||||
|
{
|
||||||
|
Console.WriteLine("FTPS 서버에 연결되지 않았습니다.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Passive Mode 설정 (필요한 경우)
|
||||||
|
// _ftpClient.SetPassiveMode(true);
|
||||||
|
|
||||||
|
if (!FtpsClient.IsFileExists(remoteFilePath))
|
||||||
|
{
|
||||||
|
Console.WriteLine("파일이 존재하지 않습니다.");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileInfo = FtpsClient.GetObjectInfo(remoteFilePath) ;
|
||||||
|
if (fileInfo == null)
|
||||||
|
{
|
||||||
|
Console.WriteLine("파일 정보를 가져오는 데 실패했습니다.");
|
||||||
|
}
|
||||||
|
return (FtpListItem)fileInfo;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"파일 정보 조회 오류: {ex.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
FtpsClient.Disconnect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool DownloadFtpsFile(string remotePath, string localPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
_ftpClient.DownloadFile(localPath, remotePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Download error: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool UploadFtpsFile(string localPath, string remotePath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
_ftpClient.UploadFile(localPath, remotePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Upload error: {ex.Message}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
121
JWH/NETWORK/SFtpClient.cs
Normal file
121
JWH/NETWORK/SFtpClient.cs
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
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)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
return _sftpClient.Exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static object GetSftpList(string path)
|
||||||
|
{
|
||||||
|
Connect();
|
||||||
|
return _sftpClient.ListDirectory(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user