추가패치
This commit is contained in:
@@ -313,6 +313,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DEFINE.cs" />
|
||||
<Compile Include="ETC\FrmTIbcoConfig.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
12
DDUtilityApp/DEFINE.cs
Normal file
12
DDUtilityApp/DEFINE.cs
Normal 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 };
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ namespace DDUtilityApp.LOGPARSER.DATA
|
||||
public class LogFile : DataTableBase
|
||||
{
|
||||
|
||||
public AccessType Access { get; set; } = AccessType.FTPS;
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public long Length { get; set; }
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -8,10 +8,12 @@ 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;
|
||||
@@ -38,6 +40,8 @@ namespace DDUtilityApp.LOGPARSER
|
||||
|
||||
private bool RadGridControlKey { get; set; } = false;
|
||||
|
||||
private Account Account { get; set; } = null;
|
||||
|
||||
private StandardCollection StandardCollection { get; set; } = new StandardCollection();
|
||||
|
||||
public LogParser LogParser
|
||||
@@ -354,9 +358,9 @@ namespace DDUtilityApp.LOGPARSER
|
||||
|
||||
int index = -1;
|
||||
index = this.lviewFiles.SelectedItems[0].Index;
|
||||
LogFile logFile = this.lviewFiles.Items[index].Tag as LogFile;
|
||||
|
||||
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 = Path.GetFileName(logFile.FullName);
|
||||
if (string.IsNullOrEmpty(this.tboxFilename.Text) == false && this.tboxFilename.Text.Length > 6)
|
||||
{
|
||||
this.tboxFilename.SelectionStart = this.tboxFilename.Text.Length - 6;
|
||||
@@ -453,14 +457,27 @@ namespace DDUtilityApp.LOGPARSER
|
||||
{
|
||||
try
|
||||
{
|
||||
string path = this.tboxFilename.Tag as string;
|
||||
LogFile logFile = this.tboxFilename.Tag as LogFile;
|
||||
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;
|
||||
|
||||
if (logFile == null)
|
||||
{
|
||||
if (this.lviewFiles.Items.Count < 1) return;
|
||||
LogFile src = this.lviewFiles.Items[0].Tag as LogFile;
|
||||
if (src != null)
|
||||
{
|
||||
string path = Path.GetDirectoryName(src.FullName);
|
||||
string fullName = Path.Combine(path, fileName);
|
||||
logFile = new LogFile(fullName);
|
||||
}
|
||||
}
|
||||
|
||||
ListViewItem lviewItem = this.lviewFiles.Items.Add(fileName);
|
||||
lviewItem.Tag = $"{path}{Path.DirectorySeparatorChar}{fileName}";
|
||||
lviewItem.Tag = logFile;
|
||||
lviewItem.Checked = true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -552,14 +569,15 @@ namespace DDUtilityApp.LOGPARSER
|
||||
{
|
||||
if (this.LogParser == null) return;
|
||||
|
||||
List<string> lstFileNames = new List<string>();
|
||||
List<LogFile> lstFileNames = 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))
|
||||
lstFileNames.Add((LogFile)item.Tag);
|
||||
}
|
||||
string[] selectedFiles = this.LogParser.FileSelector(this, lstFileNames.ToArray());
|
||||
if (selectedFiles == null || selectedFiles.Length < 1) return;
|
||||
LogFile[] logfiles = this.LogParser.FileSelector(this, lstFileNames.ToArray());
|
||||
this.Account = this.LogParser.Account;
|
||||
if (logfiles == null || logfiles.Length < 1) return;
|
||||
|
||||
if (this.chkAutoClear.Checked) this.BtnFileClear_Click(this.btnFileClear, new EventArgs());
|
||||
this.cboxLineNumber.Items.Clear();
|
||||
@@ -577,12 +595,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 = Path.GetFileName(logfile.FullName);
|
||||
this.BtnFileAdd_Click(this.btnFileAdd, new EventArgs());
|
||||
}
|
||||
this.tboxFilename.Tag = null;
|
||||
|
||||
if (this.chkAutoClear.Checked)
|
||||
this.BtnParsing_Click(this.btnParsing, new EventArgs());
|
||||
@@ -1275,7 +1294,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
#region [ Method ] ----------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// [CheckPoint] 로그파일을 로컬에 복제후, 데이터를 생성한다
|
||||
/// [CheckPoint] 로그파일을 로컬에 복제(다운로드)후, 데이터를 생성한다
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private StandardCollection Parsing()
|
||||
@@ -1286,6 +1305,98 @@ namespace DDUtilityApp.LOGPARSER
|
||||
this.tboxException.Clear();
|
||||
this.StandardCollection.Clear();
|
||||
|
||||
List<string> lstFileName = new List<string>();
|
||||
string strTitle = string.Empty;
|
||||
string destPath = string.Empty;
|
||||
string destFileName = 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.Access)
|
||||
{
|
||||
case AccessType.SMB:
|
||||
{
|
||||
FileInfo fileInfo = new FileInfo(logFile.FullName);
|
||||
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)
|
||||
{
|
||||
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
|
||||
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
|
||||
|
||||
if (string.IsNullOrEmpty(strTitle)) strTitle = logFile.Name;
|
||||
destFileName = $@"{destPath}{System.IO.Path.GetFileName(logFile.FullName)}";
|
||||
|
||||
if (logFile.FullName != destFileName)
|
||||
System.IO.File.Copy(logFile.FullName, destFileName, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AccessType.FTPS:
|
||||
{
|
||||
FtpListItem ftpsFileInfo = FtpsClient.GetFileInfo(logFile.FullName);
|
||||
if (ftpsFileInfo == null) continue;
|
||||
|
||||
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)
|
||||
{
|
||||
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
|
||||
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
|
||||
|
||||
if (string.IsNullOrEmpty(strTitle)) strTitle = logFile.Name;
|
||||
destFileName = Path.Combine(destPath, $"{logFile.Name}{logFile.Extension}");
|
||||
|
||||
FtpsClient.DownloadFtpsFile(logFile.FullName, destFileName);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AccessType.SFTP:
|
||||
break;
|
||||
case AccessType.FTP:
|
||||
break;
|
||||
}
|
||||
|
||||
lstFileName.Add(destFileName);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
this.tboxLog.Clear();
|
||||
this.tboxException.Clear();
|
||||
this.StandardCollection.Clear();
|
||||
|
||||
List<string> lstFileName = new List<string>();
|
||||
string strTitle = string.Empty;
|
||||
|
||||
|
||||
@@ -252,9 +252,7 @@ namespace DDUtilityApp.DATA
|
||||
public class Account
|
||||
{
|
||||
|
||||
public enum AccessType { SMB, FTP ,FTPS, SFTP };
|
||||
|
||||
public AccessType Access { get; set; } = Account.AccessType.FTPS;
|
||||
public AccessType Access { get; set; } = AccessType.FTPS;
|
||||
|
||||
public string IPAddress { get; set; }
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -367,49 +368,42 @@ namespace DDUtilityApp.LOGPARSER.PARSER
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
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.ServerName = this.ServerName;
|
||||
dlg.EquipmentID = this.EquipmentID;
|
||||
dlg.SelectedLogFiles = lstLogFile.ToArray();
|
||||
dlg.Equipment = sender.Equipment;
|
||||
dlg.SelectedLogFiles = logFiles.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
|
||||
|
||||
@@ -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 = Path.GetDirectoryName(args[0].Name);
|
||||
fileName = Path.GetFileName(args[0].Name);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Viewer>
|
||||
<Server name="MES">
|
||||
<!-- ?????? ???? -->
|
||||
<Item name="AP01" url="192.168.7.215" dir="/EISLog/testlog" conkey="dGVzdDpkYWVkdWNrITE="/>
|
||||
<Item name="AP02" url="192.168.7.215" dir="/EISLog/testlog1" conkey="dGVzdDpkYWVkdWNrITE="/>
|
||||
<Item name="AP03" url="192.168.7.215" dir="/EISLog/testlog2" conkey="dGVzdDpkYWVkdWNrITE="/>
|
||||
</Server>
|
||||
<Server name="MES(AUTO)">
|
||||
<Item name="AP01" url="192.168.7.215" dir="/EISLog/testbackup/logs" conkey="dGVzdDpkYWVkdWNrITE="/>
|
||||
<Item name="AP02" url="192.168.7.215" dir="/EISLog/testbackup/logs1" conkey="dGVzdDpkYWVkdWNrITE="/>
|
||||
<Item name="AP03" url="192.168.7.215" dir="/EISLog/testbackup/logs2" conkey="dGVzdDpkYWVkdWNrITE="/>
|
||||
</Server>
|
||||
<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>
|
||||
@@ -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>();
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user