LogViewer B2 CEID=308,309 Name to ModelID

ServerLog ViewList.xml 내문서/DDUtility 폴더로 복제 및 사용
This commit is contained in:
jungwoois
2025-04-24 14:04:20 +09:00
parent de709d7030
commit 395102ffea
8 changed files with 238 additions and 245 deletions

View File

@@ -7,6 +7,7 @@ using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -163,32 +164,40 @@ namespace DDUtilityApp.MESDOWNLOADER
DataRow[] rows = this.DSSetting.Tables["Item"].Select($"Server_Id='{server_Id}' AND name='{nameap}'");
foreach (DataRow row in rows)
{
string url = row["url"] as string;
string dir = row["dir"] as string;
string conkey = row["conkey"] as string;
string userId = this.GetUserIdFromConkey(conkey);
string password = this.GetPasswordFromConkey(conkey);
string currentPath = string.IsNullOrEmpty(subPath) ? dir : System.IO.Path.Combine(dir, subPath);
FtpsClient.Initialize(url, userId, password);
var files = FtpsClient.GetFtpsList(currentPath);
foreach (var file in files)
try
{
DataRow rowFile = this.DTFileInfo.NewRow();
rowFile["nameap"] = nameap;
rowFile["Name"] = file.Name;
rowFile["FileName"] = file.Name;
rowFile["Size"] = this.GetFileSize(file.Size, FileSizeType.MB);
rowFile["Modified"] = file.Modified.ToLocalTime();
rowFile["Type"] = file.Type;
rowFile["url"] = url;
rowFile["dir"] = dir;
rowFile["subpath"] = subPath;
rowFile["userId"] = userId;
rowFile["password"] = password;
this.DTFileInfo.Rows.Add(rowFile);
string url = row["url"] as string;
string dir = row["dir"] as string;
string conkey = row["conkey"] as string;
string userId = this.GetUserIdFromConkey(conkey);
string password = this.GetPasswordFromConkey(conkey);
string currentPath = string.IsNullOrEmpty(subPath) ? dir : System.IO.Path.Combine(dir, subPath);
FtpsClient.Initialize(url, userId, password);
var files = FtpsClient.GetFtpsList(currentPath);
foreach (var file in files)
{
DataRow rowFile = this.DTFileInfo.NewRow();
rowFile["nameap"] = nameap;
rowFile["Name"] = file.Name;
rowFile["FileName"] = file.Name;
rowFile["Size"] = this.GetFileSize(file.Size, FileSizeType.MB);
rowFile["Modified"] = file.Modified.ToLocalTime();
rowFile["Type"] = file.Type;
rowFile["url"] = url;
rowFile["dir"] = dir;
rowFile["subpath"] = subPath;
rowFile["userId"] = userId;
rowFile["password"] = password;
this.DTFileInfo.Rows.Add(rowFile);
}
}
catch
{
chk.Checked = false;
chk.Enabled = false;
}
}
}
@@ -484,15 +493,22 @@ namespace DDUtilityApp.MESDOWNLOADER
}
}
/// <summary>
/// XML 설정파일 로딩 및 CboxServer 셋팅
/// </summary>
/// <summary>
/// XML 설정파일 로딩 및 CboxServer 셋팅
/// </summary>
private void SetCboxServer()
{
try
{
string path = ConfigurationManager.AppSettings["BULK_VIEWER"];
this.DSSetting = XmlToDsConverter.ConvertXmlToDataSet(path);
string srcFileName = ConfigurationManager.AppSettings["BULK_VIEWER"];
string myFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "DDUtility", "ViewList.xml");
if (!File.Exists(myFileName))
{
if (!File.Exists(srcFileName)) throw new FileNotFoundException($"Source file not found: {srcFileName}");
File.Copy(srcFileName, myFileName);
}
this.DSSetting = XmlToDsConverter.ConvertXmlToDataSet(myFileName);
if (this.DSSetting == null || this.DSSetting.Tables.Count < 1 || this.DSSetting.Tables.Contains("Server") == false)
{
MessageBox.Show("XML 데이터를 불러올 수 없습니다.", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);