F1 Change

This commit is contained in:
2025-03-07 11:57:24 +09:00
parent 0790ae42f9
commit 9be4b773a5
6 changed files with 107 additions and 77 deletions

View File

@@ -40,8 +40,6 @@ 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
@@ -254,7 +252,7 @@ namespace DDUtilityApp.LOGPARSER
switch (keyData)
{
case Keys.F1:
Process.Start($"http://192.168.7.221:8081/");
Process.Start("IEXPLORE.EXE", "http://pms.e1soft.co.kr:8090/Deploy/eqview/");
break;
case Keys.F2:
this.Location = new Point(0, 0);
@@ -359,8 +357,10 @@ namespace DDUtilityApp.LOGPARSER
int index = -1;
index = this.lviewFiles.SelectedItems[0].Index;
LogFile logFile = this.lviewFiles.Items[index].Tag as LogFile;
if (logFile == null) return;
this.tboxFilename.Text = Path.GetFileName(logFile.FullName);
this.tboxFilename.Text = logFile.FileName;
this.tboxFilename.Tag = logFile;
if (string.IsNullOrEmpty(this.tboxFilename.Text) == false && this.tboxFilename.Text.Length > 6)
{
this.tboxFilename.SelectionStart = this.tboxFilename.Text.Length - 6;
@@ -457,28 +457,25 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
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)
LogFile srcLogFile = this.tboxFilename.Tag as LogFile;
if (srcLogFile == 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);
logFile.Account = src.Account;
}
srcLogFile = this.lviewFiles.Items[0].Tag as LogFile;
if (srcLogFile == null) return;
}
ListViewItem lviewItem = this.lviewFiles.Items.Add(fileName);
lviewItem.Tag = logFile;
string fullName = Path.Combine(srcLogFile.DirectoryName, fileName);
LogFile newLogFile = new LogFile(fullName) { Account = srcLogFile.Account };
ListViewItem lviewItem = this.lviewFiles.Items.Add(newLogFile.FileName);
lviewItem.Tag = newLogFile;
lviewItem.Checked = true;
}
catch (Exception ex)
@@ -570,14 +567,15 @@ namespace DDUtilityApp.LOGPARSER
{
if (this.LogParser == null) return;
List<LogFile> lstFileNames = new List<LogFile>();
List<LogFile> lstLogFile = new List<LogFile>();
foreach (ListViewItem item in this.lviewFiles.Items)
{
if (item.Tag != null && item.Tag.GetType() == typeof(LogFile))
lstFileNames.Add((LogFile)item.Tag);
lstLogFile.Add((LogFile)item.Tag);
}
LogFile[] logfiles = this.LogParser.FileSelector(this, lstFileNames.ToArray());
this.Account = this.LogParser.Account;
// LogPaser > FrmEqSelector
LogFile[] logfiles = this.LogParser.FileSelector(this, lstLogFile.ToArray());
if (logfiles == null || logfiles.Length < 1) return;
if (this.chkAutoClear.Checked) this.BtnFileClear_Click(this.btnFileClear, new EventArgs());
@@ -599,7 +597,7 @@ namespace DDUtilityApp.LOGPARSER
foreach (LogFile logfile in logfiles)
{
this.tboxFilename.Tag = logfile;
this.tboxFilename.Text = Path.GetFileName(logfile.FullName);
this.tboxFilename.Text = logfile.FileName;
this.BtnFileAdd_Click(this.btnFileAdd, new EventArgs());
}
this.tboxFilename.Tag = null;
@@ -810,25 +808,20 @@ namespace DDUtilityApp.LOGPARSER
{
try
{
List<string> lstFileName = new List<string>();
List<string> lstFullName = new List<string>();
foreach (ListViewItem lviewItem in this.lviewFiles.Items)
{
if (lviewItem.Checked == false) continue;
XLogger.Instance.Info(lviewItem.Text);
string sourceFileName = lviewItem.Tag as string;
string destPath = GlobalVariable.Instance.DownloadPath;
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
LogFile logFile = lviewItem.Tag as LogFile;
if (logFile == null) continue;
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(sourceFileName)}";
if (this.chkDownload.Checked == false) System.IO.File.Copy(sourceFileName, destFileName, true);
sourceFileName = destFileName;
lstFileName.Add(sourceFileName);
lstFullName.Add(logFile.DestFullName);
}
foreach (string filename in lstFileName)
Process.Start(filename);
foreach (string fullName in lstFullName)
Process.Start(fullName);
}
catch (Exception ex)
{
@@ -1309,7 +1302,6 @@ namespace DDUtilityApp.LOGPARSER
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
@@ -1318,47 +1310,49 @@ namespace DDUtilityApp.LOGPARSER
XLogger.Instance.Info(lviewItem.Text);
LogFile logFile = lviewItem.Tag as LogFile;
switch(this.Account.Access)
switch(logFile.Account.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";
logFile.Length = fileInfo.Length;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add(logFile.GetFileSize());
else lviewItem.SubItems[1].Text = logFile.GetFileSize();
if (this.chkDownload.Checked)
{
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (Directory.Exists(destPath) == false) Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = logFile.Name;
destFileName = $@"{destPath}{System.IO.Path.GetFileName(logFile.FullName)}";
if (string.IsNullOrEmpty(strTitle)) strTitle = this.Equipment.MesName;
logFile.DestFullName = Path.Combine(destPath, logFile.FileName);
if (logFile.FullName != destFileName)
System.IO.File.Copy(logFile.FullName, destFileName, true);
File.Copy(logFile.FullName, logFile.DestFullName, true);
}
}
break;
case AccessType.FTPS:
{
FtpsClient.Initialize(logFile.Account.IPAddress, logFile.Account.UserID, logFile.Account.Password);
if (FtpsClient._host != logFile.Account.IPAddress)
FtpsClient.Initialize(logFile.Account.IPAddress, logFile.Account.UserID, logFile.Account.Password);
FtpListItem ftpsFileInfo = FtpsClient.GetFileInfo(logFile.FullName);
if (ftpsFileInfo == null) continue;
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";
logFile.Length = ftpsFileInfo.Size;
if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add(logFile.GetFileSize());
else lviewItem.SubItems[1].Text = logFile.GetFileSize();
if (this.chkDownload.Checked)
{
destPath = Path.Combine(GlobalVariable.Instance.DownloadPath, this.Equipment.EquipmentID);
if (System.IO.Directory.Exists(destPath) == false) System.IO.Directory.CreateDirectory(destPath);
if (Directory.Exists(destPath) == false) Directory.CreateDirectory(destPath);
if (string.IsNullOrEmpty(strTitle)) strTitle = logFile.Name;
destFileName = Path.Combine(destPath, $"{logFile.Name}{logFile.Extension}");
if (string.IsNullOrEmpty(strTitle)) strTitle = this.Equipment.MesName;
logFile.DestFullName = Path.Combine(destPath, logFile.FileName);
FtpsClient.DownloadFtpsFile(logFile.FullName, destFileName);
FtpsClient.DownloadFtpsFile(logFile.FullName, logFile.DestFullName);
}
}
break;
@@ -1368,7 +1362,7 @@ namespace DDUtilityApp.LOGPARSER
break;
}
lstFileName.Add(destFileName);
lstFileName.Add(logFile.DestFullName);
}
if (!string.IsNullOrEmpty(this.tboxEISInfo04.Text)) this.LogParser.ModelID = this.tboxEISInfo04.Text;