..
This commit is contained in:
@@ -32,6 +32,7 @@ namespace VNCServerList.Services
|
||||
[User] [varchar](50) NOT NULL,
|
||||
[IP] [varchar](20) NOT NULL,
|
||||
[Category] [varchar](20) NULL,
|
||||
[Title] [varchar](50) NULL,
|
||||
[Description] [varchar](100) NULL,
|
||||
[Password] [varchar](20) NULL,
|
||||
[Argument] [varchar](50) NULL,
|
||||
@@ -68,6 +69,7 @@ namespace VNCServerList.Services
|
||||
User = reader["User"].ToString(),
|
||||
IP = reader["IP"].ToString(),
|
||||
Category = reader["Category"] == DBNull.Value ? null : reader["Category"].ToString(),
|
||||
Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(),
|
||||
Description = reader["Description"] == DBNull.Value ? null : reader["Description"].ToString(),
|
||||
Password = reader["Password"] == DBNull.Value ? null : reader["Password"].ToString(),
|
||||
Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString()
|
||||
@@ -100,6 +102,7 @@ namespace VNCServerList.Services
|
||||
User = reader["User"].ToString(),
|
||||
IP = reader["IP"].ToString(),
|
||||
Category = reader["Category"] == DBNull.Value ? null : reader["Category"].ToString(),
|
||||
Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(),
|
||||
Description = reader["Description"] == DBNull.Value ? null : reader["Description"].ToString(),
|
||||
Password = reader["Password"] == DBNull.Value ? null : reader["Password"].ToString(),
|
||||
Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString()
|
||||
@@ -118,7 +121,7 @@ namespace VNCServerList.Services
|
||||
{
|
||||
connection.Open();
|
||||
string sql = @"
|
||||
INSERT INTO VNC_ServerList ([User], [IP], [Category], [Description], [Password], [Argument])
|
||||
INSERT INTO VNC_ServerList ([User], [IP], [Category], [Title],[Description], [Password], [Argument])
|
||||
VALUES (@User, @IP, @Category, @Description, @Password, @Argument)";
|
||||
|
||||
using (var command = new SqlCommand(sql, connection))
|
||||
@@ -126,6 +129,7 @@ namespace VNCServerList.Services
|
||||
command.Parameters.AddWithValue("@User", server.User);
|
||||
command.Parameters.AddWithValue("@IP", server.IP);
|
||||
command.Parameters.AddWithValue("@Category", (object)server.Category ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Title", (object)server.Title ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Description", (object)server.Description ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Password", (object)server.Password ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Argument", (object)server.Argument ?? DBNull.Value);
|
||||
@@ -142,7 +146,7 @@ namespace VNCServerList.Services
|
||||
connection.Open();
|
||||
string sql = @"
|
||||
UPDATE VNC_ServerList
|
||||
SET [Category] = @Category, [Description] = @Description,
|
||||
SET [Category] = @Category, [Title] = @Title, [Description] = @Description,
|
||||
[Password] = @Password, [Argument] = @Argument
|
||||
WHERE [User] = @User AND [IP] = @IP";
|
||||
|
||||
@@ -151,6 +155,7 @@ namespace VNCServerList.Services
|
||||
command.Parameters.AddWithValue("@User", server.User);
|
||||
command.Parameters.AddWithValue("@IP", server.IP);
|
||||
command.Parameters.AddWithValue("@Category", (object)server.Category ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Title", (object)server.Title ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Description", (object)server.Description ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Password", (object)server.Password ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Argument", (object)server.Argument ?? DBNull.Value);
|
||||
|
||||
@@ -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