namespace VideoDownloader.Core.Config; /// 앱 설정 (JSON 직렬화). %AppData%/VideoDownloader/config.json 에 저장. public class AppConfig { public string OutputFolder { get; set; } = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), "VideoDownloader"); /// 홈 버튼이 이동할 URL public string HomeUrl { get; set; } = "https://www.google.com"; public int Concurrency { get; set; } = 8; public int Retries { get; set; } = 6; /// 동시에 실행할 다운로드(항목) 수 상한. 세그먼트 단위 Concurrency 와 별개. public int MaxConcurrentDownloads { get; set; } = 3; /// 감지/다운로드에 반응할 형식 키: hls/dash/mp4/webm/mkv/m4v/mov/avi/audio public List EnabledFormats { get; set; } = new() { "hls", "dash", "mp4", "webm", "mkv", "m4v", "mov", "avi", "audio" }; /// 직링크 감지 최소 크기(MB). 이보다 작으면(포스터 등) 무시. public long MinSizeMB { get; set; } = 2; /// null 이면 시스템 PATH 의 ffmpeg 사용 public string? FfmpegPath { get; set; } /// yt-dlp 실행 파일 경로(null → 번들/PATH/자동다운로드). 소셜 영상(YouTube·Instagram·X) 다운로드용. public string? YtDlpPath { get; set; } /// 소셜 다운로드 시 로그인 콘텐츠(인스타·X·멤버 영상 등) 를 위해 브라우저 쿠키를 yt-dlp 에 전달. public bool UseCookiesForSocial { get; set; } = true; /// yt-dlp 가 없으면 %AppData%/VideoDownloader/tools 로 자동 다운로드. public bool AutoInstallYtDlp { get; set; } = true; /// YouTube 안티봇 실패(n 챌린지/PO 토큰/서명 누락 등) 감지 시 yt-dlp 를 최신 버전으로 갱신해 1회 재시도. /// YouTube 가 난독화를 바꿀 때 yt-dlp 는 보통 몇 시간~며칠 내 대응 릴리스를 내보내므로, 최신화만으로 대부분 복구됨. public bool AutoUpdateYtDlp { get; set; } = true; /// Deno(JS 런타임) 실행 파일 경로(null → 번들/PATH/자동다운로드). yt-dlp 의 EJS(n 챌린지 해석) 실행에 필요. public string? DenoPath { get; set; } /// Deno 가 없으면 %AppData%/VideoDownloader/tools 로 자동 다운로드. YouTube n 챌린지(EJS) 해석에 필수. public bool AutoInstallDeno { get; set; } = true; /// 소셜 카드의 기본 화질 프리셋 키: best/1080/720/480/360/audio. public string DefaultSocialQuality { get; set; } = "best"; /// YouTube player_client 오버라이드(예: "tv,android_vr,web"). null/빈 → yt-dlp 공식 기본값 사용(권장). /// 2026년 기준 android/ios 는 GVS/Player PO 토큰이 필요하고 쿠키를 지원하지 않으며, web_sns 는 /// yt-dlp 에 존재하지 않는 클라이언트라 비워두는 것이 가장 안정적임. public string? YoutubePlayerClients { get; set; } public string UserAgent { get; set; } = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " + "(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"; /// 테마: "dark" (기본) 또는 "light". public string Theme { get; set; } = "dark"; /// 우측 패널 펼침 폭(px). 접기/펼치기 + 드래그 리사이즈 후 저장. public double RightPanelWidth { get; set; } = 420; /// 우측 패널 접힘 여부. public bool RightPanelCollapsed { get; set; } = false; /// 개인정보 보호(InPrivate) 모드: 쿠키·세션·localStorage 를 디스크에 저장하지 않는다. 적용 시 앱 재시작. public bool PrivateMode { get; set; } = false; /// 주소창 기본 검색 엔진(SearchEngines.Presets 의 Name). 검색어 입력 시 이 엔진으로 검색. public string SearchEngine { get; set; } = "Google"; /// 종료 시 탭을 저장하고 다음 시작에 복원(T1-10 세션 복원). public bool RestoreSession { get; set; } = true; /// M0 원격 접근(모바일 연동) 서버 켜기. 토큰은 자동 생성/저장. public bool RemoteAccessEnabled { get; set; } = false; public string? RemoteAccessToken { get; set; } /// 업데이트 확인 대상 저장소("owner/repo") — DEPLOYMENT_PLAN §6 v1. 비면 확인 안 함. /// 기본은 자체 Forgejo 공개 릴리스 저장소(§5-bis). public string UpdateRepo { get; set; } = "Video-Downloader/releases"; /// 업데이트 채널 API 베이스. Forgejo 는 /api/v1 접두 포함, GitHub 는 "https://api.github.com". public string UpdateApiBase { get; set; } = Update.UpdateChecker.DefaultApiBase; // ==================== UI 복잡 버전 (docs/UI_USECASES.md) ==================== // ---- §A 테마 ---- /// 사용자 지정 강조색(#RRGGBB). null/빈이면 테마 기본 보라. public string? AccentColor { get; set; } /// 사용자 테마 파일(.xaml 리소스사전) 경로. 설정에 있으면 우선 적용. public string? CustomThemePath { get; set; } // ---- §B 타이포그래피 ---- /// UI 기본 폰트(빈 문자열이면 기본 스택 Segoe UI+맑은고딕). public string UiFontFamily { get; set; } = ""; /// UI 기본 폰트 크기(pt 단위가 아닌 WPF Device Independent px). public double UiFontSize { get; set; } = 13; /// 한국어 폴백 폰트(기본 '맑은 고딕'). public string UiFontKoreanFallback { get; set; } = "Malgun Gothic"; // ---- §C 레이아웃·밀도·창 상태 ---- /// 정보 밀도: compact / normal / comfortable. public string UiDensity { get; set; } = "normal"; /// T3-13 컴팩트 모드(크롬 숨김) 시작 시 복원. public bool CompactMode { get; set; } = false; /// 세로 탭을 기본 레이아웃으로 시작. public bool VerticalTabsDefault { get; set; } = false; /// 분할 화면(스플릿) 패널 비율(0~1). 재시작 후 재현. public double SplitViewRatio { get; set; } = 0.5; /// 창 위치·크기 "Left,Top,Width,Height". 화면 밤새 좌표는 무시됨. public string? WindowBounds { get; set; } /// 종료 시 최대화 상태였는지. public bool WindowMaximized { get; set; } = false; /// 사용 중인 상태바는 자동으로 숨김. public bool StatusBarAutoHide { get; set; } = false; /// 툴바에 남길 버튼 키 목록(빈 목록=전부 표시). 예: back,forward,bookmarks,history,downloads public List ToolbarButtons { get; set; } = new(); /// 북마크바 표시 여부(세션 간 유지). public bool BookmarkBarVisible { get; set; } = false; /// 탭 스트립 위치: top / bottom / left. public string TabStripPosition { get; set; } = "top"; /// 우측 패널 최소 폭(px). public double RightPanelMinWidth { get; set; } = 280; /// 움직임 민감 사용자용 애니메이션 축소. public bool ReduceMotion { get; set; } = false; /// 컴팩트 모드 엣지 호버 반응 지연(ms). public int EdgeRevealDelayMs { get; set; } = 200; /// UI 전체 배율(레이아웃 루트 ScaleTransform, 0.5~2.0). public double UiScale { get; set; } = 1.0; /// 종료 시 전체화면이었는지. public bool FullScreen { get; set; } = false; // ---- §D 탭 ---- /// 여러 탭을 한 번에 닫을 때 확인 받기. public bool ConfirmCloseMultipleTabs { get; set; } = true; /// 탭 스트립에서 휠로 탭 전환. public bool TabWheelSwitch { get; set; } = true; /// 탭 최대 개수(0=제한 없음). public int MaxTabs { get; set; } = 0; /// 세션 복원 시 탭을 잠자기 상태로만 복원(빠른 시작). public bool RestoreTabsSuspended { get; set; } = false; /// 작업공간 표시 이름(인덱스 순). public List WorkspaceNames { get; set; } = new() { "작업", "개인", "학습" }; /// 탭 제목 두 줄 표시. public bool TabTitleMultiline { get; set; } = false; // ---- §E 다운로드 ---- /// 다운로드 목록 정렬: newest / largest / progress / title. public string DownloadSortOrder { get; set; } = "newest"; /// 완료 항목을 n초 후 목록에서 자동 제거(0=자동 치움 안 함). public bool AutoClearCompleted { get; set; } = false; /// 다운로드 완료 알림 소리. public bool NotifySound { get; set; } = true; /// 다운로드 완료 시 저장 폴더 자동 열기. public bool OpenFolderOnComplete { get; set; } = false; /// 자막 우선 언어(ko/en/…, 빈 문자열=자막 안 받음). public string SubtitleLanguage { get; set; } = ""; /// UC-D21 다운로드 예약 창("HH:mm-HH:mm", 빈 값=항상 허용). public string? DownloadScheduleWindow { get; set; } /// 다운로드 속도 상한(kbps, 0=제한 없음). public int MaxDownloadSpeedKbps { get; set; } = 0; // ---- §F 설정창 ---- /// 설정창 위치·크기 "Left,Top,Width,Height". public string? SettingsWindowBounds { get; set; } /// UI 언어: ko / en. public string Language { get; set; } = "ko"; /// 닫기 버튼으로 트레이로 최소화. public bool MinimizeToTray { get; set; } = false; /// Windows 시작 시 자동 실행. public bool AutoStart { get; set; } = false; /// 재시도 횟수(UI 노출용 — Retries 와 동일 값을 설정창에서 편집). public int RetriesUi { get => Retries; set => Retries = value; } /// HTTP 프록시 서버(http://host:port, 빈 문자열=직접 연결). public string ProxyServer { get; set; } = ""; // ---- §G 접근성 ---- /// 저시력용 폰트 확대 배율(1.0~2.0). UiFontSize 와 곱해 적용. public double UiFontScale { get; set; } = 1.0; /// 영상 자막 표시(플레이어에 자막 렌더 시도). public bool ShowCaptions { get; set; } = true; // ---- §H 인터랙션 ---- /// 명령 키 → 조합 문자열(예: "newtab": "Ctrl+T"). 없으면 기본값. public Dictionary Shortcuts { get; set; } = new(); /// 주소창에 붙여넣으면 즉시 이동. public bool PasteAndGo { get; set; } = true; /// 주소창 포커스 시 전체 선택. public bool FocusSelectsAddress { get; set; } = true; /// 새 탭 기본 줌 배율(0.1~5.0). public double DefaultZoomFactor { get; set; } = 1.0; // ---- §I 라이브러리·재생목록 ---- /// 재생목록 반복 모드: none / one / all. public string PlaylistLoopMode { get; set; } = "none"; // ---- §J 상태·알림 ---- /// 토스트 표시 시간(ms). public int ToastDurationMs { get; set; } = 4000; /// 절전 모드(전원 절약) 진입 시 다운로드 일시정지. public bool PauseOnPowerSaver { get; set; } = true; /// 방해 금지(알림 음소거·토스트 억제). public bool DoNotDisturb { get; set; } = false; /// UC-S04 모든 설정을 새 인스턴스 기본값으로 되돌린다(원격 접속 토큰은 유지 — 기기 페어링 유지). public void ResetToDefaults() { var fresh = new AppConfig(); foreach (var prop in typeof(AppConfig).GetProperties().Where(p => p.CanRead && p.CanWrite)) { if (prop.Name == nameof(RemoteAccessToken)) continue; try { prop.SetValue(this, prop.GetValue(fresh)); } catch { } } } }