추가패치

This commit is contained in:
2025-03-05 10:00:08 +09:00
parent 8b39c28efb
commit fb46e2b17a
12 changed files with 356 additions and 139 deletions

View File

@@ -20,7 +20,9 @@ using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;
using Telerik.WinControls.UI;
using static Telerik.WinControls.UI.ValueMapper;
namespace DDUtilityApp.LOGPARSER
{
@@ -34,15 +36,23 @@ 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 string EquipmentID { get; set; } = string.Empty;
public SECSDefine SECSDefine { get; set; } = null;
@@ -151,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);
}
@@ -411,49 +421,48 @@ namespace DDUtilityApp.LOGPARSER
if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP) == false) return;
{
Account account = logServer.NetworkAccount[equipment.LogServerIP];
switch (account.Access)
this.Account = logServer.NetworkAccount[equipment.LogServerIP];
switch (this.Account.Access)
{
case Account.AccessType.SMB:
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() == account.IPAddress) { isLocal = true; break; }
if (ip.Address.ToString() == this.Account.IPAddress) { isLocal = true; break; }
if (this.chkUseSMB.Checked)
{
if (isLocal) path=$@"{equipment.LogPath}\{equipment.EquipmentID}";
if (isLocal) path = $@"{equipment.LogPath}\{equipment.EquipmentID}";
else return;
}
else
{
if (isLocal) path = $@"{equipment.LogPath}\{equipment.EquipmentID}";
else path = $@"\\{account.IPAddress}\{account.DefaultPath}{equipment.EquipmentID}\";
else path = $@"\\{this.Account.IPAddress}\{this.Account.DefaultPath}{equipment.EquipmentID}\";
}
int result = ExtensionAPI.ConnectRemoteServer(account.IPAddress, account.UserID, account.Password);
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; }
LogFile[] logFiles = directory.GetFiles().ToClass<LogFile>().OrderByDescending(x => x.Name).ToArray();
this.gridLogFiles.AutoBinding(logFiles);
this.gridLogFiles.AutoBinding(this.GetLogFiles(directory.GetFiles()));
this.rstatus1.Text = $"Path={path}";
}
break;
case Account.AccessType.FTPS:
case AccessType.FTPS:
{
FtpsClient.Initialize(account.IPAddress, account.UserID, account.Password);
FtpsClient.Initialize(this.Account.IPAddress, this.Account.UserID, this.Account.Password);
FtpsClient.Connect();
path = $"/{account.DefaultPath}/{equipment.EquipmentID}";
path = $"/{this.Account.DefaultPath}/{equipment.EquipmentID}";
FtpListItem[] ftpFiles = FtpsClient.GetFtpsList(path);
if (ftpFiles != null) this.gridLogFiles.AutoBinding(this.GetLogFiles(ftpFiles));
this.rstatus1.Text = $"Path={account.IPAddress}{path}";
this.rstatus1.Text = $"Path={this.Account.IPAddress}{path}";
if (FtpsClient.IsDirExists($"{path}/THiRA_SECSGEM/HSMS"))
{ if (!tabControl1.TabPages.Contains(tabPage4)) tabControl1.TabPages.Add(tabPage4); }
@@ -463,15 +472,15 @@ namespace DDUtilityApp.LOGPARSER
FtpsClient.Disconnect();
}
break;
case Account.AccessType.SFTP:
case AccessType.SFTP:
{
StpClientWrap.Initialize(account.IPAddress, account.UserID, account.Password);
StpClientWrap.Initialize(this.Account.IPAddress, this.Account.UserID, this.Account.Password);
StpClientWrap.Connect();
path = $"/{account.DefaultPath}/{equipment.EquipmentID}";
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={account.IPAddress}{path}";
this.rstatus1.Text = $"Path={this.Account.IPAddress}{path}";
if (StpClientWrap.IsDirExists($"{path}/THiRA_SECSGEM/HSMS"))
{ if (!tabControl1.TabPages.Contains(tabPage4)) tabControl1.TabPages.Add(tabPage4); }
@@ -481,7 +490,7 @@ namespace DDUtilityApp.LOGPARSER
StpClientWrap.Disconnect();
}
break;
case Account.AccessType.FTP:
case AccessType.FTP:
{
}
@@ -494,6 +503,14 @@ namespace DDUtilityApp.LOGPARSER
}
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
@@ -759,19 +776,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)
{
@@ -1003,37 +1008,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", "test", "daeduck!1", @"EISLog", Account.AccessType.FTPS));
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;
@@ -1050,9 +1061,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";
@@ -1345,20 +1356,21 @@ namespace DDUtilityApp.LOGPARSER
}
/// <summary>
/// Sftp Log Files
/// SMB Log Files
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>
private LogFile[] GetLogFiles(object fileItems)
private LogFile[] GetLogFiles(FileInfo[] fileItems)
{
LogFile[] logFiles = ((List<ISftpFile>)fileItems).Where(item => !item.IsDirectory && item.Name != "." && item.Name != "..")
LogFile[] logFiles = fileItems
.Select(item => new LogFile
{
Access = AccessType.SMB,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
Length = item.Length,
CreationTime = item.LastAccessTime,
CreationTime = item.CreationTime,
LastAccessTime = item.LastAccessTime,
LastWriteTime = item.LastWriteTime
})
@@ -1369,7 +1381,7 @@ namespace DDUtilityApp.LOGPARSER
}
/// <summary>
/// Ftps Log Files
/// FTPS Log Files
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>
@@ -1378,6 +1390,7 @@ namespace DDUtilityApp.LOGPARSER
LogFile[] logFiles = fileItems.Where(item => item.Type == FtpFileSystemObjectType.File)
.Select(item => new LogFile
{
Access = AccessType.FTPS,
Name = Path.GetFileNameWithoutExtension(item.Name),
FullName = item.FullName,
Extension = Path.GetExtension(item.Name),
@@ -1393,7 +1406,32 @@ namespace DDUtilityApp.LOGPARSER
}
/// <summary>
/// Ftps Log Files jhlim 20250202
/// 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
{
Access = AccessType.SFTP,
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>
/// Fts Log Files jhlim 20250202
/// </summary>
/// <param name="fileItems"></param>
/// <returns></returns>