Compare commits

...

2 Commits

35 changed files with 1084 additions and 2725 deletions

3
.gitignore vendored
View File

@@ -3,7 +3,6 @@
## 다음과 같은 확장자는 전체 무시
.vs
bin
debug
obj
packages
*.pub
@@ -35,5 +34,3 @@ GolfTicketing/
/unimarc/UniMarc/obj
/unimarc/UniMarc/.vs
/unimarc/UniMarc/bin
obj
bin

View File

@@ -15,5 +15,11 @@
"name": "UniMarc",
"type": "도서관 자료 관리 시스템",
"tech_stack": "C# WinForms, .NET Framework 4.7.2, MySQL"
},
"permissions": {
"allow": [
"WebFetch(domain:lib.namgu.gwangju.kr)"
],
"deny": []
}
}

View File

@@ -41,8 +41,4 @@
F:\(VHD) Program Files\Microsoft Visual Studio\2022\MSBuild\Current\Bin\msbuild.exe
## 프로젝트 파일명
UniMarc.csproj
## Webview2 Fixed Version 다운로드 주소
https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/759b508a-00bb-4724-9b87-2703c8417737/Microsoft.WebView2.FixedVersionRuntime.139.0.3405.86.x86.cab
UniMarc.csproj

View File

@@ -1,51 +0,0 @@
# UniMarc - 도서관 자료 관리 시스템
## 📋 프로젝트 개요
- **프로젝트명**: UniMarc
- **목적**: 도서관 자료 관리 시스템
- **기술스택**: C# WinForms, .NET Framework 4.7.2
- **데이터베이스**: MySQL
- **주요기능**: 마크 작성, 복본조사, DLS 연동, 도서 정보 관리
## 🛠️ 개발 환경
- Visual Studio 2019 이상
- .NET Framework 4.7.2
- WebView2 Runtime
- MySQL 데이터베이스
## 📁 디렉토리 구조
```
unimarc/
├── 마크/ # 마크 관련 폼들
├── 납품관리/ # 납품 관리 관련 폼들
├── 마스터/ # 마스터 데이터 관리 폼들
├── 홈/ # 메인 화면 관련 폼들
├── 회계/ # 회계 관련 폼들
├── 편의기능/ # 편의 기능들
└── 작업일지/ # 작업 일지 관련
```
## 🔧 빌드 방법
```cmd
# MSBuild 사용
"F:\(VHD) Program Files\Microsoft Visual Studio\2022\MSBuild\Current\Bin\MSBuild.exe" UniMarc.csproj
```
## ⚠️ 중요 주의사항
1. **MSBuild 경로**: 공백이 포함되어 있어 쌍따옴표 필수
2. **WebView2**: async/await 패턴 적용 필요
3. **데이터베이스**: Helper_DB 클래스 사용
4. **에러 처리**: try-catch 블록 필수
5. **한글 주석** 사용
## 📝 코딩 컨벤션
- 파일명: PascalCase
- 클래스명: PascalCase
- 메서드명: PascalCase
- 변수명: camelCase
- 상수명: UPPER_CASE
## 🔄 최근 주요 변경사항
- DLS_Copy.cs: webBrowser1 → WebView2로 교체
- NuGet.Config: HTTPS 소스로 변경
- System.Runtime.CompilerServices.Unsafe 버전 충돌 해결

View File

@@ -9,12 +9,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Factory_Client", "Factory_C
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "UniMarcSetup", "UniMarcSetup\UniMarcSetup.vdproj", "{B0A88F76-DC68-44F9-90B4-CD94625CC1F4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "솔루션 항목", "솔루션 항목", "{2A3A057F-5D22-31FD-628C-DF5EF75AEF1E}"
ProjectSection(SolutionItems) = preProject
CLAUDE.md = CLAUDE.md
.claude\settings.local.json = .claude\settings.local.json
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU

View File

@@ -1,10 +0,0 @@
{
"permissions": {
"allow": [
"Bash(\"F:\\(VHD) Program Files\\Microsoft Visual Studio\\2022\\MSBuild\\Current\\Bin\\msbuild.exe\" \"UniMarc.csproj\")",
"Bash(\"F:\\(VHD) Program Files\\Microsoft Visual Studio\\2022\\MSBuild\\Current\\Bin\\msbuild.exe\" \"UniMarc.csproj\")",
"Bash(\"F:\\(VHD) Program Files\\Microsoft Visual Studio\\2022\\MSBuild\\Current\\Bin\\msbuild.exe\" \"UniMarc.csproj\")"
],
"deny": []
}
}

View File

@@ -1,23 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "UniMarc Debug (.NET Framework)",
"type": "clr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/UniMarc.exe",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"enableStepFiltering": false
},
{
"name": "UniMarc Attach (.NET Framework)",
"type": "clr",
"request": "attach",
"processName": "UniMarc.exe"
}
]
}

View File

@@ -1,3 +0,0 @@
{
"dotnet.preferCSharpExtension": true
}

View File

@@ -1,50 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "\"F:\\(VHD) Program Files\\Microsoft Visual Studio\\2022\\MSBuild\\Current\\Bin\\msbuild.exe\"",
"type": "process",
"args": [
"UniMarc.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "always"
},
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "msbuild",
"type": "process",
"args": [
"UniMarc.csproj",
"/p:Configuration=Release",
"/p:PublishProfile=FolderProfile"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "msbuild",
"type": "process",
"args": [
"UniMarc.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}
]
}

View File

@@ -26,7 +26,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Renci.SshNet" publicKeyToken="1cee9f8bde3db106" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2020.0.1.0" newVersion="2020.0.1.0" />
<bindingRedirect oldVersion="0.0.0.0-2025.0.0.1" newVersion="2025.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
@@ -44,6 +44,14 @@
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="AngleSharp" publicKeyToken="e83494dcdc6d31ea" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<userSettings>

View File

@@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace UniMarc
{
public static class CUtill
{
public static arUtil.Log mLog;
public static void MsgI(string m)
{
//MessageWindow.VisibleAll(false);
MessageBox.Show(m, "CHECK", MessageBoxButtons.OK, MessageBoxIcon.Information);
//MessageWindow.VisibleAll(true);
}
public static void MsgE(string m)
{
//MessageWindow.VisibleAll(false);
MessageBox.Show(m, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
//MessageWindow.VisibleAll(true);
}
public static DialogResult MsgQ(string m)
{
//MessageWindow.VisibleAll(false);
DialogResult dlg = MessageBox.Show(m, "CHECK", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
//MessageWindow.VisibleAll(true);
return dlg;
}
}
}

View File

@@ -37,39 +37,27 @@ namespace WindowsFormsApp1
public string DB_User_Data;
public string User;
public string com_idx;
public Main()
{
InitializeComponent();
PUB.Init();
}
public string User_Name { get; internal set; }
private void Main_Load(object sender, EventArgs e)
{
this.Visible = false; // 메인폼을 먼저 숨김
#region "Log setting"
var logsubdir = "{yyyy|MM|dd}";
string tPath = string.Format("{0}\\LOG", AppDomain.CurrentDomain.BaseDirectory).Replace("\\\\", "\\"); ;
CUtill.mLog = new arUtil.Log(tPath);
CUtill.mLog.SubDirectory = logsubdir;
CUtill.mLog.FileNameFormat = "{yyMMdd}";
#endregion
login login = new login();
VersionText.Text = string.Format("UniMarc Ver.{0}", ip.VersionInfo());
if (DialogResult.OK == login.ShowDialog(this))
{
if (DialogResult.OK == login.ShowDialog(this)) {
this.Visible = true;
}
else
{
else {
this.Close();
}
@@ -148,7 +136,7 @@ namespace WindowsFormsApp1
#region
public void SetBtnName()
{
string Area =
string Area =
"`ShortCut1`, `ShortCut2`, `ShortCut3`, `ShortCut4`, `ShortCut5`, " +
"`ShortCut6`, `ShortCut7`, `ShortCut8`, `ShortCut9`, `ShortCut10`, " +
"`ShortCut11`, `ShortCut12`";
@@ -243,7 +231,7 @@ namespace WindowsFormsApp1
"송금내역조회", "송금등록", "매입 집계", "매입 장부", "매출 입력",
"매출 입금", "매출 조회", "매출 집계", "파트타임 관리" };
ToolStripMenuItem[] AccT = {
, , , , ,
, , , , ,
, , ,
};
ToolStripMenuItem[] TempAcc = {
@@ -287,17 +275,15 @@ namespace WindowsFormsApp1
for (int a = 0; a < MenuTotal.Length; a++)
{
bool IsText = false;
for (int b = 0; b < MenuTotal[a].Length; b++)
for(int b = 0; b < MenuTotal[a].Length; b++)
{
if (MenuTotal[a][b] == btnText)
{
if (MenuTotal[a][b] == btnText) {
IsText = true;
count[1] = b;
break;
}
}
if (IsText)
{
if (IsText) {
count[0] = a;
break;
}
@@ -309,8 +295,7 @@ namespace WindowsFormsApp1
return;
// 권한설정으로 인한 리턴
if (!MenuCheckT[count[0]][count[1]].Enabled)
{
if (!MenuCheckT[count[0]][count[1]].Enabled) {
MessageBox.Show("권한이 설정되지 않았습니다!");
return;
}
@@ -730,7 +715,7 @@ namespace WindowsFormsApp1
Acc_purchase_Aggregation.Show();
}
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Acc_purchase_Not_Pay != null)
@@ -746,7 +731,7 @@ namespace WindowsFormsApp1
Acc_purchase_Not_Pay.Show();
}
}
private void ToolStripMenuItem1_Click(object sender, EventArgs e)
{
if (Acc_sales_Input != null)
@@ -988,11 +973,11 @@ namespace WindowsFormsApp1
//}
//else
//{
Mac_check_Copy = new Check_copy(this);
Mac_check_Copy.MdiParent = this;
Mac_check_Copy.WindowState = FormWindowState.Normal;
Mac_check_Copy.FormClosed += (o, ea) => Mac_check_Copy = null;
Mac_check_Copy.Show();
Mac_check_Copy = new Check_copy(this);
Mac_check_Copy.MdiParent = this;
Mac_check_Copy.WindowState = FormWindowState.Normal;
Mac_check_Copy.FormClosed += (o, ea) => Mac_check_Copy = null;
Mac_check_Copy.Show();
//}
//foreach (Form frm in Application.OpenForms)
@@ -1197,7 +1182,7 @@ namespace WindowsFormsApp1
DLS_school_Lookup.Show();
}
}
async private void dLS복본조사ToolStripMenuItem_Click(object sender, EventArgs e)
private void dLS복본조사ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (Mac_dLS_Copy != null)
{
@@ -1205,11 +1190,9 @@ namespace WindowsFormsApp1
}
else
{
var environment = await WebView2Installer.GetWebView2EnvironmentAsync();
Mac_dLS_Copy = new DLS_Copy(this);
Mac_dLS_Copy.MdiParent = this;
Mac_dLS_Copy.WindowState = FormWindowState.Maximized;
//Mac_dLS_Copy.WindowState = FormWindowState.Maximized;
Mac_dLS_Copy.FormClosed += (o, ea) => Mac_dLS_Copy = null;
Mac_dLS_Copy.Show();
}

26
unimarc/unimarc/PUB.cs Normal file
View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace UniMarc
{
public static class PUB
{
public static arUtil.Log log;
public static void Init()
{
#region "Log setting"
var logsubdir = "{yyyy|MM|dd}";
string tPath = string.Format("{0}\\LOG", AppDomain.CurrentDomain.BaseDirectory).Replace("\\\\", "\\"); ;
PUB.log = new arUtil.Log(tPath);
PUB.log.SubDirectory = logsubdir;
PUB.log.FileNameFormat = "{yyMMdd}";
#endregion
}
}
}

View File

@@ -26,20 +26,6 @@ namespace BokBonCheck
};
}
public async Task<List<BookSearchResult>> SearchBooksAsync(string searchTerm)
{
var results = new List<BookSearchResult>();
foreach (var searcher in _searchers)
{
searcher.StartDriver();
var result = await searcher.SearchAsync(searchTerm);
results.Add(result);
//searcher.StopDriver();
}
return results;
}
/// <summary>
/// Return Searcher

View File

@@ -8,17 +8,60 @@ using System.Reflection;
using System.Net.Http;
using System.Threading;
using System.IO.Compression;
using System.Linq;
using System.Security.Principal;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace BokBonCheck
{
public static class ChromeDriverManager
{
private static string _driverPath = null;
private static readonly object _lockObject = new object();
private static readonly int MaxRetryCount = 3;
private static readonly int RetryDelayMs = 2000;
private static readonly string UserDataDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ChromeDriverUserData");
public static async Task<string> SetupChromeDriverAsync(DownloadProgressForm progressForm = null)
{
lock (_lockObject)
{
if (!string.IsNullOrEmpty(_driverPath) && File.Exists(_driverPath))
{
// 이미 설정된 드라이버가 있고 정상 동작하면 재사용
if (IsDriverReady())
{
if (progressForm != null)
{
progressForm.UpdateProgress(100, "기존 드라이버 사용");
progressForm.SetCompleted("기존 드라이버를 사용합니다.");
}
return _driverPath;
}
}
}
try
{
// Chrome 설치 여부 확인
if (!IsChromeInstalled())
{
var errorMsg = "Chrome이 설치되어 있지 않습니다. Chrome을 설치한 후 다시 시도해주세요.";
Console.WriteLine(errorMsg);
if (progressForm != null)
{
progressForm.SetError(errorMsg);
}
throw new InvalidOperationException(errorMsg);
}
// 사용자 데이터 디렉토리 생성
EnsureUserDataDirectory();
// 사용자 디렉토리 생성 후 기존 Chrome/ChromeDriver 프로세스 정리
CleanupChromeProcesses();
// Chrome 버전 확인
var chromeVersion = GetChromeVersion();
Console.WriteLine($"설치된 Chrome 버전: {chromeVersion}");
@@ -34,7 +77,12 @@ namespace BokBonCheck
{
Console.WriteLine($"기존 드라이버 발견: {existingDriverPath}");
// 기존 드라이버 테스트
if (progressForm != null)
{
progressForm.UpdateProgress(20, "기존 드라이버 테스트 중...");
}
// 기존 드라이버 테스트 (한 번만)
if (await TestExistingDriver(existingDriverPath))
{
if (progressForm != null)
@@ -43,14 +91,17 @@ namespace BokBonCheck
progressForm.SetCompleted("기존 드라이버를 사용합니다.");
}
_driverPath = existingDriverPath;
Environment.SetEnvironmentVariable("webdriver.chrome.driver", existingDriverPath);
lock (_lockObject)
{
_driverPath = existingDriverPath;
Environment.SetEnvironmentVariable("webdriver.chrome.driver", existingDriverPath);
}
return existingDriverPath;
}
else
{
Console.WriteLine("기존 드라이버 테스트 실패 - 새로 다운로드");
// 기존 드라이버가 작동하지 않으면 삭제
// 기존 드라이버 삭제
try
{
File.Delete(existingDriverPath);
@@ -63,43 +114,137 @@ namespace BokBonCheck
}
}
// 드라이버 다운로드
if (progressForm != null)
{
progressForm.UpdateProgress(30, "Chrome 버전에 맞는 드라이버 다운로드 중...");
progressForm.UpdateProgress(30, "Chrome 드라이버 다운로드 중...");
}
// WebDriverManager를 사용하여 설치된 Chrome 버전에 맞는 드라이버 다운로드
var driverManager = new DriverManager();
var driverPath = driverManager.SetUpDriver(new ChromeConfig(), "MatchingBrowser");
// 다운로드된 드라이버 경로 저장
_driverPath = driverPath;
// 환경 변수 설정
Environment.SetEnvironmentVariable("webdriver.chrome.driver", driverPath);
var driverPath = await DownloadChromeDriverWithRetryAsync(progressForm);
// 다운로드된 드라이버 테스트 (한 번만)
if (progressForm != null)
{
progressForm.UpdateProgress(100, "드라이버 다운로드 완료");
progressForm.SetCompleted("드라이버 다운로드 완료!");
progressForm.UpdateProgress(80, "다운로드된 드라이버 테스트 중...");
}
Console.WriteLine($"ChromeDriver 경로: {driverPath}");
Console.WriteLine($"환경 변수 설정: webdriver.chrome.driver = {driverPath}");
return driverPath;
if (await TestExistingDriver(driverPath))
{
lock (_lockObject)
{
_driverPath = driverPath;
Environment.SetEnvironmentVariable("webdriver.chrome.driver", driverPath);
}
if (progressForm != null)
{
progressForm.UpdateProgress(100, "드라이버 설정 완료");
progressForm.SetCompleted("드라이버 설정 완료!");
}
Console.WriteLine($"ChromeDriver 경로: {driverPath}");
Console.WriteLine($"환경 변수 설정: webdriver.chrome.driver = {driverPath}");
return driverPath;
}
else
{
throw new InvalidOperationException("다운로드된 드라이버 테스트에 실패했습니다.");
}
}
catch (Exception ex)
{
Console.WriteLine($"ChromeDriver 설정 오류: {ex.Message}");
var errorMsg = $"ChromeDriver 설정 오류: {ex.Message}";
Console.WriteLine(errorMsg);
if (progressForm != null)
{
progressForm.SetError($"설정 오류: {ex.Message}");
progressForm.SetError(errorMsg);
}
throw;
}
}
private static void EnsureUserDataDirectory()
{
try
{
if (!Directory.Exists(UserDataDir))
{
Directory.CreateDirectory(UserDataDir);
Console.WriteLine($"사용자 데이터 디렉토리 생성: {UserDataDir}");
}
// 임시 파일 디렉토리도 생성
var tempDir = Path.Combine(UserDataDir, "temp");
if (!Directory.Exists(tempDir))
{
Directory.CreateDirectory(tempDir);
}
// 로그 디렉토리 생성
var logDir = Path.Combine(UserDataDir, "logs");
if (!Directory.Exists(logDir))
{
Directory.CreateDirectory(logDir);
}
}
catch (Exception ex)
{
Console.WriteLine($"사용자 데이터 디렉토리 생성 실패: {ex.Message}");
}
}
private static async Task<string> DownloadChromeDriverWithRetryAsync(DownloadProgressForm progressForm)
{
Exception lastException = null;
for (int attempt = 1; attempt <= MaxRetryCount; attempt++)
{
try
{
if (progressForm != null)
{
progressForm.UpdateProgress(30 + (attempt - 1) * 10,
$"Chrome 드라이버 다운로드 중... (시도 {attempt}/{MaxRetryCount})");
}
Console.WriteLine($"드라이버 다운로드 시도 {attempt}/{MaxRetryCount}");
// WebDriverManager를 사용하여 설치된 Chrome 버전에 맞는 드라이버 다운로드
var driverManager = new DriverManager();
var driverPath = driverManager.SetUpDriver(new ChromeConfig(), "MatchingBrowser");
if (!string.IsNullOrEmpty(driverPath) && File.Exists(driverPath))
{
Console.WriteLine($"드라이버 다운로드 성공: {driverPath}");
return driverPath;
}
else
{
throw new InvalidOperationException("드라이버 파일을 찾을 수 없습니다.");
}
}
catch (Exception ex)
{
lastException = ex;
Console.WriteLine($"드라이버 다운로드 시도 {attempt} 실패: {ex.Message}");
if (attempt < MaxRetryCount)
{
if (progressForm != null)
{
progressForm.UpdateProgress(30 + attempt * 10,
$"다운로드 실패. 재시도 중... ({attempt + 1}/{MaxRetryCount})");
}
// 재시도 전 잠시 대기
await Task.Delay(RetryDelayMs);
}
}
}
throw new InvalidOperationException($"드라이버 다운로드를 {MaxRetryCount}번 시도했지만 실패했습니다. 마지막 오류: {lastException?.Message}");
}
private static string GetExistingDriverPath()
{
try
@@ -111,25 +256,45 @@ namespace BokBonCheck
return envPath;
}
// 사용자 디렉토리에서 확인 (관리자 권한 없이도 접근 가능)
var userDriverPath = Path.Combine(UserDataDir, "chromedriver.exe");
if (File.Exists(userDriverPath))
{
return userDriverPath;
}
// WebDriverManager 캐시 폴더에서 확인
var cachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".cache", "selenium");
if (Directory.Exists(cachePath))
{
var chromeDriverFiles = Directory.GetFiles(cachePath, "chromedriver*", SearchOption.AllDirectories);
foreach (var file in chromeDriverFiles)
var chromeDriverFiles = Directory.GetFiles(cachePath, "chromedriver*", SearchOption.AllDirectories)
.Where(f => f.EndsWith(".exe") || !Path.HasExtension(f))
.OrderByDescending(f => File.GetLastWriteTime(f))
.ToArray();
if (chromeDriverFiles.Length > 0)
{
if (file.EndsWith(".exe") || !Path.HasExtension(file))
{
return file;
}
return chromeDriverFiles[0]; // 가장 최근 파일 반환
}
}
// 현재 실행 파일과 같은 디렉토리에서 확인
var currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (!string.IsNullOrEmpty(currentDir))
{
var localDriverPath = Path.Combine(currentDir, "chromedriver.exe");
if (File.Exists(localDriverPath))
{
return localDriverPath;
}
}
return null;
}
catch
catch (Exception ex)
{
Console.WriteLine($"기존 드라이버 경로 확인 실패: {ex.Message}");
return null;
}
}
@@ -149,6 +314,10 @@ namespace BokBonCheck
@"C:\Program Files\Google\Chrome\Application\chrome.exe",
@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
@"Google\Chrome\Application\chrome.exe"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
@"Google\Chrome\Application\chrome.exe"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
@"Google\Chrome\Application\chrome.exe")
};
@@ -163,6 +332,27 @@ namespace BokBonCheck
}
}
// 레지스트리에서 확인 (추가 방법)
try
{
using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Google\Chrome\BLBeacon"))
{
if (key != null)
{
var version = key.GetValue("version") as string;
if (!string.IsNullOrEmpty(version))
{
Console.WriteLine($"레지스트리에서 Chrome 버전 감지: {version}");
return version;
}
}
}
}
catch (Exception ex)
{
Console.WriteLine($"레지스트리 확인 실패: {ex.Message}");
}
return "알 수 없음";
}
catch (Exception ex)
@@ -181,6 +371,10 @@ namespace BokBonCheck
@"C:\Program Files\Google\Chrome\Application\chrome.exe",
@"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
@"Google\Chrome\Application\chrome.exe"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
@"Google\Chrome\Application\chrome.exe"),
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),
@"Google\Chrome\Application\chrome.exe")
};
@@ -192,10 +386,27 @@ namespace BokBonCheck
}
}
// 레지스트리에서도 확인
try
{
using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Google\Chrome\BLBeacon"))
{
if (key != null)
{
return true;
}
}
}
catch
{
// 레지스트리 접근 실패는 무시
}
return false;
}
catch
catch (Exception ex)
{
Console.WriteLine($"Chrome 설치 확인 실패: {ex.Message}");
return false;
}
}
@@ -211,32 +422,7 @@ namespace BokBonCheck
progressForm.UpdateProgress(50, "드라이버 테스트 중...");
}
// ChromeDriver 서비스 설정
var service = OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath));
service.HideCommandPromptWindow = true;
// 간단한 테스트 실행
var options = new OpenQA.Selenium.Chrome.ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-gpu");
options.AddArgument("--remote-debugging-port=0");
using (var driver = new OpenQA.Selenium.Chrome.ChromeDriver(service, options))
{
driver.Navigate().GoToUrl("https://www.google.com");
var title = driver.Title;
Console.WriteLine($"드라이버 테스트 성공: {title}");
if (progressForm != null)
{
progressForm.UpdateProgress(100, "드라이버 테스트 성공!");
progressForm.SetCompleted("드라이버 테스트 성공!");
}
return !string.IsNullOrEmpty(title);
}
return await TestExistingDriver(driverPath);
}
catch (Exception ex)
{
@@ -255,6 +441,20 @@ namespace BokBonCheck
{
Console.WriteLine("Chrome 드라이버 캐시 정리 시작...");
// 사용자 데이터 디렉토리 정리
if (Directory.Exists(UserDataDir))
{
try
{
Directory.Delete(UserDataDir, true);
Console.WriteLine($"사용자 데이터 디렉토리 정리됨: {UserDataDir}");
}
catch (Exception ex)
{
Console.WriteLine($"사용자 데이터 디렉토리 정리 실패: {ex.Message}");
}
}
// WebDriverManager 캐시 폴더 정리
var cachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
".cache", "selenium");
@@ -280,20 +480,23 @@ namespace BokBonCheck
}
// 저장된 드라이버 경로도 정리
if (!string.IsNullOrEmpty(_driverPath) && File.Exists(_driverPath))
lock (_lockObject)
{
try
if (!string.IsNullOrEmpty(_driverPath) && File.Exists(_driverPath))
{
File.Delete(_driverPath);
Console.WriteLine($"저장된 드라이버 삭제됨: {_driverPath}");
}
catch (Exception ex)
{
Console.WriteLine($"저장된 드라이버 삭제 실패: {ex.Message}");
try
{
File.Delete(_driverPath);
Console.WriteLine($"저장된 드라이버 삭제됨: {_driverPath}");
}
catch (Exception ex)
{
Console.WriteLine($"저장된 드라이버 삭제 실패: {ex.Message}");
}
}
_driverPath = null;
}
_driverPath = null;
Environment.SetEnvironmentVariable("webdriver.chrome.driver", null);
Console.WriteLine("Chrome 드라이버 캐시 정리 완료");
@@ -316,24 +519,24 @@ namespace BokBonCheck
}
Console.WriteLine($"드라이버 준비 상태 확인: {driverPath}");
// 간단한 테스트 실행
var service = OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath));
service.HideCommandPromptWindow = true;
var options = new OpenQA.Selenium.Chrome.ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-gpu");
options.AddArgument("--remote-debugging-port=0");
using (var driver = new OpenQA.Selenium.Chrome.ChromeDriver(service, options))
// 파일 크기와 수정 날짜로 기본 검증
var fileInfo = new FileInfo(driverPath);
if (fileInfo.Length < 1000) // 1KB 미만이면 의심스러움
{
driver.Navigate().GoToUrl("https://www.google.com");
var result = !string.IsNullOrEmpty(driver.Title);
Console.WriteLine($"드라이버 준비 상태: {(result ? "" : "")}");
return result;
Console.WriteLine("드라이버 파일이 너무 작습니다.");
return false;
}
// 최근 30일 내 파일인지 확인
if (fileInfo.LastWriteTime < DateTime.Now.AddDays(-30))
{
Console.WriteLine("드라이버 파일이 너무 오래되었습니다.");
return false;
}
Console.WriteLine("드라이버 준비 상태: 준비됨");
return true;
}
catch (Exception ex)
{
@@ -342,26 +545,121 @@ namespace BokBonCheck
}
}
/// <summary>
/// 기본 Chrome 옵션을 생성하는 헬퍼 메서드
/// </summary>
public static ChromeOptions CreateBaseChromeOptions(bool hideBrowser = true,int width = 800,int height = 600)
{
var options = new ChromeOptions();
if (hideBrowser)
{
options.AddArgument("--headless");
}
if(width > 0 && height > 0)
{
options.AddArgument($"--window-size={width},{height}");
}
// 기본 안정성 옵션
options.AddArgument("--no-sandbox");
options.AddArgument("--remote-debugging-port=0");
options.AddArgument("--disable-extensions");
options.AddArgument("--disable-plugins");
options.AddArgument("--disable-images");
options.AddArgument("--disable-javascript");
options.AddArgument("--disable-java");
options.AddArgument("--disable-flash");
options.AddArgument("--disable-web-security");
options.AddArgument("--allow-running-insecure-content");
// 메모리 및 성능 최적화
options.AddArgument("--memory-pressure-off");
options.AddArgument("--max_old_space_size=4096");
options.AddArgument("--disable-background-timer-throttling");
options.AddArgument("--disable-backgrounding-occluded-windows");
options.AddArgument("--disable-renderer-backgrounding");
options.AddArgument("--disable-features=TranslateUI");
options.AddArgument("--disable-ipc-flooding-protection");
options.AddArgument("--disable-default-apps");
options.AddArgument("--disable-sync");
options.AddArgument("--disable-translate");
options.AddArgument("--disable-logging");
options.AddArgument("--disable-notifications");
options.AddArgument("--disable-popup-blocking");
options.AddArgument("--disable-prompt-on-repost");
options.AddArgument("--disable-hang-monitor");
options.AddArgument("--disable-client-side-phishing-detection");
options.AddArgument("--disable-component-update");
options.AddArgument("--disable-domain-reliability");
// 프로세스 관련 안정성 옵션
options.AddArgument("--single-process");
options.AddArgument("--no-zygote");
options.AddArgument("--disable-background-networking");
// 캐시 및 저장소 비활성화
options.AddArgument("--disable-application-cache");
options.AddArgument("--disable-offline-load-stale-cache");
options.AddArgument("--disk-cache-size=0");
options.AddArgument("--media-cache-size=0");
options.AddArgument("--aggressive-cache-discard");
options.AddArgument("--enable-aggressive-domstorage-flushing");
// 기타 안정성 옵션
options.AddArgument("--enable-low-end-device-mode");
options.AddArgument("--force-fieldtrials=*BackgroundTracing/default/");
// 사용자 데이터 디렉토리 설정 (관리자 권한 없이도 접근 가능)
options.AddArgument($"--user-data-dir={UserDataDir}");
options.AddArgument("--no-first-run");
options.AddArgument("--no-default-browser-check");
return options;
}
/// <summary>
/// 검색 최적화된 Chrome 옵션을 반환합니다
/// </summary>
public static ChromeOptions GetSearchOptimizedOptions()
{
var options = CreateBaseChromeOptions(true);
// 검색에 필요한 기능만 활성화
options.AddArgument("--enable-javascript");
options.AddArgument("--enable-images");
return options;
}
private static async Task<bool> TestExistingDriver(string driverPath)
{
try
{
Console.WriteLine($"기존 드라이버 테스트: {driverPath}");
Console.WriteLine($"드라이버 테스트: {driverPath}");
// ChromeDriver 서비스 설정
var service = OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath));
service.HideCommandPromptWindow = true;
// 간단한 테스트 실행
var options = new OpenQA.Selenium.Chrome.ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-gpu");
options.AddArgument("--remote-debugging-port=0");
// 기본 Chrome 옵션 사용하고 테스트용 추가 옵션 설정
var options = CreateBaseChromeOptions(true);
// 테스트용 추가 옵션들
options.AddArgument("--log-level=3"); // 오류만 표시
options.AddArgument("--silent");
options.AddArgument("--window-size=1920,1080");
options.AddArgument("--start-maximized");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddArgument("--enable-aggressive-domstorage-flushing");
using (var driver = new OpenQA.Selenium.Chrome.ChromeDriver(service, options))
{
driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(15);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
driver.Navigate().GoToUrl("https://www.google.com");
var title = driver.Title;
Console.WriteLine($"드라이버 테스트 성공: {title}");
@@ -370,9 +668,114 @@ namespace BokBonCheck
}
catch (Exception ex)
{
Console.WriteLine($"기존 드라이버 테스트 실패: {ex.Message}");
Console.WriteLine($"드라이버 테스트 실패: {ex.Message}");
// DevToolsActivePort 및 Chrome 크래시 관련 특별 처리
if (ex.Message.Contains("DevToolsActivePort file doesn't exist") ||
ex.Message.Contains("was killed") ||
ex.Message.Contains("Chrome has crashed"))
{
Console.WriteLine("DevToolsActivePort 또는 Chrome 크래시 감지됨. 사용자 데이터 디렉토리 정리 시도...");
try
{
// 사용자 데이터 디렉토리 정리
if (Directory.Exists(UserDataDir))
{
Directory.Delete(UserDataDir, true);
Console.WriteLine("사용자 데이터 디렉토리 정리 완료");
}
// Chrome 프로세스 정리 시도
CleanupChromeProcesses();
// 잠시 대기
await Task.Delay(1000);
}
catch (Exception cleanupEx)
{
Console.WriteLine($"사용자 데이터 디렉토리 정리 실패: {cleanupEx.Message}");
}
}
return false;
}
}
// Chrome 프로세스 정리 메서드 추가
private static void CleanupChromeProcesses()
{
try
{
Console.WriteLine("Chrome 프로세스 정리 시작...");
// Chrome 관련 프로세스들 찾기
var chromeProcesses = System.Diagnostics.Process.GetProcessesByName("chrome");
var chromedriverProcesses = System.Diagnostics.Process.GetProcessesByName("chromedriver");
// Chrome 프로세스 정리
bool KILLPROC = false;
foreach (var process in chromeProcesses)
{
try
{
if (!process.HasExited)
{
KILLPROC = true;
process.Kill();
Console.WriteLine($"Chrome 프로세스 종료: PID {process.Id}");
}
}
catch (Exception ex)
{
Console.WriteLine($"Chrome 프로세스 종료 실패 (PID {process.Id}): {ex.Message}");
}
}
// ChromeDriver 프로세스 정리
foreach (var process in chromedriverProcesses)
{
try
{
if (!process.HasExited)
{
KILLPROC = true;
process.Kill();
Console.WriteLine($"ChromeDriver 프로세스 종료: PID {process.Id}");
}
}
catch (Exception ex)
{
Console.WriteLine($"ChromeDriver 프로세스 종료 실패 (PID {process.Id}): {ex.Message}");
}
}
// 잠시 대기하여 프로세스 완전 종료 확인
if(KILLPROC)
System.Threading.Thread.Sleep(2000);
Console.WriteLine("Chrome 프로세스 정리 완료");
}
catch (Exception ex)
{
Console.WriteLine($"Chrome 프로세스 정리 실패: {ex.Message}");
}
}
public static void Dispose()
{
try
{
lock (_lockObject)
{
_driverPath = null;
}
Environment.SetEnvironmentVariable("webdriver.chrome.driver", null);
Console.WriteLine("ChromeDriverManager 리소스 해제 완료");
}
catch (Exception ex)
{
Console.WriteLine($"ChromeDriverManager 리소스 해제 실패: {ex.Message}");
}
}
}
}

View File

@@ -1,15 +1,21 @@
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using System.IO;
using System;
using System.Threading.Tasks;
using Org.BouncyCastle.Bcpg;
namespace BokBonCheck
{
public interface ILibrarySearcher
{
int No { get; set; }
int No { get; set; }
string SiteName { get; }
string SiteUrl { get; }
Task<BookSearchResult> SearchAsync(string searchTerm);
void StartDriver();
void StartDriver(bool showBrowser);
void StopDriver();
Task WaitForPageChange(WebDriverWait wait);

View File

@@ -61,7 +61,7 @@ namespace BokBonCheck
}
public abstract class KwangjuCityLibrarySearcher : ILibrarySearcher
{
public int No { get; set; }
public int No { get; set; }
public string SiteName { get; protected set; } = "광주시교육청통합도서관";
public string SiteUrl => "https://lib.gen.go.kr/main/site/search/bookSearch.do#simple";
@@ -81,28 +81,55 @@ namespace BokBonCheck
this.No = no;
}
public void StartDriver()
public void StartDriver(bool showBrowser)
{
try
{
// 동기적으로 실행 (권장하지 않음)
StartDriverAsync( showBrowser).GetAwaiter().GetResult();
}
catch (Exception ex)
{
Console.WriteLine($"StartDriver 실패: {ex.Message}");
throw;
}
}
public async Task StartDriverAsync( bool showdriver = false)
{
if (_driver == null)
{
var driverPath = ChromeDriverManager.GetDriverPath();
if (string.IsNullOrEmpty(driverPath) || !File.Exists(driverPath))
try
{
driverPath = ChromeDriverManager.SetupChromeDriverAsync().GetAwaiter().GetResult();
// ChromeDriverManager를 사용하여 안정적으로 드라이버 설정
var driverPath = await ChromeDriverManager.SetupChromeDriverAsync();
// ChromeDriver 서비스 생성
_service = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), Path.GetFileName(driverPath));
_service.HideCommandPromptWindow = true;
// 안정적인 Chrome 옵션 가져오기 (브라우저 창 숨김)
var options = ChromeDriverManager.CreateBaseChromeOptions(!showdriver);
// 추가 보안 및 안정성 옵션
options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddExcludedArgument("enable-automation");
options.AddAdditionalOption("useAutomationExtension", false);
// ChromeDriver 생성
_driver = new ChromeDriver(_service, options);
// 웹드라이버 감지 방지
((IJavaScriptExecutor)_driver).ExecuteScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
Console.WriteLine("NamguLibrarySearcher ChromeDriver 초기화 완료");
}
catch (Exception ex)
{
Console.WriteLine($"ChromeDriver 초기화 실패: {ex.Message}");
throw new InvalidOperationException($"ChromeDriver 초기화에 실패했습니다: {ex.Message}", ex);
}
_service = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), Path.GetFileName(driverPath));
_service.HideCommandPromptWindow = true;
var options = new ChromeOptions();
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-gpu");
options.AddArgument("--window-size=640,700");
options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddExcludedArgument("enable-automation");
options.AddAdditionalOption("useAutomationExtension", false);
_driver = new ChromeDriver(_service, options);
((IJavaScriptExecutor)_driver).ExecuteScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
}
}
@@ -150,7 +177,7 @@ namespace BokBonCheck
try
{
if (_driver == null)
throw new InvalidOperationException("드라이버가 시작되지 않았습니다. StartDriver()를 먼저 호출하세요.");
throw new InvalidOperationException("드라이버가 시작되지 않았습니다. StartDriver()를 먼저 호출하세요.");
_driver.Navigate().GoToUrl(SiteUrl);

View File

@@ -9,6 +9,7 @@ using WebDriverManager.DriverConfigs.Impl;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using UniMarc.;
namespace BokBonCheck
{
@@ -116,7 +117,7 @@ namespace BokBonCheck
}
return true;
}
catch(Exception ex)
catch (Exception ex)
{
Console.WriteLine(ex.Message);
return false;
@@ -130,7 +131,7 @@ namespace BokBonCheck
SiteName = "남구통합도서관(효천어울림도서관)";
}
protected override bool SelectLibrary(WebDriverWait wait)
{
IWebElement searchBox = null;
@@ -176,11 +177,11 @@ namespace BokBonCheck
var selector = "#clickAll";
searchBox = wait.Until(d => d.FindElement(By.CssSelector(selector)));
if (searchBox == null) return false;
if ( searchBox.Selected == true)
if (searchBox.Selected == true)
{
SafeClick(searchBox);
}
selector = "#libSQ";
searchBox = wait.Until(d => d.FindElement(By.CssSelector(selector)));
@@ -203,7 +204,7 @@ namespace BokBonCheck
public string SiteName { get; protected set; } = "남구통합도서관(전체)";
public string SiteUrl => "https://lib.namgu.gwangju.kr/main/bookSearch";
public int No { get; set; }
public int No { get; set; }
private ChromeDriver _driver;
private ChromeDriverService _service;
@@ -219,28 +220,56 @@ namespace BokBonCheck
this.No = no;
}
public void StartDriver()
//public async Task StartDriverAsync(bool showdriver=false)
//{
// if (_driver == null)
// {
// try
// {
// // ChromeDriverManager를 사용하여 안정적으로 드라이버 설정
// var driverPath = await ChromeDriverManager.SetupChromeDriverAsync();
// // ChromeDriver 서비스 생성
// _service = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), Path.GetFileName(driverPath));
// _service.HideCommandPromptWindow = true;
// // 안정적인 Chrome 옵션 가져오기 (브라우저 창 숨김)
// var options = ChromeDriverManager.CreateBaseChromeOptions(!showdriver);
// // 추가 보안 및 안정성 옵션
// options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36");
// options.AddArgument("--disable-blink-features=AutomationControlled");
// options.AddExcludedArgument("enable-automation");
// options.AddAdditionalOption("useAutomationExtension", false);
// // ChromeDriver 생성
// _driver = new ChromeDriver(_service, options);
// // 웹드라이버 감지 방지
// ((IJavaScriptExecutor)_driver).ExecuteScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
// Console.WriteLine("NamguLibrarySearcher ChromeDriver 초기화 완료");
// }
// catch (Exception ex)
// {
// Console.WriteLine($"ChromeDriver 초기화 실패: {ex.Message}");
// throw new InvalidOperationException($"ChromeDriver 초기화에 실패했습니다: {ex.Message}", ex);
// }
// }
//}
// 기존 StartDriver 메서드를 유지하여 호환성 보장
public void StartDriver(bool showBrowser)
{
if (_driver == null)
try
{
var driverPath = ChromeDriverManager.GetDriverPath();
if (string.IsNullOrEmpty(driverPath) || !File.Exists(driverPath))
{
driverPath = ChromeDriverManager.SetupChromeDriverAsync().GetAwaiter().GetResult();
}
_service = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), Path.GetFileName(driverPath));
_service.HideCommandPromptWindow = true;
var options = new ChromeOptions();
options.AddArgument("--no-sandbox");
options.AddArgument("--disable-dev-shm-usage");
options.AddArgument("--disable-gpu");
options.AddArgument("--window-size=640,700");
options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddExcludedArgument("enable-automation");
options.AddAdditionalOption("useAutomationExtension", false);
_driver = new ChromeDriver(_service, options);
((IJavaScriptExecutor)_driver).ExecuteScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
// 동기적으로 실행 (권장하지 않음)
StartDriverAsync(showBrowser).GetAwaiter().GetResult();
}
catch (Exception ex)
{
Console.WriteLine($"StartDriver 실패: {ex.Message}");
throw;
}
}
@@ -259,6 +288,45 @@ namespace BokBonCheck
}
}
public async Task StartDriverAsync(bool showdriver = false)
{
if (_driver == null)
{
try
{
// ChromeDriverManager를 사용하여 안정적으로 드라이버 설정
var driverPath = await ChromeDriverManager.SetupChromeDriverAsync();
// ChromeDriver 서비스 생성
_service = ChromeDriverService.CreateDefaultService(Path.GetDirectoryName(driverPath), Path.GetFileName(driverPath));
_service.HideCommandPromptWindow = true;
// 안정적인 Chrome 옵션 가져오기 (브라우저 창 숨김)
var options = ChromeDriverManager.CreateBaseChromeOptions(!showdriver);
// 추가 보안 및 안정성 옵션
options.AddArgument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36");
options.AddArgument("--disable-blink-features=AutomationControlled");
options.AddExcludedArgument("enable-automation");
options.AddAdditionalOption("useAutomationExtension", false);
// ChromeDriver 생성
_driver = new ChromeDriver(_service, options);
// 웹드라이버 감지 방지
((IJavaScriptExecutor)_driver).ExecuteScript("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})");
Console.WriteLine("NamguLibrarySearcher ChromeDriver 초기화 완료");
}
catch (Exception ex)
{
Console.WriteLine($"ChromeDriver 초기화 실패: {ex.Message}");
throw new InvalidOperationException($"ChromeDriver 초기화에 실패했습니다: {ex.Message}", ex);
}
}
}
virtual protected bool SelectLibrary(WebDriverWait wait)
{
@@ -330,8 +398,11 @@ namespace BokBonCheck
try
{
// 드라이버가 없으면 자동으로 시작
if (_driver == null)
throw new InvalidOperationException("드라이버가 시작되지 않았습니다. StartDriver()를 먼저 호출하세요.");
{
await StartDriverAsync();
}
_driver.Navigate().GoToUrl(SiteUrl);
@@ -347,7 +418,7 @@ namespace BokBonCheck
//}
//대상도서관 선택
if(SelectLibrary(wait)==false)
if (SelectLibrary(wait) == false)
{
result.ErrorMessage = "도서관선택실패";
result.BookCount = -1;
@@ -496,7 +567,7 @@ namespace BokBonCheck
var match = System.Text.RegularExpressions.Regex.Match(text, @"전체\s*(\d+)");
if (match.Success)
{
if(int.TryParse(match.Groups[1].Value,out int vqty)==false)
if (int.TryParse(match.Groups[1].Value, out int vqty) == false)
{
errmessage = $"수량값오류({match.Groups[1].Value})";
return -1;
@@ -521,7 +592,7 @@ namespace BokBonCheck
}
}
// 페이지 변경을 감지하는 메서드
public async Task WaitForPageChange(WebDriverWait wait)
@@ -540,9 +611,22 @@ namespace BokBonCheck
// 방법 5: 특정 텍스트가 페이지에 나타날 때까지 대기
wait.Until(d =>
{
var pageText = d.FindElement(By.ClassName("search-result")).Text;
if (pageText.Contains("검색결과가 없습니다")) return true;
return pageText.Contains("에 대하여") && pageText.Contains("검색되었습니다");
try
{
var byclassname = By.ClassName("search-result");
var elm = d.FindElement(byclassname);
if (elm == null)
{
return false;
}
var pageText = elm.Text;
if (pageText.Contains("검색결과가 없습니다")) return true;
return pageText.Contains("에 대하여") && pageText.Contains("검색되었습니다");
}
catch
{
return false;
}
});
}

View File

@@ -63,7 +63,7 @@ namespace WindowsFormsApp1
else
dataGridView.Sort(dataGridView.Columns[col], System.ComponentModel.ListSortDirection.Ascending);
}
/// <summary>
/// * Row헤더에 체크박스를 넣는 기능*
@@ -99,7 +99,7 @@ namespace WindowsFormsApp1
}
private void datagridview_checkBox_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow r in ((DataGridView)sender).Rows)
foreach(DataGridViewRow r in ((DataGridView)sender).Rows)
{
r.Cells["colCheck"].Value = ((CheckBox)sender).Checked;
}
@@ -127,8 +127,8 @@ namespace WindowsFormsApp1
//텝 공백 문자열 동시에 사용하여 분류
// stringInClipboard= stringInClipboard.Replace("\r", "");
if (stringInClipboard == null) return;
List<string> rowsInClipboard = stringInClipboard.Split(rowSpliteter, StringSplitOptions.None).ToList();
rowsInClipboard.RemoveAt(rowsInClipboard.Count - 1);
List<string>rowsInClipboard = stringInClipboard.Split(rowSpliteter, StringSplitOptions.None).ToList();
rowsInClipboard.RemoveAt(rowsInClipboard.Count-1);
//get the row and column of selected cell in dataGridView1
int r = ((DataGridView)sender).SelectedCells[0].RowIndex;
int c = ((DataGridView)sender).SelectedCells[0].ColumnIndex;
@@ -209,7 +209,7 @@ namespace WindowsFormsApp1
private Rectangle dragBoxFromMouseDown;
private int rowIndexFromMouseDown;
private int rowIndexOfItemUnderMouseToDrop;
public void MouseMove(object sender, MouseEventArgs e)
{
DataGridView dataGridView = sender as DataGridView;
@@ -292,8 +292,7 @@ namespace WindowsFormsApp1
string[] db_data = db_res1.Split('|');
string[] db_pur = db_res2.Split('|');
if (db_res1.Length < 3)
{
if (db_res1.Length < 3) {
MessageBox.Show("DB호출 에러!", "Error");
return "False";
}
@@ -301,26 +300,20 @@ namespace WindowsFormsApp1
string fax = string.Empty;
string emchk = string.Empty;
if (db_pur.Length > 3)
{
for (int a = 0; a < db_pur.Length; a++)
if (db_pur.Length > 3) {
for(int a= 0; a < db_pur.Length; a++)
{
if (a % 3 == 0)
{ // 전화번호
if (db_pur[a] != "")
{
if (a % 3 == 0) { // 전화번호
if (db_pur[a] != "") {
tel = db_pur[a];
}
}
if (a % 3 == 1)
{ // 팩스
if (db_pur[a] != "")
{
if (a % 3 == 1) { // 팩스
if (db_pur[a] != "") {
fax = db_pur[a];
}
}
if (a % 3 == 2)
{ // 팩스 이메일 체크
if (a % 3 == 2) { // 팩스 이메일 체크
emchk = db_pur[a];
}
}
@@ -408,7 +401,7 @@ namespace WindowsFormsApp1
#region / (4)
rng = ws.Range["A4", "C4"];
rng.MergeCells = true;
rng.Value2 = "주문일자 : " + DateTime.Now.ToString("yyyy-MM-dd H:m:ss");
rng.Value2 = "주문일자 : "+DateTime.Now.ToString("yyyy-MM-dd H:m:ss");
rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft;
rng.Font.Bold = true;
@@ -502,7 +495,7 @@ namespace WindowsFormsApp1
#region
endcount++;
string = "D" + endcount.ToString();
string = "D"+endcount.ToString();
rng = ws.Range["A" + endcount, "C" + endcount];
rng.MergeCells = true;
@@ -558,7 +551,7 @@ namespace WindowsFormsApp1
rng2.Font.Bold = true;
////////
rng = ws.Range[, "D" + endcount];
rng = ws.Range[, "D"+endcount];
rng.MergeCells = true;
rng.Value2 = "발 송 처";
rng.Font.Bold = true;
@@ -587,10 +580,10 @@ namespace WindowsFormsApp1
application.Interactive = true;
application.Quit();
return FileName;
}
catch (Exception e)
catch(Exception e)
{
MessageBox.Show(e.ToString());
return "False";
@@ -637,9 +630,9 @@ namespace WindowsFormsApp1
private string Excel_Sub(string[] data)
{
string[] length = {
"1", "2", "3", "4", "5",
"6", "7", "8", "9", "10",
"11", "12", "13", "14", "15",
"1", "2", "3", "4", "5",
"6", "7", "8", "9", "10",
"11", "12", "13", "14", "15",
"16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26"
};
@@ -653,8 +646,8 @@ namespace WindowsFormsApp1
string count = data.Length.ToString();
string res = string.Empty;
for (int a = 0; a < length.Length; a++)
for(int a = 0; a < length.Length; a++)
{
if (length[a] == count)
{
@@ -665,7 +658,7 @@ namespace WindowsFormsApp1
}
#endregion
}
public class Helper_Print
public class Helper_Print
{
/// <summary>
/// 행의 갯수
@@ -795,7 +788,7 @@ namespace WindowsFormsApp1
/// <param name="file_name"></param>
/// <param name="fax_param">[0] 발신번호 / [1] 수신번호
/// / [2] 수신자 회사명 / [3 ]수신자명 </param>
public string Send_BaroFax(string file_name, string[] fax_param)
public string Send_BaroFax(string file_name, string[] fax_param )
{
BaroService_FAXSoapClient fAXSoapClient = new BaroService_FAXSoapClient();
@@ -831,7 +824,7 @@ namespace WindowsFormsApp1
BaroService_FAXSoapClient fAXSoapClient = new BaroService_FAXSoapClient();
// 수신자회사명, 수신번호, 전송일시, 전송결과, 전송페이지수, 성공페이지수, 전송파일명
string[] MsgBox_Array = {
string[] MsgBox_Array = {
fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).ReceiveCorp,
fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).ReceiverNum,
fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SendDT,
@@ -1197,9 +1190,9 @@ namespace WindowsFormsApp1
public bool IsConnected { get; set; }
private string ipAddr = string.Empty;
private string Port = string.Empty;
private string Port = string.Empty;
private string userId = string.Empty;
private string Pwd = string.Empty;
private string Pwd = string.Empty;
public FTP() { }
@@ -1226,7 +1219,7 @@ namespace WindowsFormsApp1
using (ftpRequest.GetResponse()) { }
this.IsConnected = true;
}
catch (Exception ex)
catch(Exception ex)
{
this.LastException = ex;
System.Reflection.MemberInfo info = System.Reflection.MethodInfo.GetCurrentMethod();
@@ -1295,7 +1288,7 @@ namespace WindowsFormsApp1
buff = null;
}
}
catch (Exception ex)
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
this.LastException = ex;
@@ -1399,14 +1392,14 @@ namespace WindowsFormsApp1
if (reader != null) reader.Close();
foreach (string file in result.ToString().Split('\n'))
foreach(string file in result.ToString().Split('\n'))
{
resultList.Add(file);
}
}
return resultList;
}
catch (Exception ex)
catch(Exception ex)
{
this.LastException = ex;
@@ -1427,12 +1420,12 @@ namespace WindowsFormsApp1
try
{
foreach (string tmpFolder in arrDir)
foreach(string tmpFolder in arrDir)
{
try
{
if (tmpFolder == string.Empty) continue;
currentDir += @"/" + tmpFolder;
string url = string.Format(@"FTP://{0}:{1}/{2}", this.ipAddr, this.Port, currentDir);
@@ -1460,11 +1453,9 @@ namespace WindowsFormsApp1
private void checkDir(string localFullPathFile)
{
FileInfo finfo = new FileInfo(localFullPathFile);
if (!finfo.Exists)
{
if (!finfo.Exists) {
DirectoryInfo dInfo = new DirectoryInfo(finfo.DirectoryName);
if (!dInfo.Exists)
{
if (!dInfo.Exists) {
dInfo.Create();
}
}
@@ -1561,35 +1552,30 @@ namespace WindowsFormsApp1
int tDown = 0;
for (int a = 0; a < array_text.Count; a++)
{
// if (array_text[a] == "") continue;
// if (array_text[a] == "") continue;
num.Add(array_text[a].Substring(0, 3));
if (array_text[a][5] == '▼')
{
if (array_text[a][5] == '▼') {
array_text[a] = array_text[a].Remove(0, 3);
}
else
{
else {
array_text[a] = array_text[a].Remove(0, 5);
}
+= array_text[a] + "\n";
int textLength = 0;
if (EncodingType == "UTF-8")
{
if (EncodingType == "UTF-8") {
textLength = Encoding.UTF8.GetBytes(array_text[a]).Length
- WordCheck(array_text[a], "▲")
- WordCheck(array_text[a], "▼");
}
else if (EncodingType == "UniCode")
{
else if (EncodingType == "UniCode") {
textLength = Encoding.Unicode.GetBytes(array_text[a]).Length
- WordCheck(array_text[a], "▲")
- WordCheck(array_text[a], "▼");
}
else
{ // ANSI
else { // ANSI
textLength = Encoding.Default.GetBytes(array_text[a]).Length
- WordCheck(array_text[a], "▲")
- WordCheck(array_text[a], "▼");
@@ -1601,13 +1587,12 @@ namespace WindowsFormsApp1
for (int a = 0; a < array_text.Count; a++)
{
if (a == 0)
{ //total.Add("0");
if (a == 0) { //total.Add("0");
tTotal.Add(0);
}
else
{
// total.Add(total[a - 1] + count[a - 1]);
// total.Add(total[a - 1] + count[a - 1]);
tTotal.Add(tTotal[a - 1] + tCount[a - 1]);
}
//else if (a == 1)
@@ -1624,7 +1609,7 @@ namespace WindowsFormsApp1
// else c = Convert.ToInt32(Encoding.Default.GetBytes(array_text[a - 2]).Length.ToString()) - WordCheck(array_text[a - 2], "▲") - WordCheck(array_text[a - 2], "▼");
// int res = b + c;
// total.Add(res.ToString());
}
string[] str_num = num.ToArray();
@@ -1641,7 +1626,7 @@ namespace WindowsFormsApp1
// else if (total[a].Length == 2) { total[a] = total[a].Insert(0, "000"); }
// else if (total[a].Length == 1) { total[a] = total[a].Insert(0, "0000"); }
// 디렉토리 += str_num[a] + count[a] + total[a] + "\n";
+= str_num[a] + tCount[a].ToString().PadLeft(4, '0') + tTotal[a].ToString().PadLeft(5, '0');
+= str_num[a] + tCount[a].ToString().PadLeft(4, '0') + tTotal[a].ToString().PadLeft(5, '0');
}
string[] = { "00000","n", "a", "m", " ",
@@ -1657,11 +1642,11 @@ namespace WindowsFormsApp1
string dp = + ;
int recode = 0;
if (EncodingType == "UTF-8") recode = Encoding.UTF8.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
if (EncodingType == "UTF-8") recode = Encoding.UTF8.GetBytes(dp).Length- WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
else if (EncodingType == "UniCode") recode = Encoding.Unicode.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
else recode = Encoding.Default.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
else recode = Encoding.Default.GetBytes(dp).Length- WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
[0] = insert_Zero(recode + 24, 5);
int data_addr = 24 + Encoding.Default.GetBytes().Length - WordCheck(, "▲");
@@ -1708,7 +1693,7 @@ namespace WindowsFormsApp1
return result;
}
#endregion
/// <summary>
/// 추가하고 싶은 태그를 뷰형태의 마크에 추가하는 함수.
@@ -1721,7 +1706,7 @@ namespace WindowsFormsApp1
if (Tag.Length < 3) return "";
int TargetTagNum = Convert.ToInt32(Tag.Substring(0, 3));
string[] SplitView = TypeView.Split('\n');
List<string> View = new List<string>(SplitView);
@@ -1746,9 +1731,9 @@ namespace WindowsFormsApp1
/// <param name="pAddTag">추가할 태그 (태그명\t지시기호\t태그내용)</param>
/// <param name="pTargetData">뷰형태의 마크</param>
/// <returns></returns>
public string AddTagInMarc(int pTargetTagNum, string pAddTag, string pTargetData)//TagTarget Num 을 찾아서 있을경우는 해당 Tag 데이터를 전송, 없을경우는 신규로 해야함.
public string AddTagInMarc(int pTargetTagNum,string pAddTag, string pTargetData)//TagTarget Num 을 찾아서 있을경우는 해당 Tag 데이터를 전송, 없을경우는 신규로 해야함.
{
if (pAddTag.Length < 3) return "";
string tRet = pTargetData;
// ex ) 020 : ~~~ 에 XXXX 내용줄 뒤에 추가
@@ -1842,7 +1827,7 @@ namespace WindowsFormsApp1
}
}
}
}
}
else
{// 기존 태그 변경
int endIdx = SplitView[a].IndexOf("▼", startIdx + 1);
@@ -1921,7 +1906,7 @@ namespace WindowsFormsApp1
/// <param name="marc">마크 데이터</param>
/// <param name="search">추출할 함수(배열)</param>
/// <returns></returns>
public string[] Take_Tag(string marc, string[] search, bool pSearchTag = false)
public string[] Take_Tag(string marc, string[] search,bool pSearchTag = false)
{
string[] ary = marc.Split('');
string[] tag = res_dir(ary[0].Substring(24));
@@ -1973,7 +1958,7 @@ namespace WindowsFormsApp1
//memo = result[b];
start += 2;
int end = -1;
if (tmp.Length > 1) end = tmp.IndexOf("", start);
if (tmp.Length > 1) end=tmp.IndexOf("", start);
if (memo == result[b])
break;
@@ -2203,8 +2188,7 @@ namespace WindowsFormsApp1
/// <param name="e">EventArgs</param>
public void Int_Comma(object sender, EventArgs e)
{
if (((TextBox)sender).Text != "")
{
if (((TextBox)sender).Text != "") {
string text;
text = ((TextBox)sender).Text.Replace(",", "");
((TextBox)sender).Text = String.Format("{0:#,###}", Convert.ToInt32(text));
@@ -2220,7 +2204,7 @@ namespace WindowsFormsApp1
public bool isContainHangul(string value)
{
char[] charArr = value.ToCharArray();
foreach (char c in charArr)
foreach(char c in charArr)
{
if (char.GetUnicodeCategory(c) == System.Globalization.UnicodeCategory.OtherLetter)
return true;
@@ -2237,7 +2221,7 @@ namespace WindowsFormsApp1
public bool CheckString(string value, string chkString)
{
int index = value.IndexOf(chkString);
if (index < 0)
if (index < 0)
return false;
return true;
@@ -2280,10 +2264,10 @@ namespace WindowsFormsApp1
public class API
{
public string CheckString(string pText, string pStr)
public string CheckString(string pText,string pStr)
{
string tRet = pText;
Regex reg = new Regex(@"([\" + pStr + "]+)" + @"[가-힣]+");//+ @"([\>]+)");//new Regex(@"([\<]+)"+ @"[ㄱ-ㅎ가-힣]+"+@"([\>]+)");
Regex reg = new Regex(@"([\"+pStr+"]+)" + @"[가-힣]+");//+ @"([\>]+)");//new Regex(@"([\<]+)"+ @"[ㄱ-ㅎ가-힣]+"+@"([\>]+)");
MatchCollection tMatch = reg.Matches(tRet);
for (int i = 0; i < tMatch.Count; i++)
{
@@ -2342,9 +2326,8 @@ namespace WindowsFormsApp1
xml = CheckString(xml, "〈");
doc.LoadXml(xml);
}
catch (Exception ex)
{
return "";
catch (Exception ex){
return "";
}
var json = JsonConvert.SerializeXmlNode(doc);
@@ -2537,23 +2520,19 @@ namespace WindowsFormsApp1
{
if (length == 1)
{
try
{
try {
tmp_data.Add(docs[Param[b]]["#text"]);
}
catch (KeyNotFoundException e)
{
catch (KeyNotFoundException e) {
tmp_data.Add("");
}
}
else
{
try
{
try {
tmp_data.Add(docs[a][Param[b]]["#text"]);
}
catch (KeyNotFoundException e)
{
catch (KeyNotFoundException e) {
tmp_data.Add("");
}
}
@@ -2670,8 +2649,8 @@ namespace WindowsFormsApp1
return dialogResult;
}
}
public class PrintLine
{
public class PrintLine
{
string num { get; set; }
string count { get; set; }
string list_name { get; set; }
@@ -2982,11 +2961,11 @@ namespace WindowsFormsApp1
}
public string VersionInfo()
{
string version = "";
var updatefile = $"{Application.StartupPath}\\update.inf";
if (System.IO.File.Exists(updatefile))
string version = "0";
var fn = Application.StartupPath + "\\update.inf";
if(System.IO.File.Exists(fn))
{
StreamReader sr = new StreamReader(updatefile);
StreamReader sr = new StreamReader(fn);
while (!sr.EndOfStream)
{
string line = sr.ReadLine();
@@ -2997,7 +2976,7 @@ namespace WindowsFormsApp1
}
}
}
else version = "0";
return version;
}
}

View File

@@ -36,7 +36,7 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
@@ -78,8 +78,8 @@
<ApplicationIcon>UniMarc.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="AngleSharp, Version=1.0.4.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">
<HintPath>..\packages\AngleSharp.1.0.4\lib\net472\AngleSharp.dll</HintPath>
<Reference Include="AngleSharp, Version=1.3.0.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">
<HintPath>..\packages\AngleSharp.1.3.0\lib\net472\AngleSharp.dll</HintPath>
</Reference>
<Reference Include="arCommUtil">
<HintPath>..\dll\arCommUtil.dll</HintPath>
@@ -90,34 +90,34 @@
<Reference Include="ArLog.Net4">
<HintPath>..\dll\ArLog.Net4.dll</HintPath>
</Reference>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.1\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
</Reference>
<Reference Include="CarlosAg.ExcelXmlWriter">
<HintPath>..\dll\CarlosAg.ExcelXmlWriter.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.4.2.13, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.4.2\lib\netstandard2.0\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.3\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Microsoft.Web.WebView2.Core, Version=1.0.3351.48, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3351.48\lib\net462\Microsoft.Web.WebView2.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.WinForms, Version=1.0.3351.48, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3351.48\lib\net462\Microsoft.Web.WebView2.WinForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.WebView2.Wpf, Version=1.0.3351.48, Culture=neutral, PublicKeyToken=2a8ab48044d2601e, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Web.WebView2.1.0.3351.48\lib\net462\Microsoft.Web.WebView2.Wpf.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Renci.SshNet, Version=2020.0.1.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll</HintPath>
<Reference Include="Renci.SshNet, Version=2025.0.0.1, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
<HintPath>..\packages\SSH.NET.2025.0.0\lib\net462\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
@@ -125,6 +125,9 @@
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Formats.Asn1, Version=8.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Formats.Asn1.8.0.2\lib\net462\System.Formats.Asn1.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
@@ -143,14 +146,14 @@
<HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="System.Text.Encoding.CodePages, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.6.0.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
<Reference Include="System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encoding.CodePages.8.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll</HintPath>
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
@@ -170,13 +173,13 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WebDriver, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Selenium.WebDriver.4.16.2\lib\netstandard2.0\WebDriver.dll</HintPath>
<HintPath>..\packages\Selenium.WebDriver.4.34.0\lib\netstandard2.0\WebDriver.dll</HintPath>
</Reference>
<Reference Include="WebDriver.Support, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Selenium.Support.4.16.2\lib\netstandard2.0\WebDriver.Support.dll</HintPath>
<HintPath>..\packages\Selenium.Support.4.34.0\lib\netstandard2.0\WebDriver.Support.dll</HintPath>
</Reference>
<Reference Include="WebDriverManager, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WebDriverManager.2.17.1\lib\net462\WebDriverManager.dll</HintPath>
<Reference Include="WebDriverManager, Version=2.17.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\WebDriverManager.2.17.6\lib\net472\WebDriverManager.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -191,7 +194,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Reference.svcmap</DependentUpon>
</Compile>
<Compile Include="CUtill.cs" />
<Compile Include="PUB.cs" />
<Compile Include="SearchModel\BookSearchService.cs" />
<Compile Include="SearchModel\ChromeDriverManager.cs" />
<Compile Include="SearchModel\DownloadProgressForm.cs">
@@ -200,7 +203,6 @@
<Compile Include="SearchModel\ILibrarySearcher.cs" />
<Compile Include="SearchModel\KwangjuCityLibrarySearcher.cs" />
<Compile Include="SearchModel\NamguLibrarySearcher.cs" />
<Compile Include="WebView2Installer.cs" />
<Compile Include="마스터\From_User_manage_List.cs">
<SubType>Form</SubType>
</Compile>
@@ -1954,13 +1956,11 @@
<Content Include="Resources\3_2_2_편목.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Selenium.WebDriver.4.16.2\build\Selenium.WebDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.4.16.2\build\Selenium.WebDriver.targets')" />
<Import Project="..\packages\Selenium.WebDriver.4.34.0\build\Selenium.WebDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.4.34.0\build\Selenium.WebDriver.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Selenium.WebDriver.4.16.2\build\Selenium.WebDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.4.16.2\build\Selenium.WebDriver.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\packages\Selenium.WebDriver.4.34.0\build\Selenium.WebDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.4.34.0\build\Selenium.WebDriver.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.3351.48\build\Microsoft.Web.WebView2.targets')" />
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory>E:\UniMarcApplicationUpdateFiles\|ftp://ftpgloria%401.215.250.130/|ftp://ftpgloria%401.215.250.130:50005/|sftp://ftpgloria%401.215.250.130/|ftp://ftpgloria%401.215.250.130/unimarc/</PublishUrlHistory>

View File

@@ -1,510 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Web.WebView2.Core;
namespace WindowsFormsApp1
{
public static class WebView2Installer
{
// Fixed Version 다운로드 URL (CAB 파일 사용)
private const string WEBVIEW2_FIXED_VERSION_URL = "https://msedge.sf.dl.delivery.mp.microsoft.com/filestreamingservice/files/759b508a-00bb-4724-9b87-2703c8417737/Microsoft.WebView2.FixedVersionRuntime.139.0.3405.86.x86.cab";
private const string INSTALLER_FILENAME = "Microsoft.WebView2.FixedVersionRuntime.139.0.3405.86.x86.cab";
// Fixed Version 런타임을 애플리케이션 폴더에 배치할 경로
private const string FIXED_VERSION_FOLDER = "WebView2Runtime";
/// <summary>
/// WebView2 Fixed Version 환경을 준비 (항상 Fixed Version 사용)
/// </summary>
public static async Task<CoreWebView2Environment> GetWebView2EnvironmentAsync()
{
try
{
// 일관성을 위해 항상 Fixed Version 사용
string fixedVersionPath = GetFixedVersionPath();
// Fixed Version 런타임이 이미 있는지 확인
string actualRuntimePath = FindActualRuntimePath(fixedVersionPath);
if (!string.IsNullOrEmpty(actualRuntimePath))
{
try
{
// Fixed Version 사용 시 환경 옵션 명시적 지정
string userDataFolder = Path.Combine(Application.StartupPath, "WebView2UserData");
// 사용자 데이터 폴더 생성
if (!Directory.Exists(userDataFolder))
{
Directory.CreateDirectory(userDataFolder);
}
// 런타임 버전 정보 확인
try
{
string version = CoreWebView2Environment.GetAvailableBrowserVersionString(actualRuntimePath);
}
catch (Exception verEx)
{
MessageBox.Show(
$"런타임 버전 확인 실패:\n\n" +
$"경로: {actualRuntimePath}\n" +
$"오류: {verEx.Message}",
"버전 확인 오류",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
}
return await CoreWebView2Environment.CreateAsync(actualRuntimePath, userDataFolder);
}
catch (WebView2RuntimeNotFoundException ex)
{
MessageBox.Show(
$"WebView2 환경 생성 실패!\n\n" +
$"런타임 경로: {actualRuntimePath}\n" +
$"오류: {ex.Message}\n\n" +
$"런타임을 다시 다운로드합니다.",
"WebView2 환경 오류",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
// 기존 런타임 폴더 삭제 후 재다운로드
try
{
Directory.Delete(fixedVersionPath, true);
}
catch { }
}
}
// Fixed Version 런타임 다운로드 및 배치
bool success = await DownloadFixedVersionRuntime();
if (success)
{
actualRuntimePath = FindActualRuntimePath(fixedVersionPath);
if (!string.IsNullOrEmpty(actualRuntimePath))
{
try
{
// 다운로드 후 환경 생성 시도 (Fixed Version)
string userDataFolder = Path.Combine(Application.StartupPath, "WebView2UserData");
// 사용자 데이터 폴더 생성
if (!Directory.Exists(userDataFolder))
{
Directory.CreateDirectory(userDataFolder);
}
var environment = await CoreWebView2Environment.CreateAsync(actualRuntimePath, userDataFolder);
return environment;
}
catch (WebView2RuntimeNotFoundException ex)
{
MessageBox.Show(
$"다운로드 후에도 WebView2 환경 생성 실패!\n\n" +
$"런타임 경로: {actualRuntimePath}\n" +
$"오류: {ex.Message}\n\n" +
$"해당 경로의 파일들을 확인해주세요.",
"WebView2 환경 생성 최종 실패",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
throw;
}
}
else
{
MessageBox.Show(
$"다운로드는 완료되었지만 유효한 런타임 경로를 찾을 수 없습니다.\n\n" +
$"기본 경로: {fixedVersionPath}",
"런타임 경로 탐색 실패",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
}
throw new Exception("WebView2 Fixed Version 런타임을 사용할 수 없습니다.");
}
catch (Exception ex)
{
MessageBox.Show(
$"WebView2 Fixed Version 환경 준비 중 오류가 발생했습니다: {ex.Message}",
"오류",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
throw;
}
}
/// <summary>
/// Fixed Version 런타임 경로 반환
/// </summary>
private static string GetFixedVersionPath()
{
string appPath = Application.StartupPath;
return Path.Combine(appPath, FIXED_VERSION_FOLDER);
}
/// <summary>
/// 실제 WebView2 런타임 폴더 경로를 찾는 메서드
/// </summary>
private static string FindActualRuntimePath(string basePath)
{
try
{
if (!Directory.Exists(basePath))
return null;
// WebView2 런타임의 주요 파일들 (우선순위대로)
string targetFiles = "msedgewebview2.exe";
var targetfi = new System.IO.FileInfo(System.IO.Path.Combine(basePath, targetFiles));
if(targetfi.Exists) return targetfi.Directory.FullName;
//루트에 없었으니 서브폴더에서 찾는다
foreach(var subdir in targetfi.Directory.GetDirectories())
{
var fi = new System.IO.FileInfo(System.IO.Path.Combine(subdir.FullName, targetFiles));
if (fi.Exists) return fi.Directory.FullName;
}
return null;
}
catch (Exception ex)
{
// 디버깅을 위한 예외 정보 출력
MessageBox.Show(
$"FindActualRuntimePath 오류:\n{ex.Message}\n\n기본 경로: {basePath}",
"런타임 경로 탐색 오류",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
return null;
}
}
/// <summary>
/// 서브디렉토리에서 WebView2 런타임 파일 검색
/// </summary>
private static string SearchInSubDirectories(string currentPath, string[] targetFiles, int currentDepth, int maxDepth)
{
if (currentDepth >= maxDepth || !Directory.Exists(currentPath))
return null;
try
{
// 현재 경로의 모든 서브디렉토리 검색
foreach (string subDir in Directory.GetDirectories(currentPath))
{
// 각 대상 파일을 해당 서브디렉토리에서 확인
foreach (string targetFile in targetFiles)
{
string fullPath = Path.Combine(subDir, targetFile);
if (File.Exists(fullPath))
{
string candidatePath;
// EBWebView 하위 파일인 경우 해당 디렉토리 반환
if (targetFile.Contains("\\"))
{
candidatePath = Path.Combine(subDir, Path.GetDirectoryName(targetFile));
}
else
{
candidatePath = subDir;
}
// 런타임 유효성 검증
if (ValidateWebView2Runtime(candidatePath))
{
return candidatePath;
}
}
}
// 재귀적으로 더 깊은 폴더 검색
string result = SearchInSubDirectories(subDir, targetFiles, currentDepth + 1, maxDepth);
if (!string.IsNullOrEmpty(result))
return result;
}
return null;
}
catch
{
return null;
}
}
/// <summary>
/// WebView2 런타임이 유효한지 검증
/// </summary>
private static bool ValidateWebView2Runtime(string runtimePath)
{
try
{
if (string.IsNullOrEmpty(runtimePath) || !Directory.Exists(runtimePath))
return false;
// 필수 파일들 체크
string[] requiredFiles = {
"msedgewebview2.exe",
"WebView2Loader.dll"
};
foreach (string file in requiredFiles)
{
if (!File.Exists(Path.Combine(runtimePath, file)))
{
return false;
}
}
return true;
}
catch
{
return false;
}
}
/// <summary>
/// Fixed Version WebView2 런타임 다운로드 및 배치
/// </summary>
private static async Task<bool> DownloadFixedVersionRuntime()
{
try
{
var fi = new System.IO.FileInfo(Path.Combine(".\\Temp", INSTALLER_FILENAME));
if (fi.Directory.Exists == false) fi.Directory.Create();
string extractPath = GetFixedVersionPath();
// 진행상황 표시 폼
var progressForm = new Form()
{
Text = "WebView2 런타임 다운로드",
Size = new System.Drawing.Size(400, 120),
FormBorderStyle = FormBorderStyle.FixedDialog,
StartPosition = FormStartPosition.CenterScreen,
MaximizeBox = false,
MinimizeBox = false,
//TopMost = true,
};
var progressBar = new ProgressBar()
{
Location = new System.Drawing.Point(20, 20),
Size = new System.Drawing.Size(340, 23),
Style = ProgressBarStyle.Continuous
};
var statusLabel = new Label()
{
Location = new System.Drawing.Point(20, 50),
Size = new System.Drawing.Size(340, 20),
Text = "다운로드 준비 중..."
};
progressForm.Controls.Add(progressBar);
progressForm.Controls.Add(statusLabel);
progressForm.Show();
if (System.IO.File.Exists(fi.FullName) == false)
{
// 다운로드
using (var client = new WebClient())
{
client.DownloadProgressChanged += (s, e) =>
{
progressBar.Value = e.ProgressPercentage;
statusLabel.Text = $"다운로드 중... {e.ProgressPercentage}%";
Application.DoEvents();
};
await client.DownloadFileTaskAsync(WEBVIEW2_FIXED_VERSION_URL, fi.FullName);
}
}
statusLabel.Text = "CAB 파일 압축 해제 중...";
progressBar.Style = ProgressBarStyle.Marquee;
Application.DoEvents();
// CAB 파일 압축 해제를 위한 경로 생성
if (!Directory.Exists(extractPath))
{
Directory.CreateDirectory(extractPath);
}
// Windows expand 명령어를 사용하여 CAB 파일 압축 해제
bool extractSuccess = await ExtractCabFileAsync(fi.FullName, extractPath);
statusLabel.Text = "런타임 경로 확인 중...";
Application.DoEvents();
if (!extractSuccess)
{
progressForm.Close();
throw new Exception("CAB 파일 압축 해제에 실패했습니다.");
}
// 실제 런타임 경로 확인
string actualPath = FindActualRuntimePath(extractPath);
if (string.IsNullOrEmpty(actualPath))
{
progressForm.Close();
throw new Exception("압축 해제는 완료되었지만 WebView2 런타임을 찾을 수 없습니다.");
}
statusLabel.Text = "설정 완료 중...";
Application.DoEvents();
// 잠시 대기 후 폼 닫기
await Task.Delay(500);
progressForm.Close();
return Directory.Exists(extractPath);
}
catch (Exception ex)
{
MessageBox.Show(
$"WebView2 런타임 준비 중 오류가 발생했습니다: {ex.Message}",
"오류",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
return false;
}
}
/// <summary>
/// CAB 파일을 압축 해제하는 메서드
/// </summary>
private static async Task<bool> ExtractCabFileAsync(string cabFilePath, string extractPath)
{
try
{
//// 디버깅 정보 표시
//MessageBox.Show(
// $"CAB 압축 해제 시작\n\n" +
// $"CAB 파일: {cabFilePath}\n" +
// $"압축 해제 경로: {extractPath}\n" +
// $"CAB 파일 존재: {File.Exists(cabFilePath)}\n" +
// $"CAB 파일 크기: {(File.Exists(cabFilePath) ? new FileInfo(cabFilePath).Length.ToString("N0") + " bytes" : "파일 없음")}",
// "디버깅 정보",
// MessageBoxButtons.OK,
// MessageBoxIcon.Information
//);
// Windows expand 명령어를 사용하여 CAB 파일 압축 해제
var startInfo = new ProcessStartInfo("expand.exe")
{
Arguments = $"\"{cabFilePath}\" -F:* \"{extractPath}\"",
UseShellExecute = false,
CreateNoWindow = true, // 콘솔 창 보이게 설정
RedirectStandardOutput = false, // 출력 리다이렉션 해제
RedirectStandardError = false // 에러 리다이렉션 해제
};
using (var process = Process.Start(startInfo))
{
// 최대 30초 대기
bool exited = await Task.Run(() => process.WaitForExit(30000));
if (!exited)
{
// 프로세스가 30초 내에 완료되지 않으면 강제 종료
try
{
process.Kill();
}
catch { }
return false;
}
// 압축 해제 성공 여부 확인
bool success = process.ExitCode == 0;
if (success == false)
{
try
{
System.IO.File.Delete(cabFilePath);
}
catch (Exception ex)
{
Console.WriteLine("remove cab file : " + ex.Message);
}
}
// 실제 런타임 파일이 있는지 확인
if (success)
{
string actualPath = FindActualRuntimePath(extractPath);
success = !string.IsNullOrEmpty(actualPath);
// 런타임을 찾지 못한 경우 디버깅 정보 표시
if (!success)
{
string[] extractedFiles = Directory.Exists(extractPath) ? Directory.GetFiles(extractPath, "*", SearchOption.AllDirectories) : new string[0];
string[] extractedDirs = Directory.Exists(extractPath) ? Directory.GetDirectories(extractPath, "*", SearchOption.AllDirectories) : new string[0];
MessageBox.Show(
$"WebView2 런타임 파일을 찾을 수 없습니다!\n\n" +
$"압축 해제 경로: {extractPath}\n" +
$"압축 해제된 파일 수: {extractedFiles.Length}\n" +
$"압축 해제된 폴더 수: {extractedDirs.Length}\n\n" +
$"상위 5개 파일:\n{string.Join("\n", extractedFiles.Take(5))}\n\n" +
$"모든 폴더:\n{string.Join("\n", extractedDirs)}",
"런타임 파일 탐색 실패",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
}
}
return success;
}
}
catch (Exception)
{
return false;
}
}
/// <summary>
/// WebView2 Fixed Version 런타임 상태 정보 반환
/// </summary>
public static string GetWebView2Status()
{
try
{
string fixedVersionPath = GetFixedVersionPath();
string actualRuntimePath = FindActualRuntimePath(fixedVersionPath);
if (!string.IsNullOrEmpty(actualRuntimePath))
{
return $"WebView2 Fixed Version 런타임이 준비되어 있습니다.\n경로: {actualRuntimePath}\n버전: 139.0.3405.86";
}
else
{
return "WebView2 Fixed Version 런타임이 준비되어 있지 않습니다.";
}
}
catch (Exception ex)
{
return $"WebView2 Fixed Version 런타임 확인 실패: {ex.Message}";
}
}
}
}

View File

@@ -1,24 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AngleSharp" version="1.0.4" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
<package id="Microsoft.Web.WebView2" version="1.0.3351.48" targetFramework="net472" />
<package id="AngleSharp" version="1.3.0" targetFramework="net472" />
<package id="BouncyCastle.Cryptography" version="2.5.1" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net472" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.3" targetFramework="net472" />
<package id="Microsoft.Win32.Registry" version="5.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net472" />
<package id="Selenium.Support" version="4.16.2" targetFramework="net472" />
<package id="Selenium.WebDriver" version="4.16.2" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Selenium.Support" version="4.34.0" targetFramework="net472" />
<package id="Selenium.WebDriver" version="4.34.0" targetFramework="net472" />
<package id="SharpZipLib" version="1.4.2" targetFramework="net472" />
<package id="SSH.NET" version="2020.0.1" targetFramework="net472" />
<package id="SSH.NET" version="2025.0.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Formats.Asn1" version="8.0.2" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Security.AccessControl" version="5.0.0" targetFramework="net472" />
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net472" />
<package id="System.Text.Encoding.CodePages" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="7.0.3" targetFramework="net472" />
<package id="System.Text.Encoding.CodePages" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.5" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
<package id="WebDriverManager" version="2.17.1" targetFramework="net472" />
<package id="WebDriverManager" version="2.17.6" targetFramework="net472" />
</packages>

View File

@@ -190,7 +190,7 @@ namespace WindowsFormsApp1.Delivery
dc.lbl_ID.Text = dataGridView1.Rows[idx].Cells["DLS_ID"].Value.ToString();
dc.lbl_PW.Text = dataGridView1.Rows[idx].Cells["DLS_PW"].Value.ToString();
dc.lbl_Area.Text = dataGridView1.Rows[idx].Cells["DLS_Area"].Value.ToString();
//dc.SetArea(dataGridView1.Rows[idx].Cells["DLS_Area"].Value.ToString(), true);
dc.SetArea(dataGridView1.Rows[idx].Cells["DLS_Area"].Value.ToString(), true);
}
if (sl != null) {
sl.tb_SearchClient.Text = value;

View File

@@ -1,4 +1,5 @@
using ExcelTest;
using AR;
using ExcelTest;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -91,7 +92,7 @@ namespace UniMarc
return;
}
string tText = string.Format("{0} 를 수정 하시겠습니까?", dgvList.SelectedRows[0].Cells["comp_name"].Value.ToString());
if (CUtill.MsgQ(tText) == DialogResult.Yes)
if (UTIL.MsgQ(tText) == DialogResult.Yes)
{
CheckText();
string[] tEdit_tbl = {
@@ -121,7 +122,7 @@ namespace UniMarc
return;
}
string tText = string.Format("{0} 를 삭제 하시겠습니까?", dgvList.SelectedRows[0].Cells["comp_name"].Value.ToString());
if (CUtill.MsgQ(tText) == DialogResult.Yes)
if (UTIL.MsgQ(tText) == DialogResult.Yes)
{
string tD_cmd = mDb.DB_Delete("Comp", "idx", dgvList.SelectedRows[0].Cells["dbIDX"].Value.ToString(), "comp_name", dgvList.SelectedRows[0].Cells["comp_name"].Value.ToString());
mDb.DB_Send_CMD_reVoid(tD_cmd);

View File

@@ -335,7 +335,7 @@ namespace UniMarc.마크
// break;
//}
string UpCMD = db.More_Update(Table, EditTable, EditColumn, SearchTable, SearchColumn);
CUtill.mLog.Add("ADDMarcUPDATE", string.Format("{0}({1}) : {2}", mUserName, mCompidx, UpCMD.Replace("\r", " ").Replace("\n", " ")));
PUB.log.Add("ADDMarcUPDATE", string.Format("{0}({1}) : {2}", mUserName, mCompidx, UpCMD.Replace("\r", " ").Replace("\n", " ")));
db.DB_Send_CMD_reVoid(UpCMD);
}
#region UpdateSub
@@ -386,7 +386,7 @@ namespace UniMarc.마크
};
string InCMD = db.DB_INSERT(Table, InsertTable, InsertColumn);
CUtill.mLog.Add("ADDMarcINSERT", string.Format("{0}({1}) : {2}", mUserName, mCompidx, InCMD.Replace("\r", " ").Replace("\n", " ")));
PUB.log.Add("ADDMarcINSERT", string.Format("{0}({1}) : {2}", mUserName, mCompidx, InCMD.Replace("\r", " ").Replace("\n", " ")));
db.DB_Send_CMD_reVoid(InCMD);
}

View File

@@ -28,7 +28,7 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
this.panel1 = new System.Windows.Forms.Panel();
this.chkRetryErrData = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
@@ -66,8 +66,7 @@
this.btn_GridReset = new System.Windows.Forms.Button();
this.btn_OpenMemo = new System.Windows.Forms.Button();
this.chk_spChar = new System.Windows.Forms.CheckBox();
this.panel5 = new System.Windows.Forms.Panel();
this.webBrowser1 = new System.Windows.Forms.WebBrowser();
this.chkShowBrowser = new System.Windows.Forms.CheckBox();
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.SearchCount)).BeginInit();
@@ -77,12 +76,12 @@
this.panel6.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.panel4.SuspendLayout();
this.panel5.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.chkShowBrowser);
this.panel1.Controls.Add(this.chkRetryErrData);
this.panel1.Controls.Add(this.groupBox1);
this.panel1.Controls.Add(this.rb_isNumber);
@@ -93,7 +92,7 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 34);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(629, 106);
this.panel1.Size = new System.Drawing.Size(637, 106);
this.panel1.TabIndex = 0;
//
// chkRetryErrData
@@ -281,7 +280,7 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(629, 34);
this.panel2.Size = new System.Drawing.Size(637, 34);
this.panel2.TabIndex = 0;
//
// btn_SiteDenote
@@ -318,14 +317,14 @@
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control;
this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.book_name,
@@ -336,7 +335,7 @@
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(629, 542);
this.dataGridView1.Size = new System.Drawing.Size(637, 542);
this.dataGridView1.TabIndex = 1;
this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
@@ -384,10 +383,10 @@
this.panel3.Controls.Add(this.panel4);
this.panel3.Controls.Add(this.panel1);
this.panel3.Controls.Add(this.panel2);
this.panel3.Dock = System.Windows.Forms.DockStyle.Left;
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(629, 738);
this.panel3.Size = new System.Drawing.Size(637, 738);
this.panel3.TabIndex = 3;
//
// panel6
@@ -397,7 +396,7 @@
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel6.Location = new System.Drawing.Point(0, 174);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(629, 564);
this.panel6.Size = new System.Drawing.Size(637, 564);
this.panel6.TabIndex = 3;
//
// statusStrip1
@@ -406,7 +405,7 @@
this.lblStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 542);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(629, 22);
this.statusStrip1.Size = new System.Drawing.Size(637, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
@@ -428,7 +427,7 @@
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(0, 140);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(629, 34);
this.panel4.Size = new System.Drawing.Size(637, 34);
this.panel4.TabIndex = 2;
//
// chk_RemoveBrit
@@ -481,31 +480,21 @@
this.chk_spChar.Text = "특수문자 제거";
this.chk_spChar.UseVisualStyleBackColor = true;
//
// panel5
// chkShowBrowser
//
this.panel5.Controls.Add(this.webBrowser1);
this.panel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel5.Location = new System.Drawing.Point(629, 0);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(662, 738);
this.panel5.TabIndex = 4;
//
// webBrowser1
//
this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.webBrowser1.Location = new System.Drawing.Point(0, 0);
this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.webBrowser1.Name = "webBrowser1";
this.webBrowser1.ScriptErrorsSuppressed = true;
this.webBrowser1.Size = new System.Drawing.Size(662, 738);
this.webBrowser1.TabIndex = 2;
this.chkShowBrowser.AutoSize = true;
this.chkShowBrowser.Location = new System.Drawing.Point(515, 81);
this.chkShowBrowser.Name = "chkShowBrowser";
this.chkShowBrowser.Size = new System.Drawing.Size(96, 16);
this.chkShowBrowser.TabIndex = 8;
this.chkShowBrowser.Text = "브라우저표시";
this.chkShowBrowser.UseVisualStyleBackColor = true;
//
// Check_copyWD
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1291, 738);
this.Controls.Add(this.panel5);
this.ClientSize = new System.Drawing.Size(637, 738);
this.Controls.Add(this.panel3);
this.Name = "Check_copyWD";
this.Text = "복본조사(WebDriver)";
@@ -526,7 +515,6 @@
this.statusStrip1.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel4.PerformLayout();
this.panel5.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -547,7 +535,6 @@
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel5;
private System.Windows.Forms.CheckBox chk_spChar;
private System.Windows.Forms.CheckBox chk_RemoveBrit;
public System.Windows.Forms.NumericUpDown SearchCount;
@@ -559,7 +546,6 @@
public System.Windows.Forms.Label lbl_PW;
public System.Windows.Forms.Label lbl_ID;
private System.Windows.Forms.Button btn_SiteDenote;
private System.Windows.Forms.WebBrowser webBrowser1;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripLabel lblStatus;
private System.Windows.Forms.RadioButton radTargetAll;
@@ -572,5 +558,6 @@
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_remark;
public System.Windows.Forms.CheckBox chkRetryErrData;
public System.Windows.Forms.GroupBox groupBox1;
public System.Windows.Forms.CheckBox chkShowBrowser;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -132,4 +132,7 @@
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -29,7 +29,7 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DLS_Copy));
this.label1 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel8 = new System.Windows.Forms.Panel();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
@@ -37,6 +37,7 @@
this.ISBN = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Check = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel5 = new System.Windows.Forms.Panel();
this.chkShowBrowser = new System.Windows.Forms.CheckBox();
this.chk_RemoveBrit = new System.Windows.Forms.CheckBox();
this.chk_spChar = new System.Windows.Forms.CheckBox();
this.btn_ApplyFilter = new System.Windows.Forms.Button();
@@ -48,41 +49,33 @@
this.btn_Search = new System.Windows.Forms.Button();
this.rBtn_BookName = new System.Windows.Forms.RadioButton();
this.panel2 = new System.Windows.Forms.Panel();
this.btn_SiteDenote = new System.Windows.Forms.Button();
this.btn_Connect = new System.Windows.Forms.Button();
this.lbl_PW = new System.Windows.Forms.Label();
this.lbl_Area = new System.Windows.Forms.Label();
this.lbl_ID = new System.Windows.Forms.Label();
this.lbl_Client = new System.Windows.Forms.Label();
this.tb_SearchClient = new System.Windows.Forms.TextBox();
this.btn_Close = new System.Windows.Forms.Button();
this.panel4 = new System.Windows.Forms.Panel();
this.panel7 = new System.Windows.Forms.Panel();
this.webView21 = new Microsoft.Web.WebView2.WinForms.WebView2();
this.panel6 = new System.Windows.Forms.Panel();
this.btn_Back = new System.Windows.Forms.Button();
this.btn_Forward = new System.Windows.Forms.Button();
this.tb_URL = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.lblStatus = new System.Windows.Forms.ToolStripLabel();
this.panel1.SuspendLayout();
this.panel8.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel5.SuspendLayout();
this.panel3.SuspendLayout();
this.panel2.SuspendLayout();
this.panel4.SuspendLayout();
this.panel7.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.webView21)).BeginInit();
this.panel6.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(7, 10);
this.label1.Location = new System.Drawing.Point(7, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.Size = new System.Drawing.Size(63, 22);
this.label1.TabIndex = 0;
this.label1.Text = "납품처명";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// panel1
//
@@ -91,20 +84,19 @@
this.panel1.Controls.Add(this.panel5);
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.panel2);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(397, 734);
this.panel1.Size = new System.Drawing.Size(499, 712);
this.panel1.TabIndex = 1;
//
// panel8
//
this.panel8.Controls.Add(this.statusStrip1);
this.panel8.Controls.Add(this.dataGridView1);
this.panel8.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel8.Location = new System.Drawing.Point(0, 103);
this.panel8.Name = "panel8";
this.panel8.Size = new System.Drawing.Size(395, 629);
this.panel8.Size = new System.Drawing.Size(497, 607);
this.panel8.TabIndex = 5;
//
// dataGridView1
@@ -121,7 +113,7 @@
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersWidth = 31;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.Size = new System.Drawing.Size(395, 629);
this.dataGridView1.Size = new System.Drawing.Size(497, 607);
this.dataGridView1.TabIndex = 0;
this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
@@ -148,19 +140,31 @@
// panel5
//
this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel5.Controls.Add(this.chkShowBrowser);
this.panel5.Controls.Add(this.chk_RemoveBrit);
this.panel5.Controls.Add(this.chk_spChar);
this.panel5.Controls.Add(this.btn_ApplyFilter);
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
this.panel5.Location = new System.Drawing.Point(0, 68);
this.panel5.Name = "panel5";
this.panel5.Size = new System.Drawing.Size(395, 35);
this.panel5.Size = new System.Drawing.Size(497, 35);
this.panel5.TabIndex = 4;
//
// chkShowBrowser
//
this.chkShowBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.chkShowBrowser.AutoSize = true;
this.chkShowBrowser.Location = new System.Drawing.Point(395, 7);
this.chkShowBrowser.Name = "chkShowBrowser";
this.chkShowBrowser.Size = new System.Drawing.Size(96, 16);
this.chkShowBrowser.TabIndex = 209;
this.chkShowBrowser.Text = "브라우저표시";
this.chkShowBrowser.UseVisualStyleBackColor = true;
//
// chk_RemoveBrit
//
this.chk_RemoveBrit.AutoSize = true;
this.chk_RemoveBrit.Location = new System.Drawing.Point(169, 8);
this.chk_RemoveBrit.Location = new System.Drawing.Point(116, 8);
this.chk_RemoveBrit.Name = "chk_RemoveBrit";
this.chk_RemoveBrit.Size = new System.Drawing.Size(128, 16);
this.chk_RemoveBrit.TabIndex = 3;
@@ -179,6 +183,7 @@
//
// btn_ApplyFilter
//
this.btn_ApplyFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_ApplyFilter.Location = new System.Drawing.Point(314, 3);
this.btn_ApplyFilter.Name = "btn_ApplyFilter";
this.btn_ApplyFilter.Size = new System.Drawing.Size(75, 24);
@@ -198,7 +203,7 @@
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(0, 33);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(395, 35);
this.panel3.Size = new System.Drawing.Size(497, 35);
this.panel3.TabIndex = 4;
//
// btn_Reflesh008
@@ -207,7 +212,7 @@
this.btn_Reflesh008.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btn_Reflesh008.BackgroundImage")));
this.btn_Reflesh008.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.btn_Reflesh008.Dock = System.Windows.Forms.DockStyle.Right;
this.btn_Reflesh008.Location = new System.Drawing.Point(360, 0);
this.btn_Reflesh008.Location = new System.Drawing.Point(462, 0);
this.btn_Reflesh008.Name = "btn_Reflesh008";
this.btn_Reflesh008.Size = new System.Drawing.Size(33, 33);
this.btn_Reflesh008.TabIndex = 208;
@@ -268,6 +273,7 @@
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.btn_SiteDenote);
this.panel2.Controls.Add(this.btn_Connect);
this.panel2.Controls.Add(this.lbl_PW);
this.panel2.Controls.Add(this.lbl_Area);
@@ -278,16 +284,28 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(395, 33);
this.panel2.Size = new System.Drawing.Size(497, 33);
this.panel2.TabIndex = 3;
//
// btn_SiteDenote
//
this.btn_SiteDenote.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_SiteDenote.Location = new System.Drawing.Point(414, 5);
this.btn_SiteDenote.Name = "btn_SiteDenote";
this.btn_SiteDenote.Size = new System.Drawing.Size(77, 23);
this.btn_SiteDenote.TabIndex = 6;
this.btn_SiteDenote.Text = "사이트 표출";
this.btn_SiteDenote.UseVisualStyleBackColor = true;
this.btn_SiteDenote.Click += new System.EventHandler(this.btn_SiteDenote_Click);
//
// btn_Connect
//
this.btn_Connect.Location = new System.Drawing.Point(278, 5);
this.btn_Connect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btn_Connect.Location = new System.Drawing.Point(338, 5);
this.btn_Connect.Name = "btn_Connect";
this.btn_Connect.Size = new System.Drawing.Size(110, 23);
this.btn_Connect.Size = new System.Drawing.Size(70, 23);
this.btn_Connect.TabIndex = 5;
this.btn_Connect.Text = "접 속";
this.btn_Connect.Text = "접속";
this.btn_Connect.UseVisualStyleBackColor = true;
this.btn_Connect.Click += new System.EventHandler(this.btn_Connect_Click);
//
@@ -329,118 +347,42 @@
//
// tb_SearchClient
//
this.tb_SearchClient.Location = new System.Drawing.Point(65, 6);
this.tb_SearchClient.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tb_SearchClient.Location = new System.Drawing.Point(76, 6);
this.tb_SearchClient.Name = "tb_SearchClient";
this.tb_SearchClient.Size = new System.Drawing.Size(198, 21);
this.tb_SearchClient.Size = new System.Drawing.Size(256, 21);
this.tb_SearchClient.TabIndex = 1;
this.tb_SearchClient.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_SearchClient_KeyDown);
//
// btn_Close
//
this.btn_Close.Location = new System.Drawing.Point(820, 5);
this.btn_Close.Name = "btn_Close";
this.btn_Close.Size = new System.Drawing.Size(75, 23);
this.btn_Close.TabIndex = 2;
this.btn_Close.Text = "닫 기";
this.btn_Close.UseVisualStyleBackColor = true;
this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click);
//
// panel4
//
this.panel4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel4.Controls.Add(this.panel7);
this.panel4.Controls.Add(this.panel6);
this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel4.Location = new System.Drawing.Point(397, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(931, 734);
this.panel4.TabIndex = 2;
//
// panel7
//
this.panel7.Controls.Add(this.webView21);
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel7.Location = new System.Drawing.Point(0, 35);
this.panel7.Name = "panel7";
this.panel7.Size = new System.Drawing.Size(929, 697);
this.panel7.TabIndex = 7;
//
// webView21
//
this.webView21.AllowExternalDrop = true;
this.webView21.CreationProperties = null;
this.webView21.DefaultBackgroundColor = System.Drawing.Color.White;
this.webView21.Dock = System.Windows.Forms.DockStyle.Fill;
this.webView21.Location = new System.Drawing.Point(0, 0);
this.webView21.Name = "webView21";
this.webView21.Size = new System.Drawing.Size(929, 697);
this.webView21.TabIndex = 5;
this.webView21.ZoomFactor = 1D;
//
// panel6
//
this.panel6.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel6.Controls.Add(this.btn_Back);
this.panel6.Controls.Add(this.btn_Forward);
this.panel6.Controls.Add(this.tb_URL);
this.panel6.Controls.Add(this.btn_Close);
this.panel6.Dock = System.Windows.Forms.DockStyle.Top;
this.panel6.Location = new System.Drawing.Point(0, 0);
this.panel6.Name = "panel6";
this.panel6.Size = new System.Drawing.Size(929, 35);
this.panel6.TabIndex = 6;
//
// btn_Back
//
this.btn_Back.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.btn_Back.Location = new System.Drawing.Point(10, 5);
this.btn_Back.Name = "btn_Back";
this.btn_Back.Size = new System.Drawing.Size(43, 23);
this.btn_Back.TabIndex = 1;
this.btn_Back.Text = "<<";
this.btn_Back.UseVisualStyleBackColor = true;
this.btn_Back.Click += new System.EventHandler(this.btn_Back_Click);
//
// btn_Forward
//
this.btn_Forward.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
this.btn_Forward.Location = new System.Drawing.Point(59, 5);
this.btn_Forward.Name = "btn_Forward";
this.btn_Forward.Size = new System.Drawing.Size(43, 23);
this.btn_Forward.TabIndex = 1;
this.btn_Forward.Text = ">>";
this.btn_Forward.UseVisualStyleBackColor = true;
this.btn_Forward.Click += new System.EventHandler(this.btn_Forward_Click);
//
// tb_URL
//
this.tb_URL.Location = new System.Drawing.Point(108, 6);
this.tb_URL.Name = "tb_URL";
this.tb_URL.Size = new System.Drawing.Size(706, 21);
this.tb_URL.TabIndex = 0;
this.tb_URL.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_URL_KeyDown);
//
// statusStrip1
//
this.statusStrip1.Location = new System.Drawing.Point(0, 607);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.lblStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 712);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(395, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Size = new System.Drawing.Size(499, 22);
this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1";
//
// lblStatus
//
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(27, 20);
this.lblStatus.Text = "WD";
//
// DLS_Copy
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1328, 734);
this.Controls.Add(this.panel4);
this.ClientSize = new System.Drawing.Size(499, 734);
this.Controls.Add(this.panel1);
this.Controls.Add(this.statusStrip1);
this.Name = "DLS_Copy";
this.Text = "DLS 복본조사";
this.Load += new System.EventHandler(this.DLS_Copy_Load);
this.panel1.ResumeLayout(false);
this.panel8.ResumeLayout(false);
this.panel8.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.panel5.ResumeLayout(false);
this.panel5.PerformLayout();
@@ -448,22 +390,19 @@
this.panel3.PerformLayout();
this.panel2.ResumeLayout(false);
this.panel2.PerformLayout();
this.panel4.ResumeLayout(false);
this.panel7.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.webView21)).EndInit();
this.panel6.ResumeLayout(false);
this.panel6.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button label1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Button btn_Close;
public System.Windows.Forms.TextBox tb_SearchClient;
public System.Windows.Forms.Label lbl_PW;
public System.Windows.Forms.Label lbl_ID;
@@ -475,13 +414,6 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btn_Search;
public System.Windows.Forms.Label lbl_Area;
private Microsoft.Web.WebView2.WinForms.WebView2 webView21;
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Panel panel6;
private System.Windows.Forms.TextBox tb_URL;
private System.Windows.Forms.Button btn_Back;
private System.Windows.Forms.Button btn_Forward;
private System.Windows.Forms.Panel panel7;
private System.Windows.Forms.Button btn_Reflesh008;
private System.Windows.Forms.Button btn_Connect;
private System.Windows.Forms.CheckBox chk_RemoveBrit;
@@ -492,6 +424,9 @@
private System.Windows.Forms.DataGridViewTextBoxColumn ISBN;
private System.Windows.Forms.DataGridViewTextBoxColumn Check;
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btn_SiteDenote;
public System.Windows.Forms.CheckBox chkShowBrowser;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripLabel lblStatus;
}
}

View File

@@ -1,4 +1,5 @@
using System;
using BokBonCheck;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -7,8 +8,6 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Web.WebView2.Core;
using Microsoft.Web.WebView2.WinForms;
namespace WindowsFormsApp1.Mac
{
@@ -16,7 +15,7 @@ namespace WindowsFormsApp1.Mac
{
Main main;
public string compidx;
string url = "https://reading.jnei.go.kr";
string URL = "https://reading.jnei.go.kr";
public DLS_Copy(Main _main)
{
InitializeComponent();
@@ -24,47 +23,107 @@ namespace WindowsFormsApp1.Mac
compidx = main.com_idx;
url = "https://dls.edunet.net/DLS/totalLoginMain";
URL = "https://dls.edunet.net/DLS/totalLoginMain";
//url = "https://read365.edunet.net/TotalSearch";
//변경된 홈페이지: https://dls.edunet.net/DLS/totalLoginMain 사용 ID / 비번 : t5191774 / tb5191774
}
private async void DLS_Copy_Load(object sender, EventArgs e)
private void DLS_Copy_Load(object sender, EventArgs e)
{
this.Show();
Application.DoEvents();
//크롤링
InitializeChromeDriver();
}
#region
private readonly BookSearchService _searchService;
private bool _isSearching = false;
private bool _isDriverReady = false;
private async void InitializeChromeDriver()
{
var lblStatus = this.lblStatus;// (Label)this.Controls["lblStatus"];
lblStatus.Text = "WebDriver:Chrome 드라이버 확인 중...";
lblStatus.ForeColor = Color.Blue;
try
{
compidx = main.com_idx;
// Chrome 설치 확인
if (!ChromeDriverManager.IsChromeInstalled())
{
MessageBox.Show("Google Chrome이 설치되어 있지 않습니다. Chrome을 설치한 후 프로그램을 다시 실행해주세요.",
"Chrome 필요", MessageBoxButtons.OK, MessageBoxIcon.Warning);
lblStatus.Text = "WebDriver:Chrome이 설치되지 않음";
lblStatus.ForeColor = Color.Red;
return;
}
this.Show();
Application.DoEvents();
// WebView2 환경 준비 (Fixed Version 지원)
var environment = await WebView2Installer.GetWebView2EnvironmentAsync();
await webView21.EnsureCoreWebView2Async(environment);
webView21.CoreWebView2.NavigationCompleted += WebView21_NavigationCompleted;
webView21.CoreWebView2.Navigate(url);
// 기존 드라이버가 준비되어 있는지 확인
if (ChromeDriverManager.IsDriverReady())
{
lblStatus.Text = "WebDriver:Ready";
lblStatus.ForeColor = Color.Green;
_isDriverReady = true;
return;
}
// 드라이버가 없거나 작동하지 않으면 다운로드 진행 창 표시
using (var progressForm = new DownloadProgressForm())
{
progressForm.Show();
try
{
// ChromeDriver 설정
await ChromeDriverManager.SetupChromeDriverAsync(progressForm);
// 드라이버 테스트
var isWorking = await ChromeDriverManager.TestChromeDriverAsync(progressForm);
if (isWorking)
{
_isDriverReady = true;
lblStatus.Text = "WebDriver:Ready";
lblStatus.ForeColor = Color.Green;
}
else
{
lblStatus.Text = "WebDriver:Chrome 드라이버 테스트 실패";
lblStatus.ForeColor = Color.Red;
MessageBox.Show("Chrome 드라이버 테스트에 실패했습니다. 인터넷 연결을 확인하고 프로그램을 다시 실행해주세요.",
"드라이버 오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (OperationCanceledException)
{
lblStatus.Text = "WebDriver:드라이버 다운로드가 취소되었습니다.";
lblStatus.ForeColor = Color.Orange;
return;
}
catch (Exception ex)
{
lblStatus.Text = "WebDriver:Chrome 드라이버 설정 실패";
lblStatus.ForeColor = Color.Red;
MessageBox.Show($"Chrome 드라이버 설정 중 오류가 발생했습니다: {ex.Message}",
"설정 오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
catch (Exception ex)
{
MessageBox.Show(
$"WebView2 초기화 중 오류가 발생했습니다: {ex.Message}\n\n" +
"웹 기능이 필요하면 나중에 다시 시도해 주세요.",
"WebView2 초기화 오류",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
// webView2 숨기고 오류 상태 표시
webView21.Visible = false;
lblStatus.Text = "WebDriver:Chrome 드라이버 설정 실패";
lblStatus.ForeColor = Color.Red;
MessageBox.Show($"Chrome 드라이버 설정 중 오류가 발생했습니다: {ex.Message}",
"설정 오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void WebView21_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
{
tb_URL.Text = webView21.CoreWebView2.Source;
}
#endregion
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
Skill_Grid sg = new Skill_Grid();
@@ -95,7 +154,7 @@ namespace WindowsFormsApp1.Mac
}
#endregion
private async void btn_Connect_Click(object sender, EventArgs e)
private void btn_Connect_Click(object sender, EventArgs e)
{
if (lbl_Client.Text == "Client")
{
@@ -107,44 +166,11 @@ namespace WindowsFormsApp1.Mac
MessageBox.Show("설정된 지역이 없습니다. 납품처 관리에서 확인해주세요.");
return;
}
string url = webView21.CoreWebView2.Source;
//await webView21.CoreWebView2.ExecuteScriptAsync("document.getElementById('headerLoginBtn').click();");
await Task.Delay(1000);
await DLS_Login(url);
}
#region Connect_SUB
private async Task DLS_Login(string url)
{
if (lbl_ID.Text == "" || lbl_PW.Text == "")
{
MessageBox.Show("ID 혹은 PW가 없습니다.");
return;
}
string ID = lbl_ID.Text.Trim(), PW = lbl_PW.Text.Trim();
//string elementValue = await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('{await SetArea(lbl_Area.Text)}').value;");
//url = elementValue.Trim('"');
//id설정
await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('lgID').value = '{ID}';");
//pw 설정
await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('lgPW').value = '{PW}';");
//로그인버튼 클릭
await webView21.CoreWebView2.ExecuteScriptAsync("document.getElementById('loginBtn').click();");
await Task.Delay(4000);
webView21.CoreWebView2.Navigate("https://dls1.edunet.net/DLS/bookMng/bookMain");
}
#endregion
private bool tStop = false;
private int tSearchIDX = 0;
private async void btn_Search_Click(object sender, EventArgs e)
private void btn_Search_Click(object sender, EventArgs e)
{
tStop = false;
if (dataGridView1.Rows[0].Cells["ISBN"].Value == null && rBtn_ISBN.Checked)
@@ -157,96 +183,17 @@ namespace WindowsFormsApp1.Mac
MessageBox.Show("도서명이 입력되지않았습니다!");
return;
}
if (!await SearchCopy(rBtn_ISBN.Checked))
return;
MessageBox.Show("완료되었습니다.");
}
#region SearchClick_Sub
private async Task<bool> SearchCopy(bool isISBN)
{
if (!webView21.CoreWebView2.Source.Contains("collectionFormMA"))
{
MessageBox.Show("자료관리 창이 아닙니다!");
return false;
}
int count = dataGridView1.Rows.Count;
for (int a = 0; a < count; a++)
{
if (tSearchIDX != 0) a = tSearchIDX;
string Check;
if (isISBN)
{
string Target = dataGridView1.Rows[a].Cells["ISBN"].Value.ToString();
Check = await SearchISBN(Target);
}
else
{
string Target = dataGridView1.Rows[a].Cells["Book_name"].Value.ToString();
Check = await SearchName(Target);
}
if (Check == "0")
Check = "";
dataGridView1.Rows[a].Cells["Check"].Value = Check;
if (Check == "")
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.LightGray;
else
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Yellow;
if (tStop)
{
tSearchIDX = a + 1;
break;
}
}
if (tStop) MessageBox.Show("검색이 중지 되었습니다.");
return true;
}
/// <summary>
/// 도서명 필터로 DLS복본 검색
/// </summary>
/// <param name="Target">도서명</param>
/// <param name="row">행 번호</param>
private async Task<string> SearchName(string Target)
{
await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('bib1').value = '{Target.Replace("'", "\\'")}';");
await webView21.CoreWebView2.ExecuteScriptAsync("document.querySelector('.button_search').click();");
await Task.Delay(5000);
string script = "(() => { const div = document.querySelector('.paging_nav'); return div ? div.querySelector('span')?.innerText || '' : ''; })()";
string InnerText = await webView21.CoreWebView2.ExecuteScriptAsync(script);
InnerText = InnerText.Trim('"');
return InnerText;
}
/// <summary>
/// ISBN 필터로 DLS복본 검색
/// </summary>
/// <param name="Target">ISBN</param>
/// <param name="row">행 번호</param>
private async Task<string> SearchISBN(string Target)
{
await webView21.CoreWebView2.ExecuteScriptAsync("document.getElementById('bibKind2').selectedIndex = 2;");
await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('bib2').value = '{Target}';");
await webView21.CoreWebView2.ExecuteScriptAsync("document.querySelector('.button_search').click();");
await Task.Delay(5000);
string script = "(() => { const div = document.querySelector('.paging_nav'); return div ? div.querySelector('span')?.innerText || '' : ''; })()";
string InnerText = await webView21.CoreWebView2.ExecuteScriptAsync(script);
InnerText = InnerText.Trim('"');
return InnerText;
}
#endregion
/// <summary>
/// DLS지역 코드 변환
/// </summary>
/// <returns>코드</returns>
public async Task<string> SetArea(string dlsArea, bool move = false)
public string SetArea(string dlsArea, bool move = false)
{
string[] Area = {
"서울", "부산", "대구", "인천", "광주",
@@ -271,20 +218,7 @@ namespace WindowsFormsApp1.Mac
idx++;
}
if (move)
{
try
{
string elementValue = await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('{Code[idx]}').value;");
elementValue = elementValue.Trim('"');
webView21.CoreWebView2.Navigate(elementValue);
}
catch (Exception ex)
{
AR.UTIL.MsgE("지역변경실패, 사이트가 변경되었을 수 있습니다.\n잠시 후 다시시도하세요\n"+ex.Message);
}
}
return Code[idx];
}
@@ -306,32 +240,6 @@ namespace WindowsFormsApp1.Mac
return;
}
private void btn_Close_Click(object sender, EventArgs e)
{
this.Close();
}
private void btn_Back_Click(object sender, EventArgs e)
{
if (webView21.CoreWebView2.CanGoBack)
webView21.CoreWebView2.GoBack();
}
private void btn_Forward_Click(object sender, EventArgs e)
{
if (webView21.CoreWebView2.CanGoForward)
webView21.CoreWebView2.GoForward();
}
private void tb_URL_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
string url = tb_URL.Text;
webView21.CoreWebView2.Navigate(url);
}
}
private void btn_Reflesh008_Click(object sender, EventArgs e)
{
tSearchIDX = 0;
@@ -348,5 +256,15 @@ namespace WindowsFormsApp1.Mac
tStop = true;
}
private void btn_SiteDenote_Click(object sender, EventArgs e)
{
if (URL == null) return;
AR.UTIL.RunExplorer(URL);
}
private void label1_Click(object sender, EventArgs e)
{
ClientSearch();
}
}
}

View File

@@ -117,9 +117,6 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="Book_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@@ -169,4 +166,7 @@
P87mU+ZvyRQDAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -579,7 +579,7 @@ namespace ExcelTest
date, mCompidx };
string Incmd = db.DB_INSERT(table_name, Insert_tbl, Insert_col);
CUtill.mLog.Add("INSERT", string.Format( "{0}({1},{2}) : {3}", mUserName, mCompidx, List_Book.Rows[SaveRowIdx].DefaultCellStyle.ForeColor, Incmd));
PUB.log.Add("INSERT", string.Format( "{0}({1},{2}) : {3}", mUserName, mCompidx, List_Book.Rows[SaveRowIdx].DefaultCellStyle.ForeColor, Incmd));
db.DB_Send_CMD_reVoid(Incmd);
isNewData = true;
}
@@ -631,7 +631,7 @@ namespace ExcelTest
// }
//}
string U_cmd = db.More_Update(table_name, Edit_tbl, Edit_col, Sear_tbl, Sear_col);
CUtill.mLog.Add("Update", string.Format( "{0}({1},{2}) : {3}", mUserName, mCompidx, List_Book.Rows[SaveRowIdx].DefaultCellStyle.ForeColor , U_cmd.Replace("\r", " ").Replace("\n", " ")));
PUB.log.Add("Update", string.Format( "{0}({1},{2}) : {3}", mUserName, mCompidx, List_Book.Rows[SaveRowIdx].DefaultCellStyle.ForeColor , U_cmd.Replace("\r", " ").Replace("\n", " ")));
db.DB_Send_CMD_reVoid(U_cmd);
isNewData = false;
}
@@ -645,14 +645,14 @@ namespace ExcelTest
if (isNewData) {
string MidxQuery = string.Format("SELECT `idx` FROM Marc WHERE isbn = {0} AND `compidx` = {1};", grid_data[0], mCompidx);
CUtill.mLog.Add("MarcInsert", string.Format( "{0}({1}) : {2}", mUserName, mCompidx, MidxQuery));
PUB.log.Add("MarcInsert", string.Format( "{0}({1}) : {2}", mUserName, mCompidx, MidxQuery));
Midx = db.DB_Send_CMD_Search(MidxQuery).Replace("|", "");
List_Book.Rows[SaveRowIdx].Cells["marc_idx"].Value = Midx;
}
string UpdateListIndex = string.Format("UPDATE `Obj_List_Book` SET `m_idx` = {0} WHERE `idx` = {1} AND 'compidx' ={2};",
Midx, List_Book.Rows[SaveRowIdx].Cells["list_idx"].Value.ToString(), mCompidx);
CUtill.mLog.Add("MarcUpdate", string.Format( "{0}({1}) : {2}", mUserName, mCompidx, UpdateListIndex));
PUB.log.Add("MarcUpdate", string.Format( "{0}({1}) : {2}", mUserName, mCompidx, UpdateListIndex));
db.DB_Send_CMD_reVoid(UpdateListIndex);
MessageBox.Show("저장되었습니다!");
}

View File

@@ -1,4 +1,5 @@
using ExcelTest;
using AR;
using ExcelTest;
using MySqlX.XDevAPI.Relational;
using System;
using System.Collections.Generic;
@@ -278,7 +279,7 @@ namespace WindowsFormsApp1.Home
return;
}
string tText = string.Format("{0} 를 수정 하시겠습니까?", dataGridView1.SelectedRows[0].Cells["ID"].Value.ToString());
if (CUtill.MsgQ(tText) == DialogResult.Yes)
if (UTIL.MsgQ(tText) == DialogResult.Yes)
{
if (tb_ID.Text == "" || tb_PW.Text == "" || tb_Name.Text == "")
{
@@ -366,7 +367,7 @@ namespace WindowsFormsApp1.Home
return;
}
string tText = string.Format("{0} 를 삭제 하시겠습니까?", dataGridView1.SelectedRows[0].Cells["ID"].Value.ToString());
if (CUtill.MsgQ(tText) == DialogResult.Yes)
if (UTIL.MsgQ(tText) == DialogResult.Yes)
{
int row = dataGridView1.CurrentRow.Index;
string tID = dataGridView1.SelectedRows[0].Cells["id"].Value.ToString();

View File

@@ -126,7 +126,7 @@ namespace WindowsFormsApp1.Home
if (RowIndex < 0)
return;
string tText = string.Format("{0} 를 추가 하시겠습니까?", tb_sangho.Text);
if (CUtill.MsgQ(tText) != DialogResult.Yes) return;
if (UTIL.MsgQ(tText) != DialogResult.Yes) return;
if (tb_sangho.Text == "")
{
@@ -188,7 +188,7 @@ namespace WindowsFormsApp1.Home
if (tRowIndex < 0)
return;
string tText = string.Format("{0} 를 수정 하시겠습니까?", dv1.Rows[tRowIndex].Cells["sangho"].Value.ToString());
if (CUtill.MsgQ(tText) != DialogResult.Yes) return;
if (UTIL.MsgQ(tText) != DialogResult.Yes) return;
if (tb_sangho.Text == "")
{
MessageBox.Show("업체명이 비어있습니다.");
@@ -268,7 +268,7 @@ namespace WindowsFormsApp1.Home
if (RowIndex < 0)
return;
string tText = string.Format("{0} 를 삭제 하시겠습니까?", dv1.Rows[RowIndex].Cells["sangho"].Value.ToString());
if (CUtill.MsgQ(tText) != DialogResult.Yes) return;
if (UTIL.MsgQ(tText) != DialogResult.Yes) return;
string D_cmd = db.DB_Delete("Client", "idx", dv1.Rows[RowIndex].Cells["idx"].Value.ToString(), "c_sangho", tb_sangho.Text);
db.DB_Send_CMD_reVoid(D_cmd);
Made_Grid();