추가패치

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

@@ -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;