..
This commit is contained in:
@@ -20,25 +20,44 @@ namespace VNCServerList.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
var vncViewerPath = _settingsService.GetSettings().VNCViewerPath;
|
||||
var settings = _settingsService.GetSettings();
|
||||
var vncViewerPath = settings.VNCViewerPath;
|
||||
|
||||
if (!File.Exists(vncViewerPath))
|
||||
{
|
||||
throw new FileNotFoundException($"VNC Viewer를 찾을 수 없습니다: {vncViewerPath}");
|
||||
}
|
||||
|
||||
// 서버의 argument가 없으면 설정의 기본 argument 사용
|
||||
var arguments = $"-host={server.IP}";
|
||||
|
||||
if (!string.IsNullOrEmpty(server.Argument))
|
||||
{
|
||||
arguments += $" {server.Argument}";
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(settings.Argument))
|
||||
{
|
||||
arguments += $" {settings.Argument}";
|
||||
}
|
||||
|
||||
// 비밀번호가 있으면 추가
|
||||
if (!string.IsNullOrEmpty(server.Password))
|
||||
{
|
||||
arguments += $" -password={server.Password}";
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine($"VNC 실행: 경로='{vncViewerPath}', 인수='{arguments}'");
|
||||
|
||||
// VNC Viewer 실행
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = vncViewerPath,
|
||||
Arguments = $"-host={server.IP} {server.Argument}",
|
||||
Arguments = arguments,
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
Process.Start(startInfo);
|
||||
|
||||
// 연결 성공 (마지막 연결 시간 업데이트는 현재 테이블 구조에 없으므로 제거)
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user