F1 Change
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using DDUtilityApp.DATA;
|
||||
using JWH.DATA;
|
||||
|
||||
@@ -11,33 +13,74 @@ namespace DDUtilityApp.LOGPARSER.DATA
|
||||
public class LogFile : DataTableBase
|
||||
{
|
||||
|
||||
private string m_FullName = string.Empty;
|
||||
|
||||
public Account Account { get; set; } = null;
|
||||
|
||||
public string Name { get; set; }
|
||||
public string FullName
|
||||
{
|
||||
get { return this.m_FullName; }
|
||||
set
|
||||
{
|
||||
this.m_FullName = value;
|
||||
this.DirectoryName = Path.GetDirectoryName(value);
|
||||
this.FileName = Path.GetFileName(value);
|
||||
this.Name = Path.GetFileNameWithoutExtension(value);
|
||||
this.Extension = Path.GetExtension(value);
|
||||
}
|
||||
}
|
||||
|
||||
public string DirectoryName { get; private set; }
|
||||
|
||||
public string FileName { get; private set; }
|
||||
|
||||
public string Name { get; private set; }
|
||||
|
||||
public string Extension { get; private set; }
|
||||
|
||||
public long Length { get; set; }
|
||||
|
||||
public string Extension { get; set; }
|
||||
|
||||
public string FullName { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public DateTime LastAccessTime { get; set; }
|
||||
|
||||
public DateTime LastWriteTime { get; set; }
|
||||
|
||||
public string DestFullName { get; set; }
|
||||
|
||||
public LogFile()
|
||||
{
|
||||
}
|
||||
|
||||
public LogFile(string fullName)
|
||||
{
|
||||
this.Name = System.IO.Path.GetFileNameWithoutExtension(fullName);
|
||||
this.FullName = fullName;
|
||||
this.Extension = System.IO.Path.GetExtension(fullName);
|
||||
}
|
||||
|
||||
public string GetFileSize(FileSizeType format = FileSizeType.Auto)
|
||||
{
|
||||
int index = 0;
|
||||
int nFormat = (int)format;
|
||||
double value = this.Length;
|
||||
for (index = 0; index < nFormat; index++)
|
||||
{
|
||||
if (format == FileSizeType.Auto && value < 1024) break;
|
||||
value /= 1024;
|
||||
}
|
||||
|
||||
return $"{value.ToString("N2")} {(FileSizeType)index}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum FileSizeType
|
||||
{
|
||||
Bt = 0,
|
||||
KB = 1,
|
||||
MB = 2,
|
||||
GB = 3,
|
||||
TB = 4,
|
||||
Auto = 9,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,8 +53,6 @@ namespace DDUtilityApp.LOGPARSER
|
||||
|
||||
public string ServerName { get; set; } = string.Empty;
|
||||
|
||||
//public string EquipmentID { get; set; } = string.Empty;
|
||||
|
||||
public SECSDefine SECSDefine { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
@@ -80,7 +78,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
this.tboxName.ImeMode = ImeMode.Hangul;
|
||||
this.tboxEquipmentID.ImeMode = ImeMode.Alpha;
|
||||
this.chkAllEquipment.Checked = GlobalVariable.Instance.FrmEqSelector_AllEquipment;
|
||||
this.chkUseSMB.Checked = true; // GlobalVariable.Instance.FrmEqSelector_UseSMB
|
||||
this.chkUseSMB.Checked = true; // = GlobalVariable.Instance.FrmEqSelector_UseSMB
|
||||
this.chkUseSMB.Visible = false;
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
this.tboxModelDescription.Font = font;
|
||||
@@ -142,7 +140,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
switch (keyData)
|
||||
{
|
||||
case Keys.F1:
|
||||
Process.Start($"http://jungwoois.dothome.co.kr");
|
||||
Process.Start("IEXPLORE.EXE", "http://pms.e1soft.co.kr:8090/Deploy/eqview/");
|
||||
break;
|
||||
case Keys.F6:
|
||||
this.gridEquipments.BestFitColumns(BestFitColumnMode.DisplayedCells);
|
||||
@@ -886,7 +884,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
foreach (GridViewRowInfo row in grid.SelectedRows)
|
||||
{
|
||||
LogFile logFile = row.DataBoundItem as LogFile;
|
||||
string destFileName = Path.Combine(destPath, Path.GetFileName(logFile.FullName));
|
||||
string destFileName = Path.Combine(destPath, logFile.FileName);
|
||||
|
||||
switch (this.Account.Access)
|
||||
{
|
||||
@@ -897,12 +895,14 @@ namespace DDUtilityApp.LOGPARSER
|
||||
{
|
||||
FtpsClient.DownloadFtpsFile(logFile.FullName, destFileName);
|
||||
downfiles.Add(destFileName);
|
||||
logFile.DestFullName = destFileName;
|
||||
}
|
||||
break;
|
||||
case AccessType.SFTP:
|
||||
{
|
||||
StpClientWrap.DownloadSftpFile(logFile.FullName, destFileName);
|
||||
downfiles.Add(destFileName);
|
||||
logFile.DestFullName = destFileName;
|
||||
}
|
||||
break;
|
||||
case AccessType.FTP:
|
||||
@@ -1311,7 +1311,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
|
||||
foreach (LogFile logFile in logFiles)
|
||||
{
|
||||
if (string.Compare(item.FullName, logFile.FullName, true) == 0)
|
||||
if (string.Compare(item.FileName, logFile.FileName, true) == 0)
|
||||
{
|
||||
if (current == null)
|
||||
{
|
||||
@@ -1444,9 +1444,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
.Select(item => new LogFile
|
||||
{
|
||||
Account = this.Account,
|
||||
Name = Path.GetFileNameWithoutExtension(item.Name),
|
||||
FullName = item.FullName,
|
||||
Extension = Path.GetExtension(item.Name),
|
||||
Length = item.Length,
|
||||
CreationTime = item.CreationTime,
|
||||
LastAccessTime = item.LastAccessTime,
|
||||
@@ -1469,9 +1467,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
.Select(item => new LogFile
|
||||
{
|
||||
Account = this.Account,
|
||||
Name = Path.GetFileNameWithoutExtension(item.Name),
|
||||
FullName = item.FullName,
|
||||
Extension = Path.GetExtension(item.Name),
|
||||
Length = item.Size,
|
||||
CreationTime = item.Modified,
|
||||
LastAccessTime = item.Modified,
|
||||
@@ -1494,9 +1490,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
.Select(item => new LogFile
|
||||
{
|
||||
Account = this.Account,
|
||||
Name = Path.GetFileNameWithoutExtension(item.Name),
|
||||
FullName = item.FullName,
|
||||
Extension = Path.GetExtension(item.Name),
|
||||
Length = item.Length,
|
||||
CreationTime = item.LastAccessTime,
|
||||
LastAccessTime = item.LastAccessTime,
|
||||
@@ -1519,9 +1513,7 @@ namespace DDUtilityApp.LOGPARSER
|
||||
.Select(item => new LogFile
|
||||
{
|
||||
Account = this.Account,
|
||||
Name = Path.GetFileNameWithoutExtension(item.Name),
|
||||
FullName = item.FullName,
|
||||
Extension = Path.GetExtension(item.Name),
|
||||
Length = item.Size,
|
||||
CreationTime = item.Modified,
|
||||
LastAccessTime = item.Modified,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -373,16 +373,16 @@ namespace DDUtilityApp.LOGPARSER.PARSER
|
||||
FrmEqSelector dlg = null;
|
||||
try
|
||||
{
|
||||
List<LogFile> logFiles = new List<LogFile>();
|
||||
logFiles.AddRange(args);
|
||||
List<LogFile> lstLogFile = new List<LogFile>();
|
||||
lstLogFile.AddRange(args);
|
||||
|
||||
dlg = new FrmEqSelector();
|
||||
dlg.Owner = sender;
|
||||
dlg.Size = sender.Size;
|
||||
dlg.Size = new System.Drawing.Size(sender.Width - 60, sender.Height - 60);
|
||||
dlg.StartPosition = FormStartPosition.CenterParent;
|
||||
dlg.ServerName = this.ServerName;
|
||||
dlg.Equipment = sender.Equipment == null ? new EisEquipment() { EquipmentID = this.EquipmentID, Server = new LogServer(this.ServerName)} : sender.Equipment;
|
||||
dlg.SelectedLogFiles = logFiles.ToArray();
|
||||
dlg.SelectedLogFiles = lstLogFile.ToArray();
|
||||
DialogResult dlgResult = dlg.ShowDialog();
|
||||
if (dlgResult != DialogResult.OK) return null;
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ namespace DDUtilityApp.LOGPARSER.PARSER
|
||||
string fileName = string.Empty;
|
||||
if (args != null && args.Length > 0)
|
||||
{
|
||||
directoryName = Path.GetDirectoryName(args[0].Name);
|
||||
fileName = Path.GetFileName(args[0].Name);
|
||||
directoryName = args[0].DirectoryName;
|
||||
fileName = args[0].FileName;
|
||||
}
|
||||
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using FluentFTP;
|
||||
using Org.BouncyCastle.Crypto.Agreement.JPake;
|
||||
|
||||
namespace JWH.NETWORK
|
||||
{
|
||||
public static class FtpsClient
|
||||
{
|
||||
private static FluentFTP.FtpClient _ftpClient;
|
||||
private static string _host;
|
||||
public static string _host { get; private set; }
|
||||
private static int _port = 990; // FTPS 기본 포트
|
||||
private static string _userId;
|
||||
private static string _password;
|
||||
|
||||
Reference in New Issue
Block a user