diff --git a/DDUtilityApp/GlobalVariable.cs b/DDUtilityApp/GlobalVariable.cs
index 0475392..c12e2c5 100644
--- a/DDUtilityApp/GlobalVariable.cs
+++ b/DDUtilityApp/GlobalVariable.cs
@@ -31,7 +31,7 @@ namespace DDUtilityApp
///
/// 로그파일 다운로드 경로 jhlim 20250202
///
- public string MesDownloadPath { get; set; }
+ public string DownloadPathServerLog { get; set; }
///
/// Workflow 다운로드 경로
@@ -117,7 +117,7 @@ namespace DDUtilityApp
this.DefaultPath = defaultPath.Replace("%MyDocuments%", Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
this.DownloadPath = Path.Combine(this.DefaultPath, "Download");
this.WorkflowPath = Path.Combine(this.DefaultPath, "Workflow");
- this.MesDownloadPath = Path.Combine(this.DefaultPath, "DownloadMES");
+ this.DownloadPathServerLog = Path.Combine(this.DefaultPath, "DownloadServer");
}
///
diff --git a/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs b/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs
index 96dd05f..9f5d6a6 100644
--- a/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs
+++ b/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs
@@ -1,22 +1,15 @@
using DDUtilityApp.LOGPARSER.DATA;
using JWH;
using JWH.NETWORK;
-using Org.BouncyCastle.Tls.Crypto;
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
-using System.IO;
using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-using System.Windows.Forms.DataVisualization.Charting;
-using Telerik.WinControls.Drawing;
using Telerik.WinControls.UI;
namespace DDUtilityApp.MESDOWNLOADER
@@ -40,14 +33,19 @@ namespace DDUtilityApp.MESDOWNLOADER
{
try
{
+#if DEBUG
+ this.Text = $"ServerLog Download - Ver. {Application.ProductVersion} : DEBUG";
+#else
+ this.Text = $"ServerLog Download - Ver. {Application.ProductVersion}";
+#endif
+ this.Font = new Font("돋움체", 9);
+
this.CreateDTFileInfo();
this.SetCboxServer();
this.GridFiles_Setting();
this.tboxDownPath.ReadOnly = true;
- this.tboxDownPath.Text = GlobalVariable.Instance.MesDownloadPath;
-
- this.treeFolder.Font = new Font("돋움체", 10.0F);
+ this.tboxDownPath.Text = GlobalVariable.Instance.DownloadPathServerLog;
}
catch (Exception ex)
{
@@ -87,7 +85,6 @@ namespace DDUtilityApp.MESDOWNLOADER
try
{
this.GridFiles_Setting();
- Color[] backColors = new Color[] { Color.FromArgb(0, 255, 255, 255), Color.FromArgb(255, 255, 255, 220), Color.FromArgb(255, 255, 220, 255), Color.FromArgb(255, 220, 255, 255) };
if (this.DSSetting == null || this.DSSetting.Tables.Contains("Item") == false) return;
int value = (int)this.cboxServer.SelectedValue;
@@ -112,20 +109,18 @@ namespace DDUtilityApp.MESDOWNLOADER
int index = 0;
foreach (var item in query)
{
+ string[] splitIP = item.url.Split('.');
CheckBox chk = new CheckBox()
{
- Text = $"{item.nameap} ({item.url})",
+ Text = $"{item.nameap} ({splitIP[splitIP.Length - 1]})",
AutoSize = true,
Checked = true,
+ Padding = new Padding(5, 3, 3, 5),
+ Margin = new Padding(0),
Tag = item.nameap,
- BackColor = backColors[index % 4]
};
index++;
this.pnlAPList.Controls.Add(chk);
-
- ExpressionFormattingObject formatting = new ExpressionFormattingObject($"Marking", $"nameap='{item.nameap}'", true);
- formatting.RowBackColor = chk.BackColor;
- this.gridFiles.Columns["nameap"].ConditionalFormattingObjectList.Add(formatting);
}
this.treeFolder.Nodes.Clear();
@@ -182,7 +177,6 @@ namespace DDUtilityApp.MESDOWNLOADER
foreach (var file in files)
{
DataRow rowFile = this.DTFileInfo.NewRow();
- rowFile["Check"] = false;
rowFile["nameap"] = nameap;
rowFile["Name"] = file.Name;
rowFile["FileName"] = file.Name;
@@ -213,7 +207,7 @@ namespace DDUtilityApp.MESDOWNLOADER
}
currentNode.Expand();
- this.DTFileInfo.DefaultView.RowFilter = "";
+ this.DTFileInfo.DefaultView.RowFilter = "Type='File'";
this.DTFileInfo.DefaultView.Sort = "Modified DESC";
this.gridFiles.DataSource = this.DTFileInfo;
this.gridFiles.BestFitColumns();
@@ -247,7 +241,7 @@ namespace DDUtilityApp.MESDOWNLOADER
if (dlg.ShowDialog() == DialogResult.OK)
{
this.tboxDownPath.Text = dlg.SelectedPath;
- GlobalVariable.Instance.MesDownloadPath = this.tboxDownPath.Text;
+ GlobalVariable.Instance.DownloadPathServerLog = this.tboxDownPath.Text;
}
}
}
@@ -287,8 +281,10 @@ namespace DDUtilityApp.MESDOWNLOADER
{
try
{
+ this.gridFiles.SelectionMode = GridViewSelectionMode.FullRowSelect;
+ this.gridFiles.MultiSelect = true;
+ this.gridFiles.TableElement.RowHeight = 22;
this.gridFiles.Columns.Clear();
- this.gridFiles.Columns.Add(new GridViewCheckBoxColumn("Check") { });
this.gridFiles.Columns.Add(new GridViewTextBoxColumn("nameap") { HeaderText = "Server", ReadOnly = true });
this.gridFiles.Columns.Add(new GridViewTextBoxColumn("Name") { ReadOnly=true, IsVisible = false });
this.gridFiles.Columns.Add(new GridViewTextBoxColumn("FileName") { ReadOnly = true });
@@ -306,7 +302,9 @@ namespace DDUtilityApp.MESDOWNLOADER
{
try
{
+ if (e.KeyCode != Keys.Enter) return;
+ this.GridFiles_CellDoubleClick(this.gridFiles, null);
}
catch (Exception ex)
{
@@ -314,11 +312,107 @@ namespace DDUtilityApp.MESDOWNLOADER
}
}
- private void GridFiles_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
+ private async void GridFiles_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
try
{
+ List rows = new List();
+ List downloads = new List();
+ if (e != null)
+ {
+ // 더블클릭된 파일 추가
+ DataRowView view = e.Row.DataBoundItem as DataRowView;
+ if (view != null && view.Row != null) rows.Add(view.Row);
+ }
+ else
+ {
+ // 선택된 파일들 추가
+ foreach(GridViewRowInfo row in this.gridFiles.SelectedRows)
+ {
+ DataRowView view = row.DataBoundItem as DataRowView;
+ if (view != null && view.Row != null) rows.Add(view.Row);
+ }
+ }
+
+ // 다운로드
+ bool hasZip = false;
+ using (ProgressForm frmProgress = new ProgressForm(rows.Count))
+ {
+ int countDown = 0;
+ frmProgress.Show();
+ frmProgress.UpdateProgress(string.Empty, countDown);
+
+ foreach(DataRow row in rows)
+ {
+ string fileName = row["FileName"] as string;
+ string url = row["url"] as string;
+ string dir = row["dir"] as string;
+ string subpath = row["subpath"] as string;
+ string userId = row["userId"] as string;
+ string password = row["password"] as string;
+
+ string extension = System.IO.Path.GetExtension(fileName);
+ if (string.Compare(extension, ".Zip", true) == 0) hasZip = true;
+ else if (string.Compare(extension, ".Log", false) == 0) fileName += ".Log";
+
+ List paths = new List();
+ if (!string.IsNullOrEmpty(dir)) paths.Add(dir);
+ if (!string.IsNullOrEmpty(subpath)) paths.Add(subpath);
+ if (!string.IsNullOrEmpty(fileName)) paths.Add(fileName);
+ string pathSRC = System.IO.Path.Combine(paths.ToArray());
+ string pathDST = System.IO.Path.Combine(this.tboxDownPath.Text, this.cboxServer.Text, fileName);
+ frmProgress.UpdateProgress($"{fileName}", countDown);
+
+ FtpsClient.Disconnect();
+ FtpsClient.Initialize(url, userId, password);
+ bool isSuccess = await Task.Run(() =>
+ FtpsClient.DownloadFtpsFile(pathSRC, pathDST)
+ );
+
+ countDown++;
+ if (isSuccess) downloads.Add(pathDST);
+ }
+ }
+
+ if (downloads.Count < 1)
+ {
+ MessageBox.Show($"다운로드된 파일이 없습니다.", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+
+ // FileMerge
+ if (downloads.Count == 1)
+ {
+ string fileName = downloads[0];
+ if (hasZip)
+ {
+ string path = System.IO.Path.Combine(this.tboxDownPath.Text, this.cboxServer.Text, fileName);
+ string command = $"/select,{path}";
+ Process.Start($"explorer.exe", command);
+ }
+ else
+ {
+ string extension = System.IO.Path.GetExtension(fileName);
+ if (string.Compare(extension, ".Log", true) != 0)
+ System.IO.File.Move(fileName, fileName += ".log");
+ System.Diagnostics.Process.Start(fileName);
+ }
+ }
+ else
+ {
+ if (hasZip)
+ {
+ string path = System.IO.Path.Combine(this.tboxDownPath.Text, this.cboxServer.Text);
+ string command = $"/select,{path}";
+ Process.Start($"explorer.exe", path);
+ }
+ else
+ {
+ string filename = Util.GetFileMerge(downloads);
+ System.Diagnostics.Process.Start(filename);
+ }
+ }
}
catch (Exception ex)
{
@@ -337,7 +431,6 @@ namespace DDUtilityApp.MESDOWNLOADER
try
{
this.DTFileInfo = new DataTable();
- this.DTFileInfo.Columns.Add("Check", typeof(bool));
this.DTFileInfo.Columns.Add("nameap", typeof(string));
this.DTFileInfo.Columns.Add("Name", typeof(string));
this.DTFileInfo.Columns.Add("FileName", typeof(string));
@@ -371,6 +464,7 @@ namespace DDUtilityApp.MESDOWNLOADER
return;
}
+ this.cboxServer.DropDownStyle = ComboBoxStyle.DropDownList;
this.cboxServer.DataSource = DSSetting.Tables["Server"];
this.cboxServer.DisplayMember = "name";
this.cboxServer.ValueMember = "Server_Id";
diff --git a/DDUtilityApp/MESDOWNLOADER/ServerLog.cs b/DDUtilityApp/MESDOWNLOADER/ServerLog.cs
index 413b313..647b8c0 100644
--- a/DDUtilityApp/MESDOWNLOADER/ServerLog.cs
+++ b/DDUtilityApp/MESDOWNLOADER/ServerLog.cs
@@ -32,7 +32,7 @@ namespace DDUtilityApp.MESDOWNLOADER
private void ServerLog_Shown(object sender, EventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
- txtPath.Text = GlobalVariable.Instance.MesDownloadPath; //Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
+ txtPath.Text = GlobalVariable.Instance.DownloadPathServerLog; //Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
SetGridView();
}
private void ServerLog_Resize(object sender, EventArgs e)
@@ -66,7 +66,7 @@ namespace DDUtilityApp.MESDOWNLOADER
{
// 선택한 경로를 텍스트 박스에 표시
txtPath.Text = folderDialog.SelectedPath;
- GlobalVariable.Instance.MesDownloadPath = folderDialog.SelectedPath;
+ GlobalVariable.Instance.DownloadPathServerLog = folderDialog.SelectedPath;
}
}
}
diff --git a/DDUtilityApp/Program.cs b/DDUtilityApp/Program.cs
index 20f6614..d155c0c 100644
--- a/DDUtilityApp/Program.cs
+++ b/DDUtilityApp/Program.cs
@@ -70,8 +70,8 @@ namespace DDUtilityApp
#region [ 버튼 생성 정보 ]
frmMain.Buttons.Add("EIS Log Viewer", new EisParser0());
- frmMain.Buttons.Add("MES Log Download", typeof(MESDOWNLOADER.ServerLog));
- frmMain.Buttons.Add("Server Log Download", typeof(MESDOWNLOADER.FrmServerLog));
+ //frmMain.Buttons.Add("MES Log Download", typeof(MESDOWNLOADER.ServerLog));
+ frmMain.Buttons.Add("ServerLog Download", typeof(MESDOWNLOADER.FrmServerLog));
//frmMain.Buttons.Add("MIS Log Viewer", new AgvParser()); // 제거
frmMain.Buttons.Add("FDC Mongo Viewer", typeof(MONGO.FrmFDCMongo));
frmMain.Buttons.Add("HSMS Converter", typeof(LOGPARSER.FrmHsmsViewer));