diff --git a/DDUtilityApp/FrmMain.cs b/DDUtilityApp/FrmMain.cs index b37df2d..c5ac27d 100644 --- a/DDUtilityApp/FrmMain.cs +++ b/DDUtilityApp/FrmMain.cs @@ -5,6 +5,7 @@ using System.Configuration; using System.Drawing; using System.Windows.Forms; using Telerik.WinControls.UI; +using static DDUtilityApp.GlobalVariable; namespace DDUtilityApp { @@ -50,12 +51,7 @@ namespace DDUtilityApp { try { - bool isAdmin = false; - string adminPWD = ConfigurationManager.AppSettings["ADMIN"]; - if (adminPWD != null && adminPWD == "daeduck!1") isAdmin = true; -#if DEBUG - isAdmin = true; -#endif + eUserLevel userLevel = GlobalVariable.Instance.UserLevel; int btnWidth = 200; int btnHeight = 32; @@ -70,7 +66,8 @@ namespace DDUtilityApp button.Dock = DockStyle.Top; button.TabIndex = tabIndex++; button.Tag = obj.Value; - button.Visible = obj.Visible | isAdmin; + button.Visible = obj.Visible; + if (obj.Visible == false && userLevel > eUserLevel.Normal) button.Visible = true; button.Click += Button_Click; lstControls.Add(button); } diff --git a/DDUtilityApp/GlobalVariable.cs b/DDUtilityApp/GlobalVariable.cs index c12e2c5..54edb59 100644 --- a/DDUtilityApp/GlobalVariable.cs +++ b/DDUtilityApp/GlobalVariable.cs @@ -1,4 +1,5 @@ using JWH; +using log4net.Core; using System; using System.ComponentModel; using System.Configuration; @@ -56,6 +57,14 @@ namespace DDUtilityApp public Size FormSize { get; set; } = new Size(1300, 750); + private eUserLevel m_UserLevel = eUserLevel.None; + + public eUserLevel UserLevel { get { return this.m_UserLevel; } set { this.m_UserLevel = value; } } + + public string SetUserLevel { + set { Enum.TryParse(value, out this.m_UserLevel); } + } + #region [ LogParser ] public string EisParser_GridHeader { get; set; } = string.Empty; @@ -218,6 +227,14 @@ namespace DDUtilityApp } } + public enum eUserLevel + { + None = 0, + Normal = 1, + Admin = 16, + SupperAdmin = 128 + } + } } diff --git a/DDUtilityApp/LOGPARSER/FrmEqSelector.cs b/DDUtilityApp/LOGPARSER/FrmEqSelector.cs index dca03dc..91561dd 100644 --- a/DDUtilityApp/LOGPARSER/FrmEqSelector.cs +++ b/DDUtilityApp/LOGPARSER/FrmEqSelector.cs @@ -20,6 +20,7 @@ using System.IO; using System.Linq; using System.Net.NetworkInformation; using System.Text; +using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; using Telerik.WinControls.UI; @@ -55,6 +56,8 @@ namespace DDUtilityApp.LOGPARSER public SECSDefine SECSDefine { get; set; } = null; + private int InitializeStatus { get; set; } = 0; + #endregion #region [ FrmEqSelector ] --------------------------------------------- @@ -82,17 +85,11 @@ namespace DDUtilityApp.LOGPARSER this.chkUseSMB.Visible = false; this.tabControl1.SelectedIndex = 0; this.tboxModelDescription.Font = font; - - this.GridEquipments_Setting(); - this.GridLogFiles_Setting(this.gridLogFiles); //jhlim 20250202 - this.GridLogFiles_Setting(this.gridHsms); //jhlim 20250202 - this.GridLogFiles_Setting(this.gridWorkflow); //jhlim 20250202 - this.GridModelDetail_Setting(); } protected void SetEventHandler() { - this.Load += FrmEquipments_Load; + this.Shown += this.FrmEqSelector_Shown; this.FormClosing += FrmEqSelector_FormClosing; this.FormClosed += this.FrmEqSelector_FormClosed; this.Disposed += this.FrmEqSelector_Disposed; @@ -113,12 +110,44 @@ namespace DDUtilityApp.LOGPARSER this.gridLogFiles.CellDoubleClick += GridLogFiles_CellDoubleClick; this.gridLogFiles.KeyDown += GridLogFiles_KeyDown; - //jhlim 20250202 start this.gridWorkflow.CellDoubleClick += Grid_CellDoubleClick; this.gridWorkflow.KeyDown += Grid_KeyDown; this.gridHsms.CellDoubleClick += Grid_CellDoubleClick; this.gridHsms.KeyDown += Grid_KeyDown; - //jhlim 20250202 end + } + + private async void FrmEqSelector_Shown(object sender, EventArgs e) + { + await Task.Delay(500); + + try + { + this.SuspendLayout(); + + this.GridEquipments_Setting(); + this.GridLogFiles_Setting(this.gridLogFiles); + this.GridLogFiles_Setting(this.gridHsms); + this.GridLogFiles_Setting(this.gridWorkflow); + this.GridModelDetail_Setting(); + + this.InitializeStatus = 1; + this.SetLogServer(); + if (this.Equipment != null) this.SetEquipment(this.Equipment); + else this.SetEquipment(this.ServerName, this.Equipment?.EquipmentID); + this.InitializeStatus = 0; + + this.GridEquipments_SelectionChanged(this.gridEquipments, null); + this.SetSelectedLogFiles(this.SelectedLogFiles); + } + catch (Exception ex) + { + XLogger.Instance.Fatal(ex, true); + } + finally + { + this.InitializeStatus = 0; + this.ResumeLayout(); + } } private void FrmEqSelector_Disposed(object sender, EventArgs e) @@ -157,14 +186,6 @@ namespace DDUtilityApp.LOGPARSER return base.ProcessCmdKey(ref msg, keyData); } - private void FrmEquipments_Load(object sender, EventArgs e) - { - this.SetLogServer(); - if (this.Equipment != null) this.SetEquipment(this.Equipment); - else this.SetEquipment(this.ServerName, this.Equipment?.EquipmentID); - this.SetSelectedLogFiles(this.SelectedLogFiles); - } - private void FrmEqSelector_FormClosing(object sender, FormClosingEventArgs e) { } @@ -356,7 +377,7 @@ namespace DDUtilityApp.LOGPARSER { GridViewEx grid = this.gridEquipments; grid.TableElement.RowHeight = 20; - grid.MultiSelect = true; + grid.MultiSelect = false; Dictionary dicColumnText = new Dictionary(); dicColumnText.Add("Facility", ""); @@ -424,12 +445,13 @@ namespace DDUtilityApp.LOGPARSER { try { + if (this.InitializeStatus > 0) return; if (this.gridEquipments.SelectedRows.Count < 1) return; + this.gridLogFiles.DataSource = null; this.gridModelDetail.DataSource = null; this.gridWorkflow.DataSource = null; this.gridHsms.DataSource = null; - //if (this.tabControl1.TabPages.Contains(this.tabHSMS)) this.tabControl1.TabPages.Remove(this.tabHSMS); EisEquipment equipment = this.gridEquipments.SelectedRows[0].DataBoundItem as EisEquipment; if (equipment == null) return; @@ -570,165 +592,6 @@ namespace DDUtilityApp.LOGPARSER } } - /// - /// [CheckPoint] 선택된 설비의 로그파일 목록을 표시한다. - /// - /// - /// - private void xGridEquipments_SelectionChanged(object sender, EventArgs e) - { - try - { - if (this.gridEquipments.SelectedRows.Count < 1) return; - this.gridLogFiles.DataSource = null; - this.gridModelDetail.DataSource = null; - - EisEquipment equipment = this.gridEquipments.SelectedRows[0].DataBoundItem as EisEquipment; - if (equipment == null) return; - - this.Cursor = Cursors.WaitCursor; - this.Equipment = equipment; - LogServer logServer = this.cboxServer.SelectedItem as LogServer; - string path = string.Empty; - - #region [ Model Details ] - // 모델 버전 정보 - EisModelDetails[] modelDetails = this.GetModelDetails(equipment); - this.gridModelDetail.AutoBinding(modelDetails); - this.gridModelDetail.SetRowForeColor("LockState", $"LockState = 'BLOCKED'", Color.LightGray); - foreach (GridViewRowInfo row in this.gridModelDetail.Rows) - { - EisModelDetails item = row.DataBoundItem as EisModelDetails; - if (item == null) continue; - if (item.Version == equipment.Version) - { - row.IsSelected = true; - row.IsCurrent = true; - break; - } - } - - // 모델 정보 - EisModelInfo[] modelInfo = this.GetModelInfo(equipment); - if (modelInfo?.Length > 0) - { - this.tboxModelDescription.Text = modelInfo[0].Description; - } - #endregion - - #region [ LogFiles ] - if (logServer.NetworkAccount.ContainsKey(equipment.LogServerIP)) //jhlim 20250202 jj - { - // Checking Local IP-Address - foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) - { - foreach (UnicastIPAddressInformation ip in nic.GetIPProperties().UnicastAddresses) - { - if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) - { - if (ip.Address.ToString() == equipment.LogServerIP) - { - path = $@"{equipment.LogPath}\{equipment.EquipmentID}"; - break; - } - } - } - } - - // SMB (Server Message Block) - //if (string.IsNullOrEmpty(path) && this.chkUseSMB.Checked) - //{ - // Account account = logServer.NetworkAccount[equipment.LogServerIP]; - // int result = ExtensionAPI.ConnectRemoteServer(account.IPAddress, account.UserID, account.Password); - // if (result != 0 && result != 1219) { MessageBox.Show($@"네트워크 접근에 실패하였습니다. (Code:{result})"); return; } - // path = logServer.GetLogPath(equipment.LogServerIP, equipment.EquipmentID); - //} - - if (string.IsNullOrEmpty(path) && this.chkUseSMB.Checked) //jhlim 20250202 - { - Account account = logServer.NetworkAccount[equipment.LogServerIP]; - object rtnObj = null; - - // StpClientWrap 사용 - //StpClientWrap.Initialize(equipment?.LogServerIP, "test", "daeduck!1"); - //StpClientWrap.Connect(); - var svrInfo = (DDUtilityApp.DATA.Account)GetNetworkAccount(equipment?.LogServerIP); - FtpsClient.Initialize(equipment?.LogServerIP, svrInfo.UserID, svrInfo.Password); - FtpsClient.Connect(); - - var remotePath = $"/{svrInfo.DefaultPath}/{equipment.EquipmentID}"; - //var remotePath = $"{equipment.EquipmentID}"; - // SFTP 파일 목록 가져오기 - //rtnObj = StpClientWrap.GetSftpList(remotePath); - rtnObj = FtpsClient.GetFtpsList(remotePath); - - if (rtnObj == null) return; - //StpClientWrap.IsDirectory( "/302304/THiRA_SECSGEM/HSMS") - //var hsmsEnabled = (StpClientWrap.IsDirExists( $"{remotePath}/THiRA_SECSGEM/HSMS")); - var hsmsEnabled = (FtpsClient.IsDirExists($"{remotePath}/THiRA_SECSGEM/HSMS")); - - if (hsmsEnabled == false) - { - if (tabControl1.TabPages.Contains(tabHSMS)) - { - tabControl1.TabPages.Remove(tabHSMS); - } - } - else - { - if (!tabControl1.TabPages.Contains(tabHSMS)) - { - tabControl1.TabPages.Add(tabHSMS); - } - } - - this.gridLogFiles.AutoBinding(GetFtpslogFiles(rtnObj)); - - // 연결 종료 //jhlim 20250202 - //StpClientWrap.Disconnect(); - FtpsClient.Disconnect(); - } - else if (string.IsNullOrEmpty(path) == false) - { - // 로그 파일 목록 - DirectoryInfo directory = new DirectoryInfo(path); - if (directory.Exists == false) - { - MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}"); - return; - } - LogFile[] logFiles = directory.GetFiles().ToClass().OrderByDescending(x => x.Name).ToArray(); - this.gridLogFiles.AutoBinding(logFiles); - } - } - else - { - path = $@"{equipment.LogPath}\{equipment.EquipmentID}"; - } - this.rstatus1.Text = path; - if (string.IsNullOrEmpty(path)) return; - #endregion - - //// 로그 파일 목록 - //DirectoryInfo directory = new DirectoryInfo(path); - //if (directory.Exists == false) - //{ - // MessageBox.Show($@"폴더가 존재하지 않습니다" + Environment.NewLine + Environment.NewLine + $@"Path: {path}"); - // return; - //} - //LogFile[] logFiles = directory.GetFiles().ToClass().OrderByDescending(x => x.Name).ToArray(); - //this.gridLogFiles.AutoBinding(logFiles); - } - catch (Exception ex) - { - XLogger.Instance.Fatal(ex, true); - } - finally - { - this.Cursor = Cursors.Default; - } - } - private void GridEquipments_CellDoubleClick(object sender, GridViewCellEventArgs e) { try diff --git a/DDUtilityApp/LOGPARSER/PARSER/EisParser0.cs b/DDUtilityApp/LOGPARSER/PARSER/EisParser0.cs index 52b533b..dac0c72 100644 --- a/DDUtilityApp/LOGPARSER/PARSER/EisParser0.cs +++ b/DDUtilityApp/LOGPARSER/PARSER/EisParser0.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net.Http.Headers; using System.Reflection; using System.Text; using System.Windows.Forms; @@ -378,8 +379,13 @@ namespace DDUtilityApp.LOGPARSER.PARSER dlg = new FrmEqSelector(); dlg.Owner = sender; - dlg.Size = new System.Drawing.Size(sender.Width - 10, sender.Height - 60); - dlg.StartPosition = FormStartPosition.CenterParent; + dlg.StartPosition = FormStartPosition.Manual; + int nWidth = sender.Width - 10; + int nHeight = sender.Height - 48; + int nLeft = sender.Left + ((sender.Width - nWidth) / 2); + int nTop = Math.Max(0, sender.Top) + ((sender.Height - nHeight)) - 10; + dlg.Size = new System.Drawing.Size(nWidth, nHeight); + dlg.Location = new System.Drawing.Point(nLeft, nTop); dlg.ServerName = this.ServerName; dlg.Equipment = sender.Equipment == null ? new EisEquipment() { EquipmentID = this.EquipmentID, Server = new LogServer(this.ServerName)} : sender.Equipment; dlg.SelectedLogFiles = lstLogFile.ToArray(); diff --git a/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs b/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs index 0a94cf5..38a4045 100644 --- a/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs +++ b/DDUtilityApp/MESDOWNLOADER/FrmServerLog.cs @@ -260,7 +260,8 @@ namespace DDUtilityApp.MESDOWNLOADER { try { - Process.Start("explorer.exe", this.tboxDownPath.Text); + string path = System.IO.Path.Combine(this.tboxDownPath.Text, this.cboxServer.Text); + Process.Start("explorer.exe", path); } catch (Exception ex) { @@ -312,6 +313,11 @@ namespace DDUtilityApp.MESDOWNLOADER } } + /// + /// FileDownload + /// + /// + /// private async void GridFiles_CellDoubleClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e) { try @@ -352,23 +358,25 @@ namespace DDUtilityApp.MESDOWNLOADER foreach(DataRow row in rows) { + string nameap = row["nameap"] as string; 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 fileNameDST = $"{nameap}_{fileName}"; - string extension = System.IO.Path.GetExtension(fileName); + string extension = System.IO.Path.GetExtension(fileNameDST); if (string.Compare(extension, ".Zip", true) == 0) hasZip = true; - else if (string.Compare(extension, ".Log", false) == 0) fileName += ".Log"; + else if (string.Compare(extension, ".Log", false) != 0) fileNameDST += ".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); + string pathDST = System.IO.Path.Combine(this.tboxDownPath.Text, this.cboxServer.Text, fileNameDST); frmProgress.UpdateProgress($"{fileName}", countDown); FtpsClient.Disconnect(); diff --git a/DDUtilityApp/Properties/AssemblyInfo.cs b/DDUtilityApp/Properties/AssemblyInfo.cs index 3d6b011..ba6e08c 100644 --- a/DDUtilityApp/Properties/AssemblyInfo.cs +++ b/DDUtilityApp/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 // 지정되도록 할 수 있습니다. // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2025.03.18.5")] -[assembly: AssemblyFileVersion("2025.03.18.5")] +[assembly: AssemblyVersion("2025.03.19.0")] +[assembly: AssemblyFileVersion("2025.03.19.0")] diff --git a/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.Designer.cs b/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.Designer.cs index 1716d18..4052d56 100644 --- a/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.Designer.cs +++ b/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.Designer.cs @@ -294,8 +294,13 @@ this.lviewSubject.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.lviewSubject.AutoScroll = true; + this.lviewSubject.BackColor = System.Drawing.SystemColors.ControlLightLight; this.lviewSubject.Location = new System.Drawing.Point(112, 46); this.lviewSubject.Name = "lviewSubject"; + // + // + // + this.lviewSubject.RootElement.ControlBounds = new System.Drawing.Rectangle(0, 0, 120, 95); this.lviewSubject.Size = new System.Drawing.Size(350, 89); this.lviewSubject.TabIndex = 13; // @@ -1201,6 +1206,7 @@ // // gridValue // + this.gridValue.BackColor = System.Drawing.SystemColors.ControlLightLight; this.gridValue.ColumnResizeKey = System.Windows.Forms.Keys.F6; this.gridValue.Dock = System.Windows.Forms.DockStyle.Fill; this.gridValue.Location = new System.Drawing.Point(0, 0); @@ -1209,6 +1215,10 @@ // this.gridValue.MasterTemplate.ViewDefinition = tableViewDefinition1; this.gridValue.Name = "gridValue"; + // + // + // + this.gridValue.RootElement.ControlBounds = new System.Drawing.Rectangle(0, 0, 240, 150); this.gridValue.Size = new System.Drawing.Size(402, 420); this.gridValue.TabIndex = 2; // diff --git a/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.resx b/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.resx index c158a68..a71c8a5 100644 --- a/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.resx +++ b/DDUtilityApp/TIBRENDEZVOUS/FrmSimulator01.resx @@ -117,6 +117,15 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 138, 17 + + + 243, 17 +