This commit is contained in:
backuppc
2025-07-08 14:34:38 +09:00
parent 0d2da98470
commit 447cb691d7
9 changed files with 384 additions and 9 deletions

View File

@@ -9,4 +9,5 @@
<add name="VNCServerList.Properties.Settings.VNCServerDB" connectionString="Data Source=K4FASQL.kr.ds.amkor.com,50150;Initial Catalog=EE;User ID=eeadm;Password=uJnU8a8q&amp;DJ+ug-D"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>

7
Models/VNCPathRequest.cs Normal file
View File

@@ -0,0 +1,7 @@
namespace VNCServerList.Models
{
public class VNCPathRequest
{
public string Path { get; set; }
}
}

View File

@@ -3,6 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Web.WebView2.Core;
using System.IO;
using System.Net;
using System.Diagnostics;
namespace VNCServerList
{
@@ -16,7 +20,75 @@ namespace VNCServerList
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// WebView2 런타임 확인 및 자동 다운로드
if (!WebView2Installer.IsWebView2Installed())
{
var result = MessageBox.Show(
"WebView2 런타임이 설치되지 않았습니다.\n\n" +
"자동으로 다운로드하여 설치하시겠습니까?\n\n" +
"예: 자동 다운로드 및 설치\n" +
"아니오: 수동으로 다운로드 페이지 열기",
"WebView2 런타임 설치",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
// 비동기로 설치 실행
var installTask = WebView2Installer.InstallWebView2Async();
// 설치 완료 대기
bool success = installTask.Result;
if (success)
{
MessageBox.Show(
"WebView2 런타임 설치가 완료되었습니다.\n" +
"프로그램을 다시 실행해주세요.",
"설치 완료",
MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
else
{
MessageBox.Show(
"WebView2 런타임 설치에 실패했습니다.\n" +
"수동으로 설치해주세요.",
"설치 실패",
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
// 수동 다운로드 페이지 열기
Process.Start("https://developer.microsoft.com/en-us/microsoft-edge/webview2/");
}
}
else
{
// WebView2 런타임 다운로드 페이지 열기
Process.Start("https://developer.microsoft.com/en-us/microsoft-edge/webview2/");
}
return;
}
try
{
var userDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\VNCServerList\\WebView2Data";
var env = CoreWebView2Environment.CreateAsync(null, userDataFolder).Result;
Application.Run(new Form1());
}
catch (Exception ex)
{
MessageBox.Show(
"WebView2 초기화 중 오류가 발생했습니다.\n" +
"오류: " + ex.Message,
"오류",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
}
}
}

19
README_deploy.txt Normal file
View File

@@ -0,0 +1,19 @@
VNCServerList 배포 파일 (VS2017 Express 버전)
필요한 파일:
- VNCServerList.exe (메인 실행 파일)
- VNCServerList.exe.config (설정 파일)
- *.dll 파일들 (필요한 라이브러리)
- Web\ 폴더 (웹 인터페이스 파일들)
시스템 요구사항:
- Windows 7 SP1 이상
- .NET Framework 4.8
- Microsoft Edge WebView2 Runtime (자동 다운로드됨)
설치 방법:
1. 모든 파일을 원하는 폴더에 복사
2. VNCServerList.exe 실행
3. 웹 브라우저에서 http://localhost:8080 접속
참고: WebView2 Runtime이 설치되지 않은 경우 자동으로 다운로드됩니다.

View File

@@ -12,6 +12,7 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<WebView2Loader>false</WebView2Loader>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -35,15 +36,10 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Web" />
<Reference Include="System.Configuration" />
</ItemGroup>
@@ -56,7 +52,14 @@
<PackageReference Include="Microsoft.AspNet.WebApi.Owin" Version="5.2.9" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<!-- 패키지 버전 충돌 해결 -->
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
@@ -65,9 +68,11 @@
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="WebView2Installer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Models\VNCServer.cs" />
<Compile Include="Models\AppSettings.cs" />
<Compile Include="Models\VNCPathRequest.cs" />
<Compile Include="Services\DatabaseService.cs" />
<Compile Include="Services\VNCService.cs" />
<Compile Include="Services\SettingsService.cs" />
@@ -103,5 +108,6 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -186,11 +186,11 @@ namespace VNCServerList.Web.Controllers
[HttpPost]
[Route("set-vnc-path")]
public IHttpActionResult SetVNCPath([FromBody] dynamic data)
public IHttpActionResult SetVNCPath([FromBody] VNCPathRequest data)
{
try
{
string path = data.path;
string path = data.Path;
if (string.IsNullOrEmpty(path))
{
return BadRequest("VNC Viewer 경로가 제공되지 않았습니다.");

190
WebView2Installer.cs Normal file
View File

@@ -0,0 +1,190 @@
using System;
using System.IO;
using System.Net;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading.Tasks;
namespace VNCServerList
{
public static class WebView2Installer
{
private const string DOWNLOAD_URL = "https://go.microsoft.com/fwlink/p/?LinkId=2124703";
private const string INSTALLER_NAME = "MicrosoftEdgeWebview2Setup.exe";
public static async Task<bool> InstallWebView2Async()
{
try
{
// 다운로드 진행 상황 표시
using (var progressForm = new WebView2DownloadForm())
{
progressForm.Show();
// 임시 폴더에 설치 파일 다운로드
string tempFolder = Path.GetTempPath();
string installerPath = Path.Combine(tempFolder, INSTALLER_NAME);
// 기존 파일이 있으면 삭제
if (File.Exists(installerPath))
{
File.Delete(installerPath);
}
// 다운로드
using (var client = new WebClient())
{
client.DownloadProgressChanged += (sender, e) =>
{
progressForm.UpdateProgress(e.ProgressPercentage, e.BytesReceived, e.TotalBytesToReceive);
};
await client.DownloadFileTaskAsync(new Uri(DOWNLOAD_URL), installerPath);
}
progressForm.Close();
// 설치 실행
var startInfo = new ProcessStartInfo
{
FileName = installerPath,
Arguments = "/silent /install", // 자동 설치
UseShellExecute = true
};
var process = Process.Start(startInfo);
// 설치 완료 대기 (최대 5분)
if (process != null)
{
await Task.Run(() => process.WaitForExit(300000)); // 5분
// 설치 파일 정리
try
{
if (File.Exists(installerPath))
{
File.Delete(installerPath);
}
}
catch { /* 무시 */ }
return process.ExitCode == 0;
}
return false;
}
}
catch (Exception ex)
{
MessageBox.Show(
$"WebView2 런타임 설치 중 오류가 발생했습니다:\n{ex.Message}",
"설치 오류",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return false;
}
}
public static bool IsWebView2Installed()
{
try
{
// 레지스트리에서 WebView2 설치 확인
using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"))
{
if (key != null)
{
return true;
}
}
// 64비트 시스템에서 32비트 레지스트리 확인
using (var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"))
{
if (key != null)
{
return true;
}
}
return false;
}
catch
{
return false;
}
}
}
public partial class WebView2DownloadForm : Form
{
private ProgressBar progressBar;
private Label statusLabel;
public WebView2DownloadForm()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.progressBar = new ProgressBar();
this.statusLabel = new Label();
this.SuspendLayout();
// Form 설정
this.Text = "WebView2 런타임 다운로드";
this.Size = new System.Drawing.Size(400, 150);
this.StartPosition = FormStartPosition.CenterScreen;
this.FormBorderStyle = FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
// Status Label
this.statusLabel.AutoSize = true;
this.statusLabel.Location = new System.Drawing.Point(20, 20);
this.statusLabel.Size = new System.Drawing.Size(360, 20);
this.statusLabel.Text = "WebView2 런타임을 다운로드하고 있습니다...";
// Progress Bar
this.progressBar.Location = new System.Drawing.Point(20, 50);
this.progressBar.Size = new System.Drawing.Size(360, 30);
this.progressBar.Style = ProgressBarStyle.Continuous;
// Controls 추가
this.Controls.Add(this.statusLabel);
this.Controls.Add(this.progressBar);
this.ResumeLayout(false);
this.PerformLayout();
}
public void UpdateProgress(int percentage, long bytesReceived, long totalBytes)
{
if (this.InvokeRequired)
{
this.Invoke(new Action(() => UpdateProgress(percentage, bytesReceived, totalBytes)));
return;
}
this.progressBar.Value = percentage;
this.statusLabel.Text = $"다운로드 중... {percentage}% ({FormatBytes(bytesReceived)} / {FormatBytes(totalBytes)})";
}
private string FormatBytes(long bytes)
{
string[] suffixes = { "B", "KB", "MB", "GB" };
int counter = 0;
decimal number = bytes;
while (Math.Round(number / 1024) >= 1)
{
number /= 1024;
counter++;
}
return $"{number:n1} {suffixes[counter]}";
}
}
}

46
build_simple.bat Normal file
View File

@@ -0,0 +1,46 @@
@echo off
echo Creating VNCServerList deployment package from Debug folder...
echo.
REM Check if Debug folder exists
if not exist "bin\Debug" (
echo Error: bin\Debug folder not found!
echo Please build the project first in Visual Studio 2017 Express:
echo 1. Open VNCServerList.sln in Visual Studio 2017 Express
echo 2. Build -> Build Solution
echo.
pause
exit /b 1
)
echo Found Debug folder. Creating deployment package...
echo.
REM Create deployment folder
if not exist "deploy" mkdir deploy
REM Copy all files from Debug folder (except .pdb files)
echo Copying files from Debug folder...
xcopy "bin\Debug\*.*" "deploy\" /E /I /Y
REM Remove .pdb files (debug symbols)
if exist "deploy\*.pdb" del "deploy\*.pdb"
REM Copy README file
if exist "README_deploy.txt" (
copy "README_deploy.txt" "deploy\README.txt"
echo Copied README.txt to deploy\
) else (
echo Warning: README_deploy.txt not found
)
echo.
echo Deployment package created in 'deploy' folder!
echo.
echo Files included:
dir deploy /b
echo.
echo Note: This package includes all necessary files from Debug folder.
echo You can now zip the 'deploy' folder and distribute it.
echo.
pause

34
deploy_debug.bat Normal file
View File

@@ -0,0 +1,34 @@
@echo off
echo VNCServerList Debug 배포 패키지 생성
echo.
REM Debug 폴더 확인
if not exist "bin\Debug" (
echo 오류: bin\Debug 폴더를 찾을 수 없습니다!
echo Visual Studio에서 먼저 빌드해주세요.
pause
exit /b 1
)
REM 배포 폴더 생성
if exist "deploy" rmdir /s /q "deploy"
mkdir deploy
REM Debug 폴더의 모든 파일 복사
echo Debug 폴더에서 파일 복사 중...
xcopy "bin\Debug\*.*" "deploy\" /E /I /Y
REM .pdb 파일 제거 (디버그 심볼)
if exist "deploy\*.pdb" del "deploy\*.pdb"
REM README 추가
if exist "README_deploy.txt" copy "README_deploy.txt" "deploy\README.txt"
echo.
echo 배포 패키지가 생성되었습니다!
echo.
echo 포함된 파일:
dir deploy /b
echo.
echo 이제 deploy 폴더를 압축해서 배포하세요.
pause