..
This commit is contained in:
@@ -7,12 +7,12 @@ namespace VNCServerList.Services
|
||||
{
|
||||
public class VNCService
|
||||
{
|
||||
private readonly string _vncViewerPath;
|
||||
private readonly SettingsService _settingsService;
|
||||
private readonly DatabaseService _databaseService;
|
||||
|
||||
public VNCService(DatabaseService databaseService)
|
||||
public VNCService(DatabaseService databaseService, SettingsService settingsService = null)
|
||||
{
|
||||
_vncViewerPath = @"C:\Program Files\TightVNC\tvnviewer.exe";
|
||||
_settingsService = settingsService ?? new SettingsService();
|
||||
_databaseService = databaseService;
|
||||
}
|
||||
|
||||
@@ -20,15 +20,17 @@ namespace VNCServerList.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(_vncViewerPath))
|
||||
var vncViewerPath = _settingsService.GetSettings().VNCViewerPath;
|
||||
|
||||
if (!File.Exists(vncViewerPath))
|
||||
{
|
||||
throw new FileNotFoundException($"VNC Viewer를 찾을 수 없습니다: {_vncViewerPath}");
|
||||
throw new FileNotFoundException($"VNC Viewer를 찾을 수 없습니다: {vncViewerPath}");
|
||||
}
|
||||
|
||||
// VNC Viewer 실행
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = _vncViewerPath,
|
||||
FileName = vncViewerPath,
|
||||
Arguments = $"-host={server.IP} {server.Argument}",
|
||||
UseShellExecute = true
|
||||
};
|
||||
@@ -58,12 +60,21 @@ namespace VNCServerList.Services
|
||||
|
||||
public bool IsVNCViewerInstalled()
|
||||
{
|
||||
return File.Exists(_vncViewerPath);
|
||||
var vncViewerPath = _settingsService.GetSettings().VNCViewerPath;
|
||||
System.Diagnostics.Debug.WriteLine($"VNC 설치 확인: 경로='{vncViewerPath}', 존재={File.Exists(vncViewerPath)}");
|
||||
return File.Exists(vncViewerPath);
|
||||
}
|
||||
|
||||
public string GetVNCViewerPath()
|
||||
{
|
||||
return _vncViewerPath;
|
||||
var path = _settingsService.GetSettings().VNCViewerPath;
|
||||
System.Diagnostics.Debug.WriteLine($"VNC 경로 조회: '{path}'");
|
||||
return path;
|
||||
}
|
||||
|
||||
public void SetVNCViewerPath(string path)
|
||||
{
|
||||
_settingsService.UpdateVNCViewerPath(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user