실행환경검사 invoke 오류 수정
This commit is contained in:
8
.claude/settings.local.json
Normal file
8
.claude/settings.local.json
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(curl:*)"
|
||||||
|
],
|
||||||
|
"deny": []
|
||||||
|
}
|
||||||
|
}
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -3,3 +3,6 @@ obj
|
|||||||
*.suo
|
*.suo
|
||||||
.vs
|
.vs
|
||||||
packages
|
packages
|
||||||
|
.vscode
|
||||||
|
*.tmp
|
||||||
|
*.zip
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
|
|
||||||
namespace Project.Dialog
|
|
||||||
{
|
|
||||||
public partial class fWarning : Form
|
|
||||||
{
|
|
||||||
public fWarning()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>Full</DebugType>
|
<DebugType>Full</DebugType>
|
||||||
<Optimize>False</Optimize>
|
<Optimize>False</Optimize>
|
||||||
<OutputPath>..\..\..\..\..\Amkor\GroupWare\</OutputPath>
|
<OutputPath>..\..\..\..\amkor\GroupWare\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;WEB1</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;WEB1</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
@@ -283,16 +283,17 @@
|
|||||||
<Compile Include="Dialog\fLogin_WB.Designer.cs">
|
<Compile Include="Dialog\fLogin_WB.Designer.cs">
|
||||||
<DependentUpon>fLogin_WB.cs</DependentUpon>
|
<DependentUpon>fLogin_WB.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Dialog\fWarning.cs">
|
<Compile Include="fSystemCheck.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Dialog\fWarning.Designer.cs">
|
<Compile Include="fSystemCheck.Designer.cs">
|
||||||
<DependentUpon>fWarning.cs</DependentUpon>
|
<DependentUpon>fSystemCheck.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Web\Controller\BaseController.cs" />
|
<Compile Include="Web\Controller\BaseController.cs" />
|
||||||
<Compile Include="Web\Controller\APIController.cs" />
|
<Compile Include="Web\Controller\APIController.cs" />
|
||||||
<Compile Include="Web\Controller\DashBoardController.cs" />
|
<Compile Include="Web\Controller\DashBoardController.cs" />
|
||||||
<Compile Include="Web\Controller\CommonController.cs" />
|
<Compile Include="Web\Controller\CommonController.cs" />
|
||||||
|
<Compile Include="Web\Controller\TodoController.cs" />
|
||||||
<Compile Include="Web\Controller\KuntaeController.cs" />
|
<Compile Include="Web\Controller\KuntaeController.cs" />
|
||||||
<Compile Include="Web\Controller\ManualController.cs" />
|
<Compile Include="Web\Controller\ManualController.cs" />
|
||||||
<Compile Include="Web\Controller\ProjectController.cs" />
|
<Compile Include="Web\Controller\ProjectController.cs" />
|
||||||
@@ -425,6 +426,7 @@
|
|||||||
<Compile Include="MessageWindow.cs" />
|
<Compile Include="MessageWindow.cs" />
|
||||||
<Compile Include="MethodExtentions.cs" />
|
<Compile Include="MethodExtentions.cs" />
|
||||||
<Compile Include="Web\Model\PageModel.cs" />
|
<Compile Include="Web\Model\PageModel.cs" />
|
||||||
|
<Compile Include="Web\Model\TodoModel.cs" />
|
||||||
<Compile Include="Web\Startup.cs" />
|
<Compile Include="Web\Startup.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Settings.cs" />
|
<Compile Include="Settings.cs" />
|
||||||
@@ -527,8 +529,8 @@
|
|||||||
<EmbeddedResource Include="Dialog\fUnZip.resx">
|
<EmbeddedResource Include="Dialog\fUnZip.resx">
|
||||||
<DependentUpon>fUnZip.cs</DependentUpon>
|
<DependentUpon>fUnZip.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Dialog\fWarning.resx">
|
<EmbeddedResource Include="fSystemCheck.resx">
|
||||||
<DependentUpon>fWarning.cs</DependentUpon>
|
<DependentUpon>fSystemCheck.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="fLog.resx">
|
<EmbeddedResource Include="fLog.resx">
|
||||||
<DependentUpon>fLog.cs</DependentUpon>
|
<DependentUpon>fLog.cs</DependentUpon>
|
||||||
@@ -670,6 +672,21 @@
|
|||||||
<Content Include="SqlServerTypes\x86\SqlServerSpatial140.dll">
|
<Content Include="SqlServerTypes\x86\SqlServerSpatial140.dll">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Include="Web\wwwroot\css\common.css">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Web\wwwroot\js\common-navigation.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Web\wwwroot\js\navigation.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Web\wwwroot\js\tailwind-config.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Web\wwwroot\Todo\index.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="Web\wwwroot\DashBoard\index.html">
|
<None Include="Web\wwwroot\DashBoard\index.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.IO.Compression;
|
|
||||||
using System.IO;
|
|
||||||
using System.DirectoryServices;
|
using System.DirectoryServices;
|
||||||
using System.ServiceModel.Configuration;
|
using System.ServiceModel.Configuration;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Project
|
namespace Project
|
||||||
{
|
{
|
||||||
@@ -17,94 +17,87 @@ namespace Project
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
// COM 초기화 (WebView2 오류 방지)
|
||||||
|
System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.STA);
|
||||||
|
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
// Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
|
// Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
|
||||||
// AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
// AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
|
||||||
|
|
||||||
var fi = new System.IO.FileInfo("WebView2Runtime.zip");
|
// 중복실행 방지 체크
|
||||||
if (fi.Exists)
|
if (!CheckSingleInstance())
|
||||||
{
|
{
|
||||||
var existlen = 0;
|
return; // 프로그램 종료
|
||||||
var webruntimepath = new System.IO.DirectoryInfo("WebView2Runtime");
|
}
|
||||||
if (webruntimepath.Exists)
|
|
||||||
|
// WebView2Runtime 압축해제와 SqlServerTypes 로드는 fWarning에서 처리
|
||||||
|
|
||||||
|
// fWarning 폼을 먼저 표시하여 실행환경 체크
|
||||||
|
using(var f = new Dialog.fSystemCheck())
|
||||||
{
|
{
|
||||||
var filen = new System.IO.FileInfo("WebView2Runtime\\version.txt");
|
Application.Run(f);
|
||||||
if(filen.Exists)
|
if (f.environmentCheckCompleted)
|
||||||
{
|
Application.Run(new fMain());
|
||||||
var verstr = System.IO.File.ReadAllText(filen.FullName);
|
|
||||||
int.TryParse(verstr, out existlen);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(existlen != fi.Length)
|
|
||||||
|
/// <summary>
|
||||||
|
/// 중복실행 방지 체크
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>단일 인스턴스인 경우 true, 중복실행인 경우 false</returns>
|
||||||
|
static bool CheckSingleInstance()
|
||||||
{
|
{
|
||||||
//fi 파일의 압축을 해제한다.
|
string processName = Process.GetCurrentProcess().ProcessName;
|
||||||
var fprogress = new Dialog.fUnZip();
|
Process[] processes = Process.GetProcessesByName(processName);
|
||||||
fprogress.TopMost = true;
|
|
||||||
fprogress.Show();
|
if (processes.Length > 1)
|
||||||
Application.DoEvents();
|
{
|
||||||
|
// 중복실행 감지
|
||||||
|
string message = "⚠️ GroupWare 프로그램이 이미 실행 중입니다!\n\n" +
|
||||||
|
"동시에 여러 개의 GroupWare를 실행할 수 없습니다.\n\n" +
|
||||||
|
"해결방법을 선택하세요:";
|
||||||
|
|
||||||
|
var result = MessageBox.Show(message + "\n\n예(Y): 기존 프로그램을 종료하고 새로 시작\n아니오(N): 현재 실행을 취소",
|
||||||
|
"중복실행 감지",
|
||||||
|
MessageBoxButtons.YesNo,
|
||||||
|
MessageBoxIcon.Warning);
|
||||||
|
|
||||||
|
if (result == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
// 기존 프로세스들을 종료
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (webruntimepath.Exists)
|
int currentProcessId = Process.GetCurrentProcess().Id;
|
||||||
|
foreach (Process process in processes)
|
||||||
{
|
{
|
||||||
fprogress.label1.Text = "기존폴더삭제";
|
if (process.Id != currentProcessId)
|
||||||
Application.DoEvents();
|
|
||||||
webruntimepath.Delete(true);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
var diruntime = new System.IO.DirectoryInfo("runtimes");
|
|
||||||
if (diruntime.Exists) diruntime.Delete(true);
|
|
||||||
webruntimepath.Create();
|
|
||||||
diruntime.Create();
|
|
||||||
|
|
||||||
|
|
||||||
using (var archive = ZipFile.OpenRead(fi.FullName))
|
|
||||||
{
|
{
|
||||||
int totalFiles = archive.Entries.Count;
|
process.Kill();
|
||||||
int currentFile = 0;
|
process.WaitForExit(3000); // 3초 대기
|
||||||
long totalSize = archive.Entries.Sum(e => e.Length);
|
|
||||||
long extractedSize = 0;
|
|
||||||
|
|
||||||
foreach (var entry in archive.Entries)
|
|
||||||
{
|
|
||||||
currentFile++;
|
|
||||||
extractedSize += entry.Length;
|
|
||||||
int progress = (int)((extractedSize * 100) / totalSize);
|
|
||||||
|
|
||||||
fprogress.label1.Text = $"압축 해제 중... ({currentFile}/{totalFiles})";
|
|
||||||
fprogress.label2.Text = $"{entry.FullName} ({progress}%)";
|
|
||||||
fprogress.progressBar1.Value = progress;
|
|
||||||
Application.DoEvents();
|
|
||||||
|
|
||||||
string destinationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, entry.FullName);
|
|
||||||
string destinationDir = Path.GetDirectoryName(destinationPath);
|
|
||||||
|
|
||||||
if (!Directory.Exists(destinationDir))
|
|
||||||
Directory.CreateDirectory(destinationDir);
|
|
||||||
|
|
||||||
if (entry.Length > 0)
|
|
||||||
entry.ExtractToFile(destinationPath, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.IO.File.WriteAllText("WebView2Runtime\\version.txt", fi.Length.ToString());
|
// 잠시 대기 후 계속 진행
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
fprogress.Hide();
|
MessageBox.Show($"기존 프로그램 종료 중 오류가 발생했습니다:\n{ex.Message}\n\n" +
|
||||||
MessageBox.Show($"WebView2 Runtime 압축 해제 중 오류가 발생했습니다: {ex.Message}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
"작업관리자에서 수동으로 종료해주세요.",
|
||||||
|
"오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
fprogress.Dispose();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 현재 실행을 취소
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true; // 단일 인스턴스
|
||||||
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
|
|
||||||
|
|
||||||
Application.Run(new fMain());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||||
|
|||||||
@@ -234,8 +234,9 @@ namespace Project
|
|||||||
|
|
||||||
InitWebView = 1;
|
InitWebView = 1;
|
||||||
}
|
}
|
||||||
catch
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
InitWebView = 2;
|
InitWebView = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -463,7 +463,7 @@ namespace Project.Web.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
//공용값 적용
|
//공용값 적용
|
||||||
ApplyCommonValue(ref contents);
|
//ApplyCommonValue(ref contents);
|
||||||
|
|
||||||
var resp = new HttpResponseMessage()
|
var resp = new HttpResponseMessage()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,28 +28,6 @@ namespace Project.Web.Controllers
|
|||||||
|
|
||||||
public class HomeController : BaseController
|
public class HomeController : BaseController
|
||||||
{
|
{
|
||||||
[HttpPost]
|
|
||||||
public void Index([FromBody]string value)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUT api/values/5
|
|
||||||
public void Put(int id, [FromBody]string value)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// DELETE api/values/5
|
|
||||||
public void Delete(int id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public string Test()
|
|
||||||
{
|
|
||||||
return "test";
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public string TestLogin()
|
public string TestLogin()
|
||||||
{
|
{
|
||||||
@@ -202,7 +180,7 @@ namespace Project.Web.Controllers
|
|||||||
info.Login.no = "dev";
|
info.Login.no = "dev";
|
||||||
info.Login.nameK = "개발자";
|
info.Login.nameK = "개발자";
|
||||||
info.Login.dept = GInfo.name;
|
info.Login.dept = GInfo.name;
|
||||||
info.Login.level = 9;
|
info.Login.level = 10;
|
||||||
info.Login.email = UInfo.email;
|
info.Login.email = UInfo.email;
|
||||||
info.Login.hp = UInfo.hp;
|
info.Login.hp = UInfo.hp;
|
||||||
info.Login.tel = UInfo.tel;
|
info.Login.tel = UInfo.tel;
|
||||||
@@ -319,36 +297,7 @@ namespace Project.Web.Controllers
|
|||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
|
||||||
public HttpResponseMessage Index()
|
|
||||||
{
|
|
||||||
// DashBoard로 리디렉션하도록 변경
|
|
||||||
var filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Web", "wwwroot", "DashBoard", "index.html");
|
|
||||||
var contents = string.Empty;
|
|
||||||
|
|
||||||
if (System.IO.File.Exists(filePath))
|
|
||||||
{
|
|
||||||
contents = System.IO.File.ReadAllText(filePath, System.Text.Encoding.UTF8);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 파일이 없으면 404 에러 페이지 또는 기본 메시지
|
|
||||||
contents = "<html><body><h1>404 - File Not Found</h1><p>The requested file was not found: " + filePath + "</p></body></html>";
|
|
||||||
}
|
|
||||||
|
|
||||||
//공용값 적용
|
|
||||||
ApplyCommonValue(ref contents);
|
|
||||||
|
|
||||||
var resp = new HttpResponseMessage()
|
|
||||||
{
|
|
||||||
Content = new StringContent(
|
|
||||||
contents,
|
|
||||||
System.Text.Encoding.UTF8,
|
|
||||||
"text/html")
|
|
||||||
};
|
|
||||||
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public HttpResponseMessage GetPreviousLoginInfo()
|
public HttpResponseMessage GetPreviousLoginInfo()
|
||||||
|
|||||||
@@ -120,6 +120,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="gradient-bg min-h-screen">
|
<body class="gradient-bg min-h-screen">
|
||||||
<div class="container mx-auto px-4 py-8">
|
<div class="container mx-auto px-4 py-8">
|
||||||
<!-- 헤더 -->
|
<!-- 헤더 -->
|
||||||
|
|||||||
@@ -383,7 +383,7 @@
|
|||||||
* 공통 네비게이션 컴포넌트
|
* 공통 네비게이션 컴포넌트
|
||||||
* 서버에서 메뉴 정보를 받아와서 동적으로 네비게이션을 생성합니다.
|
* 서버에서 메뉴 정보를 받아와서 동적으로 네비게이션을 생성합니다.
|
||||||
*/
|
*/
|
||||||
class ㄴ {
|
class CommonNavigation {
|
||||||
constructor(currentPage = '') {
|
constructor(currentPage = '') {
|
||||||
this.currentPage = currentPage;
|
this.currentPage = currentPage;
|
||||||
this.menuItems = [];
|
this.menuItems = [];
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ namespace Project
|
|||||||
Pub.log.Flush();
|
Pub.log.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//ConnectionMultiplexer redisConnection;
|
//ConnectionMultiplexer redisConnection;
|
||||||
//IDatabase db;
|
//IDatabase db;
|
||||||
|
|
||||||
@@ -102,52 +103,23 @@ namespace Project
|
|||||||
{
|
{
|
||||||
EnsureVisibleAndUsableSize();
|
EnsureVisibleAndUsableSize();
|
||||||
this.Text = Application.ProductName + " v" + Application.ProductVersion;
|
this.Text = Application.ProductName + " v" + Application.ProductVersion;
|
||||||
Pub.init();
|
|
||||||
|
|
||||||
Pub.InitializeWebView2();
|
// 실행환경 체크는 fWarning에서 이미 완료됨
|
||||||
setToolbar();
|
setToolbar();
|
||||||
|
|
||||||
var f = new Dialog.fWarning();
|
|
||||||
f.TopMost = true;
|
|
||||||
f.Show();
|
|
||||||
|
|
||||||
_SetLang();
|
_SetLang();
|
||||||
if (Pub.setting.FullScreen) this.WindowState = FormWindowState.Maximized;
|
if (Pub.setting.FullScreen) this.WindowState = FormWindowState.Maximized;
|
||||||
else this.WindowState = FormWindowState.Normal;
|
else this.WindowState = FormWindowState.Normal;
|
||||||
this.Show();
|
this.Show();
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
|
||||||
|
// 바코드 이벤트 연결
|
||||||
// 데이터베이스 접속 정보 확인
|
|
||||||
Pub.dbinfo = DatabaseConnectionString.Utility.Read();
|
|
||||||
if (Pub.dbinfo.IsValid == false)
|
|
||||||
{
|
|
||||||
Application.DoEvents();
|
|
||||||
this.Visible = false;
|
|
||||||
MessageBox.Show("데이터베이스 접속정보가 존재하지 않습니다\n개발부서에 접속정보를 문의하세요", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
Pub.dbinfo = DatabaseConnectionString.Utility.ShowForm();
|
|
||||||
if (Pub.dbinfo.IsValid == false)
|
|
||||||
{
|
|
||||||
MessageBox.Show("데이터 베이스 정보가 없습니다\n프로그램이 정상 작동하지 않을 수 있습니다", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
this.Visible = true;
|
|
||||||
}
|
|
||||||
Properties.Settings.Default["CS"] = Pub.dbinfo.ToString();
|
|
||||||
Properties.Settings.Default["gwcs"] = Pub.dbinfo.ToString();
|
|
||||||
//Util.MsgE(Pub.dbinfo.ToString());
|
|
||||||
//Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;Persist Security Info=True;User ID=eeadm;Password=uJnU8a8q&DJ+ug-D;Encrypt=False;TrustServerCertificate=True
|
|
||||||
|
|
||||||
|
|
||||||
Pub.barcode = new Device.Barcode();
|
|
||||||
if (!Pub.setting.Barcode.isEmpty()) Pub.barcode.PortName = Pub.setting.Barcode;
|
|
||||||
Pub.barcode.ReceiveData += barcode_ReceiveData;
|
Pub.barcode.ReceiveData += barcode_ReceiveData;
|
||||||
|
|
||||||
FCOMMON.info.camIndex = Pub.setting.CamIndex;
|
|
||||||
UpdateControls();
|
UpdateControls();
|
||||||
|
|
||||||
tmDisplay.Start(); //display timer
|
tmDisplay.Start(); //display timer
|
||||||
|
|
||||||
// Start OWIN host
|
// Start OWIN host (실행환경 체크는 이미 완료됨)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var options = new StartOptions(Pub.setting.WebServiceURL);
|
var options = new StartOptions(Pub.setting.WebServiceURL);
|
||||||
@@ -164,22 +136,36 @@ namespace Project
|
|||||||
webok = false;
|
webok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WebView2 초기화 재시도 (필요시)
|
||||||
|
if (Pub.InitWebView == 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Console.WriteLine("WebView2 재초기화 시도...");
|
||||||
|
Pub.InitializeWebView2();
|
||||||
|
}
|
||||||
|
catch (Exception retryEx)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"WebView2 재초기화 실패: {retryEx.Message}");
|
||||||
|
// 실패해도 계속 진행
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WebView2 대기 (짧게 조정)
|
||||||
var wat = new System.Diagnostics.Stopwatch();
|
var wat = new System.Diagnostics.Stopwatch();
|
||||||
wat.Restart();
|
wat.Restart();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (Pub.InitWebView != 0) break;
|
if (Pub.InitWebView != 0) break;
|
||||||
if (wat.ElapsedMilliseconds > 5000) break;
|
if (wat.ElapsedMilliseconds > 3000) break; // 5초에서 3초로 단축
|
||||||
System.Threading.Thread.Sleep(1000);
|
System.Threading.Thread.Sleep(500); // 1초에서 0.5초로 단축
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
f.Dispose();
|
Console.WriteLine($"WebView2 초기화 상태: {Pub.InitWebView}");
|
||||||
|
|
||||||
Func_Login();
|
Func_Login();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
///즐겨찾기 목록 갱신
|
///즐겨찾기 목록 갱신
|
||||||
Update_FavoriteSite();
|
Update_FavoriteSite();
|
||||||
|
|
||||||
@@ -187,8 +173,6 @@ namespace Project
|
|||||||
|
|
||||||
//사용기록추적
|
//사용기록추적
|
||||||
Pub.CheckNRegister3(Application.ProductName, "chi", Application.ProductVersion);
|
Pub.CheckNRegister3(Application.ProductName, "chi", Application.ProductVersion);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update_FavoriteSite()
|
void Update_FavoriteSite()
|
||||||
@@ -243,7 +227,7 @@ namespace Project
|
|||||||
//220421
|
//220421
|
||||||
FCOMMON.info.Disable_8hourover = Pub.setting.Disable8HourOver;
|
FCOMMON.info.Disable_8hourover = Pub.setting.Disable8HourOver;
|
||||||
|
|
||||||
if (FCOMMON.info.Login.level >= 10) btDev.Visible = true;
|
if ( FCOMMON.info.Login.level >= 10) btDev.Visible = true;
|
||||||
|
|
||||||
sbLogin.Text = string.Format("[{0}] ({1}-{2} T:{3}) - ({5}){4}",
|
sbLogin.Text = string.Format("[{0}] ({1}-{2} T:{3}) - ({5}){4}",
|
||||||
FCOMMON.info.Login.title,
|
FCOMMON.info.Login.title,
|
||||||
@@ -383,9 +367,9 @@ namespace Project
|
|||||||
string formkey = "WORKBOOK";
|
string formkey = "WORKBOOK";
|
||||||
if (!ShowForm(formkey))
|
if (!ShowForm(formkey))
|
||||||
{
|
{
|
||||||
if (this.webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached)
|
//if (this.webok && Pub.InitWebView == 1 && System.Diagnostics.Debugger.IsAttached)
|
||||||
AddForm(formkey, new Dialog.fJobReport());
|
// AddForm(formkey, new Dialog.fJobReport());
|
||||||
else
|
//else
|
||||||
AddForm(formkey, new FPJ0000.fJobReport());
|
AddForm(formkey, new FPJ0000.fJobReport());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Project.Dialog
|
namespace Project.Dialog
|
||||||
{
|
{
|
||||||
partial class fWarning
|
partial class fSystemCheck
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
@@ -36,22 +36,22 @@
|
|||||||
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
this.label1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(543, 66);
|
this.label1.Size = new System.Drawing.Size(551, 127);
|
||||||
this.label1.TabIndex = 0;
|
this.label1.TabIndex = 0;
|
||||||
this.label1.Text = " 실행 환경을 검사하고 있습니다";
|
this.label1.Text = " 실행 환경을 검사하고 있습니다";
|
||||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
//
|
//
|
||||||
// fWarning
|
// fSystemCheck
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(543, 66);
|
this.ClientSize = new System.Drawing.Size(551, 127);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "fWarning";
|
this.Name = "fSystemCheck";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "fWarning";
|
this.Text = " ";
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
414
Project/fSystemCheck.cs
Normal file
414
Project/fSystemCheck.cs
Normal file
@@ -0,0 +1,414 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Net;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.IO;
|
||||||
|
using FCOMMON;
|
||||||
|
using Microsoft.Owin.Hosting;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace Project.Dialog
|
||||||
|
{
|
||||||
|
public partial class fSystemCheck : Form
|
||||||
|
{
|
||||||
|
private Timer checkTimer;
|
||||||
|
public bool environmentCheckCompleted = false;
|
||||||
|
|
||||||
|
public fSystemCheck()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
// 폼 설정
|
||||||
|
this.Text = "GroupWare 시작 중...";
|
||||||
|
this.FormBorderStyle = FormBorderStyle.FixedDialog;
|
||||||
|
this.ControlBox = false;
|
||||||
|
this.ShowInTaskbar = false;
|
||||||
|
this.TopMost = true;
|
||||||
|
|
||||||
|
// 타이머 설정
|
||||||
|
checkTimer = new Timer();
|
||||||
|
checkTimer.Interval = 100; // 0.1초
|
||||||
|
checkTimer.Tick += CheckTimer_Tick;
|
||||||
|
checkTimer.Start();
|
||||||
|
|
||||||
|
this.Load += FSystemCheck_Load;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FSystemCheck_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
// 환경 체크 시작
|
||||||
|
this.Show();
|
||||||
|
Application.DoEvents();
|
||||||
|
Task.Run(() => PerformEnvironmentCheck());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SafeInvoke(Action action)
|
||||||
|
{
|
||||||
|
if (this.IsHandleCreated)
|
||||||
|
{
|
||||||
|
if (this.InvokeRequired)
|
||||||
|
this.Invoke(action);
|
||||||
|
else
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosed(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnClosed(e);
|
||||||
|
|
||||||
|
checkTimer?.Stop();
|
||||||
|
checkTimer?.Dispose();
|
||||||
|
if (components != null)
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void CheckTimer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (environmentCheckCompleted)
|
||||||
|
{
|
||||||
|
checkTimer.Stop();
|
||||||
|
this.Hide();
|
||||||
|
|
||||||
|
// fWarning 폼 닫기
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 실행환경 체크 수행
|
||||||
|
/// </summary>
|
||||||
|
private async void PerformEnvironmentCheck()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// UI 업데이트
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
label1.Text = "🔍 실행환경을 검사하고 있습니다...";
|
||||||
|
}));
|
||||||
|
|
||||||
|
await Task.Delay(500);
|
||||||
|
|
||||||
|
|
||||||
|
// 1. Pub 초기화
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "⚙️ 시스템 초기화 중...";
|
||||||
|
});
|
||||||
|
|
||||||
|
Pub.init();
|
||||||
|
await Task.Delay(300);
|
||||||
|
|
||||||
|
|
||||||
|
// 0. WebView2Runtime 압축해제 체크
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "🌐 WebView2 Runtime 확인 중...";
|
||||||
|
});
|
||||||
|
await CheckAndExtractWebView2Runtime();
|
||||||
|
|
||||||
|
|
||||||
|
// 2. WebView2 초기화 (메인 스레드에서 실행)
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "🌐 WebView2 초기화 중...";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Pub.InitializeWebView2();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// COM 스레드 모드 오류 처리
|
||||||
|
if (ex.Message.Contains("RPC_E_CHANGED_MODE") || ex.Message.Contains("스레드 모드"))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"WebView2 초기화 COM 오류 (무시됨): {ex.Message}");
|
||||||
|
// 이 오류는 무시하고 계속 진행 (fMain에서 다시 시도)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine($"WebView2 초기화 오류: {ex.Message}");
|
||||||
|
// 다른 심각한 오류는 무시하고 계속 (fMain에서 처리)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
await Task.Delay(500);
|
||||||
|
|
||||||
|
// 3. 데이터베이스 접속 정보 확인
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "🗄️ 데이터베이스 연결 확인 중...";
|
||||||
|
});
|
||||||
|
|
||||||
|
CheckDatabaseConnection();
|
||||||
|
await Task.Delay(300);
|
||||||
|
|
||||||
|
// 4. 포트 7979 사용 여부 체크
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "🔌 포트 7979 상태 확인 중...";
|
||||||
|
});
|
||||||
|
|
||||||
|
CheckPort7979InUse();
|
||||||
|
await Task.Delay(300);
|
||||||
|
|
||||||
|
// 5. 바코드 설정
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "📊 바코드 설정 초기화 중...";
|
||||||
|
});
|
||||||
|
|
||||||
|
InitializeBarcodeSettings();
|
||||||
|
await Task.Delay(300);
|
||||||
|
|
||||||
|
// 6. 웹서버 시작 시뮬레이션 (실제 시작은 fMain에서)
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "🚀 웹서버 준비 중...";
|
||||||
|
});
|
||||||
|
|
||||||
|
await Task.Delay(500);
|
||||||
|
|
||||||
|
// 7. SqlServerTypes 라이브러리 로드
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "📚 Reporting System 로드 중...";
|
||||||
|
});
|
||||||
|
|
||||||
|
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
|
||||||
|
await Task.Delay(300);
|
||||||
|
|
||||||
|
// 완료
|
||||||
|
SafeInvoke(() => {
|
||||||
|
label1.Text = "✅ 실행환경 검사 완료";
|
||||||
|
});
|
||||||
|
|
||||||
|
await Task.Delay(500);
|
||||||
|
environmentCheckCompleted = true;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var st = new System.Diagnostics.StackTrace(ex, true);
|
||||||
|
var frame = st.GetFrame(0);
|
||||||
|
var fileName = frame?.GetFileName() ?? "Unknown";
|
||||||
|
var lineNumber = frame?.GetFileLineNumber() ?? 0;
|
||||||
|
var errorMsg = $"실행환경 검사 중 오류가 발생했습니다:\n{ex.Message}\n\n파일: {System.IO.Path.GetFileName(fileName)}\n줄수: {lineNumber}";
|
||||||
|
|
||||||
|
SafeInvoke(() => {
|
||||||
|
MessageBox.Show(errorMsg, "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
Application.Exit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 데이터베이스 연결 확인
|
||||||
|
/// </summary>
|
||||||
|
private void CheckDatabaseConnection()
|
||||||
|
{
|
||||||
|
Pub.dbinfo = DatabaseConnectionString.Utility.Read();
|
||||||
|
if (Pub.dbinfo.IsValid == false)
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
this.Visible = false;
|
||||||
|
MessageBox.Show("데이터베이스 접속정보가 존재하지 않습니다\n개발부서에 접속정보를 문의하세요",
|
||||||
|
"Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
|
||||||
|
Pub.dbinfo = DatabaseConnectionString.Utility.ShowForm();
|
||||||
|
if (Pub.dbinfo.IsValid == false)
|
||||||
|
{
|
||||||
|
MessageBox.Show("데이터 베이스 정보가 없습니다\n프로그램이 정상 작동하지 않을 수 있습니다",
|
||||||
|
"Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
this.Visible = true;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
Properties.Settings.Default["CS"] = Pub.dbinfo.ToString();
|
||||||
|
Properties.Settings.Default["gwcs"] = Pub.dbinfo.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 포트 7979가 이미 사용중인지 체크하고 경고 표시
|
||||||
|
/// </summary>
|
||||||
|
private void CheckPort7979InUse()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 현재 사용중인 TCP 포트 목록 가져오기
|
||||||
|
IPGlobalProperties ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
|
||||||
|
TcpConnectionInformation[] tcpConnInfoArray = ipGlobalProperties.GetActiveTcpConnections();
|
||||||
|
IPEndPoint[] tcpListeners = ipGlobalProperties.GetActiveTcpListeners();
|
||||||
|
|
||||||
|
// 포트 7979가 이미 사용중인지 확인
|
||||||
|
bool port7979InUse = false;
|
||||||
|
|
||||||
|
// TCP 연결 중에서 7979 포트 사용하는지 확인
|
||||||
|
foreach (var tcpInfo in tcpConnInfoArray)
|
||||||
|
{
|
||||||
|
if (tcpInfo.LocalEndPoint.Port == 7979)
|
||||||
|
{
|
||||||
|
port7979InUse = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TCP 리스너 중에서 7979 포트 사용하는지 확인
|
||||||
|
if (!port7979InUse)
|
||||||
|
{
|
||||||
|
foreach (var listener in tcpListeners)
|
||||||
|
{
|
||||||
|
if (listener.Port == 7979)
|
||||||
|
{
|
||||||
|
port7979InUse = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 포트가 이미 사용중이면 경고 메시지 표시
|
||||||
|
if (port7979InUse)
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
string warningMessage = "⚠️ 경고: 포트 7979가 이미 사용 중입니다!\n\n" +
|
||||||
|
"다른 프로그램이 포트 7979를 사용하고 있어서\n" +
|
||||||
|
"웹 서버가 정상적으로 시작되지 않을 수 있습니다.\n\n" +
|
||||||
|
"해결방법:\n" +
|
||||||
|
"1. 다른 GroupWare 프로그램을 종료하세요\n" +
|
||||||
|
"2. 작업관리자에서 관련 프로세스를 종료하세요\n" +
|
||||||
|
"3. 컴퓨터를 재시작하세요";
|
||||||
|
|
||||||
|
MessageBox.Show(warningMessage, "포트 충돌 경고", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||||
|
}));
|
||||||
|
|
||||||
|
Pub.log.Add($"포트 7979가 이미 사용 중입니다. 웹서버 시작에 문제가 발생할 수 있습니다.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// 포트 체크 중 오류가 발생해도 프로그램 실행은 계속
|
||||||
|
Pub.log.AddE($"포트 7979 체크 중 오류 발생: {ex.Message}");
|
||||||
|
Console.WriteLine($"Port check error: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 바코드 설정 초기화
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeBarcodeSettings()
|
||||||
|
{
|
||||||
|
Pub.barcode = new Device.Barcode();
|
||||||
|
if (!Pub.setting.Barcode.isEmpty())
|
||||||
|
Pub.barcode.PortName = Pub.setting.Barcode;
|
||||||
|
|
||||||
|
FCOMMON.info.camIndex = Pub.setting.CamIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// WebView2Runtime 압축해제 체크 및 실행
|
||||||
|
/// </summary>
|
||||||
|
private async Task CheckAndExtractWebView2Runtime()
|
||||||
|
{
|
||||||
|
var fi = new System.IO.FileInfo("WebView2Runtime.zip");
|
||||||
|
if (!fi.Exists) return;
|
||||||
|
|
||||||
|
var existlen = 0;
|
||||||
|
var webruntimepath = new System.IO.DirectoryInfo("WebView2Runtime");
|
||||||
|
if (webruntimepath.Exists)
|
||||||
|
{
|
||||||
|
var filen = new System.IO.FileInfo("WebView2Runtime\\version.txt");
|
||||||
|
if (filen.Exists)
|
||||||
|
{
|
||||||
|
var verstr = System.IO.File.ReadAllText(filen.FullName);
|
||||||
|
int.TryParse(verstr, out existlen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existlen != fi.Length)
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
label1.Text = "📦 WebView2Runtime 압축해제 중...";
|
||||||
|
}));
|
||||||
|
|
||||||
|
await Task.Run(() => {
|
||||||
|
// fUnZip 폼을 메인 스레드에서 생성
|
||||||
|
fUnZip fprogress = null;
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
fprogress = new fUnZip();
|
||||||
|
fprogress.TopMost = true;
|
||||||
|
fprogress.Show();
|
||||||
|
Application.DoEvents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (webruntimepath.Exists)
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
fprogress.label1.Text = "기존폴더삭제";
|
||||||
|
Application.DoEvents();
|
||||||
|
}));
|
||||||
|
webruntimepath.Delete(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var diruntime = new System.IO.DirectoryInfo("runtimes");
|
||||||
|
if (diruntime.Exists) diruntime.Delete(true);
|
||||||
|
webruntimepath.Create();
|
||||||
|
diruntime.Create();
|
||||||
|
|
||||||
|
using (var archive = ZipFile.OpenRead(fi.FullName))
|
||||||
|
{
|
||||||
|
int totalFiles = archive.Entries.Count;
|
||||||
|
int currentFile = 0;
|
||||||
|
long totalSize = archive.Entries.Sum(e => e.Length);
|
||||||
|
long extractedSize = 0;
|
||||||
|
|
||||||
|
foreach (var entry in archive.Entries)
|
||||||
|
{
|
||||||
|
currentFile++;
|
||||||
|
extractedSize += entry.Length;
|
||||||
|
int progress = (int)((extractedSize * 100) / totalSize);
|
||||||
|
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
fprogress.label1.Text = $"압축 해제 중... ({currentFile}/{totalFiles})";
|
||||||
|
fprogress.label2.Text = $"{entry.FullName} ({progress}%)";
|
||||||
|
fprogress.progressBar1.Value = progress;
|
||||||
|
Application.DoEvents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
string destinationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, entry.FullName);
|
||||||
|
string destinationDir = Path.GetDirectoryName(destinationPath);
|
||||||
|
|
||||||
|
if (!Directory.Exists(destinationDir))
|
||||||
|
Directory.CreateDirectory(destinationDir);
|
||||||
|
|
||||||
|
if (entry.Length > 0)
|
||||||
|
entry.ExtractToFile(destinationPath, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.IO.File.WriteAllText("WebView2Runtime\\version.txt", fi.Length.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
fprogress.Hide();
|
||||||
|
MessageBox.Show($"WebView2 Runtime 압축 해제 중 오류가 발생했습니다: {ex.Message}",
|
||||||
|
"오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.Invoke(new Action(() => {
|
||||||
|
fprogress.Dispose();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
{"RootPath":"C:\\Data\\Source\\##### 완료아이템\\(0014#) GroupWare\\Source\\Sub\\StaffLayoutCtl","ProjectFileName":"StaffLayoutCtl.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"grid.cs"},{"SourceFile":"grid.Designer.cs"},{"SourceFile":"Item.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.0.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Data\\Source\\##### 완료아이템\\(0014#) GroupWare\\Source\\Sub\\StaffLayoutCtl\\bin\\Debug\\StaffLayoutCtl.dll","OutputItemRelativePath":"StaffLayoutCtl.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
{"RootPath":"C:\\Data\\Source\\(0014) GroupWare\\Source\\Sub\\StaffLayoutCtl","ProjectFileName":"StaffLayoutCtl.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"grid.cs"},{"SourceFile":"grid.Designer.cs"},{"SourceFile":"Item.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.0.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Data\\Source\\(0014) GroupWare\\Source\\Sub\\StaffLayoutCtl\\bin\\Debug\\StaffLayoutCtl.dll","OutputItemRelativePath":"StaffLayoutCtl.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
||||||
@@ -1 +1 @@
|
|||||||
{"RootPath":"C:\\Data\\Source\\##### 완료아이템\\(0014#) GroupWare\\Source\\Sub\\YARTE","ProjectFileName":"YARTE.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"Buttons\\BoldButton.cs"},{"SourceFile":"Buttons\\CheckboxButton.cs"},{"SourceFile":"Buttons\\ForecolorButton.cs"},{"SourceFile":"Buttons\\IButton.cs"},{"SourceFile":"Buttons\\IFunctionButton.cs"},{"SourceFile":"Buttons\\IHTMLEditorButton.cs"},{"SourceFile":"Buttons\\InsertLinkedImageButton.cs"},{"SourceFile":"Buttons\\ItalicButton.cs"},{"SourceFile":"Buttons\\JustifyCenterButton.cs"},{"SourceFile":"Buttons\\JustifyLeftButton.cs"},{"SourceFile":"Buttons\\JustifyRightButton.cs"},{"SourceFile":"Buttons\\LinkButton.cs"},{"SourceFile":"Buttons\\OrderedListButton.cs"},{"SourceFile":"Buttons\\PredefinedButtonSets.cs"},{"SourceFile":"Buttons\\ReadOnlyButton.cs"},{"SourceFile":"Buttons\\UnderlineButton.cs"},{"SourceFile":"Buttons\\UnlinkButton.cs"},{"SourceFile":"Buttons\\UnorderedListButton.cs"},{"SourceFile":"CheckboxItem.cs"},{"SourceFile":"HtmlEditor.cs"},{"SourceFile":"HTMLEditor.Designer.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.0.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\Microsoft.VisualBasic.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Data\\Source\\##### 완료아이템\\(0014#) GroupWare\\Source\\Sub\\YARTE\\bin\\Debug\\YARTE.dll","OutputItemRelativePath":"YARTE.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
{"RootPath":"C:\\Data\\Source\\(0014) GroupWare\\Source\\Sub\\YARTE","ProjectFileName":"YARTE.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"Buttons\\BoldButton.cs"},{"SourceFile":"Buttons\\CheckboxButton.cs"},{"SourceFile":"Buttons\\ForecolorButton.cs"},{"SourceFile":"Buttons\\IButton.cs"},{"SourceFile":"Buttons\\IFunctionButton.cs"},{"SourceFile":"Buttons\\IHTMLEditorButton.cs"},{"SourceFile":"Buttons\\InsertLinkedImageButton.cs"},{"SourceFile":"Buttons\\ItalicButton.cs"},{"SourceFile":"Buttons\\JustifyCenterButton.cs"},{"SourceFile":"Buttons\\JustifyLeftButton.cs"},{"SourceFile":"Buttons\\JustifyRightButton.cs"},{"SourceFile":"Buttons\\LinkButton.cs"},{"SourceFile":"Buttons\\OrderedListButton.cs"},{"SourceFile":"Buttons\\PredefinedButtonSets.cs"},{"SourceFile":"Buttons\\ReadOnlyButton.cs"},{"SourceFile":"Buttons\\UnderlineButton.cs"},{"SourceFile":"Buttons\\UnlinkButton.cs"},{"SourceFile":"Buttons\\UnorderedListButton.cs"},{"SourceFile":"CheckboxItem.cs"},{"SourceFile":"HtmlEditor.cs"},{"SourceFile":"HTMLEditor.Designer.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"Properties\\Resources.Designer.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.0.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\Microsoft.VisualBasic.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Data\\Source\\(0014) GroupWare\\Source\\Sub\\YARTE\\bin\\Debug\\YARTE.dll","OutputItemRelativePath":"YARTE.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
||||||
@@ -1 +1 @@
|
|||||||
{"RootPath":"C:\\Data\\Source\\##### 완료아이템\\(0014#) GroupWare\\Source\\SubProject\\CMSControl","ProjectFileName":"UMSControl.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"cmsview.cs"},{"SourceFile":"EventArgs.cs"},{"SourceFile":"Item.cs"},{"SourceFile":"Slot.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.0.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Data\\Source\\##### 완료아이템\\(0014#) GroupWare\\Source\\SubProject\\CMSControl\\bin\\Debug\\UMSControl.dll","OutputItemRelativePath":"UMSControl.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
{"RootPath":"C:\\Data\\Source\\(0014) GroupWare\\Source\\SubProject\\CMSControl","ProjectFileName":"UMSControl.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"cmsview.cs"},{"SourceFile":"EventArgs.cs"},{"SourceFile":"Item.cs"},{"SourceFile":"Slot.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.0.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Drawing.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Windows.Forms.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.0\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"C:\\Data\\Source\\(0014) GroupWare\\Source\\SubProject\\CMSControl\\bin\\Debug\\UMSControl.dll","OutputItemRelativePath":"UMSControl.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -6,6 +6,7 @@ using System.Data.SqlClient;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using FCOMMON.Models;
|
using FCOMMON.Models;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace FCOMMON
|
namespace FCOMMON
|
||||||
{
|
{
|
||||||
@@ -1801,5 +1802,218 @@ namespace FCOMMON
|
|||||||
cn2.Dispose();
|
cn2.Dispose();
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Generic Query Methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generic Query method that returns a list of objects of type T
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type to map the results to</typeparam>
|
||||||
|
/// <param name="sql">SQL query string</param>
|
||||||
|
/// <param name="parameters">Anonymous object containing parameters</param>
|
||||||
|
/// <returns>List of objects of type T</returns>
|
||||||
|
public static List<T> Query<T>(string sql, object parameters = null) where T : new()
|
||||||
|
{
|
||||||
|
var retval = new List<T>();
|
||||||
|
var cn = getCn();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cn.Open();
|
||||||
|
var cmd = new SqlCommand(sql, cn);
|
||||||
|
|
||||||
|
// Add parameters if provided
|
||||||
|
if (parameters != null)
|
||||||
|
{
|
||||||
|
AddParameters(cmd, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
var rdr = cmd.ExecuteReader();
|
||||||
|
while (rdr.Read())
|
||||||
|
{
|
||||||
|
var item = MapReaderToObject<T>(rdr);
|
||||||
|
retval.Add(item);
|
||||||
|
}
|
||||||
|
rdr.Close();
|
||||||
|
cmd.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Log error if needed
|
||||||
|
throw new Exception($"Query<{typeof(T).Name}> failed: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
cn.Close();
|
||||||
|
cn.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generic QuerySingle method that returns a single object of type T
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type to map the result to</typeparam>
|
||||||
|
/// <param name="sql">SQL query string</param>
|
||||||
|
/// <param name="parameters">Anonymous object containing parameters</param>
|
||||||
|
/// <returns>Single object of type T</returns>
|
||||||
|
/// <exception cref="InvalidOperationException">Thrown when no data is found or more than one row is returned</exception>
|
||||||
|
public static T QuerySingle<T>(string sql, object parameters = null) where T : new()
|
||||||
|
{
|
||||||
|
var results = Query<T>(sql, parameters);
|
||||||
|
|
||||||
|
if (results.Count == 0)
|
||||||
|
throw new InvalidOperationException("Sequence contains no elements");
|
||||||
|
if (results.Count > 1)
|
||||||
|
throw new InvalidOperationException("Sequence contains more than one element");
|
||||||
|
|
||||||
|
return results.First();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generic QuerySingleOrDefault method that returns a single object of type T or default value
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type to map the result to</typeparam>
|
||||||
|
/// <param name="sql">SQL query string</param>
|
||||||
|
/// <param name="parameters">Anonymous object containing parameters</param>
|
||||||
|
/// <returns>Single object of type T or default value if no data found</returns>
|
||||||
|
/// <exception cref="InvalidOperationException">Thrown when more than one row is returned</exception>
|
||||||
|
public static T QuerySingleOrDefault<T>(string sql, object parameters = null) where T : new()
|
||||||
|
{
|
||||||
|
var results = Query<T>(sql, parameters);
|
||||||
|
|
||||||
|
if (results.Count == 0)
|
||||||
|
return default(T);
|
||||||
|
if (results.Count > 1)
|
||||||
|
throw new InvalidOperationException("Sequence contains more than one element");
|
||||||
|
|
||||||
|
return results.First();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Execute a command with parameters and return the number of affected rows
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sql">SQL command string</param>
|
||||||
|
/// <param name="parameters">Anonymous object containing parameters</param>
|
||||||
|
/// <returns>Number of affected rows</returns>
|
||||||
|
public static int Execute(string sql, object parameters = null)
|
||||||
|
{
|
||||||
|
var cn = getCn();
|
||||||
|
int retval = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cn.Open();
|
||||||
|
var cmd = new SqlCommand(sql, cn);
|
||||||
|
|
||||||
|
// Add parameters if provided
|
||||||
|
if (parameters != null)
|
||||||
|
{
|
||||||
|
AddParameters(cmd, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
retval = cmd.ExecuteNonQuery();
|
||||||
|
cmd.Dispose();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
throw new Exception($"Execute failed: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
cn.Close();
|
||||||
|
cn.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to add parameters from an anonymous object to a SqlCommand
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cmd">SqlCommand to add parameters to</param>
|
||||||
|
/// <param name="parameters">Anonymous object containing parameters</param>
|
||||||
|
private static void AddParameters(SqlCommand cmd, object parameters)
|
||||||
|
{
|
||||||
|
if (parameters == null) return;
|
||||||
|
|
||||||
|
var properties = parameters.GetType().GetProperties();
|
||||||
|
foreach (var prop in properties)
|
||||||
|
{
|
||||||
|
var value = prop.GetValue(parameters, null) ?? DBNull.Value;
|
||||||
|
cmd.Parameters.AddWithValue("@" + prop.Name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to map a SqlDataReader to an object of type T
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T">The type to map to</typeparam>
|
||||||
|
/// <param name="reader">SqlDataReader containing the data</param>
|
||||||
|
/// <returns>Object of type T with mapped values</returns>
|
||||||
|
private static T MapReaderToObject<T>(SqlDataReader reader) where T : new()
|
||||||
|
{
|
||||||
|
var obj = new T();
|
||||||
|
var type = typeof(T);
|
||||||
|
var properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||||
|
|
||||||
|
foreach (var prop in properties)
|
||||||
|
{
|
||||||
|
// Check if the property has a setter
|
||||||
|
if (!prop.CanWrite) continue;
|
||||||
|
|
||||||
|
// Try to find a column with the same name (case insensitive)
|
||||||
|
var columnName = FindColumnName(reader, prop.Name);
|
||||||
|
if (columnName == null) continue;
|
||||||
|
|
||||||
|
var value = reader[columnName];
|
||||||
|
if (value == DBNull.Value) continue;
|
||||||
|
|
||||||
|
// Convert the value to the property type if needed
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||||
|
{
|
||||||
|
// Handle nullable types
|
||||||
|
var underlyingType = Nullable.GetUnderlyingType(prop.PropertyType);
|
||||||
|
var convertedValue = Convert.ChangeType(value, underlyingType);
|
||||||
|
prop.SetValue(obj, convertedValue, null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var convertedValue = Convert.ChangeType(value, prop.PropertyType);
|
||||||
|
prop.SetValue(obj, convertedValue, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// If conversion fails, skip this property
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helper method to find a column name in the reader (case insensitive)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="reader">SqlDataReader to search in</param>
|
||||||
|
/// <param name="propertyName">Property name to find</param>
|
||||||
|
/// <returns>Column name if found, null otherwise</returns>
|
||||||
|
private static string FindColumnName(SqlDataReader reader, string propertyName)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < reader.FieldCount; i++)
|
||||||
|
{
|
||||||
|
var columnName = reader.GetName(i);
|
||||||
|
if (string.Equals(columnName, propertyName, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return columnName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user