20250202_1 jhlim

This commit is contained in:
t001310
2025-02-28 08:40:40 +09:00
parent 402df7997b
commit 5cf740318e
9 changed files with 681 additions and 84 deletions

View File

@@ -14,6 +14,7 @@ using DDUtilityApp.MONGO;
using DDUtilityApp.SECS;
using JWH;
using JWH.CONTROL;
using JWH.NETWORK;
using Telerik.WinControls.UI;
using ContentAlignment = System.Drawing.ContentAlignment;
@@ -1289,29 +1290,59 @@ namespace DDUtilityApp.LOGPARSER
string strTitle = string.Empty;
// Process Unit: File
foreach (ListViewItem lviewItem in this.lviewFiles.Items)
foreach (ListViewItem lviewItem in this.lviewFiles.Items) //jhlim 20250202
{
if (lviewItem.Checked == false) continue;
XLogger.Instance.Info(lviewItem.Text);
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");
else lviewItem.SubItems[1].Text = $"{((float)fileInfo.Length / 1024 / 1024).ToString("F2")} MB";
if (this.chkDownload.Checked)
//var sftpFileInfo = SftpClientWrapper.GetFileInfo(fullPath);
var ftpsFileInfo = FtpsClient.GetFileInfo(fullPath);
//if (sftpFileInfo != null)
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);
string destFileName = $@"{destPath}{System.IO.Path.GetFileName(fullPath)}";
System.IO.File.Copy(fullPath, destFileName, true);
fullPath = destFileName;
//if (lviewItem.SubItems.Count < 2) lviewItem.SubItems.Add($"{((float)sftpFileInfo.Size / 1024 / 1024).ToString("F2")} MB");
//else lviewItem.SubItems[1].Text = $"{((float)sftpFileInfo.Size / 1024 / 1024).ToString("F2")} MB";
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)
{
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);
} // Process Unit: File