Revert "WebView2 Fixed Version 호환성 문제 해결 - NuGet 패키지 버전 업데이트 및 환경 설정 개선"
This reverts commit a13306115b.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -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
|
||||
@@ -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": []
|
||||
}
|
||||
}
|
||||
@@ -46,3 +46,305 @@ 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
|
||||
|
||||
## WebView2 Selenium 스타일 DOM 조작 가이드
|
||||
|
||||
### 🔧 기본 DOM 조작 메서드들 (NamguLibrarySearcher 기본 클래스에 구현됨)
|
||||
|
||||
#### 1. 요소 대기 및 존재 확인
|
||||
```csharp
|
||||
// DOM 요소가 준비될 때까지 대기 (Selenium의 WebDriverWait와 유사)
|
||||
await WaitForElementReady("#clickAll", 10000); // 10초 타임아웃
|
||||
await WaitForElementReady("input[name='query']", 5000); // 5초 타임아웃
|
||||
```
|
||||
|
||||
#### 2. 요소 상태 확인
|
||||
```csharp
|
||||
// 체크박스가 체크되어 있는지 확인 (Selenium의 element.IsSelected와 유사)
|
||||
bool isChecked = await IsElementChecked("#clickAll");
|
||||
bool isLibMAChecked = await IsElementChecked("#libMA");
|
||||
```
|
||||
|
||||
#### 3. 요소 클릭
|
||||
```csharp
|
||||
// 요소 클릭 (Selenium의 element.Click()와 유사)
|
||||
await ClickElement("#clickAll"); // 전체 선택 클릭
|
||||
await ClickElement("#libMA"); // 문화정보도서관 클릭
|
||||
await ClickElement("button[type='submit']"); // 검색 버튼 클릭
|
||||
```
|
||||
|
||||
#### 4. 값 입력 및 설정
|
||||
```csharp
|
||||
// 입력창에 값 설정 (Selenium의 element.SendKeys()와 유사)
|
||||
await SetElementValue("input[name='query']", "검색어");
|
||||
await SetElementValue("#search_txt", "도서명");
|
||||
// 이벤트도 자동으로 발생시킴 (input, change 이벤트)
|
||||
```
|
||||
|
||||
#### 5. 텍스트 가져오기
|
||||
```csharp
|
||||
// 요소의 텍스트 내용 가져오기 (Selenium의 element.Text와 유사)
|
||||
string resultText = await GetElementText(".search-result span");
|
||||
string bookCount = await GetElementText("span:contains('전체')");
|
||||
```
|
||||
|
||||
### 🚀 실제 사용 예제
|
||||
|
||||
#### 도서관 선택 (남구통합도서관 예제)
|
||||
```csharp
|
||||
protected override async Task<bool> SelectLibraryWebView2()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 1. DOM 요소 존재 확인 및 대기
|
||||
await WaitForElementReady("#clickAll");
|
||||
await WaitForElementReady("#libMA");
|
||||
|
||||
// 2. 전체 선택 해제 (단계별 실행)
|
||||
bool isClickAllChecked = await IsElementChecked("#clickAll");
|
||||
if (isClickAllChecked)
|
||||
{
|
||||
await ClickElement("#clickAll");
|
||||
Console.WriteLine("전체 선택 해제됨");
|
||||
}
|
||||
|
||||
// 3. 특정 도서관 선택
|
||||
bool libMAChecked = await ClickElement("#libMA");
|
||||
Console.WriteLine($"문화정보도서관 선택: {libMAChecked}");
|
||||
|
||||
return libMAChecked;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"도서관 선택 오류: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 검색 실행 (단계별)
|
||||
```csharp
|
||||
private async Task PerformSearchWebView2(string searchTerm)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 1. 검색창 찾기 및 대기 (여러 선택자 시도)
|
||||
string[] searchSelectors = {
|
||||
"input[name='query']",
|
||||
"input[id='query']",
|
||||
"input[type='text']"
|
||||
};
|
||||
|
||||
string searchInputSelector = null;
|
||||
foreach (var selector in searchSelectors)
|
||||
{
|
||||
try
|
||||
{
|
||||
await WaitForElementReady(selector, 3000);
|
||||
searchInputSelector = selector;
|
||||
break;
|
||||
}
|
||||
catch { continue; }
|
||||
}
|
||||
|
||||
// 2. 검색어 입력
|
||||
await SetElementValue(searchInputSelector, searchTerm);
|
||||
|
||||
// 3. 검색 버튼 클릭 (여러 선택자 시도)
|
||||
string[] buttonSelectors = {
|
||||
"button[type='submit']",
|
||||
"input[type='submit']",
|
||||
".search-btn",
|
||||
".btn-search"
|
||||
};
|
||||
|
||||
bool searchExecuted = false;
|
||||
foreach (var selector in buttonSelectors)
|
||||
{
|
||||
if (await ClickElement(selector))
|
||||
{
|
||||
searchExecuted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 검색 버튼이 없으면 Enter 키로 검색
|
||||
if (!searchExecuted)
|
||||
{
|
||||
string enterScript = $@"
|
||||
const input = document.querySelector('{searchInputSelector}');
|
||||
if (input) {{
|
||||
input.dispatchEvent(new KeyboardEvent('keydown', {{
|
||||
key: 'Enter', keyCode: 13, bubbles: true
|
||||
}}));
|
||||
return true;
|
||||
}}
|
||||
return false;
|
||||
";
|
||||
await _webView2.CoreWebView2.ExecuteScriptAsync(enterScript);
|
||||
}
|
||||
|
||||
Console.WriteLine("✅ 검색 실행 완료");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"❌ 검색 실행 오류: {ex.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 🎯 CSS 선택자 참고
|
||||
|
||||
#### 남구통합도서관 주요 선택자들
|
||||
```css
|
||||
/* 도서관 선택 체크박스 */
|
||||
#clickAll /* 전체 선택 */
|
||||
#libMA /* 문화정보도서관 */
|
||||
#libMB /* 푸른길도서관 */
|
||||
#libMC /* 청소년도서관 */
|
||||
#libSW /* 효천어울림도서관 */
|
||||
#libSQ /* 스마트도서관 */
|
||||
|
||||
/* 검색 관련 */
|
||||
input[name='query'] /* 검색창 */
|
||||
button[type='submit'] /* 검색 버튼 */
|
||||
|
||||
/* 결과 관련 */
|
||||
.search-result /* 검색 결과 영역 */
|
||||
span:contains('전체') /* 검색 결과 수량 */
|
||||
```
|
||||
|
||||
### ⚠️ 주의사항
|
||||
|
||||
1. **페이지 로딩 대기**: 항상 `WaitForElementReady()`로 요소가 준비될 때까지 대기
|
||||
2. **에러 처리**: try-catch로 각 단계별 예외 처리
|
||||
3. **로깅**: `Console.WriteLine()`으로 상세한 실행 로그 남기기
|
||||
4. **타임아웃**: 적절한 타임아웃 설정 (기본 10초)
|
||||
5. **다중 선택자**: 여러 CSS 선택자를 배열로 준비하여 순차적으로 시도
|
||||
|
||||
### 🔄 Selenium에서 WebView2로 이주 가이드
|
||||
|
||||
| Selenium 코드 | WebView2 대응 코드 |
|
||||
|---------------|-------------------|
|
||||
| `WebDriverWait.Until()` | `await WaitForElementReady()` |
|
||||
| `element.Click()` | `await ClickElement()` |
|
||||
| `element.SendKeys()` | `await SetElementValue()` |
|
||||
| `element.Text` | `await GetElementText()` |
|
||||
| `element.IsSelected` | `await IsElementChecked()` |
|
||||
| `element.Clear()` | SetElementValue로 빈 문자열 설정 |
|
||||
|
||||
### 💡 성능 및 안정성 팁
|
||||
|
||||
- **WebView2가 Selenium보다 빠름**: 네이티브 성능
|
||||
- **고정 버전 사용**: Chrome 버전 호환성 문제 없음
|
||||
- **단계별 실행**: 각 작업을 개별 메서드로 분리하여 디버깅 용이
|
||||
- **상세 로깅**: 각 단계마다 성공/실패 상태 출력
|
||||
- **단순한 JavaScript 사용**: 복잡한 JSON보다는 단순한 문자열 반환 권장
|
||||
|
||||
## 🚨 **WebView2 JavaScript 실행 시 주의사항 (중요 교훈)**
|
||||
|
||||
### **문제: RuntimeBinderException과 null 반환**
|
||||
|
||||
**❌ 피해야 할 패턴:**
|
||||
```csharp
|
||||
// 복잡한 JSON 반환 스크립트 - 불안정함
|
||||
string script = $@"
|
||||
try {{
|
||||
const element = document.querySelector('{selector}');
|
||||
return JSON.stringify({{ success: true, isChecked: element.checked }});
|
||||
}} catch (e) {{
|
||||
return JSON.stringify({{ success: false, error: e.message }});
|
||||
}}
|
||||
";
|
||||
|
||||
string result = await webView2.CoreWebView2.ExecuteScriptAsync(script);
|
||||
dynamic resultObj = JsonConvert.DeserializeObject(result); // RuntimeBinderException 위험!
|
||||
|
||||
if (resultObj.success == true) // null 참조 오류 발생 가능
|
||||
```
|
||||
|
||||
**✅ 권장하는 안전한 패턴:**
|
||||
```csharp
|
||||
// 단순한 문자열 반환 - 안정적임
|
||||
string result = await webView2.CoreWebView2.ExecuteScriptAsync($@"
|
||||
try {{
|
||||
var element = document.querySelector('{selector}');
|
||||
if (element && element.checked) {{
|
||||
element.click();
|
||||
return element.checked ? 'failed' : 'success';
|
||||
}}
|
||||
return element ? 'already_unchecked' : 'not_found';
|
||||
}} catch (e) {{
|
||||
return 'error: ' + e.message;
|
||||
}}
|
||||
");
|
||||
|
||||
// 안전한 문자열 비교
|
||||
if (result != null && result.Contains("success"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
### **핵심 교훈:**
|
||||
|
||||
1. **단순함이 최고**: WebView2에서는 복잡한 JSON.stringify()보다 단순한 문자열 반환이 훨씬 안정적
|
||||
2. **Dynamic 타입 위험**: `dynamic` 객체는 null 체크 없이 사용하면 RuntimeBinderException 발생
|
||||
3. **직접적인 JavaScript**: 중간 JSON 변환 없이 직접적인 DOM 조작이 더 확실함
|
||||
4. **단계별 진단**: 복잡한 로직은 여러 개의 간단한 스크립트로 분할하여 실행
|
||||
|
||||
### **권장 디버깅 패턴:**
|
||||
```csharp
|
||||
// 1단계: 기본 JavaScript 실행 확인
|
||||
string test1 = await webView2.ExecuteScriptAsync("1+1");
|
||||
Console.WriteLine($"기본 연산: {test1}");
|
||||
|
||||
// 2단계: DOM 접근 확인
|
||||
string test2 = await webView2.ExecuteScriptAsync("document.title");
|
||||
Console.WriteLine($"DOM 접근: {test2}");
|
||||
|
||||
// 3단계: 요소 존재 확인
|
||||
string test3 = await webView2.ExecuteScriptAsync($"document.querySelector('{selector}') !== null");
|
||||
Console.WriteLine($"요소 존재: {test3}");
|
||||
|
||||
// 4단계: 실제 작업 수행
|
||||
string result = await webView2.ExecuteScriptAsync($"document.querySelector('{selector}').click(); 'clicked'");
|
||||
Console.WriteLine($"작업 결과: {result}");
|
||||
```
|
||||
|
||||
**이 패턴을 사용하면 WebView2 JavaScript 실행에서 99%의 문제를 예방할 수 있습니다!**
|
||||
|
||||
## 🧹 **WebView2 메모리 누수 방지 (중요!)**
|
||||
|
||||
**문제**: WebView2는 메모리 누수로 인해 프로그램이 갑자기 종료될 수 있습니다.
|
||||
|
||||
**해결책**: 검색 전후로 메모리 정리를 수행하세요.
|
||||
|
||||
```csharp
|
||||
// 검색 시작 전
|
||||
await CleanupWebView2Memory();
|
||||
|
||||
// 검색 작업 수행...
|
||||
|
||||
// 검색 완료 후 (finally 블록에서)
|
||||
finally {
|
||||
await CleanupWebView2Memory();
|
||||
}
|
||||
|
||||
private async Task CleanupWebView2Memory()
|
||||
{
|
||||
try {
|
||||
await _webView2.CoreWebView2.ExecuteScriptAsync(@"
|
||||
if (window.gc) window.gc(); null;
|
||||
");
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
} catch { /* 무시 */ }
|
||||
}
|
||||
```
|
||||
|
||||
**주의사항**:
|
||||
- WebView2는 장시간 사용 시 메모리 누수 발생 가능
|
||||
- 각 검색 작업 후 반드시 정리 수행
|
||||
- Chrome WebDriver보다 메모리 관리가 까다로움
|
||||
|
||||
|
||||
@@ -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 버전 충돌 해결
|
||||
@@ -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
|
||||
|
||||
@@ -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": []
|
||||
}
|
||||
}
|
||||
23
unimarc/unimarc/.vscode/launch.json
vendored
23
unimarc/unimarc/.vscode/launch.json
vendored
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
3
unimarc/unimarc/.vscode/settings.json
vendored
3
unimarc/unimarc/.vscode/settings.json
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"dotnet.preferCSharpExtension": true
|
||||
}
|
||||
50
unimarc/unimarc/.vscode/tasks.json
vendored
50
unimarc/unimarc/.vscode/tasks.json
vendored
@@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -37,12 +37,12 @@ namespace WindowsFormsApp1
|
||||
public string DB_User_Data;
|
||||
public string User;
|
||||
public string com_idx;
|
||||
|
||||
|
||||
public Main()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public string User_Name { get; internal set; }
|
||||
@@ -53,7 +53,7 @@ namespace WindowsFormsApp1
|
||||
|
||||
|
||||
this.Visible = false; // 메인폼을 먼저 숨김
|
||||
|
||||
|
||||
#region "Log setting"
|
||||
var logsubdir = "{yyyy|MM|dd}";
|
||||
string tPath = string.Format("{0}\\LOG", AppDomain.CurrentDomain.BaseDirectory).Replace("\\\\", "\\"); ;
|
||||
@@ -64,12 +64,10 @@ namespace WindowsFormsApp1
|
||||
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 +146,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 +241,7 @@ namespace WindowsFormsApp1
|
||||
"송금내역조회", "송금등록", "매입 집계", "매입 장부", "매출 입력",
|
||||
"매출 입금", "매출 조회", "매출 집계", "파트타임 관리" };
|
||||
ToolStripMenuItem[] AccT = {
|
||||
송금내역조회, 송금등록, 매입집계, 매입장부, 매출입력,
|
||||
송금내역조회, 송금등록, 매입집계, 매입장부, 매출입력,
|
||||
매출입금, 매출조회, 매출집계, 파트타임관리
|
||||
};
|
||||
ToolStripMenuItem[] TempAcc = {
|
||||
@@ -287,17 +285,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 +305,7 @@ namespace WindowsFormsApp1
|
||||
return;
|
||||
|
||||
// 권한설정으로 인한 리턴
|
||||
if (!MenuCheckT[count[0]][count[1]].Enabled)
|
||||
{
|
||||
if (!MenuCheckT[count[0]][count[1]].Enabled) {
|
||||
MessageBox.Show("권한이 설정되지 않았습니다!");
|
||||
return;
|
||||
}
|
||||
@@ -730,7 +725,7 @@ namespace WindowsFormsApp1
|
||||
Acc_purchase_Aggregation.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void 매입미결제ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Acc_purchase_Not_Pay != null)
|
||||
@@ -746,7 +741,7 @@ namespace WindowsFormsApp1
|
||||
Acc_purchase_Not_Pay.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void 매출입력ToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Acc_sales_Input != null)
|
||||
@@ -988,11 +983,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 +1192,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,8 +1200,6 @@ 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;
|
||||
|
||||
@@ -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; }
|
||||
@@ -2983,21 +2962,16 @@ namespace WindowsFormsApp1
|
||||
public string VersionInfo()
|
||||
{
|
||||
string version = "";
|
||||
var updatefile = $"{Application.StartupPath}\\update.inf";
|
||||
if (System.IO.File.Exists(updatefile))
|
||||
StreamReader sr = new StreamReader(Application.StartupPath + "\\update.inf");
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
StreamReader sr = new StreamReader(updatefile);
|
||||
while (!sr.EndOfStream)
|
||||
string line = sr.ReadLine();
|
||||
if (line.IndexOf("count=", 0) != -1)
|
||||
{
|
||||
string line = sr.ReadLine();
|
||||
if (line.IndexOf("count=", 0) != -1)
|
||||
{
|
||||
version = line.Replace("count=", "");
|
||||
break;
|
||||
}
|
||||
version = line.Replace("count=", "");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else version = "0";
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -100,15 +100,6 @@
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.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>
|
||||
@@ -200,7 +191,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>
|
||||
@@ -1960,7 +1950,5 @@
|
||||
<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'))" />
|
||||
</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>
|
||||
@@ -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>
|
||||
|
||||
@@ -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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
<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="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" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
101
unimarc/unimarc/마크/DLS_Copy.Designer.cs
generated
101
unimarc/unimarc/마크/DLS_Copy.Designer.cs
generated
@@ -33,9 +33,6 @@
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel8 = new System.Windows.Forms.Panel();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.Book_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ISBN = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Check = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.panel5 = new System.Windows.Forms.Panel();
|
||||
this.chk_RemoveBrit = new System.Windows.Forms.CheckBox();
|
||||
this.chk_spChar = new System.Windows.Forms.CheckBox();
|
||||
@@ -44,7 +41,6 @@
|
||||
this.btn_Reflesh008 = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.rBtn_ISBN = new System.Windows.Forms.RadioButton();
|
||||
this.btnStop = new System.Windows.Forms.Button();
|
||||
this.btn_Search = new System.Windows.Forms.Button();
|
||||
this.rBtn_BookName = new System.Windows.Forms.RadioButton();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -57,12 +53,15 @@
|
||||
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.webBrowser1 = new System.Windows.Forms.WebBrowser();
|
||||
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.btnStop = new System.Windows.Forms.Button();
|
||||
this.Book_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ISBN = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Check = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel8.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
@@ -71,7 +70,6 @@
|
||||
this.panel2.SuspendLayout();
|
||||
this.panel4.SuspendLayout();
|
||||
this.panel7.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.webView21)).BeginInit();
|
||||
this.panel6.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -99,7 +97,6 @@
|
||||
//
|
||||
// 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);
|
||||
@@ -126,25 +123,6 @@
|
||||
this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
|
||||
this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
|
||||
//
|
||||
// Book_name
|
||||
//
|
||||
this.Book_name.HeaderText = "도서명";
|
||||
this.Book_name.Name = "Book_name";
|
||||
this.Book_name.Width = 140;
|
||||
//
|
||||
// ISBN
|
||||
//
|
||||
this.ISBN.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
this.ISBN.HeaderText = "ISBN";
|
||||
this.ISBN.Name = "ISBN";
|
||||
this.ISBN.Width = 140;
|
||||
//
|
||||
// Check
|
||||
//
|
||||
this.Check.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Check.HeaderText = "Y/N";
|
||||
this.Check.Name = "Check";
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
@@ -235,16 +213,6 @@
|
||||
this.rBtn_ISBN.Text = "ISBN";
|
||||
this.rBtn_ISBN.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnStop
|
||||
//
|
||||
this.btnStop.Location = new System.Drawing.Point(283, 5);
|
||||
this.btnStop.Name = "btnStop";
|
||||
this.btnStop.Size = new System.Drawing.Size(65, 23);
|
||||
this.btnStop.TabIndex = 2;
|
||||
this.btnStop.Text = "중 지";
|
||||
this.btnStop.UseVisualStyleBackColor = true;
|
||||
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
|
||||
//
|
||||
// btn_Search
|
||||
//
|
||||
this.btn_Search.Location = new System.Drawing.Point(217, 5);
|
||||
@@ -358,24 +326,23 @@
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
this.panel7.Controls.Add(this.webView21);
|
||||
this.panel7.Controls.Add(this.webBrowser1);
|
||||
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
|
||||
// webBrowser1
|
||||
//
|
||||
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;
|
||||
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(929, 697);
|
||||
this.webBrowser1.TabIndex = 5;
|
||||
this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
|
||||
//
|
||||
// panel6
|
||||
//
|
||||
@@ -420,13 +387,34 @@
|
||||
this.tb_URL.TabIndex = 0;
|
||||
this.tb_URL.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_URL_KeyDown);
|
||||
//
|
||||
// statusStrip1
|
||||
// btnStop
|
||||
//
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 607);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(395, 22);
|
||||
this.statusStrip1.TabIndex = 1;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
this.btnStop.Location = new System.Drawing.Point(283, 5);
|
||||
this.btnStop.Name = "btnStop";
|
||||
this.btnStop.Size = new System.Drawing.Size(65, 23);
|
||||
this.btnStop.TabIndex = 2;
|
||||
this.btnStop.Text = "중 지";
|
||||
this.btnStop.UseVisualStyleBackColor = true;
|
||||
this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
|
||||
//
|
||||
// Book_name
|
||||
//
|
||||
this.Book_name.HeaderText = "도서명";
|
||||
this.Book_name.Name = "Book_name";
|
||||
this.Book_name.Width = 140;
|
||||
//
|
||||
// ISBN
|
||||
//
|
||||
this.ISBN.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
this.ISBN.HeaderText = "ISBN";
|
||||
this.ISBN.Name = "ISBN";
|
||||
this.ISBN.Width = 140;
|
||||
//
|
||||
// Check
|
||||
//
|
||||
this.Check.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Check.HeaderText = "Y/N";
|
||||
this.Check.Name = "Check";
|
||||
//
|
||||
// DLS_Copy
|
||||
//
|
||||
@@ -440,7 +428,6 @@
|
||||
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();
|
||||
@@ -450,7 +437,6 @@
|
||||
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.ResumeLayout(false);
|
||||
@@ -475,7 +461,7 @@
|
||||
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.WebBrowser webBrowser1;
|
||||
private System.Windows.Forms.Panel panel4;
|
||||
private System.Windows.Forms.Panel panel6;
|
||||
private System.Windows.Forms.TextBox tb_URL;
|
||||
@@ -492,6 +478,5 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ISBN;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Check;
|
||||
private System.Windows.Forms.Button btnStop;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,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
|
||||
{
|
||||
@@ -30,39 +28,9 @@ namespace WindowsFormsApp1.Mac
|
||||
//변경된 홈페이지: 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)
|
||||
{
|
||||
try
|
||||
{
|
||||
compidx = main.com_idx;
|
||||
|
||||
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);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(
|
||||
$"WebView2 초기화 중 오류가 발생했습니다: {ex.Message}\n\n" +
|
||||
"웹 기능이 필요하면 나중에 다시 시도해 주세요.",
|
||||
"WebView2 초기화 오류",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error
|
||||
);
|
||||
|
||||
// webView2 숨기고 오류 상태 표시
|
||||
webView21.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void WebView21_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
|
||||
{
|
||||
tb_URL.Text = webView21.CoreWebView2.Source;
|
||||
webBrowser1.Navigate(url);
|
||||
}
|
||||
|
||||
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||||
@@ -95,7 +63,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")
|
||||
{
|
||||
@@ -108,43 +76,38 @@ namespace WindowsFormsApp1.Mac
|
||||
return;
|
||||
}
|
||||
|
||||
string url = webView21.CoreWebView2.Source;
|
||||
string url = webBrowser1.Url.AbsoluteUri;
|
||||
|
||||
//await webView21.CoreWebView2.ExecuteScriptAsync("document.getElementById('headerLoginBtn').click();");
|
||||
webBrowser1.Document.GetElementById("headerLoginBtn").InvokeMember("click");
|
||||
|
||||
await Task.Delay(1000);
|
||||
Delay(5000);
|
||||
|
||||
await DLS_Login(url);
|
||||
DLS_Login(url);
|
||||
}
|
||||
#region Connect_SUB
|
||||
|
||||
private async Task DLS_Login(string url)
|
||||
private void 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('"');
|
||||
string ID = lbl_ID.Text, PW = lbl_PW.Text;
|
||||
url = webBrowser1.Document.GetElementById(SetArea(lbl_Area.Text)).GetAttribute("value");
|
||||
|
||||
//id설정
|
||||
await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('lgID').value = '{ID}';");
|
||||
webBrowser1.Document.GetElementById("s_id").SetAttribute("value", ID);
|
||||
webBrowser1.Document.GetElementById("s_pwd").SetAttribute("value", PW);
|
||||
|
||||
//pw 설정
|
||||
await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('lgPW').value = '{PW}';");
|
||||
webBrowser1.Document.GetElementById("s_login").InvokeMember("click");
|
||||
|
||||
//로그인버튼 클릭
|
||||
await webView21.CoreWebView2.ExecuteScriptAsync("document.getElementById('loginBtn').click();");
|
||||
|
||||
await Task.Delay(4000);
|
||||
webView21.CoreWebView2.Navigate("https://dls1.edunet.net/DLS/bookMng/bookMain");
|
||||
Delay(4000);
|
||||
webBrowser1.Navigate(url + "/r/dls_new/bookInfo/collectionFormMA.jsp");
|
||||
}
|
||||
#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,16 +120,16 @@ namespace WindowsFormsApp1.Mac
|
||||
MessageBox.Show("도서명이 입력되지않았습니다!");
|
||||
return;
|
||||
}
|
||||
if (!await SearchCopy(rBtn_ISBN.Checked))
|
||||
if (!SearchCopy(rBtn_ISBN.Checked))
|
||||
return;
|
||||
|
||||
MessageBox.Show("완료되었습니다.");
|
||||
}
|
||||
#region SearchClick_Sub
|
||||
|
||||
private async Task<bool> SearchCopy(bool isISBN)
|
||||
private bool SearchCopy(bool isISBN)
|
||||
{
|
||||
if (!webView21.CoreWebView2.Source.Contains("collectionFormMA"))
|
||||
if (!webBrowser1.Url.AbsoluteUri.Contains("collectionFormMA"))
|
||||
{
|
||||
MessageBox.Show("자료관리 창이 아닙니다!");
|
||||
return false;
|
||||
@@ -181,12 +144,12 @@ namespace WindowsFormsApp1.Mac
|
||||
if (isISBN)
|
||||
{
|
||||
string Target = dataGridView1.Rows[a].Cells["ISBN"].Value.ToString();
|
||||
Check = await SearchISBN(Target);
|
||||
Check = SearchISBN(Target);
|
||||
}
|
||||
else
|
||||
{
|
||||
string Target = dataGridView1.Rows[a].Cells["Book_name"].Value.ToString();
|
||||
Check = await SearchName(Target);
|
||||
Check = SearchName(Target);
|
||||
}
|
||||
if (Check == "0")
|
||||
Check = "";
|
||||
@@ -210,15 +173,34 @@ namespace WindowsFormsApp1.Mac
|
||||
/// </summary>
|
||||
/// <param name="Target">도서명</param>
|
||||
/// <param name="row">행 번호</param>
|
||||
private async Task<string> SearchName(string Target)
|
||||
private 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);
|
||||
HtmlElementCollection search = webBrowser1.Document.GetElementsByTagName("input");
|
||||
foreach (HtmlElement Search in search)
|
||||
{
|
||||
if (Search.Id == "bib1")
|
||||
Search.SetAttribute("value", Target);
|
||||
|
||||
string script = "(() => { const div = document.querySelector('.paging_nav'); return div ? div.querySelector('span')?.innerText || '' : ''; })()";
|
||||
string InnerText = await webView21.CoreWebView2.ExecuteScriptAsync(script);
|
||||
InnerText = InnerText.Trim('"');
|
||||
if (Search.GetAttribute("className") == "button_search")
|
||||
Search.InvokeMember("click");
|
||||
}
|
||||
Delay(5000);
|
||||
|
||||
string InnerText = "";
|
||||
|
||||
HtmlElementCollection paging_nav = webBrowser1.Document.GetElementsByTagName("div");
|
||||
foreach (HtmlElement div in paging_nav)
|
||||
{
|
||||
if (div.GetAttribute("className") == "paging_nav")
|
||||
{
|
||||
HtmlElementCollection span = div.GetElementsByTagName("span");
|
||||
foreach (HtmlElement count in span)
|
||||
{
|
||||
InnerText = count.InnerText;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return InnerText;
|
||||
}
|
||||
@@ -227,16 +209,41 @@ namespace WindowsFormsApp1.Mac
|
||||
/// </summary>
|
||||
/// <param name="Target">ISBN</param>
|
||||
/// <param name="row">행 번호</param>
|
||||
private async Task<string> SearchISBN(string Target)
|
||||
private 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);
|
||||
HtmlElementCollection combo = webBrowser1.Document.GetElementsByTagName("select");
|
||||
foreach (HtmlElement Search in combo)
|
||||
{
|
||||
if (Search.Id == "bibKind2")
|
||||
Search.SetAttribute("selectedIndex", "2");
|
||||
}
|
||||
|
||||
string script = "(() => { const div = document.querySelector('.paging_nav'); return div ? div.querySelector('span')?.innerText || '' : ''; })()";
|
||||
string InnerText = await webView21.CoreWebView2.ExecuteScriptAsync(script);
|
||||
InnerText = InnerText.Trim('"');
|
||||
HtmlElementCollection search = webBrowser1.Document.GetElementsByTagName("input");
|
||||
foreach (HtmlElement Search in search)
|
||||
{
|
||||
if (Search.Id == "bib2")
|
||||
Search.SetAttribute("value", Target);
|
||||
|
||||
if (Search.GetAttribute("className") == "button_search")
|
||||
Search.InvokeMember("click");
|
||||
}
|
||||
Delay(5000);
|
||||
|
||||
string InnerText = "";
|
||||
|
||||
HtmlElementCollection paging_nav = webBrowser1.Document.GetElementsByTagName("div");
|
||||
foreach (HtmlElement div in paging_nav)
|
||||
{
|
||||
if (div.GetAttribute("className") == "paging_nav")
|
||||
{
|
||||
HtmlElementCollection span = div.GetElementsByTagName("span");
|
||||
foreach (HtmlElement count in span)
|
||||
{
|
||||
InnerText = count.InnerText;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return InnerText;
|
||||
}
|
||||
@@ -246,7 +253,7 @@ namespace WindowsFormsApp1.Mac
|
||||
/// DLS지역 코드 변환
|
||||
/// </summary>
|
||||
/// <returns>코드</returns>
|
||||
public async Task<string> SetArea(string dlsArea, bool move = false)
|
||||
public string SetArea(string dlsArea, bool move = false)
|
||||
{
|
||||
string[] Area = {
|
||||
"서울", "부산", "대구", "인천", "광주",
|
||||
@@ -275,9 +282,7 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
try
|
||||
{
|
||||
string elementValue = await webView21.CoreWebView2.ExecuteScriptAsync($"document.getElementById('{Code[idx]}').value;");
|
||||
elementValue = elementValue.Trim('"');
|
||||
webView21.CoreWebView2.Navigate(elementValue);
|
||||
webBrowser1.Navigate(webBrowser1.Document.GetElementById(Code[idx]).GetAttribute("value"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -313,14 +318,17 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
private void btn_Back_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (webView21.CoreWebView2.CanGoBack)
|
||||
webView21.CoreWebView2.GoBack();
|
||||
webBrowser1.GoBack();
|
||||
}
|
||||
|
||||
private void btn_Forward_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (webView21.CoreWebView2.CanGoForward)
|
||||
webView21.CoreWebView2.GoForward();
|
||||
webBrowser1.GoForward();
|
||||
}
|
||||
|
||||
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||
{
|
||||
tb_URL.Text = webBrowser1.Url.AbsoluteUri;
|
||||
}
|
||||
|
||||
private void tb_URL_KeyDown(object sender, KeyEventArgs e)
|
||||
@@ -328,7 +336,7 @@ namespace WindowsFormsApp1.Mac
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
string url = tb_URL.Text;
|
||||
webView21.CoreWebView2.Navigate(url);
|
||||
webBrowser1.Navigate(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -135,38 +132,37 @@
|
||||
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
|
||||
P87mU+ZvyRQDAAAAAElFTkSuQmCC
|
||||
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
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user