Files
AX-Copilot/src/AxCopilot/Models/AppSettings.Models.cs
lacvet 212ed9519e [Phase L8] 파일·시스템 유틸리티 핸들러 4종 추가
FileHashHandler.cs (200줄, prefix=hash):
- MD5/SHA1/SHA256/SHA512 비동기 해시 계산
- 클립보드 파일 경로 자동 감지
- hash check <기대값>으로 클립보드 해시 비교

ZipHandler.cs (260줄, prefix=zip):
- System.IO.Compression 기반 목록·추출·압축
- zip list: 파일 목록 미리보기 (최대 20개)
- zip extract: 동일/지정 폴더 압축 해제
- zip folder: 폴더→zip 압축

EventLogHandler.cs (165줄, prefix=evt):
- System+Application 로그 최근 24시간 조회
- evt error/warn/app/sys/<키워드> 필터
- InstanceId 기반 (EventID deprecated 경고 수정)
- 이벤트 상세 클립보드 복사

SshHandler.cs (270줄, prefix=ssh):
- SshHostEntry 모델 + AppSettings.SshHosts 영속화
- ssh add user@host[:port], ssh del <이름>
- Windows Terminal/PuTTY/PowerShell 순 폴백 연결
- 직접 user@host 입력 즉시 연결 지원

AppSettings.Models.cs: SshHostEntry 클래스 추가
AppSettings.cs: SshHosts 프로퍼티 추가
App.xaml.cs: Phase L8 핸들러 4종 등록
docs/LAUNCHER_ROADMAP.md: Phase L8 섹션 추가 

빌드: 경고 0, 오류 0
2026-04-04 14:06:24 +09:00

489 lines
18 KiB
C#

using System.Text.Json.Serialization;
namespace AxCopilot.Models;
// 기타 설정 모델 클래스
public class WorkspaceProfile
{
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("windows")]
public List<WindowSnapshot> Windows { get; set; } = new();
[JsonPropertyName("createdAt")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
}
public class WindowSnapshot
{
[JsonPropertyName("exe")]
public string Exe { get; set; } = "";
[JsonPropertyName("title")]
public string Title { get; set; } = "";
[JsonPropertyName("rect")]
public WindowRect Rect { get; set; } = new();
[JsonPropertyName("showCmd")]
public string ShowCmd { get; set; } = "Normal"; // Normal | Minimized | Maximized
[JsonPropertyName("monitor")]
public int Monitor { get; set; } = 0;
}
public class WindowRect
{
[JsonPropertyName("x")]
public int X { get; set; }
[JsonPropertyName("y")]
public int Y { get; set; }
[JsonPropertyName("width")]
public int Width { get; set; }
[JsonPropertyName("height")]
public int Height { get; set; }
}
public class AliasEntry
{
[JsonPropertyName("key")]
public string Key { get; set; } = "";
[JsonPropertyName("type")]
public string Type { get; set; } = "url"; // url | folder | app | batch | api | clipboard
[JsonPropertyName("target")]
public string Target { get; set; } = "";
[JsonPropertyName("description")]
public string? Description { get; set; }
[JsonPropertyName("showWindow")]
public bool ShowWindow { get; set; } = false;
[JsonPropertyName("adapter")]
public string? Adapter { get; set; }
[JsonPropertyName("query")]
public string? Query { get; set; }
}
public class ClipboardTransformer
{
[JsonPropertyName("key")]
public string Key { get; set; } = "";
[JsonPropertyName("type")]
public string Type { get; set; } = "regex"; // regex | script
[JsonPropertyName("pattern")]
public string? Pattern { get; set; }
[JsonPropertyName("replace")]
public string? Replace { get; set; }
[JsonPropertyName("command")]
public string? Command { get; set; }
[JsonPropertyName("timeout")]
public int Timeout { get; set; } = 5000;
[JsonPropertyName("description")]
public string? Description { get; set; }
}
public class ApiAdapter
{
[JsonPropertyName("id")]
public string Id { get; set; } = "";
[JsonPropertyName("baseUrl")]
public string BaseUrl { get; set; } = "";
[JsonPropertyName("credentialKey")]
public string CredentialKey { get; set; } = "";
}
public class PluginEntry
{
[JsonPropertyName("path")]
public string Path { get; set; } = "";
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
}
// ─── 스니펫 ───────────────────────────────────────────────────────────────────
public class SnippetEntry
{
[JsonPropertyName("key")]
public string Key { get; set; } = ""; // 트리거 키워드 (예: addr, sig)
[JsonPropertyName("name")]
public string Name { get; set; } = ""; // 표시 이름
[JsonPropertyName("content")]
public string Content { get; set; } = ""; // 확장될 전체 텍스트
}
// ─── 퀵링크 ──────────────────────────────────────────────────────────────────
/// <summary>
/// 파라미터 퀵링크 항목.
/// 예: keyword="maps", urlTemplate="https://map.naver.com/p/search/{0}"
/// 사용: ql maps 강남역 → URL에 "강남역" 치환 후 브라우저 열기
/// </summary>
public class QuickLinkEntry
{
[JsonPropertyName("keyword")]
public string Keyword { get; set; } = ""; // 트리거 키워드
[JsonPropertyName("name")]
public string Name { get; set; } = ""; // 표시 이름
[JsonPropertyName("urlTemplate")]
public string UrlTemplate { get; set; } = ""; // {0}, {1} 또는 {query} 플레이스홀더
[JsonPropertyName("description")]
public string Description { get; set; } = ""; // 설명
}
// ─── AI 스니펫 템플릿 ─────────────────────────────────────────────────────────
/// <summary>
/// AI 스니펫 템플릿 항목.
/// 예: keyword="email", prompt="다음 상황에 맞는 업무 이메일 작성: {0}"
/// 사용: ai email 프로젝트 일정 변경 안내 → AI가 이메일 초안 생성
/// </summary>
public class AiSnippetTemplate
{
[JsonPropertyName("keyword")]
public string Keyword { get; set; } = "";
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("prompt")]
public string Prompt { get; set; } = ""; // {0}, {query} 플레이스홀더 지원
}
// ─── 클립보드 히스토리 ────────────────────────────────────────────────────────
public class ClipboardHistorySettings
{
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
[JsonPropertyName("maxItems")]
public int MaxItems { get; set; } = 50;
[JsonPropertyName("excludePatterns")]
public List<string> ExcludePatterns { get; set; } = new()
{
@"^\d{4}[\s\-]?\d{4}[\s\-]?\d{4}[\s\-]?\d{4}$", // 카드번호
@"^(?:\d{1,3}\.){3}\d{1,3}$" // IP 주소
};
/// <summary>이미지 클립보드 항목에서 OCR 텍스트를 자동 추출하여 검색에 활용 (Windows OCR, 로컬 처리)</summary>
[JsonPropertyName("enableOcrSearch")]
public bool EnableOcrSearch { get; set; } = true;
}
// ─── 시스템 명령 ──────────────────────────────────────────────────────────────
public class SystemCommandSettings
{
[JsonPropertyName("showLock")] public bool ShowLock { get; set; } = true;
[JsonPropertyName("showSleep")] public bool ShowSleep { get; set; } = true;
[JsonPropertyName("showRestart")] public bool ShowRestart { get; set; } = true;
[JsonPropertyName("showShutdown")] public bool ShowShutdown { get; set; } = true;
[JsonPropertyName("showHibernate")] public bool ShowHibernate { get; set; } = false;
[JsonPropertyName("showLogout")] public bool ShowLogout { get; set; } = true;
[JsonPropertyName("showRecycleBin")] public bool ShowRecycleBin { get; set; } = true;
/// <summary>
/// 시스템 명령 별칭. key = 기본 명령어(lock/sleep 등), value = 사용자 정의 별칭 목록.
/// 예: { "lock": ["잠금", "l"] } → /잠금, /l 로도 실행 가능
/// </summary>
[JsonPropertyName("commandAliases")]
public Dictionary<string, List<string>> CommandAliases { get; set; } = new();
}
// ─── 스크린 캡처 설정 ──────────────────────────────────────────────────────────
public class ScreenCaptureSettings
{
/// <summary>캡처 명령어 프리픽스. 기본값 "cap".</summary>
[JsonPropertyName("prefix")]
public string Prefix { get; set; } = "cap";
/// <summary>런처를 열지 않고 글로벌 단축키로 캡처하는 기능 활성화 여부.</summary>
[JsonPropertyName("globalHotkeyEnabled")]
public bool GlobalHotkeyEnabled { get; set; } = false;
/// <summary>글로벌 캡처 단축키 문자열. 기본값 "PrintScreen".</summary>
[JsonPropertyName("globalHotkey")]
public string GlobalHotkey { get; set; } = "PrintScreen";
/// <summary>글로벌 캡처 단축키 실행 모드. screen|window|region.</summary>
[JsonPropertyName("globalHotkeyMode")]
public string GlobalHotkeyMode { get; set; } = "screen";
/// <summary>스크롤 캡처 프레임 간 대기 시간(ms). 기본값 120.</summary>
[JsonPropertyName("scrollDelayMs")]
public int ScrollDelayMs { get; set; } = 120;
}
// ─── 전용 핫키 ────────────────────────────────────────────────────────────────
/// <summary>
/// 항목별 글로벌 전용 핫키 할당.
/// Hotkey: "Ctrl+Alt+1" 형식, Target: 실행 대상 경로/URL/명령어, Label: 표시 이름.
/// </summary>
public class HotkeyAssignment
{
[JsonPropertyName("hotkey")]
public string Hotkey { get; set; } = "";
[JsonPropertyName("target")]
public string Target { get; set; } = "";
[JsonPropertyName("label")]
public string Label { get; set; } = "";
/// <summary>실행 타입. app | url | folder | command. 기본 app.</summary>
[JsonPropertyName("type")]
public string Type { get; set; } = "app";
}
// ─── 앱 세션 스냅 ────────────────────────────────────────────────────────────────
/// <summary>
/// 앱 세션: 여러 앱을 지정 레이아웃으로 한번에 실행하는 세트.
/// session 핸들러로 저장/로드/실행합니다.
/// </summary>
public class AppSession
{
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("description")]
public string Description { get; set; } = "";
[JsonPropertyName("apps")]
public List<SessionApp> Apps { get; set; } = new();
[JsonPropertyName("createdAt")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
}
/// <summary>
/// 세션 내 개별 앱 항목. 실행 경로·인자·스냅 위치를 지정합니다.
/// </summary>
public class SessionApp
{
[JsonPropertyName("path")]
public string Path { get; set; } = "";
[JsonPropertyName("args")]
public string Arguments { get; set; } = "";
/// <summary>표시 이름. 비어 있으면 파일명을 사용합니다.</summary>
[JsonPropertyName("label")]
public string Label { get; set; } = "";
/// <summary>
/// 스냅 위치. left / right / tl / tr / bl / br / full / center /
/// third-l / third-c / third-r / two3-l / two3-r / none
/// </summary>
[JsonPropertyName("snap")]
public string SnapPosition { get; set; } = "full";
/// <summary>이 앱을 실행하기 전 대기 시간(ms). 기본값 0.</summary>
[JsonPropertyName("delayMs")]
public int DelayMs { get; set; } = 0;
}
// ─── 자동화 스케줄러 ─────────────────────────────────────────────────────────────
/// <summary>
/// 자동화 스케줄 항목.
/// 지정 시각에 앱 실행 또는 알림을 자동으로 발생시킵니다.
/// </summary>
public class ScheduleEntry
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString("N")[..8];
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = true;
// ─── 트리거 ───────────────────────────────────────────────────────────
/// <summary>실행 주기. daily | weekdays | weekly | once</summary>
[JsonPropertyName("triggerType")]
public string TriggerType { get; set; } = "daily";
/// <summary>실행 시각 (HH:mm 형식). 예: "09:00"</summary>
[JsonPropertyName("triggerTime")]
public string TriggerTime { get; set; } = "09:00";
/// <summary>weekly 트리거: 요일 목록. 0=일, 1=월 … 6=토</summary>
[JsonPropertyName("weekDays")]
public List<int> WeekDays { get; set; } = new();
/// <summary>once 트리거: 실행 날짜 (yyyy-MM-dd). 한 번만 실행 후 비활성화.</summary>
[JsonPropertyName("triggerDate")]
public string? TriggerDate { get; set; }
// ─── 액션 ─────────────────────────────────────────────────────────────
/// <summary>실행 동작 유형. app | notification</summary>
[JsonPropertyName("actionType")]
public string ActionType { get; set; } = "app";
/// <summary>앱 경로 또는 알림 메시지 본문</summary>
[JsonPropertyName("actionTarget")]
public string ActionTarget { get; set; } = "";
/// <summary>앱 실행 시 추가 인자</summary>
[JsonPropertyName("actionArgs")]
public string ActionArgs { get; set; } = "";
// ─── 상태 ─────────────────────────────────────────────────────────────
[JsonPropertyName("lastRun")]
public DateTime? LastRun { get; set; }
// ─── 조건 (L6-4) ─────────────────────────────────────────────────────
/// <summary>
/// 실행 조건: 특정 프로세스가 실행 중이어야(또는 아니어야) 트리거를 발화합니다.
/// 비어 있으면 조건 없음.
/// </summary>
[JsonPropertyName("conditionProcess")]
public string ConditionProcess { get; set; } = "";
/// <summary>
/// true=해당 프로세스가 실행 중일 때만 발화.
/// false=해당 프로세스가 실행 중이지 않을 때만 발화.
/// </summary>
[JsonPropertyName("conditionProcessMustRun")]
public bool ConditionProcessMustRun { get; set; } = true;
}
// ─── 런처 매크로 (L6-2) ─────────────────────────────────────────────────────────
/// <summary>
/// 런처 명령 시퀀스를 저장하는 매크로 항목.
/// macro 핸들러로 생성·편집·실행합니다.
/// </summary>
public class MacroEntry
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString("N")[..8];
[JsonPropertyName("name")]
public string Name { get; set; } = "";
[JsonPropertyName("description")]
public string Description { get; set; } = "";
[JsonPropertyName("steps")]
public List<MacroStep> Steps { get; set; } = new();
[JsonPropertyName("createdAt")]
public DateTime CreatedAt { get; set; } = DateTime.Now;
}
/// <summary>
/// 매크로 단일 단계.
/// </summary>
public class MacroStep
{
/// <summary>실행 유형. app | url | folder | notification | cmd</summary>
[JsonPropertyName("type")]
public string Type { get; set; } = "app";
/// <summary>앱 경로 / URL / 폴더 경로 / 알림 메시지 / PowerShell 명령</summary>
[JsonPropertyName("target")]
public string Target { get; set; } = "";
/// <summary>추가 인자 (app 유형 전용)</summary>
[JsonPropertyName("args")]
public string Args { get; set; } = "";
/// <summary>표시 이름</summary>
[JsonPropertyName("label")]
public string Label { get; set; } = "";
/// <summary>이 단계 실행 전 대기 시간(ms). 기본값 500.</summary>
[JsonPropertyName("delayMs")]
public int DelayMs { get; set; } = 500;
}
// ─── SSH 퀵 커넥트 호스트 ─────────────────────────────────────────────────────
/// <summary>
/// SSH 퀵 커넥트 호스트 항목. ssh 핸들러로 저장·연결합니다.
/// </summary>
public class SshHostEntry
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString();
/// <summary>표시 이름 (예: "dev-server", "prod-web")</summary>
[JsonPropertyName("name")]
public string Name { get; set; } = "";
/// <summary>호스트 주소 (IP 또는 도메인)</summary>
[JsonPropertyName("host")]
public string Host { get; set; } = "";
/// <summary>SSH 포트. 기본값 22.</summary>
[JsonPropertyName("port")]
public int Port { get; set; } = 22;
/// <summary>SSH 사용자명</summary>
[JsonPropertyName("user")]
public string User { get; set; } = "";
/// <summary>메모 (예: "운영서버", "DB 전용")</summary>
[JsonPropertyName("note")]
public string Note { get; set; } = "";
}
// ─── 잠금 해제 알림 설정 ───────────────────────────────────────────────────────
public class ReminderSettings
{
/// <summary>기능 활성화 여부. 기본값 false.</summary>
[JsonPropertyName("enabled")]
public bool Enabled { get; set; } = false;
/// <summary>팝업 표시 위치. top-left | top-right | bottom-left | bottom-right</summary>
[JsonPropertyName("corner")]
public string Corner { get; set; } = "bottom-right";
/// <summary>알림 간격(분). 30 | 60 | 120 | 180 | 240</summary>
[JsonPropertyName("intervalMinutes")]
public int IntervalMinutes { get; set; } = 60;
/// <summary>팝업 자동 닫힘 시간(초). 기본값 15. (5/10/15/20/30/60/120/180)</summary>
[JsonPropertyName("displaySeconds")]
public int DisplaySeconds { get; set; } = 15;
/// <summary>알림 콘텐츠 카테고리 활성화 목록.</summary>
[JsonPropertyName("enabledCategories")]
public List<string> EnabledCategories { get; set; } = new() { "motivational" };
}