C# 소스와 C# 전용 시험, .NET 의존 설정 제거
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
19885712eede435898484167b51f30f933ea5ef9- 부모
- ae91536
변경된 파일 107개
+0-2,695변경 내용이 커서 일부 파일의 Diff를 생략했어요. 생략한 파일은 파일 보기나 Raw로 확인할 수 있어요.
| @@ -2,8 +2,6 @@ | ||
| 2 | 2 | .messenger-* |
| 3 | 3 | |
| 4 | 4 | # Build, publish, and package output |
| 5 | 삭제: [Bb]in/ | |
| 6 | 삭제: [Oo]bj/ | |
| 7 | 5 | artifacts/ |
| 8 | 6 | dist/ |
| 9 | 7 | publish/ |
| @@ -11,7 +9,6 @@ packaging/output/ | ||
| 11 | 9 | packaging/staging/ |
| 12 | 10 | |
| 13 | 11 | # Test and Python scratch data |
| 14 | 삭제: tests/security/.work/ | |
| 15 | 12 | # 로컬 시험, 리뷰, 설치 파일 작업 폴더 |
| 16 | 13 | tests/work/ |
| 17 | 14 | __pycache__/ |
| @@ -19,14 +16,10 @@ __pycache__/ | ||
| 19 | 16 | .pytest_cache/ |
| 20 | 17 | .coverage |
| 21 | 18 | htmlcov/ |
| 22 | 삭제: TestResults/ | |
| 23 | 19 | *.log |
| 24 | 20 | |
| 25 | 21 | # Local IDE and operating-system files |
| 26 | 삭제: .vs/ | |
| 27 | 22 | .idea/ |
| 28 | 삭제: *.user | |
| 29 | 삭제: *.suo | |
| 30 | 23 | .DS_Store |
| 31 | 24 | Thumbs.db |
| 32 | 25 | |
| @@ -37,8 +30,6 @@ Thumbs.db | ||
| 37 | 30 | *.key |
| 38 | 31 | *.pfx |
| 39 | 32 | *.p12 |
| 40 | 삭제: *.snk | |
| 41 | 삭제: *.pubxml.user | |
| 42 | 33 | |
| 43 | 34 | # Curated tests/**/fixtures/*.zip are intentional source fixtures. |
| 44 | 35 | # Do not add a blanket *.zip ignore rule. |
| @@ -1,83 +0,0 @@ | ||
| 1 | 삭제: using System.Security; | |
| 2 | 삭제: | |
| 3 | 삭제: namespace Zipelo.Core; | |
| 4 | 삭제: | |
| 5 | 삭제: public enum ArchiveAction { List, Extract, Create, Verify, Preview, Recover } | |
| 6 | 삭제: public enum JobState { Created, Running, WaitingForPassword, Cancelling, Completed, Partial, Cancelled, Failed } | |
| 7 | 삭제: public enum EntryKind { File, Directory, SymbolicLink, HardLink, Other } | |
| 8 | 삭제: public enum EntryOutcome { Listed, Staged, Extracted, Skipped, Failed } | |
| 9 | 삭제: public enum VerificationState { NotChecked, Passed, Failed, Unavailable } | |
| 10 | 삭제: public enum ArchiveError | |
| 11 | 삭제: { | |
| 12 | 삭제: None, | |
| 13 | 삭제: EngineUnavailable, | |
| 14 | 삭제: UnsupportedOperation, | |
| 15 | 삭제: UnsafePath, | |
| 16 | 삭제: UnsupportedEntry, | |
| 17 | 삭제: OutputUnavailable, | |
| 18 | 삭제: OutputConflict, | |
| 19 | 삭제: BudgetExceeded, | |
| 20 | 삭제: PasswordAttemptsExceeded, | |
| 21 | 삭제: InvalidPasswordResponse, | |
| 22 | 삭제: IntegrityFailure, | |
| 23 | 삭제: Cancelled, | |
| 24 | 삭제: EngineFailure | |
| 25 | 삭제: } | |
| 26 | 삭제: | |
| 27 | 삭제: public sealed class ArchiveException(ArchiveError code) : Exception(code.ToString()) | |
| 28 | 삭제: { | |
| 29 | 삭제: public ArchiveError Code { get; } = code; | |
| 30 | 삭제: } | |
| 31 | 삭제: | |
| 32 | 삭제: public sealed record EngineCapability(string Format, ArchiveAction Action); | |
| 33 | 삭제: public sealed record ArchiveEntry(string Id, string Name, EntryKind Kind, long? DeclaredSize); | |
| 34 | 삭제: public sealed record EntryResult(ArchiveEntry Entry, EntryOutcome Outcome, VerificationState Verification, ArchiveError Error) | |
| 35 | 삭제: { | |
| 36 | 삭제: public string EntryId => Entry.Id; | |
| 37 | 삭제: } | |
| 38 | 삭제: public sealed record JobEvent(Guid JobId, long Sequence, JobState State, long ProcessedBytes); | |
| 39 | 삭제: public sealed record PasswordChallenge(Guid JobId, Guid RequestId, int Attempt); | |
| 40 | 삭제: public sealed record JobResult(Guid JobId, JobState State, IReadOnlyList<EntryResult> Entries, ArchiveError Error); | |
| 41 | 삭제: | |
| 42 | 삭제: // 호출자는 반환된 암호의 소유권을 코어에 넘김. 코어가 소비 종료 시 폐기함. | |
| 43 | 삭제: // 제공자는 작업별로 한 번에 하나만 호출됨. 같은 작업의 암호 제공자를 재진입하지 않음. | |
| 44 | 삭제: public delegate ValueTask<SecureString?> PasswordProvider(PasswordChallenge challenge, CancellationToken cancellationToken); | |
| 45 | 삭제: | |
| 46 | 삭제: public interface IArchiveEngine | |
| 47 | 삭제: { | |
| 48 | 삭제: IReadOnlyCollection<EngineCapability> Capabilities { get; } | |
| 49 | 삭제: | |
| 50 | 삭제: // 원본 경로나 출력 경로를 받지 않고 제한된 스트림과 작업 문맥만 사용함. | |
| 51 | 삭제: // 시작한 문맥 작업을 모두 await하고 실패를 숨기지 않아야 함. 입력 스트림은 폐기하지 않음. | |
| 52 | 삭제: Task ExecuteAsync(ArchiveAction action, IReadOnlyList<Stream> inputs, EngineContext context, CancellationToken cancellationToken); | |
| 53 | 삭제: } | |
| 54 | 삭제: | |
| 55 | 삭제: public sealed class UnavailableEngine : IArchiveEngine | |
| 56 | 삭제: { | |
| 57 | 삭제: public IReadOnlyCollection<EngineCapability> Capabilities => Array.Empty<EngineCapability>(); | |
| 58 | 삭제: | |
| 59 | 삭제: public Task ExecuteAsync(ArchiveAction action, IReadOnlyList<Stream> inputs, EngineContext context, CancellationToken cancellationToken) | |
| 60 | 삭제: => Task.FromException(new ArchiveException(ArchiveError.EngineUnavailable)); | |
| 61 | 삭제: } | |
| 62 | 삭제: | |
| 63 | 삭제: // 저장 계층은 링크와 junction, 경로 교체 경쟁, 기존 파일 충돌을 실제 핸들 기준으로 차단해야 함. | |
| 64 | 삭제: // 원본과 기존 파일은 수정하지 않으며 작업 소유 임시 출력만 폐기해야 함. | |
| 65 | 삭제: // CommitAsync는 전체 게시 성공에만 정상 반환함. 실패나 취소 시 이미 게시한 작업 소유 출력도 원복해야 함. | |
| 66 | 삭제: // 게시 성공 뒤에는 늦은 취소로 예외를 던지지 않음. 부분 게시만 가능한 저장 계층은 이 계약에 연결하지 않음. | |
| 67 | 삭제: // DisposeAsync는 성공한 게시를 유지하고 미확정 출력을 정리함. 원복이나 정리 실패를 숨기지 않음. | |
| 68 | 삭제: public interface IOutputTransaction : IAsyncDisposable | |
| 69 | 삭제: { | |
| 70 | 삭제: ValueTask<Stream> CreateFileAsync(IReadOnlyList<string> relativeSegments, CancellationToken cancellationToken); | |
| 71 | 삭제: ValueTask CommitAsync(CancellationToken cancellationToken); | |
| 72 | 삭제: } | |
| 73 | 삭제: | |
| 74 | 삭제: public sealed class UnavailableOutput : IOutputTransaction | |
| 75 | 삭제: { | |
| 76 | 삭제: public ValueTask<Stream> CreateFileAsync(IReadOnlyList<string> relativeSegments, CancellationToken cancellationToken) | |
| 77 | 삭제: => ValueTask.FromException<Stream>(new ArchiveException(ArchiveError.OutputUnavailable)); | |
| 78 | 삭제: | |
| 79 | 삭제: public ValueTask CommitAsync(CancellationToken cancellationToken) | |
| 80 | 삭제: => ValueTask.FromException(new ArchiveException(ArchiveError.OutputUnavailable)); | |
| 81 | 삭제: | |
| 82 | 삭제: public ValueTask DisposeAsync() => ValueTask.CompletedTask; | |
| 83 | 삭제: } |
| @@ -1,125 +0,0 @@ | ||
| 1 | 삭제: namespace Zipelo.Core; | |
| 2 | 삭제: | |
| 3 | 삭제: public sealed class ArchiveJob | |
| 4 | 삭제: { | |
| 5 | 삭제: private readonly Guid id; | |
| 6 | 삭제: private readonly JobLimits limits; | |
| 7 | 삭제: private int started; | |
| 8 | 삭제: | |
| 9 | 삭제: public ArchiveJob(Guid id, JobLimits limits) | |
| 10 | 삭제: { | |
| 11 | 삭제: if (id == Guid.Empty) { throw new ArgumentException("작업 ID가 필요함", nameof(id)); } | |
| 12 | 삭제: this.id = id; | |
| 13 | 삭제: this.limits = limits; | |
| 14 | 삭제: } | |
| 15 | 삭제: | |
| 16 | 삭제: // 입력 수명은 호출자가 소유함. 출력 트랜잭션은 작업이 소유하여 종료 전에 정리함. | |
| 17 | 삭제: public async Task<JobResult> ExecuteAsync(ArchiveAction action, string format, IArchiveEngine engine, | |
| 18 | 삭제: IReadOnlyList<Stream> readOnlyInputs, IOutputTransaction output, PasswordProvider passwords, | |
| 19 | 삭제: IProgress<JobEvent>? progress, CancellationToken cancellationToken) | |
| 20 | 삭제: { | |
| 21 | 삭제: ArgumentNullException.ThrowIfNull(engine); | |
| 22 | 삭제: ArgumentNullException.ThrowIfNull(readOnlyInputs); | |
| 23 | 삭제: ArgumentNullException.ThrowIfNull(output); | |
| 24 | 삭제: ArgumentNullException.ThrowIfNull(passwords); | |
| 25 | 삭제: if (Interlocked.Exchange(ref started, 1) != 0) | |
| 26 | 삭제: { | |
| 27 | 삭제: throw new InvalidOperationException("작업 인스턴스는 재사용할 수 없음"); | |
| 28 | 삭제: } | |
| 29 | 삭제: | |
| 30 | 삭제: JobBudget? budget = null; | |
| 31 | 삭제: EngineContext? context = null; | |
| 32 | 삭제: CancellationTokenSource? linked = null; | |
| 33 | 삭제: CancellationTokenRegistration cancellationRegistration = default; | |
| 34 | 삭제: var eventGate = new object(); | |
| 35 | 삭제: long sequence = 0; | |
| 36 | 삭제: void Report(JobState reportedState) | |
| 37 | 삭제: { | |
| 38 | 삭제: lock (eventGate) | |
| 39 | 삭제: { | |
| 40 | 삭제: if ((reportedState is JobState.Running or JobState.WaitingForPassword) && | |
| 41 | 삭제: (cancellationToken.IsCancellationRequested || linked?.IsCancellationRequested == true)) | |
| 42 | 삭제: { | |
| 43 | 삭제: reportedState = JobState.Cancelling; | |
| 44 | 삭제: } | |
| 45 | 삭제: | |
| 46 | 삭제: // 관찰자 오류가 정리나 실제 작업 결과를 바꾸지 않도록 함. | |
| 47 | 삭제: try { progress?.Report(new(id, ++sequence, reportedState, budget?.Usage.ProcessedBytes ?? 0)); } | |
| 48 | 삭제: catch { } | |
| 49 | 삭제: } | |
| 50 | 삭제: } | |
| 51 | 삭제: | |
| 52 | 삭제: var state = JobState.Failed; | |
| 53 | 삭제: var error = ArchiveError.None; | |
| 54 | 삭제: var committed = false; | |
| 55 | 삭제: try | |
| 56 | 삭제: { | |
| 57 | 삭제: // 출력 소유권을 받은 뒤의 초기화도 정리 범위에 포함함. | |
| 58 | 삭제: budget = new JobBudget(limits); | |
| 59 | 삭제: linked = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); | |
| 60 | 삭제: cancellationRegistration = linked.Token.Register(() => Report(JobState.Cancelling)); | |
| 61 | 삭제: var inputs = readOnlyInputs.ToArray(); | |
| 62 | 삭제: context = new EngineContext(id, action, budget, output, passwords, Report, linked, limits.MaxPasswordAttempts); | |
| 63 | 삭제: budget.Check(linked.Token); | |
| 64 | 삭제: if (inputs.Length == 0 || inputs.Any(input => input is null || !input.CanRead || input.CanWrite)) | |
| 65 | 삭제: { | |
| 66 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 67 | 삭제: } | |
| 68 | 삭제: if (!engine.Capabilities.Any(capability => capability.Action == action && | |
| 69 | 삭제: string.Equals(capability.Format, format, StringComparison.OrdinalIgnoreCase))) | |
| 70 | 삭제: { | |
| 71 | 삭제: throw new ArchiveException(engine is UnavailableEngine ? ArchiveError.EngineUnavailable : ArchiveError.UnsupportedOperation); | |
| 72 | 삭제: } | |
| 73 | 삭제: | |
| 74 | 삭제: Report(JobState.Running); | |
| 75 | 삭제: await engine.ExecuteAsync(action, Array.AsReadOnly(inputs), context, linked.Token).ConfigureAwait(false); | |
| 76 | 삭제: budget.Check(linked.Token); | |
| 77 | 삭제: if (context.Failure != ArchiveError.None) | |
| 78 | 삭제: { | |
| 79 | 삭제: throw new ArchiveException(context.Failure); | |
| 80 | 삭제: } | |
| 81 | 삭제: if (context.Results.Any(result => result.Error != ArchiveError.None || result.Verification == VerificationState.Failed)) | |
| 82 | 삭제: { | |
| 83 | 삭제: throw new ArchiveException(ArchiveError.IntegrityFailure); | |
| 84 | 삭제: } | |
| 85 | 삭제: | |
| 86 | 삭제: if (context.HasOutput) | |
| 87 | 삭제: { | |
| 88 | 삭제: await output.CommitAsync(linked.Token).ConfigureAwait(false); | |
| 89 | 삭제: committed = true; | |
| 90 | 삭제: } | |
| 91 | 삭제: // 게시 성공 뒤의 늦은 취소로 실제 출력을 취소 결과로 바꾸지 않음. | |
| 92 | 삭제: state = JobState.Completed; | |
| 93 | 삭제: } | |
| 94 | 삭제: catch (OperationCanceledException) when (linked?.IsCancellationRequested == true || cancellationToken.IsCancellationRequested) | |
| 95 | 삭제: { | |
| 96 | 삭제: state = JobState.Cancelled; | |
| 97 | 삭제: error = ArchiveError.Cancelled; | |
| 98 | 삭제: } | |
| 99 | 삭제: catch (ArgumentException) when (context is null) { error = ArchiveError.UnsupportedOperation; } | |
| 100 | 삭제: catch (ArchiveException failure) { error = failure.Code; } | |
| 101 | 삭제: catch { error = ArchiveError.EngineFailure; } | |
| 102 | 삭제: finally | |
| 103 | 삭제: { | |
| 104 | 삭제: try { await output.DisposeAsync().ConfigureAwait(false); } | |
| 105 | 삭제: catch | |
| 106 | 삭제: { | |
| 107 | 삭제: state = JobState.Failed; | |
| 108 | 삭제: if (error == ArchiveError.None) { error = ArchiveError.OutputUnavailable; } | |
| 109 | 삭제: } | |
| 110 | 삭제: finally | |
| 111 | 삭제: { | |
| 112 | 삭제: // 종료 이벤트 뒤에 취소 이벤트가 나오지 않도록 등록을 먼저 해제함. | |
| 113 | 삭제: cancellationRegistration.Dispose(); | |
| 114 | 삭제: linked?.Dispose(); | |
| 115 | 삭제: } | |
| 116 | 삭제: } | |
| 117 | 삭제: | |
| 118 | 삭제: var results = (context?.Results ?? Array.Empty<EntryResult>()).Select(result => result.Outcome == EntryOutcome.Staged | |
| 119 | 삭제: ? result with { Outcome = committed ? EntryOutcome.Extracted : EntryOutcome.Failed, | |
| 120 | 삭제: Error = committed ? ArchiveError.None : error } | |
| 121 | 삭제: : result).ToArray(); | |
| 122 | 삭제: Report(state); | |
| 123 | 삭제: return new(id, state, Array.AsReadOnly(results), error); | |
| 124 | 삭제: } | |
| 125 | 삭제: } |
| @@ -1,215 +0,0 @@ | ||
| 1 | 삭제: using System.Security; | |
| 2 | 삭제: | |
| 3 | 삭제: namespace Zipelo.Core; | |
| 4 | 삭제: | |
| 5 | 삭제: public sealed class EngineContext | |
| 6 | 삭제: { | |
| 7 | 삭제: private readonly Guid jobId; | |
| 8 | 삭제: private readonly ArchiveAction action; | |
| 9 | 삭제: private readonly IOutputTransaction output; | |
| 10 | 삭제: private readonly PasswordProvider passwords; | |
| 11 | 삭제: private readonly Action<JobState> reportState; | |
| 12 | 삭제: private readonly CancellationTokenSource cancellation; | |
| 13 | 삭제: private readonly int maxPasswordAttempts; | |
| 14 | 삭제: private readonly SemaphoreSlim serial = new(1, 1); | |
| 15 | 삭제: private readonly SemaphoreSlim passwordSerial = new(1, 1); | |
| 16 | 삭제: private readonly object passwordStateGate = new(); | |
| 17 | 삭제: private bool waitingForPassword; | |
| 18 | 삭제: private readonly HashSet<string> entryIds = new(StringComparer.Ordinal); | |
| 19 | 삭제: private readonly HashSet<string> paths = new(OutputPathPolicy.Comparer(OutputPathPolicy.CurrentPolicy)); | |
| 20 | 삭제: private readonly List<EntryResult> results = []; | |
| 21 | 삭제: private int passwordAttempts; | |
| 22 | 삭제: private ArchiveError failure; | |
| 23 | 삭제: | |
| 24 | 삭제: internal EngineContext(Guid jobId, ArchiveAction action, JobBudget budget, IOutputTransaction output, | |
| 25 | 삭제: PasswordProvider passwords, Action<JobState> reportState, CancellationTokenSource cancellation, int maxPasswordAttempts) | |
| 26 | 삭제: { | |
| 27 | 삭제: this.jobId = jobId; | |
| 28 | 삭제: this.action = action; | |
| 29 | 삭제: Budget = budget; | |
| 30 | 삭제: this.output = output; | |
| 31 | 삭제: this.passwords = passwords; | |
| 32 | 삭제: this.reportState = reportState; | |
| 33 | 삭제: this.cancellation = cancellation; | |
| 34 | 삭제: this.maxPasswordAttempts = maxPasswordAttempts; | |
| 35 | 삭제: } | |
| 36 | 삭제: | |
| 37 | 삭제: public JobBudget Budget { get; } | |
| 38 | 삭제: public CancellationToken CancellationToken => cancellation.Token; | |
| 39 | 삭제: internal IReadOnlyList<EntryResult> Results => results.AsReadOnly(); | |
| 40 | 삭제: internal bool HasOutput => paths.Count != 0; | |
| 41 | 삭제: internal ArchiveError Failure => failure; | |
| 42 | 삭제: | |
| 43 | 삭제: public async ValueTask ListEntryAsync(ArchiveEntry entry) | |
| 44 | 삭제: { | |
| 45 | 삭제: await serial.WaitAsync(CancellationToken).ConfigureAwait(false); | |
| 46 | 삭제: try | |
| 47 | 삭제: { | |
| 48 | 삭제: Register(entry); | |
| 49 | 삭제: results.Add(new(entry, EntryOutcome.Listed, VerificationState.NotChecked, ArchiveError.None)); | |
| 50 | 삭제: ReportRunning(); | |
| 51 | 삭제: } | |
| 52 | 삭제: catch (ArchiveException error) | |
| 53 | 삭제: { | |
| 54 | 삭제: failure = error.Code; | |
| 55 | 삭제: throw; | |
| 56 | 삭제: } | |
| 57 | 삭제: finally { serial.Release(); } | |
| 58 | 삭제: } | |
| 59 | 삭제: | |
| 60 | 삭제: // 해제된 바이트를 직접 복사하여 헤더 크기와 무관하게 예산을 적용함. | |
| 61 | 삭제: // 검증 콜백은 스트림 끝에서 CRC 또는 인증 결과를 반환해야 함. | |
| 62 | 삭제: public async Task WriteEntryAsync(ArchiveEntry entry, Stream decoded, | |
| 63 | 삭제: Func<CancellationToken, ValueTask<VerificationState>> verify) | |
| 64 | 삭제: { | |
| 65 | 삭제: ArgumentNullException.ThrowIfNull(decoded); | |
| 66 | 삭제: ArgumentNullException.ThrowIfNull(verify); | |
| 67 | 삭제: await serial.WaitAsync(CancellationToken).ConfigureAwait(false); | |
| 68 | 삭제: try | |
| 69 | 삭제: { | |
| 70 | 삭제: if (action is not (ArchiveAction.Extract or ArchiveAction.Create or ArchiveAction.Recover)) | |
| 71 | 삭제: { | |
| 72 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 73 | 삭제: } | |
| 74 | 삭제: | |
| 75 | 삭제: Register(entry); | |
| 76 | 삭제: if (entry.Kind != EntryKind.File) | |
| 77 | 삭제: { | |
| 78 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedEntry); | |
| 79 | 삭제: } | |
| 80 | 삭제: | |
| 81 | 삭제: var segments = OutputPathPolicy.Validate(entry.Name, OutputPathPolicy.CurrentPolicy); | |
| 82 | 삭제: var key = string.Join('/', segments); | |
| 83 | 삭제: if (paths.Any(existing => existing.Equals(key, OutputPathPolicy.Comparison(OutputPathPolicy.CurrentPolicy)) || | |
| 84 | 삭제: existing.StartsWith(key + "/", OutputPathPolicy.Comparison(OutputPathPolicy.CurrentPolicy)) || | |
| 85 | 삭제: key.StartsWith(existing + "/", OutputPathPolicy.Comparison(OutputPathPolicy.CurrentPolicy)))) | |
| 86 | 삭제: { | |
| 87 | 삭제: throw new ArchiveException(ArchiveError.OutputConflict); | |
| 88 | 삭제: } | |
| 89 | 삭제: | |
| 90 | 삭제: paths.Add(key); | |
| 91 | 삭제: await using (var destination = await output.CreateFileAsync(segments, CancellationToken).ConfigureAwait(false)) | |
| 92 | 삭제: { | |
| 93 | 삭제: var buffer = new byte[65536]; | |
| 94 | 삭제: try | |
| 95 | 삭제: { | |
| 96 | 삭제: while (true) | |
| 97 | 삭제: { | |
| 98 | 삭제: Budget.Check(CancellationToken); | |
| 99 | 삭제: var count = await decoded.ReadAsync(buffer.AsMemory(), CancellationToken).ConfigureAwait(false); | |
| 100 | 삭제: if (count == 0) { break; } | |
| 101 | 삭제: Budget.ChargeProcessed(count, CancellationToken); | |
| 102 | 삭제: Budget.ReserveOutput(count, CancellationToken); | |
| 103 | 삭제: await destination.WriteAsync(buffer.AsMemory(0, count), CancellationToken).ConfigureAwait(false); | |
| 104 | 삭제: ReportRunning(); | |
| 105 | 삭제: } | |
| 106 | 삭제: await destination.FlushAsync(CancellationToken).ConfigureAwait(false); | |
| 107 | 삭제: } | |
| 108 | 삭제: finally { System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer); } | |
| 109 | 삭제: } | |
| 110 | 삭제: | |
| 111 | 삭제: var verification = await verify(CancellationToken).ConfigureAwait(false); | |
| 112 | 삭제: Budget.Check(CancellationToken); | |
| 113 | 삭제: if (verification == VerificationState.Failed) | |
| 114 | 삭제: { | |
| 115 | 삭제: results.Add(new(entry, EntryOutcome.Failed, verification, ArchiveError.IntegrityFailure)); | |
| 116 | 삭제: throw new ArchiveException(ArchiveError.IntegrityFailure); | |
| 117 | 삭제: } | |
| 118 | 삭제: | |
| 119 | 삭제: results.Add(new(entry, EntryOutcome.Staged, verification, ArchiveError.None)); | |
| 120 | 삭제: } | |
| 121 | 삭제: catch (ArchiveException error) | |
| 122 | 삭제: { | |
| 123 | 삭제: failure = error.Code; | |
| 124 | 삭제: if (entryIds.Contains(entry.Id) && results.All(result => result.EntryId != entry.Id)) | |
| 125 | 삭제: { | |
| 126 | 삭제: results.Add(new(entry, EntryOutcome.Failed, VerificationState.NotChecked, error.Code)); | |
| 127 | 삭제: } | |
| 128 | 삭제: throw; | |
| 129 | 삭제: } | |
| 130 | 삭제: catch (Exception error) | |
| 131 | 삭제: { | |
| 132 | 삭제: failure = error is OperationCanceledException && CancellationToken.IsCancellationRequested | |
| 133 | 삭제: ? ArchiveError.Cancelled : ArchiveError.EngineFailure; | |
| 134 | 삭제: if (entry is not null && entryIds.Contains(entry.Id) && results.All(result => result.EntryId != entry.Id)) | |
| 135 | 삭제: { | |
| 136 | 삭제: results.Add(new(entry, EntryOutcome.Failed, VerificationState.NotChecked, failure)); | |
| 137 | 삭제: } | |
| 138 | 삭제: throw; | |
| 139 | 삭제: } | |
| 140 | 삭제: finally { serial.Release(); } | |
| 141 | 삭제: } | |
| 142 | 삭제: | |
| 143 | 삭제: // 제공자 호출을 직렬화함. 소비자는 잠금 밖에서 암호를 사용하고 재요청할 수 있음. | |
| 144 | 삭제: public async ValueTask<T> UsePasswordAsync<T>(Func<SecureString, CancellationToken, ValueTask<T>> consume) | |
| 145 | 삭제: { | |
| 146 | 삭제: ArgumentNullException.ThrowIfNull(consume); | |
| 147 | 삭제: await passwordSerial.WaitAsync(CancellationToken).ConfigureAwait(false); | |
| 148 | 삭제: SecureString? password = null; | |
| 149 | 삭제: var waiting = false; | |
| 150 | 삭제: try | |
| 151 | 삭제: { | |
| 152 | 삭제: try | |
| 153 | 삭제: { | |
| 154 | 삭제: Budget.Check(CancellationToken); | |
| 155 | 삭제: if (passwordAttempts >= maxPasswordAttempts) | |
| 156 | 삭제: { | |
| 157 | 삭제: failure = ArchiveError.PasswordAttemptsExceeded; | |
| 158 | 삭제: throw new ArchiveException(ArchiveError.PasswordAttemptsExceeded); | |
| 159 | 삭제: } | |
| 160 | 삭제: | |
| 161 | 삭제: var attempt = ++passwordAttempts; | |
| 162 | 삭제: waiting = true; | |
| 163 | 삭제: SetPasswordWaiting(true); | |
| 164 | 삭제: password = await passwords(new(jobId, Guid.NewGuid(), attempt), CancellationToken).ConfigureAwait(false); | |
| 165 | 삭제: if (password is null) | |
| 166 | 삭제: { | |
| 167 | 삭제: cancellation.Cancel(); | |
| 168 | 삭제: throw new OperationCanceledException(CancellationToken); | |
| 169 | 삭제: } | |
| 170 | 삭제: Budget.Check(CancellationToken); | |
| 171 | 삭제: } | |
| 172 | 삭제: finally | |
| 173 | 삭제: { | |
| 174 | 삭제: if (waiting) { SetPasswordWaiting(false); } | |
| 175 | 삭제: passwordSerial.Release(); | |
| 176 | 삭제: } | |
| 177 | 삭제: | |
| 178 | 삭제: Budget.Check(CancellationToken); | |
| 179 | 삭제: return await consume(password, CancellationToken).ConfigureAwait(false); | |
| 180 | 삭제: } | |
| 181 | 삭제: finally { password?.Dispose(); } | |
| 182 | 삭제: } | |
| 183 | 삭제: | |
| 184 | 삭제: private void SetPasswordWaiting(bool waiting) | |
| 185 | 삭제: { | |
| 186 | 삭제: lock (passwordStateGate) | |
| 187 | 삭제: { | |
| 188 | 삭제: waitingForPassword = waiting; | |
| 189 | 삭제: reportState(CancellationToken.IsCancellationRequested ? JobState.Cancelling : | |
| 190 | 삭제: waiting ? JobState.WaitingForPassword : JobState.Running); | |
| 191 | 삭제: } | |
| 192 | 삭제: } | |
| 193 | 삭제: | |
| 194 | 삭제: private void ReportRunning() | |
| 195 | 삭제: { | |
| 196 | 삭제: lock (passwordStateGate) | |
| 197 | 삭제: { | |
| 198 | 삭제: // 다른 항목의 진행 보고가 활성 암호 요청 상태를 덮지 않도록 함. | |
| 199 | 삭제: if (!waitingForPassword) | |
| 200 | 삭제: { | |
| 201 | 삭제: reportState(CancellationToken.IsCancellationRequested ? JobState.Cancelling : JobState.Running); | |
| 202 | 삭제: } | |
| 203 | 삭제: } | |
| 204 | 삭제: } | |
| 205 | 삭제: | |
| 206 | 삭제: private void Register(ArchiveEntry entry) | |
| 207 | 삭제: { | |
| 208 | 삭제: ArgumentNullException.ThrowIfNull(entry); | |
| 209 | 삭제: Budget.AddEntry(CancellationToken); | |
| 210 | 삭제: if (string.IsNullOrWhiteSpace(entry.Id) || !entryIds.Add(entry.Id) || entry.DeclaredSize < 0) | |
| 211 | 삭제: { | |
| 212 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedEntry); | |
| 213 | 삭제: } | |
| 214 | 삭제: } | |
| 215 | 삭제: } |
| @@ -1,75 +0,0 @@ | ||
| 1 | 삭제: namespace Zipelo.Core; | |
| 2 | 삭제: | |
| 3 | 삭제: // 제한값은 호스트가 정함. 아래 값은 제품 기본값이나 성능 약속이 아님. | |
| 4 | 삭제: public sealed record JobLimits(long MaxEntries, long MaxProcessedBytes, long MaxOutputBytes, TimeSpan MaxDuration, int MaxPasswordAttempts); | |
| 5 | 삭제: public sealed record BudgetUsage(long Entries, long ProcessedBytes, long OutputBytes); | |
| 6 | 삭제: | |
| 7 | 삭제: public sealed class JobBudget | |
| 8 | 삭제: { | |
| 9 | 삭제: private readonly object gate = new(); | |
| 10 | 삭제: private readonly JobLimits limits; | |
| 11 | 삭제: private readonly TimeProvider time; | |
| 12 | 삭제: private readonly long started; | |
| 13 | 삭제: private long entries; | |
| 14 | 삭제: private long processedBytes; | |
| 15 | 삭제: private long outputBytes; | |
| 16 | 삭제: private int exhausted; | |
| 17 | 삭제: | |
| 18 | 삭제: public JobBudget(JobLimits limits, TimeProvider? timeProvider = null) | |
| 19 | 삭제: { | |
| 20 | 삭제: ArgumentNullException.ThrowIfNull(limits); | |
| 21 | 삭제: if (limits.MaxEntries <= 0 || limits.MaxProcessedBytes <= 0 || limits.MaxOutputBytes <= 0 || | |
| 22 | 삭제: limits.MaxDuration <= TimeSpan.Zero || limits.MaxPasswordAttempts <= 0) | |
| 23 | 삭제: { | |
| 24 | 삭제: throw new ArgumentOutOfRangeException(nameof(limits)); | |
| 25 | 삭제: } | |
| 26 | 삭제: | |
| 27 | 삭제: this.limits = limits; | |
| 28 | 삭제: time = timeProvider ?? TimeProvider.System; | |
| 29 | 삭제: started = time.GetTimestamp(); | |
| 30 | 삭제: } | |
| 31 | 삭제: | |
| 32 | 삭제: public BudgetUsage Usage | |
| 33 | 삭제: { | |
| 34 | 삭제: get { lock (gate) { return new(entries, processedBytes, outputBytes); } } | |
| 35 | 삭제: } | |
| 36 | 삭제: | |
| 37 | 삭제: public void Check(CancellationToken cancellationToken) | |
| 38 | 삭제: { | |
| 39 | 삭제: cancellationToken.ThrowIfCancellationRequested(); | |
| 40 | 삭제: if (Volatile.Read(ref exhausted) != 0 || time.GetElapsedTime(started) >= limits.MaxDuration) | |
| 41 | 삭제: { | |
| 42 | 삭제: Interlocked.Exchange(ref exhausted, 1); | |
| 43 | 삭제: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 44 | 삭제: } | |
| 45 | 삭제: } | |
| 46 | 삭제: | |
| 47 | 삭제: public void AddEntry(CancellationToken cancellationToken) => Charge(1, 0, 0, cancellationToken); | |
| 48 | 삭제: | |
| 49 | 삭제: // 중간 TAR, 솔리드 선행 처리, 복구 재시도도 같은 인스턴스에 누적함. | |
| 50 | 삭제: public void ChargeProcessed(long bytes, CancellationToken cancellationToken) => Charge(0, bytes, 0, cancellationToken); | |
| 51 | 삭제: public void ReserveOutput(long bytes, CancellationToken cancellationToken) => Charge(0, 0, bytes, cancellationToken); | |
| 52 | 삭제: | |
| 53 | 삭제: private void Charge(long entryCount, long processed, long output, CancellationToken cancellationToken) | |
| 54 | 삭제: { | |
| 55 | 삭제: if (entryCount < 0 || processed < 0 || output < 0) | |
| 56 | 삭제: { | |
| 57 | 삭제: throw new ArgumentOutOfRangeException(nameof(processed)); | |
| 58 | 삭제: } | |
| 59 | 삭제: | |
| 60 | 삭제: lock (gate) | |
| 61 | 삭제: { | |
| 62 | 삭제: Check(cancellationToken); | |
| 63 | 삭제: if (entryCount > limits.MaxEntries - entries || processed > limits.MaxProcessedBytes - processedBytes || | |
| 64 | 삭제: output > limits.MaxOutputBytes - outputBytes) | |
| 65 | 삭제: { | |
| 66 | 삭제: Interlocked.Exchange(ref exhausted, 1); | |
| 67 | 삭제: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 68 | 삭제: } | |
| 69 | 삭제: | |
| 70 | 삭제: entries += entryCount; | |
| 71 | 삭제: processedBytes += processed; | |
| 72 | 삭제: outputBytes += output; | |
| 73 | 삭제: } | |
| 74 | 삭제: } | |
| 75 | 삭제: } |
| @@ -1,82 +0,0 @@ | ||
| 1 | 삭제: using System.Text; | |
| 2 | 삭제: | |
| 3 | 삭제: namespace Zipelo.Core; | |
| 4 | 삭제: | |
| 5 | 삭제: public enum FileNamePolicy { Windows, Linux } | |
| 6 | 삭제: | |
| 7 | 삭제: public static class OutputPathPolicy | |
| 8 | 삭제: { | |
| 9 | 삭제: public static FileNamePolicy CurrentPolicy => OperatingSystem.IsWindows() ? FileNamePolicy.Windows : | |
| 10 | 삭제: OperatingSystem.IsLinux() ? FileNamePolicy.Linux : throw new PlatformNotSupportedException(); | |
| 11 | 삭제: | |
| 12 | 삭제: public static StringComparison Comparison(FileNamePolicy policy) => policy switch | |
| 13 | 삭제: { | |
| 14 | 삭제: FileNamePolicy.Windows => StringComparison.OrdinalIgnoreCase, | |
| 15 | 삭제: FileNamePolicy.Linux => StringComparison.Ordinal, | |
| 16 | 삭제: _ => throw new ArgumentOutOfRangeException(nameof(policy)) | |
| 17 | 삭제: }; | |
| 18 | 삭제: | |
| 19 | 삭제: public static StringComparer Comparer(FileNamePolicy policy) => policy switch | |
| 20 | 삭제: { | |
| 21 | 삭제: FileNamePolicy.Windows => StringComparer.OrdinalIgnoreCase, | |
| 22 | 삭제: FileNamePolicy.Linux => StringComparer.Ordinal, | |
| 23 | 삭제: _ => throw new ArgumentOutOfRangeException(nameof(policy)) | |
| 24 | 삭제: }; | |
| 25 | 삭제: | |
| 26 | 삭제: public static IReadOnlyList<string> Validate(string path, FileNamePolicy policy) | |
| 27 | 삭제: { | |
| 28 | 삭제: if (policy == FileNamePolicy.Windows) { return Validate(path); } | |
| 29 | 삭제: if (policy != FileNamePolicy.Linux) { throw new ArgumentOutOfRangeException(nameof(policy)); } | |
| 30 | 삭제: if (string.IsNullOrEmpty(path) || path.Length > 4096 || path.Contains('\0')) | |
| 31 | 삭제: { | |
| 32 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 33 | 삭제: } | |
| 34 | 삭제: var segments = path.Split('/'); | |
| 35 | 삭제: var encoding = new UTF8Encoding(false, true); | |
| 36 | 삭제: foreach (var segment in segments) | |
| 37 | 삭제: { | |
| 38 | 삭제: if (segment.Length == 0 || segment is "." or "..") | |
| 39 | 삭제: { | |
| 40 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 41 | 삭제: } | |
| 42 | 삭제: try | |
| 43 | 삭제: { | |
| 44 | 삭제: if (encoding.GetByteCount(segment) > 255) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 45 | 삭제: } | |
| 46 | 삭제: catch (EncoderFallbackException) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 47 | 삭제: } | |
| 48 | 삭제: return Array.AsReadOnly(segments); | |
| 49 | 삭제: } | |
| 50 | 삭제: | |
| 51 | 삭제: // 기존 단일 인수 API는 Windows 사전 정책을 유지함. | |
| 52 | 삭제: // 문자열 검사는 사전 정책임. 파일시스템의 링크나 경쟁 상태를 검사한 결과가 아님. | |
| 53 | 삭제: public static IReadOnlyList<string> Validate(string path) | |
| 54 | 삭제: { | |
| 55 | 삭제: if (string.IsNullOrWhiteSpace(path) || path.Length > 4096) | |
| 56 | 삭제: { | |
| 57 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 58 | 삭제: } | |
| 59 | 삭제: | |
| 60 | 삭제: var segments = path.Replace('\\', '/').Split('/'); | |
| 61 | 삭제: foreach (var segment in segments) | |
| 62 | 삭제: { | |
| 63 | 삭제: if (segment.Length is 0 or > 255 || segment is "." or ".." || | |
| 64 | 삭제: segment.EndsWith(' ') || segment.EndsWith('.') || | |
| 65 | 삭제: !segment.IsNormalized(NormalizationForm.FormC) || | |
| 66 | 삭제: segment.Any(c => char.IsControl(c) || "<>:\"|?*".Contains(c))) | |
| 67 | 삭제: { | |
| 68 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 69 | 삭제: } | |
| 70 | 삭제: | |
| 71 | 삭제: var stem = segment.Split('.')[0].TrimEnd(' ').ToUpperInvariant(); | |
| 72 | 삭제: if (stem is "CON" or "PRN" or "AUX" or "NUL" or "CONIN$" or "CONOUT$" || | |
| 73 | 삭제: (stem.Length == 4 && (stem.StartsWith("COM") || stem.StartsWith("LPT")) && | |
| 74 | 삭제: "123456789¹²³".Contains(stem[3]))) | |
| 75 | 삭제: { | |
| 76 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 77 | 삭제: } | |
| 78 | 삭제: } | |
| 79 | 삭제: | |
| 80 | 삭제: return Array.AsReadOnly(segments); | |
| 81 | 삭제: } | |
| 82 | 삭제: } |
| @@ -1,8 +0,0 @@ | ||
| 1 | 삭제: <Project Sdk="Microsoft.NET.Sdk"> | |
| 2 | 삭제: <PropertyGroup> | |
| 3 | 삭제: <TargetFramework>net10.0</TargetFramework> | |
| 4 | 삭제: <Nullable>enable</Nullable> | |
| 5 | 삭제: <ImplicitUsings>enable</ImplicitUsings> | |
| 6 | 삭제: <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | |
| 7 | 삭제: </PropertyGroup> | |
| 8 | 삭제: </Project> |
| @@ -1,21 +0,0 @@ | ||
| 1 | 삭제: <Application x:Class="Zipelo.Desktop.App" | |
| 2 | 삭제: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| 3 | 삭제: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
| 4 | 삭제: <Application.Resources> | |
| 5 | 삭제: <Style TargetType="Window"> | |
| 6 | 삭제: <Setter Property="FontFamily" Value="Malgun Gothic" /> | |
| 7 | 삭제: <Setter Property="FontSize" Value="16" /> | |
| 8 | 삭제: <Setter Property="Foreground" Value="#17263C" /> | |
| 9 | 삭제: <Setter Property="Background" Value="#F3F6FA" /> | |
| 10 | 삭제: </Style> | |
| 11 | 삭제: <Style TargetType="Button"> | |
| 12 | 삭제: <Setter Property="Padding" Value="20,12" /> | |
| 13 | 삭제: <Setter Property="Margin" Value="0,0,12,0" /> | |
| 14 | 삭제: <Setter Property="MinHeight" Value="48" /> | |
| 15 | 삭제: <Setter Property="MinWidth" Value="100" /> | |
| 16 | 삭제: </Style> | |
| 17 | 삭제: <Style TargetType="TextBlock"> | |
| 18 | 삭제: <Setter Property="TextWrapping" Value="Wrap" /> | |
| 19 | 삭제: </Style> | |
| 20 | 삭제: </Application.Resources> | |
| 21 | 삭제: </Application> |
| @@ -1,18 +0,0 @@ | ||
| 1 | 삭제: using System.Windows; | |
| 2 | 삭제: | |
| 3 | 삭제: namespace Zipelo.Desktop; | |
| 4 | 삭제: | |
| 5 | 삭제: public partial class App : Application | |
| 6 | 삭제: { | |
| 7 | 삭제: protected override void OnStartup(StartupEventArgs e) | |
| 8 | 삭제: { | |
| 9 | 삭제: base.OnStartup(e); | |
| 10 | 삭제: var fallback = new UnavailableWorkspace(); | |
| 11 | 삭제: var workspace = ZipWorkerWorkspace.TryCreate(out var unavailableReason); | |
| 12 | 삭제: fallback.AvailabilityMessage = unavailableReason; | |
| 13 | 삭제: var window = new MainWindow(workspace ?? fallback); | |
| 14 | 삭제: MainWindow = window; | |
| 15 | 삭제: window.ContentRendered += async (_, _) => await window.OpenStartupAsync(e.Args); | |
| 16 | 삭제: window.Show(); | |
| 17 | 삭제: } | |
| 18 | 삭제: } |
| @@ -1,55 +0,0 @@ | ||
| 1 | 삭제: using System.IO; | |
| 2 | 삭제: | |
| 3 | 삭제: namespace Zipelo.Ui; | |
| 4 | 삭제: | |
| 5 | 삭제: public sealed record ArchiveOpenTarget(string? Path, string? Error); | |
| 6 | 삭제: | |
| 7 | 삭제: public static class ArchiveOpenArguments | |
| 8 | 삭제: { | |
| 9 | 삭제: public static ArchiveOpenTarget Parse(IReadOnlyList<string> arguments) | |
| 10 | 삭제: { | |
| 11 | 삭제: if (arguments.Count == 0) { return new(null, null); } | |
| 12 | 삭제: if (arguments.Count != 1) | |
| 13 | 삭제: { | |
| 14 | 삭제: return new(null, "압축파일은 한 번에 하나만 열 수 있습니다. 단일 로컬 ZIP 경로를 전달하세요."); | |
| 15 | 삭제: } | |
| 16 | 삭제: var path = arguments[0]; | |
| 17 | 삭제: if (path.StartsWith('-') || (OperatingSystem.IsWindows() && path.StartsWith('/'))) | |
| 18 | 삭제: { | |
| 19 | 삭제: return new(null, "알 수 없는 옵션입니다. 옵션 없이 단일 로컬 ZIP 절대 경로를 전달하세요."); | |
| 20 | 삭제: } | |
| 21 | 삭제: return ValidatePath(path); | |
| 22 | 삭제: } | |
| 23 | 삭제: | |
| 24 | 삭제: public static string? ValidateName(string name) => Path.GetExtension(name).ToLowerInvariant() switch | |
| 25 | 삭제: { | |
| 26 | 삭제: ".jar" => "JAR 파일은 지원 대상에서 제외됩니다.", | |
| 27 | 삭제: ".zip" => null, | |
| 28 | 삭제: _ => "현재는 .zip 파일의 목록 열기만 지원합니다. 다른 형식은 열 수 없습니다." | |
| 29 | 삭제: }; | |
| 30 | 삭제: | |
| 31 | 삭제: public static ArchiveOpenTarget ValidatePath(string path) | |
| 32 | 삭제: { | |
| 33 | 삭제: try | |
| 34 | 삭제: { | |
| 35 | 삭제: // URI, UNC 및 장치 경로를 실행 인수나 원격 주소로 재해석하지 않음. | |
| 36 | 삭제: if (string.IsNullOrWhiteSpace(path) || path.Contains('\0') || | |
| 37 | 삭제: !Path.IsPathFullyQualified(path) || path.StartsWith(@"\\") || path.StartsWith("//")) | |
| 38 | 삭제: { | |
| 39 | 삭제: return new(null, "로컬 파일의 절대 경로가 필요합니다. URI, 네트워크와 장치 경로는 지원하지 않습니다."); | |
| 40 | 삭제: } | |
| 41 | 삭제: var error = ValidateName(path); | |
| 42 | 삭제: if (error is not null) { return new(null, error); } | |
| 43 | 삭제: if (!File.Exists(path)) { return new(null, "파일이 없거나 읽을 수 없습니다. 파일 위치와 접근 권한을 확인하세요."); } | |
| 44 | 삭제: if ((File.GetAttributes(path) & (FileAttributes.Directory | FileAttributes.Device)) != 0) | |
| 45 | 삭제: { | |
| 46 | 삭제: return new(null, "폴더나 장치는 열 수 없습니다. 일반 ZIP 파일을 선택하세요."); | |
| 47 | 삭제: } | |
| 48 | 삭제: return new(Path.GetFullPath(path), null); | |
| 49 | 삭제: } | |
| 50 | 삭제: catch (Exception error) when (error is ArgumentException or IOException or UnauthorizedAccessException or NotSupportedException) | |
| 51 | 삭제: { | |
| 52 | 삭제: return new(null, "파일 경로를 확인하지 못했습니다. 올바른 로컬 ZIP 경로를 전달하세요."); | |
| 53 | 삭제: } | |
| 54 | 삭제: } | |
| 55 | 삭제: } |
| @@ -1,163 +0,0 @@ | ||
| 1 | 삭제: using System.Security; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: | |
| 4 | 삭제: namespace Zipelo.Desktop; | |
| 5 | 삭제: | |
| 6 | 삭제: // 호스트는 별도 작업 프로세스를 사용하고 입력과 출력 정리를 마친 뒤 반환해야 함. | |
| 7 | 삭제: public delegate Task<JobResult> CoreJobRunner( | |
| 8 | 삭제: WorkspaceRequest request, | |
| 9 | 삭제: IProgress<JobEvent> progress, | |
| 10 | 삭제: PasswordProvider passwords, | |
| 11 | 삭제: CancellationToken cancellationToken); | |
| 12 | 삭제: | |
| 13 | 삭제: public sealed class CoreWorkspace : IArchiveWorkspace, IWorkspaceCapabilities | |
| 14 | 삭제: { | |
| 15 | 삭제: private readonly CoreJobRunner run; | |
| 16 | 삭제: private readonly string? availabilityMessage; | |
| 17 | 삭제: private readonly IReadOnlyList<EngineCapability> capabilities; | |
| 18 | 삭제: | |
| 19 | 삭제: public CoreWorkspace(CoreJobRunner run, IEnumerable<EngineCapability> capabilities, string? availabilityMessage = null) | |
| 20 | 삭제: { | |
| 21 | 삭제: ArgumentNullException.ThrowIfNull(run); | |
| 22 | 삭제: ArgumentNullException.ThrowIfNull(capabilities); | |
| 23 | 삭제: this.run = run; | |
| 24 | 삭제: this.availabilityMessage = availabilityMessage; | |
| 25 | 삭제: this.capabilities = Array.AsReadOnly(capabilities.ToArray()); | |
| 26 | 삭제: } | |
| 27 | 삭제: | |
| 28 | 삭제: public bool IsAvailable => capabilities.Any(capability => | |
| 29 | 삭제: capability.Action is ArchiveAction.List or ArchiveAction.Create); | |
| 30 | 삭제: | |
| 31 | 삭제: public string AvailabilityMessage => availabilityMessage ?? (IsAvailable | |
| 32 | 삭제: ? "연결된 형식과 기능만 사용할 수 있습니다. 압축 풀기는 안전 검증 전까지 준비 중입니다." | |
| 33 | 삭제: : "작업 프로세스가 아직 연결되지 않았습니다. 파일을 처리할 수 없습니다."); | |
| 34 | 삭제: | |
| 35 | 삭제: public bool CanExecute(WorkspaceAction action, string format) | |
| 36 | 삭제: { | |
| 37 | 삭제: // 안전한 출력 계층의 Windows 검증 전까지 해제를 닫아 둠. | |
| 38 | 삭제: return action != WorkspaceAction.Extract && capabilities.Any(capability => | |
| 39 | 삭제: capability.Action == MapAction(action) && | |
| 40 | 삭제: string.Equals(capability.Format, format, StringComparison.OrdinalIgnoreCase)); | |
| 41 | 삭제: } | |
| 42 | 삭제: | |
| 43 | 삭제: public async Task<WorkspaceResult> ExecuteAsync( | |
| 44 | 삭제: WorkspaceRequest request, | |
| 45 | 삭제: IProgress<WorkspaceProgress> progress, | |
| 46 | 삭제: Func<PasswordChallenge, CancellationToken, Task<SecureString?>> requestPassword, | |
| 47 | 삭제: CancellationToken cancellationToken) | |
| 48 | 삭제: { | |
| 49 | 삭제: ArgumentNullException.ThrowIfNull(request); | |
| 50 | 삭제: ArgumentNullException.ThrowIfNull(progress); | |
| 51 | 삭제: ArgumentNullException.ThrowIfNull(requestPassword); | |
| 52 | 삭제: if (request.JobId == Guid.Empty || request.Sources.Count == 0) | |
| 53 | 삭제: { | |
| 54 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 55 | 삭제: } | |
| 56 | 삭제: if (!CanExecute(request.Action, request.Format)) | |
| 57 | 삭제: { | |
| 58 | 삭제: return new(WorkspaceOutcome.Failed, Array.Empty<FileRow>()) | |
| 59 | 삭제: { | |
| 60 | 삭제: JobId = request.JobId, | |
| 61 | 삭제: Error = IsAvailable ? ArchiveError.UnsupportedOperation : ArchiveError.EngineUnavailable | |
| 62 | 삭제: }; | |
| 63 | 삭제: } | |
| 64 | 삭제: | |
| 65 | 삭제: var gate = new object(); | |
| 66 | 삭제: long lastSequence = 0; | |
| 67 | 삭제: var finished = false; | |
| 68 | 삭제: var events = new ForwardProgress<JobEvent>(value => | |
| 69 | 삭제: { | |
| 70 | 삭제: lock (gate) | |
| 71 | 삭제: { | |
| 72 | 삭제: if (finished || value.JobId != request.JobId || value.Sequence <= lastSequence) | |
| 73 | 삭제: { | |
| 74 | 삭제: return; | |
| 75 | 삭제: } | |
| 76 | 삭제: lastSequence = value.Sequence; | |
| 77 | 삭제: progress.Report(new(value.ProcessedBytes, null) | |
| 78 | 삭제: { | |
| 79 | 삭제: JobId = value.JobId, | |
| 80 | 삭제: Sequence = value.Sequence, | |
| 81 | 삭제: State = value.State | |
| 82 | 삭제: }); | |
| 83 | 삭제: } | |
| 84 | 삭제: }); | |
| 85 | 삭제: | |
| 86 | 삭제: async ValueTask<SecureString?> Passwords(Zipelo.Core.PasswordChallenge challenge, CancellationToken token) | |
| 87 | 삭제: { | |
| 88 | 삭제: if (challenge.JobId != request.JobId || challenge.RequestId == Guid.Empty) | |
| 89 | 삭제: { | |
| 90 | 삭제: throw new ArchiveException(ArchiveError.InvalidPasswordResponse); | |
| 91 | 삭제: } | |
| 92 | 삭제: // 성공한 전달 이후 암호는 Core가 소비와 폐기를 소유함. | |
| 93 | 삭제: return await requestPassword(new(challenge.JobId, challenge.RequestId) | |
| 94 | 삭제: { | |
| 95 | 삭제: Attempt = challenge.Attempt | |
| 96 | 삭제: }, token).ConfigureAwait(false); | |
| 97 | 삭제: } | |
| 98 | 삭제: | |
| 99 | 삭제: try | |
| 100 | 삭제: { | |
| 101 | 삭제: var result = await run(request, events, Passwords, cancellationToken).ConfigureAwait(false); | |
| 102 | 삭제: if (result.JobId != request.JobId) | |
| 103 | 삭제: { | |
| 104 | 삭제: throw new ArchiveException(ArchiveError.EngineFailure); | |
| 105 | 삭제: } | |
| 106 | 삭제: return MapResult(result); | |
| 107 | 삭제: } | |
| 108 | 삭제: finally | |
| 109 | 삭제: { | |
| 110 | 삭제: lock (gate) { finished = true; } | |
| 111 | 삭제: } | |
| 112 | 삭제: } | |
| 113 | 삭제: | |
| 114 | 삭제: private static ArchiveAction MapAction(WorkspaceAction action) => action switch | |
| 115 | 삭제: { | |
| 116 | 삭제: WorkspaceAction.List => ArchiveAction.List, | |
| 117 | 삭제: WorkspaceAction.Create => ArchiveAction.Create, | |
| 118 | 삭제: WorkspaceAction.Extract => ArchiveAction.Extract, | |
| 119 | 삭제: _ => throw new ArchiveException(ArchiveError.UnsupportedOperation) | |
| 120 | 삭제: }; | |
| 121 | 삭제: | |
| 122 | 삭제: internal static WorkspaceResult MapResult(JobResult result) | |
| 123 | 삭제: { | |
| 124 | 삭제: var terminal = result.State is JobState.Completed or JobState.Partial or JobState.Cancelled or JobState.Failed; | |
| 125 | 삭제: var outcome = result.State switch | |
| 126 | 삭제: { | |
| 127 | 삭제: JobState.Completed => WorkspaceOutcome.Completed, | |
| 128 | 삭제: JobState.Partial => WorkspaceOutcome.Partial, | |
| 129 | 삭제: JobState.Cancelled => WorkspaceOutcome.Cancelled, | |
| 130 | 삭제: _ => WorkspaceOutcome.Failed | |
| 131 | 삭제: }; | |
| 132 | 삭제: var rows = result.Entries.Select(value => new FileRow( | |
| 133 | 삭제: value.Entry.Name, | |
| 134 | 삭제: value.Entry.DeclaredSize is long size ? $"{size:N0}바이트" : "알 수 없음", | |
| 135 | 삭제: value.Verification switch | |
| 136 | 삭제: { | |
| 137 | 삭제: VerificationState.Passed => "검증 통과", | |
| 138 | 삭제: VerificationState.Failed => "검증 실패", | |
| 139 | 삭제: VerificationState.Unavailable => "검증 불가", | |
| 140 | 삭제: _ => "검증 전" | |
| 141 | 삭제: }) | |
| 142 | 삭제: { | |
| 143 | 삭제: EntryId = value.Entry.Id, | |
| 144 | 삭제: Kind = value.Entry.Kind, | |
| 145 | 삭제: Outcome = value.Outcome, | |
| 146 | 삭제: Error = value.Error | |
| 147 | 삭제: }).ToArray(); | |
| 148 | 삭제: if (outcome == WorkspaceOutcome.Completed && result.Error != ArchiveError.None) | |
| 149 | 삭제: { | |
| 150 | 삭제: outcome = WorkspaceOutcome.Failed; | |
| 151 | 삭제: } | |
| 152 | 삭제: return new(outcome, Array.AsReadOnly(rows)) | |
| 153 | 삭제: { | |
| 154 | 삭제: JobId = result.JobId, | |
| 155 | 삭제: Error = terminal ? result.Error : ArchiveError.EngineFailure | |
| 156 | 삭제: }; | |
| 157 | 삭제: } | |
| 158 | 삭제: | |
| 159 | 삭제: private sealed class ForwardProgress<T>(Action<T> report) : IProgress<T> | |
| 160 | 삭제: { | |
| 161 | 삭제: public void Report(T value) => report(value); | |
| 162 | 삭제: } | |
| 163 | 삭제: } |
| @@ -1,73 +0,0 @@ | ||
| 1 | 삭제: using System.IO; | |
| 2 | 삭제: using System.Security; | |
| 3 | 삭제: using Zipelo.Core; | |
| 4 | 삭제: using Zipelo.Runtime; | |
| 5 | 삭제: using Zipelo.Ui; | |
| 6 | 삭제: | |
| 7 | 삭제: namespace Zipelo.Desktop; | |
| 8 | 삭제: | |
| 9 | 삭제: internal sealed class CreationWorkspace(CoreWorkspace listing, ZipWorkerClient client, Func<bool> filesReady) | |
| 10 | 삭제: : IArchiveWorkspace, IWorkspaceCapabilities | |
| 11 | 삭제: { | |
| 12 | 삭제: public bool IsAvailable => listing.IsAvailable && filesReady(); | |
| 13 | 삭제: public string AvailabilityMessage => listing.AvailabilityMessage + | |
| 14 | 삭제: (ZipExtractionWorkflow.ValidationEnabled ? " " + ZipExtractionWorkflow.ScopeMessage : " 일반 압축 풀기는 비활성입니다.") + | |
| 15 | 삭제: (ZipCreationWorkflow.ValidationEnabled ? " " + ZipCreationWorkflow.ScopeMessage : " 생성 연결은 개발 검증 빌드에서만 사용할 수 있습니다."); | |
| 16 | 삭제: | |
| 17 | 삭제: public bool CanExecute(WorkspaceAction action, string format) => IsAvailable && | |
| 18 | 삭제: (action == WorkspaceAction.Create | |
| 19 | 삭제: ? ZipCreationWorkflow.ValidationEnabled && NewZipPublisher.IsSupportedPlatform && | |
| 20 | 삭제: format.Equals("zip", StringComparison.OrdinalIgnoreCase) | |
| 21 | 삭제: : action == WorkspaceAction.Extract | |
| 22 | 삭제: ? ZipExtractionWorkflow.ValidationEnabled && NewFolderPublisher.IsSupportedPlatform && | |
| 23 | 삭제: client.SupportsMemoryExtraction && format.Equals("zip", StringComparison.OrdinalIgnoreCase) | |
| 24 | 삭제: : listing.CanExecute(action, format)); | |
| 25 | 삭제: | |
| 26 | 삭제: public async Task<WorkspaceResult> ExecuteAsync(WorkspaceRequest request, IProgress<WorkspaceProgress> progress, | |
| 27 | 삭제: Func<PasswordChallenge, CancellationToken, Task<SecureString?>> requestPassword, CancellationToken token) | |
| 28 | 삭제: { | |
| 29 | 삭제: if (!CanExecute(request.Action, request.Format)) { throw new ArchiveException(ArchiveError.UnsupportedOperation); } | |
| 30 | 삭제: if (request.Action == WorkspaceAction.Extract) | |
| 31 | 삭제: { | |
| 32 | 삭제: if (request.Sources.Count != 1 || request.Destination is null || | |
| 33 | 삭제: ArchiveOpenArguments.ValidatePath(request.Sources[0]).Error is not null) | |
| 34 | 삭제: { | |
| 35 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 36 | 삭제: } | |
| 37 | 삭제: var extraction = await ZipExtractionWorkflow.RunAsync(client, request.JobId, cancellation => | |
| 38 | 삭제: { | |
| 39 | 삭제: cancellation.ThrowIfCancellationRequested(); | |
| 40 | 삭제: return Task.FromResult<Stream>(new FileStream(request.Sources[0], FileMode.Open, | |
| 41 | 삭제: FileAccess.Read, FileShare.Read, 65536, FileOptions.Asynchronous | FileOptions.SequentialScan)); | |
| 42 | 삭제: }, request.Destination, token).ConfigureAwait(false); | |
| 43 | 삭제: var extracted = CoreWorkspace.MapResult(extraction.Job); | |
| 44 | 삭제: var extractionError = extraction.Publication?.Error ?? extraction.Job.Error; | |
| 45 | 삭제: var extractionOutcome = ZipExtractionWorkflow.Published(extraction) ? WorkspaceOutcome.Completed | |
| 46 | 삭제: : extractionError == ArchiveError.Cancelled ? WorkspaceOutcome.Cancelled : WorkspaceOutcome.Failed; | |
| 47 | 삭제: return extracted with { Outcome = extractionOutcome, Error = extractionError, Extraction = extraction }; | |
| 48 | 삭제: } | |
| 49 | 삭제: if (request.Action != WorkspaceAction.Create) | |
| 50 | 삭제: { | |
| 51 | 삭제: return await listing.ExecuteAsync(request, progress, requestPassword, token).ConfigureAwait(false); | |
| 52 | 삭제: } | |
| 53 | 삭제: if (request.Destination is null) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 54 | 삭제: var sources = request.Sources.Select(path => new CreationSource(Path.GetFileName(path), cancellation => | |
| 55 | 삭제: { | |
| 56 | 삭제: cancellation.ThrowIfCancellationRequested(); | |
| 57 | 삭제: // 디렉터리 재귀 수집 없이 사용자가 고른 파일만 읽음. | |
| 58 | 삭제: if ((File.GetAttributes(path) & FileAttributes.Directory) != 0) | |
| 59 | 삭제: { | |
| 60 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedEntry); | |
| 61 | 삭제: } | |
| 62 | 삭제: return Task.FromResult<Stream>(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, | |
| 63 | 삭제: 65536, FileOptions.Asynchronous | FileOptions.SequentialScan)); | |
| 64 | 삭제: })).ToArray(); | |
| 65 | 삭제: var result = await ZipCreationWorkflow.RunAsync(client, request.JobId, sources, request.Destination, token) | |
| 66 | 삭제: .ConfigureAwait(false); | |
| 67 | 삭제: var mapped = CoreWorkspace.MapResult(result.Job); | |
| 68 | 삭제: var error = result.Publication?.Error ?? result.Job.Error; | |
| 69 | 삭제: var outcome = result.Publication?.Published == true ? WorkspaceOutcome.Completed | |
| 70 | 삭제: : error == ArchiveError.Cancelled ? WorkspaceOutcome.Cancelled : WorkspaceOutcome.Failed; | |
| 71 | 삭제: return mapped with { Outcome = outcome, Error = error, Creation = result }; | |
| 72 | 삭제: } | |
| 73 | 삭제: } |
| @@ -1,62 +0,0 @@ | ||
| 1 | 삭제: <Window x:Class="Zipelo.Desktop.MainWindow" | |
| 2 | 삭제: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| 3 | 삭제: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| 4 | 삭제: Title="Zipelo" Width="980" Height="740" MinWidth="640" MinHeight="520" | |
| 5 | 삭제: Closing="OnClosing"> | |
| 6 | 삭제: <Grid Margin="28"> | |
| 7 | 삭제: <Grid.RowDefinitions> | |
| 8 | 삭제: <RowDefinition Height="Auto" /> | |
| 9 | 삭제: <RowDefinition Height="Auto" /> | |
| 10 | 삭제: <RowDefinition Height="Auto" /> | |
| 11 | 삭제: <RowDefinition Height="*" /> | |
| 12 | 삭제: <RowDefinition Height="Auto" /> | |
| 13 | 삭제: </Grid.RowDefinitions> | |
| 14 | 삭제: <DockPanel Margin="0,0,0,24"> | |
| 15 | 삭제: <Button DockPanel.Dock="Right" Content="설치 안내" Click="ShowInstallation" Margin="0" /> | |
| 16 | 삭제: <StackPanel> | |
| 17 | 삭제: <TextBlock Text="Zipelo" FontSize="36" FontWeight="Bold" /> | |
| 18 | 삭제: <TextBlock Text="파일을 열고, 간편하게 풀어보세요." Margin="0,4,12,0" /> | |
| 19 | 삭제: </StackPanel> | |
| 20 | 삭제: </DockPanel> | |
| 21 | 삭제: <WrapPanel Grid.Row="1" Margin="0,0,0,20"> | |
| 22 | 삭제: <Button x:Name="OpenButton" Content="압축파일 열기" Click="OpenArchive" | |
| 23 | 삭제: Background="#185ABD" Foreground="White" FontWeight="SemiBold" Margin="0,0,12,8" /> | |
| 24 | 삭제: <Button x:Name="CreateButton" Content="새로 압축하기" Click="CreateArchive" Margin="0,0,12,8" /> | |
| 25 | 삭제: <Button x:Name="RetryCreateButton" Content="생성 다시 시도" Click="RetryCreation" IsEnabled="False" Margin="0,0,12,8" /> | |
| 26 | 삭제: <Button x:Name="ExtractButton" Content="압축 풀기" Click="ExtractArchive" IsEnabled="False" Margin="0,0,12,8" /> | |
| 27 | 삭제: </WrapPanel> | |
| 28 | 삭제: <StackPanel Grid.Row="2" Margin="0,0,0,16"> | |
| 29 | 삭제: <TextBlock x:Name="ArchiveTitle" Text="아직 열린 압축파일이 없습니다." FontSize="20" FontWeight="SemiBold" /> | |
| 30 | 삭제: <TextBlock x:Name="Availability" TextWrapping="Wrap" Text="개발 중인 화면입니다. 압축 엔진 연결 전에는 파일을 처리할 수 없습니다." | |
| 31 | 삭제: Margin="0,8,0,0" /> | |
| 32 | 삭제: </StackPanel> | |
| 33 | 삭제: <Grid Grid.Row="3" Background="White"> | |
| 34 | 삭제: <DataGrid x:Name="Files" AutoGenerateColumns="False" IsReadOnly="True" | |
| 35 | 삭제: CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" | |
| 36 | 삭제: HeadersVisibility="Column" GridLinesVisibility="Horizontal" | |
| 37 | 삭제: RowHeaderWidth="0" BorderBrush="#CFD7E3" RowHeight="40" | |
| 38 | 삭제: EnableRowVirtualization="True" EnableColumnVirtualization="True" | |
| 39 | 삭제: AutomationProperties.Name="압축파일 안의 파일 목록"> | |
| 40 | 삭제: <DataGrid.Columns> | |
| 41 | 삭제: <DataGridTextColumn Header="파일 이름" Binding="{Binding Name}" Width="*" MinWidth="200" /> | |
| 42 | 삭제: <DataGridTextColumn Header="크기" Binding="{Binding Size}" Width="120" /> | |
| 43 | 삭제: <DataGridTextColumn Header="검증 상태" Binding="{Binding Verification}" Width="150" /> | |
| 44 | 삭제: </DataGrid.Columns> | |
| 45 | 삭제: </DataGrid> | |
| 46 | 삭제: <TextBlock x:Name="EmptyState" Text="압축파일을 열면 여기에 파일 목록이 표시됩니다." | |
| 47 | 삭제: HorizontalAlignment="Center" VerticalAlignment="Center" Margin="24" | |
| 48 | 삭제: IsHitTestVisible="False" /> | |
| 49 | 삭제: </Grid> | |
| 50 | 삭제: <StackPanel Grid.Row="4" Margin="0,20,0,0"> | |
| 51 | 삭제: <TextBlock x:Name="Status" Text="작업 대기 중" AutomationProperties.LiveSetting="Polite" /> | |
| 52 | 삭제: <TextBlock x:Name="CreationSelection" TextWrapping="Wrap" Margin="0,8,0,0" /> | |
| 53 | 삭제: <TextBlock Text="새 결과 폴더 이름 (기존 대상과 병합하지 않음)" Margin="0,8,0,0" /> | |
| 54 | 삭제: <TextBox x:Name="ExtractionName" Text="압축 푼 파일" AutomationProperties.Name="새 결과 폴더 이름" /> | |
| 55 | 삭제: <TextBlock x:Name="ExtractionSelection" TextWrapping="Wrap" /> | |
| 56 | 삭제: <TextBlock x:Name="ResultSummary" Margin="0,8,0,0" /> | |
| 57 | 삭제: <ProgressBar x:Name="Progress" Height="8" Margin="0,12,0,16" Minimum="0" Maximum="100" | |
| 58 | 삭제: AutomationProperties.Name="작업 진행률" /> | |
| 59 | 삭제: <Button x:Name="StopButton" Content="작업 중지" Click="StopJob" IsEnabled="False" HorizontalAlignment="Left" /> | |
| 60 | 삭제: </StackPanel> | |
| 61 | 삭제: </Grid> | |
| 62 | 삭제: </Window> |
| @@ -1,432 +0,0 @@ | ||
| 1 | 삭제: using System.ComponentModel; | |
| 2 | 삭제: using System.IO; | |
| 3 | 삭제: using System.Security; | |
| 4 | 삭제: using System.Windows; | |
| 5 | 삭제: using System.Windows.Media; | |
| 6 | 삭제: using Microsoft.Win32; | |
| 7 | 삭제: using Zipelo.Core; | |
| 8 | 삭제: using Zipelo.Ui; | |
| 9 | 삭제: | |
| 10 | 삭제: namespace Zipelo.Desktop; | |
| 11 | 삭제: | |
| 12 | 삭제: public partial class MainWindow : Window | |
| 13 | 삭제: { | |
| 14 | 삭제: private enum ScreenPhase { Idle, Selecting, Running, WaitingForPassword, Cancelling, Finishing } | |
| 15 | 삭제: | |
| 16 | 삭제: private readonly IArchiveWorkspace workspace; | |
| 17 | 삭제: private readonly HashSet<Guid> passwordRequests = []; | |
| 18 | 삭제: private ScreenPhase phase; | |
| 19 | 삭제: private CancellationTokenSource? activeJob; | |
| 20 | 삭제: private Guid? activeJobId; | |
| 21 | 삭제: private long lastSequence; | |
| 22 | 삭제: private string? archivePath; | |
| 23 | 삭제: private PasswordWindow? passwordWindow; | |
| 24 | 삭제: private string[] creationSources = []; | |
| 25 | 삭제: private string? creationDestination; | |
| 26 | 삭제: private bool startupHandled; | |
| 27 | 삭제: | |
| 28 | 삭제: public MainWindow(IArchiveWorkspace workspace) | |
| 29 | 삭제: { | |
| 30 | 삭제: this.workspace = workspace; | |
| 31 | 삭제: InitializeComponent(); | |
| 32 | 삭제: Availability.Text = workspace is IWorkspaceCapabilities features | |
| 33 | 삭제: ? features.AvailabilityMessage | |
| 34 | 삭제: : "작업 프로세스가 아직 연결되지 않았습니다. 파일을 처리할 수 없습니다."; | |
| 35 | 삭제: UpdateActions(); | |
| 36 | 삭제: } | |
| 37 | 삭제: | |
| 38 | 삭제: private bool CanExecute(WorkspaceAction action, string format = "zip") => | |
| 39 | 삭제: workspace.IsAvailable && workspace is IWorkspaceCapabilities features && features.CanExecute(action, format); | |
| 40 | 삭제: | |
| 41 | 삭제: public async Task OpenStartupAsync(IReadOnlyList<string> arguments) | |
| 42 | 삭제: { | |
| 43 | 삭제: if (startupHandled) { return; } | |
| 44 | 삭제: startupHandled = true; | |
| 45 | 삭제: var target = ArchiveOpenArguments.Parse(arguments); | |
| 46 | 삭제: if (target.Error is not null) { SetStatus(target.Error, true); return; } | |
| 47 | 삭제: if (target.Path is null) { return; } | |
| 48 | 삭제: if (phase != ScreenPhase.Idle) | |
| 49 | 삭제: { | |
| 50 | 삭제: SetStatus("다른 작업이 진행 중이라 시작 파일을 열지 못했습니다. 작업 후 파일 열기를 사용하세요.", true); | |
| 51 | 삭제: return; | |
| 52 | 삭제: } | |
| 53 | 삭제: await SelectAndRun(WorkspaceAction.List, () => new WorkspaceRequest( | |
| 54 | 삭제: Guid.NewGuid(), WorkspaceAction.List, [target.Path])); | |
| 55 | 삭제: } | |
| 56 | 삭제: | |
| 57 | 삭제: private async void OpenArchive(object sender, RoutedEventArgs e) | |
| 58 | 삭제: { | |
| 59 | 삭제: await SelectAndRun(WorkspaceAction.List, () => | |
| 60 | 삭제: { | |
| 61 | 삭제: var dialog = new OpenFileDialog | |
| 62 | 삭제: { | |
| 63 | 삭제: Title = "압축파일 열기", | |
| 64 | 삭제: Filter = "ZIP 압축파일|*.zip", | |
| 65 | 삭제: CheckFileExists = true | |
| 66 | 삭제: }; | |
| 67 | 삭제: return dialog.ShowDialog(this) == true | |
| 68 | 삭제: ? new WorkspaceRequest(Guid.NewGuid(), WorkspaceAction.List, [dialog.FileName]) | |
| 69 | 삭제: : null; | |
| 70 | 삭제: }); | |
| 71 | 삭제: } | |
| 72 | 삭제: | |
| 73 | 삭제: private async void CreateArchive(object sender, RoutedEventArgs e) | |
| 74 | 삭제: { | |
| 75 | 삭제: await SelectAndRun(WorkspaceAction.Create, () => | |
| 76 | 삭제: { | |
| 77 | 삭제: var sources = new OpenFileDialog | |
| 78 | 삭제: { | |
| 79 | 삭제: Title = "압축할 파일 선택", | |
| 80 | 삭제: Multiselect = true, | |
| 81 | 삭제: CheckFileExists = true | |
| 82 | 삭제: }; | |
| 83 | 삭제: if (sources.ShowDialog(this) != true) { return null; } | |
| 84 | 삭제: creationSources = sources.FileNames; | |
| 85 | 삭제: creationDestination = null; | |
| 86 | 삭제: CreationSelection.Text = $"선택한 생성 파일 {creationSources.Length:N0}개: {string.Join(", ", creationSources.Select(path => Path.GetFileName(path)))}"; | |
| 87 | 삭제: var destination = new SaveFileDialog | |
| 88 | 삭제: { | |
| 89 | 삭제: Title = "새 ZIP 파일 저장 위치", | |
| 90 | 삭제: Filter = "ZIP 압축파일|*.zip", | |
| 91 | 삭제: DefaultExt = ".zip", | |
| 92 | 삭제: AddExtension = true, | |
| 93 | 삭제: FileName = creationDestination ?? "새 압축파일.zip", | |
| 94 | 삭제: OverwritePrompt = false | |
| 95 | 삭제: }; | |
| 96 | 삭제: if (destination.ShowDialog(this) != true) { return null; } | |
| 97 | 삭제: creationDestination = destination.FileName; | |
| 98 | 삭제: CreationSelection.Text += $" → {Path.GetFileName(creationDestination)}"; | |
| 99 | 삭제: return new WorkspaceRequest(Guid.NewGuid(), WorkspaceAction.Create, creationSources, creationDestination); | |
| 100 | 삭제: }); | |
| 101 | 삭제: } | |
| 102 | 삭제: | |
| 103 | 삭제: private async void RetryCreation(object sender, RoutedEventArgs e) | |
| 104 | 삭제: { | |
| 105 | 삭제: await SelectAndRun(WorkspaceAction.Create, () => creationSources.Length > 0 && creationDestination is not null | |
| 106 | 삭제: ? new WorkspaceRequest(Guid.NewGuid(), WorkspaceAction.Create, creationSources, creationDestination) | |
| 107 | 삭제: : null); | |
| 108 | 삭제: } | |
| 109 | 삭제: | |
| 110 | 삭제: private async void ExtractArchive(object sender, RoutedEventArgs e) | |
| 111 | 삭제: { | |
| 112 | 삭제: await SelectAndRun(WorkspaceAction.Extract, () => | |
| 113 | 삭제: { | |
| 114 | 삭제: if (archivePath is null) { SetStatus("먼저 ZIP 목록을 열어주세요.", true); return null; } | |
| 115 | 삭제: var name = ExtractionName.Text; | |
| 116 | 삭제: ZipExtractionWorkflow.ValidateFolderName(name); | |
| 117 | 삭제: var parent = new OpenFolderDialog | |
| 118 | 삭제: { | |
| 119 | 삭제: Title = "새 결과 폴더를 만들 부모 위치 선택 (기존 폴더에 병합하지 않음)", | |
| 120 | 삭제: Multiselect = false | |
| 121 | 삭제: }; | |
| 122 | 삭제: if (parent.ShowDialog(this) != true) { return null; } | |
| 123 | 삭제: var destination = Path.Combine(parent.FolderName, name); | |
| 124 | 삭제: ExtractionSelection.Text = $"새 결과 폴더: {destination}"; | |
| 125 | 삭제: return new WorkspaceRequest(Guid.NewGuid(), WorkspaceAction.Extract, [archivePath], destination); | |
| 126 | 삭제: }); | |
| 127 | 삭제: } | |
| 128 | 삭제: | |
| 129 | 삭제: private async Task SelectAndRun(WorkspaceAction action, Func<WorkspaceRequest?> select) | |
| 130 | 삭제: { | |
| 131 | 삭제: if (phase != ScreenPhase.Idle) { return; } | |
| 132 | 삭제: if (!CanExecute(action)) | |
| 133 | 삭제: { | |
| 134 | 삭제: SetStatus(action == WorkspaceAction.Extract | |
| 135 | 삭제: ? "일반 압축 풀기는 비활성입니다. 명시적인 개발 검증 빌드와 작업자가 필요합니다." | |
| 136 | 삭제: : "이 기능의 작업 프로세스가 연결되지 않았거나 지원하지 않습니다.", true); | |
| 137 | 삭제: return; | |
| 138 | 삭제: } | |
| 139 | 삭제: | |
| 140 | 삭제: // 파일 선택부터 결과 반영까지 같은 게이트를 유지함. | |
| 141 | 삭제: phase = ScreenPhase.Selecting; | |
| 142 | 삭제: UpdateActions(); | |
| 143 | 삭제: try | |
| 144 | 삭제: { | |
| 145 | 삭제: var request = select(); | |
| 146 | 삭제: if (request is null) { return; } | |
| 147 | 삭제: if (request.Action == WorkspaceAction.List) | |
| 148 | 삭제: { | |
| 149 | 삭제: var target = request.Sources.Count == 1 | |
| 150 | 삭제: ? ArchiveOpenArguments.ValidatePath(request.Sources[0]) | |
| 151 | 삭제: : new ArchiveOpenTarget(null, "압축파일은 한 번에 하나만 열 수 있습니다."); | |
| 152 | 삭제: if (target.Error is not null) { SetStatus(target.Error, true); return; } | |
| 153 | 삭제: } | |
| 154 | 삭제: await RunJob(request); | |
| 155 | 삭제: } | |
| 156 | 삭제: catch (ArchiveException error) | |
| 157 | 삭제: { | |
| 158 | 삭제: SetStatus(WorkspaceMessages.Error(error.Code), true); | |
| 159 | 삭제: Progress.Value = 0; | |
| 160 | 삭제: } | |
| 161 | 삭제: catch (Exception) | |
| 162 | 삭제: { | |
| 163 | 삭제: // 파일 선택과 엔진 예외의 원문은 화면과 로그에 노출하지 않음. | |
| 164 | 삭제: SetStatus("작업을 시작하지 못했습니다. 파일 상태를 확인하고 다시 선택하세요.", true); | |
| 165 | 삭제: Progress.Value = 0; | |
| 166 | 삭제: } | |
| 167 | 삭제: finally | |
| 168 | 삭제: { | |
| 169 | 삭제: Progress.IsIndeterminate = false; | |
| 170 | 삭제: activeJob = null; | |
| 171 | 삭제: activeJobId = null; | |
| 172 | 삭제: passwordRequests.Clear(); | |
| 173 | 삭제: phase = ScreenPhase.Idle; | |
| 174 | 삭제: UpdateActions(); | |
| 175 | 삭제: } | |
| 176 | 삭제: } | |
| 177 | 삭제: | |
| 178 | 삭제: private async Task RunJob(WorkspaceRequest request) | |
| 179 | 삭제: { | |
| 180 | 삭제: using var cancellation = new CancellationTokenSource(); | |
| 181 | 삭제: activeJob = cancellation; | |
| 182 | 삭제: activeJobId = request.JobId; | |
| 183 | 삭제: lastSequence = 0; | |
| 184 | 삭제: passwordRequests.Clear(); | |
| 185 | 삭제: phase = ScreenPhase.Running; | |
| 186 | 삭제: Progress.Value = 0; | |
| 187 | 삭제: Progress.IsIndeterminate = true; | |
| 188 | 삭제: ResultSummary.Text = ""; | |
| 189 | 삭제: UpdateActions(); | |
| 190 | 삭제: SetStatus(request.Action switch | |
| 191 | 삭제: { | |
| 192 | 삭제: WorkspaceAction.List => "파일 목록을 읽고 있습니다.", | |
| 193 | 삭제: WorkspaceAction.Extract => "ZIP 무결성과 새 폴더 게시를 확인하고 있습니다.", | |
| 194 | 삭제: _ => "파일을 압축하고 있습니다." | |
| 195 | 삭제: }); | |
| 196 | 삭제: | |
| 197 | 삭제: var progress = new Progress<WorkspaceProgress>(value => ApplyProgress(request.JobId, value)); | |
| 198 | 삭제: try | |
| 199 | 삭제: { | |
| 200 | 삭제: var result = await Task.Run(() => workspace.ExecuteAsync( | |
| 201 | 삭제: request, progress, RequestPasswordAsync, cancellation.Token)); | |
| 202 | 삭제: phase = ScreenPhase.Finishing; | |
| 203 | 삭제: UpdateActions(); | |
| 204 | 삭제: if (activeJobId != request.JobId || result.JobId != request.JobId) | |
| 205 | 삭제: { | |
| 206 | 삭제: throw new ArchiveException(ArchiveError.EngineFailure); | |
| 207 | 삭제: } | |
| 208 | 삭제: | |
| 209 | 삭제: // 늦은 취소 토큰 대신 호스트의 실제 종료 결과를 사용함. | |
| 210 | 삭제: PublishResult(request, result); | |
| 211 | 삭제: } | |
| 212 | 삭제: catch (OperationCanceledException) when (cancellation.IsCancellationRequested) | |
| 213 | 삭제: { | |
| 214 | 삭제: phase = ScreenPhase.Finishing; | |
| 215 | 삭제: Progress.Value = 0; | |
| 216 | 삭제: SetStatus("중지 요청 후 작업이 종료되었습니다. 결과 파일 상태를 확인하세요."); | |
| 217 | 삭제: } | |
| 218 | 삭제: catch (ArchiveException error) | |
| 219 | 삭제: { | |
| 220 | 삭제: phase = ScreenPhase.Finishing; | |
| 221 | 삭제: Progress.Value = 0; | |
| 222 | 삭제: SetStatus(WorkspaceMessages.Error(error.Code), true); | |
| 223 | 삭제: } | |
| 224 | 삭제: catch (Exception) | |
| 225 | 삭제: { | |
| 226 | 삭제: phase = ScreenPhase.Finishing; | |
| 227 | 삭제: Progress.Value = 0; | |
| 228 | 삭제: SetStatus("파일을 처리하지 못했습니다. 파일 상태와 저장 위치를 확인하고 다시 시도하세요.", true); | |
| 229 | 삭제: } | |
| 230 | 삭제: finally | |
| 231 | 삭제: { | |
| 232 | 삭제: // 수명이 끝난 작업의 이벤트와 암호 요청을 결과 반영 이후 거부함. | |
| 233 | 삭제: activeJobId = null; | |
| 234 | 삭제: activeJob = null; | |
| 235 | 삭제: Progress.IsIndeterminate = false; | |
| 236 | 삭제: } | |
| 237 | 삭제: } | |
| 238 | 삭제: | |
| 239 | 삭제: private void ApplyProgress(Guid jobId, WorkspaceProgress value) | |
| 240 | 삭제: { | |
| 241 | 삭제: if (activeJobId != jobId || value.JobId != jobId || value.Sequence <= lastSequence || | |
| 242 | 삭제: phase is ScreenPhase.Idle or ScreenPhase.Selecting or ScreenPhase.Finishing) | |
| 243 | 삭제: { | |
| 244 | 삭제: return; | |
| 245 | 삭제: } | |
| 246 | 삭제: lastSequence = value.Sequence; | |
| 247 | 삭제: if (value.State is JobState.Completed or JobState.Partial or JobState.Cancelled or JobState.Failed) | |
| 248 | 삭제: { | |
| 249 | 삭제: phase = ScreenPhase.Finishing; | |
| 250 | 삭제: Progress.IsIndeterminate = false; | |
| 251 | 삭제: SetStatus("작업 결과와 정리를 확인하고 있습니다."); | |
| 252 | 삭제: UpdateActions(); | |
| 253 | 삭제: return; | |
| 254 | 삭제: } | |
| 255 | 삭제: if (phase == ScreenPhase.Cancelling || activeJob?.IsCancellationRequested == true || value.State == JobState.Cancelling) | |
| 256 | 삭제: { | |
| 257 | 삭제: phase = ScreenPhase.Cancelling; | |
| 258 | 삭제: SetStatus("중지 요청을 처리하고 있습니다."); | |
| 259 | 삭제: Progress.IsIndeterminate = true; | |
| 260 | 삭제: } | |
| 261 | 삭제: else if (passwordWindow is not null || value.State == JobState.WaitingForPassword) | |
| 262 | 삭제: { | |
| 263 | 삭제: phase = ScreenPhase.WaitingForPassword; | |
| 264 | 삭제: SetStatus("암호 입력을 기다리고 있습니다."); | |
| 265 | 삭제: Progress.IsIndeterminate = false; | |
| 266 | 삭제: } | |
| 267 | 삭제: else | |
| 268 | 삭제: { | |
| 269 | 삭제: phase = ScreenPhase.Running; | |
| 270 | 삭제: Progress.IsIndeterminate = value.TotalBytes is null or <= 0; | |
| 271 | 삭제: if (value.TotalBytes > 0) | |
| 272 | 삭제: { | |
| 273 | 삭제: Progress.Value = Math.Clamp(100.0 * value.ProcessedBytes / value.TotalBytes.Value, 0, 100); | |
| 274 | 삭제: } | |
| 275 | 삭제: SetStatus($"처리한 크기: {Math.Max(0, value.ProcessedBytes):N0}바이트"); | |
| 276 | 삭제: } | |
| 277 | 삭제: UpdateActions(); | |
| 278 | 삭제: } | |
| 279 | 삭제: | |
| 280 | 삭제: private void PublishResult(WorkspaceRequest request, WorkspaceResult result) | |
| 281 | 삭제: { | |
| 282 | 삭제: if (request.Action == WorkspaceAction.Extract) | |
| 283 | 삭제: { | |
| 284 | 삭제: var extractionPublished = result.Extraction is not null && ZipExtractionWorkflow.Published(result.Extraction); | |
| 285 | 삭제: Progress.Value = extractionPublished ? 100 : 0; | |
| 286 | 삭제: ResultSummary.Text = "열린 ZIP 목록과 이름/위치는 유지됩니다. 다른 새 위치는 압축 풀기 검증에서 선택하세요."; | |
| 287 | 삭제: SetStatus(result.Extraction is not null ? ZipExtractionWorkflow.Describe(result.Extraction) | |
| 288 | 삭제: : "새 결과 폴더의 게시를 확인하지 못했습니다.", !extractionPublished); | |
| 289 | 삭제: return; | |
| 290 | 삭제: } | |
| 291 | 삭제: if (request.Action == WorkspaceAction.Create) | |
| 292 | 삭제: { | |
| 293 | 삭제: Progress.Value = result.Creation?.Publication?.Published == true ? 100 : 0; | |
| 294 | 삭제: ResultSummary.Text = "생성에 사용한 선택은 유지됩니다. 다른 저장 이름은 새로 압축하기에서 선택하세요."; | |
| 295 | 삭제: SetStatus(result.Creation is not null ? ZipCreationWorkflow.Describe(result.Creation) | |
| 296 | 삭제: : "새 파일의 게시를 확인하지 못했습니다.", result.Creation?.Publication?.Published != true); | |
| 297 | 삭제: return; | |
| 298 | 삭제: } | |
| 299 | 삭제: var succeeded = result.Outcome == WorkspaceOutcome.Completed && result.Error == ArchiveError.None; | |
| 300 | 삭제: Progress.Value = succeeded ? 100 : 0; | |
| 301 | 삭제: if (request.Action == WorkspaceAction.List && succeeded) | |
| 302 | 삭제: { | |
| 303 | 삭제: archivePath = request.Sources[0]; | |
| 304 | 삭제: ArchiveTitle.Text = Path.GetFileName(archivePath); | |
| 305 | 삭제: Files.ItemsSource = result.Entries; | |
| 306 | 삭제: EmptyState.Text = "이 압축파일에는 표시할 항목이 없습니다."; | |
| 307 | 삭제: EmptyState.Visibility = result.Entries.Count == 0 ? Visibility.Visible : Visibility.Collapsed; | |
| 308 | 삭제: } | |
| 309 | 삭제: var published = result.Entries.Count(entry => entry.Outcome == EntryOutcome.Extracted); | |
| 310 | 삭제: var failed = result.Entries.Count(entry => entry.Outcome == EntryOutcome.Failed || entry.Error != ArchiveError.None); | |
| 311 | 삭제: ResultSummary.Text = $"결과 항목 {result.Entries.Count:N0}개, 게시 확인 {published:N0}개, 실패 {failed:N0}개"; | |
| 312 | 삭제: if (succeeded) | |
| 313 | 삭제: { | |
| 314 | 삭제: SetStatus(request.Action == WorkspaceAction.List ? "파일 목록을 읽었습니다. 내용 검증은 별도입니다." : "ZIP 생성 작업이 완료되었습니다."); | |
| 315 | 삭제: } | |
| 316 | 삭제: else if (result.Outcome == WorkspaceOutcome.Cancelled && result.Error is ArchiveError.None or ArchiveError.Cancelled) | |
| 317 | 삭제: { | |
| 318 | 삭제: SetStatus("작업이 중지되었습니다. 결과 파일 상태를 확인하세요."); | |
| 319 | 삭제: } | |
| 320 | 삭제: else if (result.Outcome == WorkspaceOutcome.Partial) | |
| 321 | 삭제: { | |
| 322 | 삭제: SetStatus("일부 항목만 처리했습니다. 결과와 검증 상태를 확인하세요.", true); | |
| 323 | 삭제: } | |
| 324 | 삭제: else | |
| 325 | 삭제: { | |
| 326 | 삭제: SetStatus(WorkspaceMessages.Error(result.Error), true); | |
| 327 | 삭제: } | |
| 328 | 삭제: } | |
| 329 | 삭제: | |
| 330 | 삭제: private Task<SecureString?> RequestPasswordAsync(PasswordChallenge challenge, CancellationToken cancellationToken) | |
| 331 | 삭제: { | |
| 332 | 삭제: return Dispatcher.InvokeAsync<SecureString?>(() => | |
| 333 | 삭제: { | |
| 334 | 삭제: cancellationToken.ThrowIfCancellationRequested(); | |
| 335 | 삭제: if (activeJobId != challenge.JobId || challenge.RequestId == Guid.Empty || | |
| 336 | 삭제: phase is ScreenPhase.Finishing or ScreenPhase.Cancelling || passwordWindow is not null || | |
| 337 | 삭제: !passwordRequests.Add(challenge.RequestId)) | |
| 338 | 삭제: { | |
| 339 | 삭제: throw new ArchiveException(ArchiveError.InvalidPasswordResponse); | |
| 340 | 삭제: } | |
| 341 | 삭제: | |
| 342 | 삭제: phase = ScreenPhase.WaitingForPassword; | |
| 343 | 삭제: SetStatus(challenge.Attempt > 1 ? "암호를 다시 확인해 입력하세요." : "암호 입력을 기다리고 있습니다."); | |
| 344 | 삭제: Progress.IsIndeterminate = false; | |
| 345 | 삭제: var dialog = new PasswordWindow { Owner = this }; | |
| 346 | 삭제: passwordWindow = dialog; | |
| 347 | 삭제: UpdateActions(); | |
| 348 | 삭제: using var registration = cancellationToken.Register(() => | |
| 349 | 삭제: Dispatcher.BeginInvoke(new Action(() => | |
| 350 | 삭제: { | |
| 351 | 삭제: if (dialog.IsVisible) { dialog.Close(); } | |
| 352 | 삭제: }))); | |
| 353 | 삭제: try | |
| 354 | 삭제: { | |
| 355 | 삭제: cancellationToken.ThrowIfCancellationRequested(); | |
| 356 | 삭제: if (dialog.ShowDialog() == true && !cancellationToken.IsCancellationRequested && activeJobId == challenge.JobId) | |
| 357 | 삭제: { | |
| 358 | 삭제: return dialog.TakePassword(); | |
| 359 | 삭제: } | |
| 360 | 삭제: RequestStop(); | |
| 361 | 삭제: return null; | |
| 362 | 삭제: } | |
| 363 | 삭제: finally | |
| 364 | 삭제: { | |
| 365 | 삭제: dialog.DiscardPassword(); | |
| 366 | 삭제: passwordWindow = null; | |
| 367 | 삭제: if (phase != ScreenPhase.Finishing) | |
| 368 | 삭제: { | |
| 369 | 삭제: phase = activeJob?.IsCancellationRequested == true ? ScreenPhase.Cancelling : ScreenPhase.Running; | |
| 370 | 삭제: SetStatus(phase == ScreenPhase.Cancelling ? "중지 요청을 처리하고 있습니다." : "작업을 계속하고 있습니다."); | |
| 371 | 삭제: Progress.IsIndeterminate = true; | |
| 372 | 삭제: } | |
| 373 | 삭제: UpdateActions(); | |
| 374 | 삭제: } | |
| 375 | 삭제: }).Task; | |
| 376 | 삭제: } | |
| 377 | 삭제: | |
| 378 | 삭제: private void StopJob(object sender, RoutedEventArgs e) => RequestStop(); | |
| 379 | 삭제: | |
| 380 | 삭제: private void RequestStop() | |
| 381 | 삭제: { | |
| 382 | 삭제: if (activeJob is null || phase == ScreenPhase.Finishing) { return; } | |
| 383 | 삭제: phase = ScreenPhase.Cancelling; | |
| 384 | 삭제: try { activeJob.Cancel(); } | |
| 385 | 삭제: catch (AggregateException) | |
| 386 | 삭제: { | |
| 387 | 삭제: // 취소 관찰자 실패가 있어도 실제 작업 종료를 기다림. | |
| 388 | 삭제: } | |
| 389 | 삭제: SetStatus("중지 요청을 처리하고 있습니다."); | |
| 390 | 삭제: UpdateActions(); | |
| 391 | 삭제: } | |
| 392 | 삭제: | |
| 393 | 삭제: private void UpdateActions() | |
| 394 | 삭제: { | |
| 395 | 삭제: var ready = phase == ScreenPhase.Idle; | |
| 396 | 삭제: OpenButton.IsEnabled = ready && CanExecute(WorkspaceAction.List); | |
| 397 | 삭제: CreateButton.IsEnabled = ready && CanExecute(WorkspaceAction.Create); | |
| 398 | 삭제: CreateButton.Content = ZipCreationWorkflow.ValidationEnabled ? "ZIP 생성 검증" : "새로 압축하기"; | |
| 399 | 삭제: CreateButton.ToolTip = ZipCreationWorkflow.ScopeMessage; | |
| 400 | 삭제: RetryCreateButton.IsEnabled = ready && CanExecute(WorkspaceAction.Create) && | |
| 401 | 삭제: creationSources.Length > 0 && creationDestination is not null; | |
| 402 | 삭제: ExtractButton.IsEnabled = ready && archivePath is not null && CanExecute(WorkspaceAction.Extract); | |
| 403 | 삭제: ExtractButton.Content = ZipExtractionWorkflow.ValidationEnabled ? "압축 풀기 검증" : "압축 풀기"; | |
| 404 | 삭제: ExtractButton.ToolTip = ZipExtractionWorkflow.ScopeMessage; | |
| 405 | 삭제: ExtractionName.IsEnabled = ready && CanExecute(WorkspaceAction.Extract); | |
| 406 | 삭제: StopButton.IsEnabled = activeJob is not null && | |
| 407 | 삭제: phase is ScreenPhase.Running or ScreenPhase.WaitingForPassword; | |
| 408 | 삭제: } | |
| 409 | 삭제: | |
| 410 | 삭제: private void SetStatus(string message, bool error = false) | |
| 411 | 삭제: { | |
| 412 | 삭제: Status.Text = message; | |
| 413 | 삭제: Status.Foreground = error ? new SolidColorBrush(Color.FromRgb(164, 38, 44)) : SystemColors.ControlTextBrush; | |
| 414 | 삭제: } | |
| 415 | 삭제: | |
| 416 | 삭제: private void ShowInstallation(object sender, RoutedEventArgs e) | |
| 417 | 삭제: { | |
| 418 | 삭제: MessageBox.Show(this, | |
| 419 | 삭제: "설치 파일은 준비 중입니다.\n\n예정 흐름: 설치 파일 더블클릭 → 설치 → 완료\n\n기본 앱은 설치 후 Windows 설정에서 직접 선택합니다. 현재 화면은 설정을 변경하지 않습니다.", | |
| 420 | 삭제: "설치와 기본 앱 설정", MessageBoxButton.OK, MessageBoxImage.Information); | |
| 421 | 삭제: } | |
| 422 | 삭제: | |
| 423 | 삭제: private void OnClosing(object? sender, CancelEventArgs e) | |
| 424 | 삭제: { | |
| 425 | 삭제: if (phase != ScreenPhase.Idle) | |
| 426 | 삭제: { | |
| 427 | 삭제: e.Cancel = true; | |
| 428 | 삭제: RequestStop(); | |
| 429 | 삭제: SetStatus("파일 선택이나 작업 정리가 끝난 뒤 창을 닫아주세요."); | |
| 430 | 삭제: } | |
| 431 | 삭제: } | |
| 432 | 삭제: } |
| @@ -1,17 +0,0 @@ | ||
| 1 | 삭제: <Window x:Class="Zipelo.Desktop.PasswordWindow" | |
| 2 | 삭제: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| 3 | 삭제: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| 4 | 삭제: Title="암호 입력" SizeToContent="WidthAndHeight" ResizeMode="NoResize" | |
| 5 | 삭제: WindowStartupLocation="CenterOwner" MinWidth="400"> | |
| 6 | 삭제: <StackPanel Margin="28" MaxWidth="460"> | |
| 7 | 삭제: <TextBlock Text="이 파일의 암호를 입력하세요." FontSize="20" FontWeight="SemiBold" /> | |
| 8 | 삭제: <Label Content="암호" Target="{Binding ElementName=Secret}" Margin="0,16,0,0" /> | |
| 9 | 삭제: <PasswordBox x:Name="Secret" MinHeight="44" Padding="8" MaxLength="1024" | |
| 10 | 삭제: AutomationProperties.Name="압축파일 암호" /> | |
| 11 | 삭제: <TextBlock Text="암호를 저장하지 않습니다." Margin="0,12,0,20" /> | |
| 12 | 삭제: <WrapPanel> | |
| 13 | 삭제: <Button Content="확인" IsDefault="True" Click="AcceptPassword" /> | |
| 14 | 삭제: <Button Content="취소" IsCancel="True" /> | |
| 15 | 삭제: </WrapPanel> | |
| 16 | 삭제: </StackPanel> | |
| 17 | 삭제: </Window> |
| @@ -1,38 +0,0 @@ | ||
| 1 | 삭제: using System.Security; | |
| 2 | 삭제: using System.Windows; | |
| 3 | 삭제: | |
| 4 | 삭제: namespace Zipelo.Desktop; | |
| 5 | 삭제: | |
| 6 | 삭제: public partial class PasswordWindow : Window | |
| 7 | 삭제: { | |
| 8 | 삭제: public SecureString? SubmittedPassword { get; private set; } | |
| 9 | 삭제: | |
| 10 | 삭제: public PasswordWindow() | |
| 11 | 삭제: { | |
| 12 | 삭제: InitializeComponent(); | |
| 13 | 삭제: Loaded += (_, _) => Secret.Focus(); | |
| 14 | 삭제: Closed += (_, _) => Secret.Clear(); | |
| 15 | 삭제: } | |
| 16 | 삭제: | |
| 17 | 삭제: public SecureString? TakePassword() | |
| 18 | 삭제: { | |
| 19 | 삭제: var password = SubmittedPassword; | |
| 20 | 삭제: SubmittedPassword = null; | |
| 21 | 삭제: return password; | |
| 22 | 삭제: } | |
| 23 | 삭제: | |
| 24 | 삭제: public void DiscardPassword() | |
| 25 | 삭제: { | |
| 26 | 삭제: SubmittedPassword?.Dispose(); | |
| 27 | 삭제: SubmittedPassword = null; | |
| 28 | 삭제: Secret.Clear(); | |
| 29 | 삭제: } | |
| 30 | 삭제: | |
| 31 | 삭제: private void AcceptPassword(object sender, RoutedEventArgs e) | |
| 32 | 삭제: { | |
| 33 | 삭제: SubmittedPassword = Secret.SecurePassword; | |
| 34 | 삭제: SubmittedPassword.MakeReadOnly(); | |
| 35 | 삭제: Secret.Clear(); | |
| 36 | 삭제: DialogResult = true; | |
| 37 | 삭제: } | |
| 38 | 삭제: } |
| @@ -1,9 +0,0 @@ | ||
| 1 | 삭제: <Project> | |
| 2 | 삭제: <PropertyGroup> | |
| 3 | 삭제: <Configuration>Release</Configuration> | |
| 4 | 삭제: <RuntimeIdentifier>win-x64</RuntimeIdentifier> | |
| 5 | 삭제: <SelfContained>true</SelfContained> | |
| 6 | 삭제: <PublishSingleFile>false</PublishSingleFile> | |
| 7 | 삭제: <PublishTrimmed>false</PublishTrimmed> | |
| 8 | 삭제: </PropertyGroup> | |
| 9 | 삭제: </Project> |
| @@ -1,67 +0,0 @@ | ||
| 1 | 삭제: <Project> | |
| 2 | 삭제: <PropertyGroup> | |
| 3 | 삭제: <!-- 명시적으로 전달하는 게시 속성을 제거 목록에 중복하지 않음. --> | |
| 4 | 삭제: <_ZipeloWorkerPublishRemoveProperties>PublishProfile;PublishProfileFullPath;PublishUrl;OutputPath;OutDir;BaseOutputPath;BaseIntermediateOutputPath;IntermediateOutputPath;TargetDir;NoBuild;PublishSelfContained</_ZipeloWorkerPublishRemoveProperties> | |
| 5 | 삭제: <_ZipeloWorkerProject>$(MSBuildThisFileDirectory)../Zipelo.Worker/Zipelo.Worker.csproj</_ZipeloWorkerProject> | |
| 6 | 삭제: </PropertyGroup> | |
| 7 | 삭제: | |
| 8 | 삭제: <Target Name="PrepareZipeloWorkerDeployment"> | |
| 9 | 삭제: <PropertyGroup> | |
| 10 | 삭제: <_ZipeloWorkerSelfContained Condition="'$(SelfContained)' == ''">false</_ZipeloWorkerSelfContained> | |
| 11 | 삭제: <_ZipeloWorkerSelfContained Condition="'$(SelfContained)' != ''">$(SelfContained)</_ZipeloWorkerSelfContained> | |
| 12 | 삭제: </PropertyGroup> | |
| 13 | 삭제: </Target> | |
| 14 | 삭제: | |
| 15 | 삭제: <!-- 개발 빌드의 작업자 출력을 앱 기준 고정 하위 폴더에 배치함. --> | |
| 16 | 삭제: <Target Name="StageZipeloWorkerForBuild" AfterTargets="Build" DependsOnTargets="PrepareZipeloWorkerDeployment" | |
| 17 | 삭제: Condition="'$(DesignTimeBuild)' != 'true' And ('$(OS)' == 'Windows_NT' Or '$(RuntimeIdentifier)' == 'win-x64')"> | |
| 18 | 삭제: <MSBuild Projects="$(_ZipeloWorkerProject)" Targets="GetTargetPath" | |
| 19 | 삭제: RemoveProperties="TargetFramework;PublishProfile;PublishProfileFullPath;PublishDir;OutputPath;OutDir;BaseOutputPath;BaseIntermediateOutputPath;IntermediateOutputPath;TargetDir" | |
| 20 | 삭제: Properties="Configuration=$(Configuration);TargetFramework=net10.0;RuntimeIdentifier=$(RuntimeIdentifier);SelfContained=$(_ZipeloWorkerSelfContained);UseAppHost=true"> | |
| 21 | 삭제: <Output TaskParameter="TargetOutputs" ItemName="_ZipeloWorkerTargetPath" /> | |
| 22 | 삭제: </MSBuild> | |
| 23 | 삭제: <Error Condition="'@(_ZipeloWorkerTargetPath)' == ''" Text="작업자 출력 위치를 확인하지 못했습니다." /> | |
| 24 | 삭제: <PropertyGroup> | |
| 25 | 삭제: <_ZipeloWorkerBuildDirectory>@(_ZipeloWorkerTargetPath->'%(RootDir)%(Directory)')</_ZipeloWorkerBuildDirectory> | |
| 26 | 삭제: </PropertyGroup> | |
| 27 | 삭제: <ItemGroup> | |
| 28 | 삭제: <_ZipeloWorkerBuildFile Include="$(_ZipeloWorkerBuildDirectory)**/*" | |
| 29 | 삭제: Exclude="$(_ZipeloWorkerBuildDirectory)publish/**/*" /> | |
| 30 | 삭제: </ItemGroup> | |
| 31 | 삭제: <Error Condition="!Exists('$(_ZipeloWorkerBuildDirectory)Zipelo.Worker.exe') Or !Exists('$(_ZipeloWorkerBuildDirectory)Zipelo.Worker.dll') Or !Exists('$(_ZipeloWorkerBuildDirectory)Zipelo.Worker.runtimeconfig.json') Or !Exists('$(_ZipeloWorkerBuildDirectory)Zipelo.Worker.deps.json') Or !Exists('$(_ZipeloWorkerBuildDirectory)Zipelo.Core.dll') Or !Exists('$(_ZipeloWorkerBuildDirectory)Zipelo.Runtime.dll')" | |
| 32 | 삭제: Text="작업자 필수 빌드 파일이 누락되었습니다. Desktop과 작업자를 같은 구성으로 빌드하세요." /> | |
| 33 | 삭제: <Copy SourceFiles="@(_ZipeloWorkerBuildFile)" | |
| 34 | 삭제: DestinationFiles="@(_ZipeloWorkerBuildFile->'$(TargetDir)worker/%(RecursiveDir)%(Filename)%(Extension)')" | |
| 35 | 삭제: SkipUnchangedFiles="true" /> | |
| 36 | 삭제: </Target> | |
| 37 | 삭제: | |
| 38 | 삭제: <!-- 최종 배치는 UI 게시 위치 아래에 SDK가 같은 RID로 별도 게시하도록 함. --> | |
| 39 | 삭제: <Target Name="PublishZipeloWorker" AfterTargets="Publish" DependsOnTargets="PrepareZipeloWorkerDeployment" | |
| 40 | 삭제: Condition="'$(DesignTimeBuild)' != 'true' And ('$(OS)' == 'Windows_NT' Or '$(RuntimeIdentifier)' == 'win-x64')"> | |
| 41 | 삭제: <Error Condition="'$(PublishDir)' == ''" Text="Windows UI 게시 출력 디렉터리가 비어 있습니다." /> | |
| 42 | 삭제: <PropertyGroup> | |
| 43 | 삭제: <_ZipeloWorkerPublishSelfContained>$(_ZipeloWorkerSelfContained)</_ZipeloWorkerPublishSelfContained> | |
| 44 | 삭제: <_ZipeloWorkerPublishSelfContained Condition="'$(PublishSelfContained)' != ''">$(PublishSelfContained)</_ZipeloWorkerPublishSelfContained> | |
| 45 | 삭제: <_ZipeloWorkerPublishStage>$([System.IO.Path]::GetFullPath('$(IntermediateOutputPath)', '$(MSBuildProjectDirectory)'))/zipelo-worker-publish/$([System.Guid]::NewGuid())/</_ZipeloWorkerPublishStage> | |
| 46 | 삭제: <_ZipeloWorkerPublishDirectory>$([System.IO.Path]::GetFullPath('$(PublishDir)', '$(MSBuildProjectDirectory)'))/worker/</_ZipeloWorkerPublishDirectory> | |
| 47 | 삭제: </PropertyGroup> | |
| 48 | 삭제: <!-- 이번 게시의 새 SDK 출력만 수집하며 이전 bin/publish를 검색하지 않음. --> | |
| 49 | 삭제: <MakeDir Directories="$(_ZipeloWorkerPublishStage)" /> | |
| 50 | 삭제: <MSBuild Projects="$(_ZipeloWorkerProject)" Targets="Publish" | |
| 51 | 삭제: RemoveProperties="$(_ZipeloWorkerPublishRemoveProperties)" | |
| 52 | 삭제: Properties="Configuration=$(Configuration);TargetFramework=net10.0;RuntimeIdentifier=$(RuntimeIdentifier);SelfContained=$(_ZipeloWorkerPublishSelfContained);UseAppHost=true;PublishSingleFile=false;PublishTrimmed=false;PublishAot=false;PublishDir=$(_ZipeloWorkerPublishStage)" /> | |
| 53 | 삭제: <ItemGroup> | |
| 54 | 삭제: <_ZipeloWorkerPublishRequired Include="$(_ZipeloWorkerPublishStage)Zipelo.Worker.exe;$(_ZipeloWorkerPublishStage)Zipelo.Worker.dll;$(_ZipeloWorkerPublishStage)Zipelo.Worker.deps.json;$(_ZipeloWorkerPublishStage)Zipelo.Worker.runtimeconfig.json;$(_ZipeloWorkerPublishStage)Zipelo.Core.dll;$(_ZipeloWorkerPublishStage)Zipelo.Runtime.dll" /> | |
| 55 | 삭제: <_ZipeloWorkerPublishRequired Include="$(_ZipeloWorkerPublishStage)System.Private.CoreLib.dll;$(_ZipeloWorkerPublishStage)coreclr.dll;$(_ZipeloWorkerPublishStage)clrjit.dll;$(_ZipeloWorkerPublishStage)hostfxr.dll;$(_ZipeloWorkerPublishStage)hostpolicy.dll" | |
| 56 | 삭제: Condition="'$(_ZipeloWorkerPublishSelfContained)' == 'true'" /> | |
| 57 | 삭제: </ItemGroup> | |
| 58 | 삭제: <Error Condition="!Exists('%(_ZipeloWorkerPublishRequired.Identity)')" Text="Windows 작업자 필수 게시 파일이 누락되었습니다: %(_ZipeloWorkerPublishRequired.Filename)%(_ZipeloWorkerPublishRequired.Extension)" /> | |
| 59 | 삭제: <ItemGroup> | |
| 60 | 삭제: <_ZipeloWorkerPublishedFile Include="$(_ZipeloWorkerPublishStage)**/*" /> | |
| 61 | 삭제: </ItemGroup> | |
| 62 | 삭제: <Copy SourceFiles="@(_ZipeloWorkerPublishedFile)" | |
| 63 | 삭제: DestinationFiles="@(_ZipeloWorkerPublishedFile->'$(_ZipeloWorkerPublishDirectory)%(RecursiveDir)%(Filename)%(Extension)')" | |
| 64 | 삭제: SkipUnchangedFiles="false" /> | |
| 65 | 삭제: <RemoveDir Directories="$(_ZipeloWorkerPublishStage)" /> | |
| 66 | 삭제: </Target> | |
| 67 | 삭제: </Project> |
| @@ -1,23 +0,0 @@ | ||
| 1 | 삭제: using Zipelo.Core; | |
| 2 | 삭제: | |
| 3 | 삭제: namespace Zipelo.Desktop; | |
| 4 | 삭제: | |
| 5 | 삭제: internal static class WorkspaceMessages | |
| 6 | 삭제: { | |
| 7 | 삭제: public static string Error(ArchiveError code) => code switch | |
| 8 | 삭제: { | |
| 9 | 삭제: ArchiveError.EngineUnavailable => "작업 프로세스를 시작할 수 없습니다. Zipelo 폴더 전체를 확인한 뒤 다시 실행하세요.", | |
| 10 | 삭제: ArchiveError.EngineFailure => "작업 프로세스가 정상 결과를 반환하지 못했습니다. ZIP 파일 상태와 Zipelo 폴더를 확인한 뒤 다시 여세요.", | |
| 11 | 삭제: ArchiveError.UnsupportedOperation => "이 형식 또는 기능은 현재 연결된 엔진에서 지원하지 않습니다.", | |
| 12 | 삭제: ArchiveError.UnsafePath => "안전하게 저장할 수 없는 파일 경로가 포함되어 작업을 중단했습니다.", | |
| 13 | 삭제: ArchiveError.UnsupportedEntry => "현재 처리할 수 없는 파일 항목이 포함되어 있습니다.", | |
| 14 | 삭제: ArchiveError.OutputUnavailable => "저장 또는 정리를 완료하지 못했습니다. 결과 위치를 확인하세요.", | |
| 15 | 삭제: ArchiveError.OutputConflict => "저장할 이름이 기존 파일과 충돌합니다. 다른 이름이나 위치를 선택하세요.", | |
| 16 | 삭제: ArchiveError.BudgetExceeded => "안전한 처리 한도를 초과했습니다. 더 작은 파일로 다시 시도하세요.", | |
| 17 | 삭제: ArchiveError.PasswordAttemptsExceeded => "암호 입력 횟수 한도에 도달했습니다. 암호를 확인한 뒤 다시 여세요.", | |
| 18 | 삭제: ArchiveError.InvalidPasswordResponse => "암호 요청을 연결하지 못했습니다. 파일을 다시 여세요.", | |
| 19 | 삭제: ArchiveError.IntegrityFailure => "일부 데이터가 검증을 통과하지 못했습니다. 정상 파일로 간주하지 마세요.", | |
| 20 | 삭제: ArchiveError.Cancelled => "중지 후 정리를 완료하지 못했습니다. 결과 위치를 확인하세요.", | |
| 21 | 삭제: _ => "작업에 실패했습니다. 파일 상태와 저장 위치를 확인하고 다시 시도하세요." | |
| 22 | 삭제: }; | |
| 23 | 삭제: } |
| @@ -1,94 +0,0 @@ | ||
| 1 | 삭제: using System.Security; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: | |
| 4 | 삭제: namespace Zipelo.Desktop; | |
| 5 | 삭제: | |
| 6 | 삭제: public enum WorkspaceAction | |
| 7 | 삭제: { | |
| 8 | 삭제: List, | |
| 9 | 삭제: Extract, | |
| 10 | 삭제: Create | |
| 11 | 삭제: } | |
| 12 | 삭제: | |
| 13 | 삭제: public enum WorkspaceOutcome | |
| 14 | 삭제: { | |
| 15 | 삭제: Completed, | |
| 16 | 삭제: Partial, | |
| 17 | 삭제: Cancelled, | |
| 18 | 삭제: Failed | |
| 19 | 삭제: } | |
| 20 | 삭제: | |
| 21 | 삭제: public sealed record WorkspaceRequest( | |
| 22 | 삭제: Guid JobId, | |
| 23 | 삭제: WorkspaceAction Action, | |
| 24 | 삭제: IReadOnlyList<string> Sources, | |
| 25 | 삭제: string? Destination = null) | |
| 26 | 삭제: { | |
| 27 | 삭제: public string Format { get; init; } = "zip"; | |
| 28 | 삭제: } | |
| 29 | 삭제: | |
| 30 | 삭제: public sealed record FileRow(string Name, string Size, string Verification) | |
| 31 | 삭제: { | |
| 32 | 삭제: public string EntryId { get; init; } = ""; | |
| 33 | 삭제: public EntryKind Kind { get; init; } | |
| 34 | 삭제: public EntryOutcome Outcome { get; init; } | |
| 35 | 삭제: public ArchiveError Error { get; init; } | |
| 36 | 삭제: } | |
| 37 | 삭제: | |
| 38 | 삭제: public sealed record WorkspaceProgress(long ProcessedBytes, long? TotalBytes) | |
| 39 | 삭제: { | |
| 40 | 삭제: public Guid JobId { get; init; } | |
| 41 | 삭제: public long Sequence { get; init; } | |
| 42 | 삭제: public JobState State { get; init; } = JobState.Running; | |
| 43 | 삭제: } | |
| 44 | 삭제: | |
| 45 | 삭제: public sealed record PasswordChallenge(Guid JobId, Guid RequestId) | |
| 46 | 삭제: { | |
| 47 | 삭제: public int Attempt { get; init; } = 1; | |
| 48 | 삭제: } | |
| 49 | 삭제: | |
| 50 | 삭제: public sealed record WorkspaceResult( | |
| 51 | 삭제: WorkspaceOutcome Outcome, | |
| 52 | 삭제: IReadOnlyList<FileRow> Entries) | |
| 53 | 삭제: { | |
| 54 | 삭제: public Guid JobId { get; init; } | |
| 55 | 삭제: public ArchiveError Error { get; init; } | |
| 56 | 삭제: public Zipelo.Ui.CreationResult? Creation { get; init; } | |
| 57 | 삭제: public Zipelo.Ui.ExtractionResult? Extraction { get; init; } | |
| 58 | 삭제: } | |
| 59 | 삭제: | |
| 60 | 삭제: // UI 측 연결 경계임. 실제 코어 계약과 연결하는 어댑터는 별도 구현함. | |
| 61 | 삭제: public interface IArchiveWorkspace | |
| 62 | 삭제: { | |
| 63 | 삭제: bool IsAvailable { get; } | |
| 64 | 삭제: | |
| 65 | 삭제: Task<WorkspaceResult> ExecuteAsync( | |
| 66 | 삭제: WorkspaceRequest request, | |
| 67 | 삭제: IProgress<WorkspaceProgress> progress, | |
| 68 | 삭제: Func<PasswordChallenge, CancellationToken, Task<SecureString?>> requestPassword, | |
| 69 | 삭제: CancellationToken cancellationToken); | |
| 70 | 삭제: } | |
| 71 | 삭제: | |
| 72 | 삭제: public sealed class UnavailableWorkspace : IArchiveWorkspace, IWorkspaceCapabilities | |
| 73 | 삭제: { | |
| 74 | 삭제: public bool IsAvailable => false; | |
| 75 | 삭제: public string AvailabilityMessage { get; internal set; } = | |
| 76 | 삭제: "작업 프로세스가 아직 연결되지 않았습니다. 파일을 처리할 수 없습니다."; | |
| 77 | 삭제: public bool CanExecute(WorkspaceAction action, string format) => false; | |
| 78 | 삭제: | |
| 79 | 삭제: public Task<WorkspaceResult> ExecuteAsync( | |
| 80 | 삭제: WorkspaceRequest request, | |
| 81 | 삭제: IProgress<WorkspaceProgress> progress, | |
| 82 | 삭제: Func<PasswordChallenge, CancellationToken, Task<SecureString?>> requestPassword, | |
| 83 | 삭제: CancellationToken cancellationToken) | |
| 84 | 삭제: { | |
| 85 | 삭제: throw new NotSupportedException("압축 엔진이 아직 연결되지 않았습니다."); | |
| 86 | 삭제: } | |
| 87 | 삭제: } | |
| 88 | 삭제: | |
| 89 | 삭제: // 기능 조회는 실제 연결된 호스트가 제공함. 해제 검증 전에는 해제 능력을 게시하지 않음. | |
| 90 | 삭제: public interface IWorkspaceCapabilities | |
| 91 | 삭제: { | |
| 92 | 삭제: bool CanExecute(WorkspaceAction action, string format); | |
| 93 | 삭제: string AvailabilityMessage { get; } | |
| 94 | 삭제: } |
| @@ -1,101 +0,0 @@ | ||
| 1 | 삭제: using System.IO; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: using Zipelo.Runtime; | |
| 4 | 삭제: | |
| 5 | 삭제: namespace Zipelo.Ui; | |
| 6 | 삭제: | |
| 7 | 삭제: public sealed record CreationSource(string Name, Func<CancellationToken, Task<Stream>> OpenRead); | |
| 8 | 삭제: public sealed record CreationResult(JobResult Job, ZipPublicationResult? Publication); | |
| 9 | 삭제: | |
| 10 | 삭제: public static class ZipCreationWorkflow | |
| 11 | 삭제: { | |
| 12 | 삭제: #if ZIPELO_CREATION_VALIDATION | |
| 13 | 삭제: public static bool ValidationEnabled => true; | |
| 14 | 삭제: #else | |
| 15 | 삭제: public static bool ValidationEnabled => false; | |
| 16 | 삭제: #endif | |
| 17 | 삭제: public const string ScopeMessage = "개발 검증용: 파일 최대 1,024개, 합계 16 MiB, 새 ZIP만 저장합니다. 폴더, 암호, 분할은 지원하지 않습니다."; | |
| 18 | 삭제: | |
| 19 | 삭제: public static async Task<CreationResult> RunAsync(ZipWorkerClient client, Guid jobId, | |
| 20 | 삭제: IReadOnlyList<CreationSource> sources, string destination, CancellationToken cancellationToken) | |
| 21 | 삭제: { | |
| 22 | 삭제: if (!ValidationEnabled || !NewZipPublisher.IsSupportedPlatform) | |
| 23 | 삭제: { | |
| 24 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 25 | 삭제: } | |
| 26 | 삭제: if (sources.Count is < 1 or > 1024 || !Path.IsPathFullyQualified(destination)) | |
| 27 | 삭제: { | |
| 28 | 삭제: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 29 | 삭제: } | |
| 30 | 삭제: using var deadline = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); | |
| 31 | 삭제: deadline.CancelAfter(TimeSpan.FromMinutes(2)); | |
| 32 | 삭제: var token = deadline.Token; | |
| 33 | 삭제: var snapshots = new List<MemoryStream>(); | |
| 34 | 삭제: var inputs = new List<ZipCreateInput>(); | |
| 35 | 삭제: var names = new HashSet<string>(OutputPathPolicy.Comparer(OutputPathPolicy.CurrentPolicy)); | |
| 36 | 삭제: long total = 0; | |
| 37 | 삭제: try | |
| 38 | 삭제: { | |
| 39 | 삭제: var buffer = new byte[65536]; | |
| 40 | 삭제: foreach (var source in sources) | |
| 41 | 삭제: { | |
| 42 | 삭제: token.ThrowIfCancellationRequested(); | |
| 43 | 삭제: if (source.Name.Length > 1024 || | |
| 44 | 삭제: OutputPathPolicy.Validate(source.Name, OutputPathPolicy.CurrentPolicy).Count != 1 || | |
| 45 | 삭제: !names.Add(source.Name)) | |
| 46 | 삭제: { | |
| 47 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 48 | 삭제: } | |
| 49 | 삭제: await using var input = await source.OpenRead(token).ConfigureAwait(false); | |
| 50 | 삭제: using var snapshot = new MemoryStream(); | |
| 51 | 삭제: int count; | |
| 52 | 삭제: while ((count = await input.ReadAsync(buffer.AsMemory(), token).ConfigureAwait(false)) != 0) | |
| 53 | 삭제: { | |
| 54 | 삭제: total += count; | |
| 55 | 삭제: if (total > 16L * 1024 * 1024) { throw new ArchiveException(ArchiveError.BudgetExceeded); } | |
| 56 | 삭제: await snapshot.WriteAsync(buffer.AsMemory(0, count), token).ConfigureAwait(false); | |
| 57 | 삭제: } | |
| 58 | 삭제: // Runtime requires read-only inputs; keep writable staging private. | |
| 59 | 삭제: var readOnlySnapshot = new MemoryStream(snapshot.ToArray(), writable: false); | |
| 60 | 삭제: snapshots.Add(readOnlySnapshot); | |
| 61 | 삭제: inputs.Add(new ZipCreateInput(source.Name, readOnlySnapshot)); | |
| 62 | 삭제: } | |
| 63 | 삭제: var limits = new JobLimits(1024, 16L * 1024 * 1024, 16L * 1024 * 1024, | |
| 64 | 삭제: TimeSpan.FromMinutes(2), 3); | |
| 65 | 삭제: var result = await client.CreateAsync(jobId, inputs, limits, new ZipCreationOptions(), token) | |
| 66 | 삭제: .ConfigureAwait(false); | |
| 67 | 삭제: if (result.Job.JobId != jobId) { throw new ArchiveException(ArchiveError.EngineFailure); } | |
| 68 | 삭제: if (result.Job.State != JobState.Completed || result.Job.Error != ArchiveError.None) | |
| 69 | 삭제: { | |
| 70 | 삭제: return new CreationResult(result.Job, null); | |
| 71 | 삭제: } | |
| 72 | 삭제: var publication = await NewZipPublisher.PublishAsync(result, destination, token).ConfigureAwait(false); | |
| 73 | 삭제: return new CreationResult(result.Job, publication); | |
| 74 | 삭제: } | |
| 75 | 삭제: catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested && deadline.IsCancellationRequested) | |
| 76 | 삭제: { | |
| 77 | 삭제: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 78 | 삭제: } | |
| 79 | 삭제: finally | |
| 80 | 삭제: { | |
| 81 | 삭제: foreach (var snapshot in snapshots) { snapshot.Dispose(); } | |
| 82 | 삭제: } | |
| 83 | 삭제: } | |
| 84 | 삭제: | |
| 85 | 삭제: public static string Describe(CreationResult result) | |
| 86 | 삭제: { | |
| 87 | 삭제: if (result.Publication is { Published: true }) { return "새 ZIP 파일을 저장했습니다. 기존 파일은 덮어쓰지 않았습니다."; } | |
| 88 | 삭제: if (result.Publication is { CleanupFailed: true }) | |
| 89 | 삭제: { | |
| 90 | 삭제: return "ZIP 저장에 실패했고 임시 파일 정리도 완료하지 못했습니다. 선택한 저장 폴더를 확인하세요."; | |
| 91 | 삭제: } | |
| 92 | 삭제: var error = result.Publication?.Error ?? result.Job.Error; | |
| 93 | 삭제: return error switch | |
| 94 | 삭제: { | |
| 95 | 삭제: ArchiveError.Cancelled => "생성이 중지되었습니다. 새 ZIP 파일은 게시되지 않았습니다.", | |
| 96 | 삭제: ArchiveError.OutputConflict => "같은 이름의 파일이 있습니다. 기존 파일을 유지했습니다. 새 이름을 선택하세요.", | |
| 97 | 삭제: ArchiveError.BudgetExceeded => "파일 크기나 처리 시간 한도를 초과했습니다. 더 작은 파일로 시도하세요.", | |
| 98 | 삭제: _ => "새 ZIP 파일을 저장하지 못했습니다. 파일과 저장 위치를 확인하고 다시 시도하세요." | |
| 99 | 삭제: }; | |
| 100 | 삭제: } | |
| 101 | 삭제: } |
| @@ -1,112 +0,0 @@ | ||
| 1 | 삭제: using System.IO; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: using Zipelo.Runtime; | |
| 4 | 삭제: | |
| 5 | 삭제: namespace Zipelo.Ui; | |
| 6 | 삭제: | |
| 7 | 삭제: public sealed record ExtractionResult(JobResult Job, ZipPublicationResult? Publication); | |
| 8 | 삭제: | |
| 9 | 삭제: public static class ZipExtractionWorkflow | |
| 10 | 삭제: { | |
| 11 | 삭제: #if ZIPELO_EXTRACTION_VALIDATION | |
| 12 | 삭제: public static bool ValidationEnabled => true; | |
| 13 | 삭제: #else | |
| 14 | 삭제: public static bool ValidationEnabled => false; | |
| 15 | 삭제: #endif | |
| 16 | 삭제: public const string ScopeMessage = "개발 검증용: ZIP 입력/해제 합계 각각 16 MiB, 최대 1,024항목, 2분 한도입니다. 새 폴더만 게시하며 암호/분할/다른 형식은 지원하지 않습니다."; | |
| 17 | 삭제: | |
| 18 | 삭제: public static bool Published(ExtractionResult result) => | |
| 19 | 삭제: result.Job.State == JobState.Completed && result.Job.Error == ArchiveError.None && | |
| 20 | 삭제: result.Publication is { Published: true, Error: ArchiveError.None, CleanupFailed: false }; | |
| 21 | 삭제: | |
| 22 | 삭제: public static void ValidateFolderName(string name) | |
| 23 | 삭제: { | |
| 24 | 삭제: if (string.IsNullOrWhiteSpace(name) || name.Length > 128 || | |
| 25 | 삭제: OutputPathPolicy.Validate(name, OutputPathPolicy.CurrentPolicy).Count != 1) | |
| 26 | 삭제: { | |
| 27 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 28 | 삭제: } | |
| 29 | 삭제: } | |
| 30 | 삭제: | |
| 31 | 삭제: public static async Task<ExtractionResult> RunAsync(ZipWorkerClient client, Guid jobId, | |
| 32 | 삭제: Func<CancellationToken, Task<Stream>> openRead, string destination, CancellationToken cancellationToken) | |
| 33 | 삭제: { | |
| 34 | 삭제: if (!ValidationEnabled || !NewFolderPublisher.IsSupportedPlatform || !client.SupportsMemoryExtraction) | |
| 35 | 삭제: { | |
| 36 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 37 | 삭제: } | |
| 38 | 삭제: if (!Path.IsPathFullyQualified(destination)) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 39 | 삭제: ValidateFolderName(Path.GetFileName(destination)); | |
| 40 | 삭제: using var deadline = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); | |
| 41 | 삭제: deadline.CancelAfter(TimeSpan.FromMinutes(2)); | |
| 42 | 삭제: var token = deadline.Token; | |
| 43 | 삭제: try | |
| 44 | 삭제: { | |
| 45 | 삭제: token.ThrowIfCancellationRequested(); | |
| 46 | 삭제: using var staging = new MemoryStream(); | |
| 47 | 삭제: await using (var input = await openRead(token).ConfigureAwait(false)) | |
| 48 | 삭제: { | |
| 49 | 삭제: if (!input.CanRead || input.CanWrite) { throw new ArchiveException(ArchiveError.UnsupportedOperation); } | |
| 50 | 삭제: var buffer = new byte[65536]; | |
| 51 | 삭제: int count; | |
| 52 | 삭제: while ((count = await input.ReadAsync(buffer.AsMemory(), token).ConfigureAwait(false)) != 0) | |
| 53 | 삭제: { | |
| 54 | 삭제: if (staging.Length + count > 16L * 1024 * 1024) | |
| 55 | 삭제: { | |
| 56 | 삭제: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 57 | 삭제: } | |
| 58 | 삭제: await staging.WriteAsync(buffer.AsMemory(0, count), token).ConfigureAwait(false); | |
| 59 | 삭제: } | |
| 60 | 삭제: } | |
| 61 | 삭제: // 동일한 제한 스냅샷을 읽기 전용으로 작업자에 전달함. | |
| 62 | 삭제: using var snapshot = new MemoryStream(staging.ToArray(), writable: false); | |
| 63 | 삭제: var limits = new JobLimits(1024, 16L * 1024 * 1024, 16L * 1024 * 1024, | |
| 64 | 삭제: TimeSpan.FromMinutes(2), 3); | |
| 65 | 삭제: var result = await client.ExtractAsync(jobId, snapshot, limits, token).ConfigureAwait(false); | |
| 66 | 삭제: if (result.Job.JobId != jobId) { throw new ArchiveException(ArchiveError.EngineFailure); } | |
| 67 | 삭제: if (result.Job.Error == ArchiveError.Cancelled && !cancellationToken.IsCancellationRequested && | |
| 68 | 삭제: deadline.IsCancellationRequested) | |
| 69 | 삭제: { | |
| 70 | 삭제: result = result with { Job = result.Job with { State = JobState.Failed, Error = ArchiveError.BudgetExceeded } }; | |
| 71 | 삭제: } | |
| 72 | 삭제: if (result.Job.State != JobState.Completed || result.Job.Error != ArchiveError.None) | |
| 73 | 삭제: { | |
| 74 | 삭제: return new ExtractionResult(result.Job, null); | |
| 75 | 삭제: } | |
| 76 | 삭제: var publication = await NewFolderPublisher.PublishAsync(result, destination, token).ConfigureAwait(false); | |
| 77 | 삭제: if (!publication.Published && publication.Error == ArchiveError.Cancelled && | |
| 78 | 삭제: !cancellationToken.IsCancellationRequested && deadline.IsCancellationRequested) | |
| 79 | 삭제: { | |
| 80 | 삭제: publication = publication with { Error = ArchiveError.BudgetExceeded }; | |
| 81 | 삭제: } | |
| 82 | 삭제: // 게시 이후에는 늦은 취소보다 실제 게시 결과를 우선함. | |
| 83 | 삭제: return new ExtractionResult(result.Job, publication); | |
| 84 | 삭제: } | |
| 85 | 삭제: catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested && deadline.IsCancellationRequested) | |
| 86 | 삭제: { | |
| 87 | 삭제: throw new ArchiveException(ArchiveError.BudgetExceeded); | |
| 88 | 삭제: } | |
| 89 | 삭제: } | |
| 90 | 삭제: | |
| 91 | 삭제: public static string Describe(ExtractionResult result) | |
| 92 | 삭제: { | |
| 93 | 삭제: if (result.Publication is { CleanupFailed: true }) | |
| 94 | 삭제: { | |
| 95 | 삭제: return "압축 풀기 또는 임시 결과 정리가 완료되지 않았습니다. 선택한 부모 폴더의 임시 항목을 확인하세요. 원본과 기존 대상은 덮어쓰지 않았습니다."; | |
| 96 | 삭제: } | |
| 97 | 삭제: if (Published(result)) { return "검증한 내용을 새 결과 폴더에 게시했습니다. 기존 파일/폴더는 덮어쓰지 않았습니다."; } | |
| 98 | 삭제: var error = result.Publication?.Error ?? result.Job.Error; | |
| 99 | 삭제: return error switch | |
| 100 | 삭제: { | |
| 101 | 삭제: ArchiveError.Cancelled => "압축 풀기가 중지되었습니다. 새 결과 폴더는 게시되지 않았습니다.", | |
| 102 | 삭제: ArchiveError.OutputConflict => "같은 이름의 대상이 있거나 ZIP 내부 이름이 충돌합니다. 기존 대상은 유지됩니다. 다른 새 폴더 이름/위치를 선택하거나 ZIP을 확인하세요.", | |
| 103 | 삭제: ArchiveError.OutputUnavailable => "이 위치에 안전하게 게시할 수 없습니다. 권한과 지원 파일시스템을 확인하고 다른 부모 폴더를 선택하세요.", | |
| 104 | 삭제: ArchiveError.UnsafePath => "안전하지 않은 경로나 링크 조건으로 게시하지 않았습니다. ZIP과 새 저장 위치를 확인하세요.", | |
| 105 | 삭제: ArchiveError.UnsupportedEntry => "링크 또는 지원하지 않는 항목이 있어 게시하지 않았습니다.", | |
| 106 | 삭제: ArchiveError.IntegrityFailure => "CRC/길이 등 무결성 검증에 실패해 게시하지 않았습니다. 정상 결과로 사용하지 마세요.", | |
| 107 | 삭제: ArchiveError.BudgetExceeded => "입력/해제 크기 또는 처리 시간 한도를 초과했습니다. 더 작은 ZIP으로 시도하세요.", | |
| 108 | 삭제: ArchiveError.UnsupportedOperation => "이 ZIP의 암호/압축 방식이나 현재 플랫폼은 개발 검증 해제에서 지원하지 않습니다.", | |
| 109 | 삭제: _ => "새 결과 폴더의 안전한 게시를 확인하지 못했습니다. 기존 목록과 선택을 유지했습니다." | |
| 110 | 삭제: }; | |
| 111 | 삭제: } | |
| 112 | 삭제: } |
| @@ -1,71 +0,0 @@ | ||
| 1 | 삭제: using System.IO; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: using Zipelo.Runtime; | |
| 4 | 삭제: | |
| 5 | 삭제: namespace Zipelo.Desktop; | |
| 6 | 삭제: | |
| 7 | 삭제: internal static class ZipWorkerWorkspace | |
| 8 | 삭제: { | |
| 9 | 삭제: public static IArchiveWorkspace? TryCreate(out string unavailableReason) | |
| 10 | 삭제: { | |
| 11 | 삭제: // 사용자 입력이나 압축파일에서 실행 경로를 얻지 않음. | |
| 12 | 삭제: unavailableReason = ""; | |
| 13 | 삭제: var workerDirectory = Path.Combine(AppContext.BaseDirectory, "worker"); | |
| 14 | 삭제: if (!HasRequiredFiles(workerDirectory)) | |
| 15 | 삭제: { | |
| 16 | 삭제: unavailableReason = "작업에 필요한 프로그램 파일이 누락되었습니다. Zipelo 폴더 전체를 복원한 뒤 다시 실행하세요."; | |
| 17 | 삭제: return null; | |
| 18 | 삭제: } | |
| 19 | 삭제: var workerPath = Path.Combine(workerDirectory, "Zipelo.Worker.exe"); | |
| 20 | 삭제: var client = new ZipWorkerClient(workerPath); | |
| 21 | 삭제: if (!client.IsAvailable) | |
| 22 | 삭제: { | |
| 23 | 삭제: unavailableReason = WorkspaceMessages.Error(ArchiveError.EngineUnavailable); | |
| 24 | 삭제: return null; | |
| 25 | 삭제: } | |
| 26 | 삭제: | |
| 27 | 삭제: var capabilities = client.Capabilities.Where(capability => | |
| 28 | 삭제: capability.Format.Equals("zip", StringComparison.OrdinalIgnoreCase) && | |
| 29 | 삭제: capability.Action == ArchiveAction.List).ToArray(); | |
| 30 | 삭제: var listing = new CoreWorkspace(async (request, progress, passwords, token) => | |
| 31 | 삭제: { | |
| 32 | 삭제: if (request.Action != WorkspaceAction.List || request.Sources.Count != 1 || | |
| 33 | 삭제: !request.Format.Equals("zip", StringComparison.OrdinalIgnoreCase) || | |
| 34 | 삭제: Path.GetExtension(request.Sources[0]).Equals(".jar", StringComparison.OrdinalIgnoreCase)) | |
| 35 | 삭제: { | |
| 36 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 37 | 삭제: } | |
| 38 | 삭제: | |
| 39 | 삭제: if (!HasRequiredFiles(workerDirectory)) | |
| 40 | 삭제: { | |
| 41 | 삭제: throw new ArchiveException(ArchiveError.EngineUnavailable); | |
| 42 | 삭제: } | |
| 43 | 삭제: | |
| 44 | 삭제: // 파싱은 작업자에서 수행함. Desktop은 읽기 전용 스트림만 전달함. | |
| 45 | 삭제: await using var input = new FileStream(request.Sources[0], FileMode.Open, FileAccess.Read, | |
| 46 | 삭제: FileShare.Read, 65536, FileOptions.Asynchronous | FileOptions.SequentialScan); | |
| 47 | 삭제: var limits = new JobLimits(1024, 16L * 1024 * 1024, 16L * 1024 * 1024, | |
| 48 | 삭제: TimeSpan.FromMinutes(2), 3); | |
| 49 | 삭제: var result = await client.ListAsync(request.JobId, input, limits, token).ConfigureAwait(false); | |
| 50 | 삭제: // 런타임은 현재 실시간 진행과 암호 요청을 제공하지 않음. 가짜 이벤트를 만들지 않음. | |
| 51 | 삭제: return result.Job; | |
| 52 | 삭제: }, capabilities, | |
| 53 | 삭제: "단일 ZIP 목록을 지원합니다. 일반 사용자용 생성과 압축 풀기는 검증 전입니다."); | |
| 54 | 삭제: return new CreationWorkspace(listing, client, () => HasRequiredFiles(workerDirectory)); | |
| 55 | 삭제: } | |
| 56 | 삭제: | |
| 57 | 삭제: private static bool HasRequiredFiles(string directory) | |
| 58 | 삭제: { | |
| 59 | 삭제: string[] required = | |
| 60 | 삭제: [ | |
| 61 | 삭제: "Zipelo.Worker.exe", | |
| 62 | 삭제: "Zipelo.Worker.dll", | |
| 63 | 삭제: "Zipelo.Worker.runtimeconfig.json", | |
| 64 | 삭제: "Zipelo.Worker.deps.json", | |
| 65 | 삭제: "Zipelo.Core.dll", | |
| 66 | 삭제: "Zipelo.Runtime.dll" | |
| 67 | 삭제: ]; | |
| 68 | 삭제: return required.All(name => File.Exists(Path.Combine(directory, name))); | |
| 69 | 삭제: } | |
| 70 | 삭제: | |
| 71 | 삭제: } |
| @@ -1,28 +0,0 @@ | ||
| 1 | 삭제: <Project Sdk="Microsoft.NET.Sdk"> | |
| 2 | 삭제: <PropertyGroup> | |
| 3 | 삭제: <OutputType>WinExe</OutputType> | |
| 4 | 삭제: <TargetFramework>net10.0-windows</TargetFramework> | |
| 5 | 삭제: <UseWPF>true</UseWPF> | |
| 6 | 삭제: <EnableWindowsTargeting>true</EnableWindowsTargeting> | |
| 7 | 삭제: <Nullable>enable</Nullable> | |
| 8 | 삭제: <ImplicitUsings>enable</ImplicitUsings> | |
| 9 | 삭제: <ApplicationManifest>app.manifest</ApplicationManifest> | |
| 10 | 삭제: <AssemblyName>Zipelo</AssemblyName> | |
| 11 | 삭제: <RootNamespace>Zipelo.Desktop</RootNamespace> | |
| 12 | 삭제: </PropertyGroup> | |
| 13 | 삭제: <PropertyGroup Condition="'$(ZipeloCreationValidation)' == 'true'"> | |
| 14 | 삭제: <DefineConstants>$(DefineConstants);ZIPELO_CREATION_VALIDATION</DefineConstants> | |
| 15 | 삭제: </PropertyGroup> | |
| 16 | 삭제: <PropertyGroup Condition="'$(ZipeloExtractionValidation)' == 'true'"> | |
| 17 | 삭제: <DefineConstants>$(DefineConstants);ZIPELO_EXTRACTION_VALIDATION</DefineConstants> | |
| 18 | 삭제: </PropertyGroup> | |
| 19 | 삭제: <ItemGroup> | |
| 20 | 삭제: <ProjectReference Include="../Zipelo.Core/Zipelo.Core.csproj" /> | |
| 21 | 삭제: <ProjectReference Include="../Zipelo.Runtime/Zipelo.Runtime.csproj" /> | |
| 22 | 삭제: <ProjectReference Include="../Zipelo.Worker/Zipelo.Worker.csproj" | |
| 23 | 삭제: ReferenceOutputAssembly="false" Private="false" | |
| 24 | 삭제: GlobalPropertiesToRemove="PublishProfile;PublishProfileFullPath;PublishDir;OutputPath;OutDir;BaseOutputPath;BaseIntermediateOutputPath;IntermediateOutputPath;TargetDir" | |
| 25 | 삭제: AdditionalProperties="UseAppHost=true" /> | |
| 26 | 삭제: </ItemGroup> | |
| 27 | 삭제: <Import Project="WorkerDeployment.targets" /> | |
| 28 | 삭제: </Project> |
| @@ -1,16 +0,0 @@ | ||
| 1 | 삭제: <?xml version="1.0" encoding="utf-8"?> | |
| 2 | 삭제: <assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | |
| 3 | 삭제: <assemblyIdentity version="0.1.0.0" name="Zipelo.Desktop" /> | |
| 4 | 삭제: <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> | |
| 5 | 삭제: <security> | |
| 6 | 삭제: <requestedPrivileges> | |
| 7 | 삭제: <requestedExecutionLevel level="asInvoker" uiAccess="false" /> | |
| 8 | 삭제: </requestedPrivileges> | |
| 9 | 삭제: </security> | |
| 10 | 삭제: </trustInfo> | |
| 11 | 삭제: <application xmlns="urn:schemas-microsoft-com:asm.v3"> | |
| 12 | 삭제: <windowsSettings> | |
| 13 | 삭제: <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness> | |
| 14 | 삭제: </windowsSettings> | |
| 15 | 삭제: </application> | |
| 16 | 삭제: </assembly> |
| @@ -1,301 +0,0 @@ | ||
| 1 | 삭제: using System.Globalization; | |
| 2 | 삭제: using System.Runtime.InteropServices; | |
| 3 | 삭제: using System.Text; | |
| 4 | 삭제: using Microsoft.Win32.SafeHandles; | |
| 5 | 삭제: using Zipelo.Core; | |
| 6 | 삭제: | |
| 7 | 삭제: namespace Zipelo.Runtime; | |
| 8 | 삭제: | |
| 9 | 삭제: internal sealed class LinuxFolderPublication : PendingFolderPublication | |
| 10 | 삭제: { | |
| 11 | 삭제: private readonly SafeFileHandle parent; | |
| 12 | 삭제: private readonly string parentPath; | |
| 13 | 삭제: private ulong parentMountId; | |
| 14 | 삭제: private readonly uint user = GetEffectiveUser(); | |
| 15 | 삭제: private string parentIdentity = ""; | |
| 16 | 삭제: private bool unboundCreation; | |
| 17 | 삭제: internal int? NativeError { get; private set; } | |
| 18 | 삭제: internal int? CleanupError { get; private set; } | |
| 19 | 삭제: | |
| 20 | 삭제: internal LinuxFolderPublication(string path) | |
| 21 | 삭제: { | |
| 22 | 삭제: parentPath = path; | |
| 23 | 삭제: parent = Open(-100, path, 0x90000, 0, 0x04); | |
| 24 | 삭제: } | |
| 25 | 삭제: | |
| 26 | 삭제: internal override void Initialize() | |
| 27 | 삭제: { | |
| 28 | 삭제: RequireFileSystem(); | |
| 29 | 삭제: parentIdentity = Inspect(parent, true); | |
| 30 | 삭제: AddRoot(Create(parent, TemporaryName, true)); | |
| 31 | 삭제: } | |
| 32 | 삭제: | |
| 33 | 삭제: private void RequireFileSystem() | |
| 34 | 삭제: { | |
| 35 | 삭제: var magic = FileSystemMagic(parent); | |
| 36 | 삭제: var expectedType = magic switch | |
| 37 | 삭제: { | |
| 38 | 삭제: 0xEF53 => "ext4", | |
| 39 | 삭제: 0x58465342 => "xfs", | |
| 40 | 삭제: _ => throw new ArchiveException(ArchiveError.OutputUnavailable) | |
| 41 | 삭제: }; | |
| 42 | 삭제: var before = MountStatus(parent); | |
| 43 | 삭제: var mountId = BitConverter.ToUInt64(before, 144); | |
| 44 | 삭제: var device = FormattableString.Invariant($"{BitConverter.ToUInt32(before, 136)}:{BitConverter.ToUInt32(before, 140)}"); | |
| 45 | 삭제: | |
| 46 | 삭제: // procfs 핸들을 고정하고 하위 bind mount와 링크를 통한 정보 대체를 거부함. | |
| 47 | 삭제: using var proc = Open(-100, "/proc", 0x90000, 0, 0x04); | |
| 48 | 삭제: if (FileSystemMagic(proc) != 0x9FA0) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 49 | 삭제: var name = FormattableString.Invariant($"{GetProcessId()}/task/{GetThreadId()}/mountinfo"); | |
| 50 | 삭제: using var info = Open(proc.DangerousGetHandle().ToInt32(), name, 0x80000, 0, 0x0F); | |
| 51 | 삭제: if (FileSystemMagic(info) != 0x9FA0) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 52 | 삭제: using var stream = new FileStream(info, FileAccess.Read); | |
| 53 | 삭제: using var bytes = new MemoryStream(); | |
| 54 | 삭제: var buffer = new byte[8192]; | |
| 55 | 삭제: int count; | |
| 56 | 삭제: while ((count = stream.Read(buffer, 0, buffer.Length)) != 0) | |
| 57 | 삭제: { | |
| 58 | 삭제: if (bytes.Length + count > 4 * 1024 * 1024) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 59 | 삭제: bytes.Write(buffer, 0, count); | |
| 60 | 삭제: } | |
| 61 | 삭제: var content = new UTF8Encoding(false, true).GetString(bytes.ToArray()); | |
| 62 | 삭제: var matches = 0; | |
| 63 | 삭제: foreach (var line in content.Split('\n', StringSplitOptions.RemoveEmptyEntries)) | |
| 64 | 삭제: { | |
| 65 | 삭제: var fields = line.Split(' ', StringSplitOptions.RemoveEmptyEntries); | |
| 66 | 삭제: if (!ulong.TryParse(fields[0], NumberStyles.None, CultureInfo.InvariantCulture, out var id)) | |
| 67 | 삭제: { | |
| 68 | 삭제: throw new ArchiveException(ArchiveError.OutputUnavailable); | |
| 69 | 삭제: } | |
| 70 | 삭제: if (id != mountId) { continue; } | |
| 71 | 삭제: var separator = Array.IndexOf(fields, "-"); | |
| 72 | 삭제: if (++matches != 1 || separator < 6 || fields.Length != separator + 4 || | |
| 73 | 삭제: fields[2] != device || fields[separator + 1] != expectedType) | |
| 74 | 삭제: { | |
| 75 | 삭제: throw new ArchiveException(ArchiveError.OutputUnavailable); | |
| 76 | 삭제: } | |
| 77 | 삭제: } | |
| 78 | 삭제: var after = MountStatus(parent); | |
| 79 | 삭제: if (matches != 1 || BitConverter.ToUInt64(after, 144) != mountId || | |
| 80 | 삭제: Identity(before) != Identity(after) || FileSystemMagic(parent) != magic) | |
| 81 | 삭제: { | |
| 82 | 삭제: throw new ArchiveException(ArchiveError.OutputUnavailable); | |
| 83 | 삭제: } | |
| 84 | 삭제: parentMountId = mountId; | |
| 85 | 삭제: } | |
| 86 | 삭제: | |
| 87 | 삭제: private byte[] MountStatus(SafeFileHandle handle) | |
| 88 | 삭제: { | |
| 89 | 삭제: // mountinfo의 기존 mount ID와 대조하므로 UNIQUE 플래그를 요청하지 않음. | |
| 90 | 삭제: var status = Stat(handle, "", 0x1100, 0x17FF); | |
| 91 | 삭제: if ((BitConverter.ToUInt32(status, 0) & 0x1000) == 0 || BitConverter.ToUInt64(status, 144) == 0) | |
| 92 | 삭제: { | |
| 93 | 삭제: throw new ArchiveException(ArchiveError.OutputUnavailable); | |
| 94 | 삭제: } | |
| 95 | 삭제: return status; | |
| 96 | 삭제: } | |
| 97 | 삭제: | |
| 98 | 삭제: private long FileSystemMagic(SafeFileHandle handle) | |
| 99 | 삭제: { | |
| 100 | 삭제: var system = new byte[256]; | |
| 101 | 삭제: if (Fstatfs(handle, system) != 0) { ThrowLast(); } | |
| 102 | 삭제: return BitConverter.ToInt64(system, 0); | |
| 103 | 삭제: } | |
| 104 | 삭제: | |
| 105 | 삭제: protected override SafeFileHandle Create(SafeFileHandle directory, string name, bool folder) | |
| 106 | 삭제: { | |
| 107 | 삭제: if (folder) | |
| 108 | 삭제: { | |
| 109 | 삭제: // 기존 권한은 변경하지 않고 새 디렉터리를 0700 이하로 생성함. | |
| 110 | 삭제: if (Mkdirat(directory, name, 0x1C0) != 0) { ThrowLast(); } | |
| 111 | 삭제: unboundCreation = true; | |
| 112 | 삭제: var handle = Open(directory.DangerousGetHandle().ToInt32(), name, 0x90000, 0, 0x0F); | |
| 113 | 삭제: unboundCreation = false; | |
| 114 | 삭제: return handle; | |
| 115 | 삭제: } | |
| 116 | 삭제: return Open(directory.DangerousGetHandle().ToInt32(), name, 0x800C2, 0x180, 0x0F); | |
| 117 | 삭제: } | |
| 118 | 삭제: | |
| 119 | 삭제: protected override string Inspect(SafeFileHandle handle, bool directory) | |
| 120 | 삭제: { | |
| 121 | 삭제: var status = Stat(handle, "", 0x1100); | |
| 122 | 삭제: var mode = BitConverter.ToUInt16(status, 28); | |
| 123 | 삭제: if ((mode & 0xF000) != (directory ? 0x4000 : 0x8000) || | |
| 124 | 삭제: BitConverter.ToUInt32(status, 20) != user || (mode & 0x12) != 0 || | |
| 125 | 삭제: (!directory && BitConverter.ToUInt32(status, 16) != 1)) | |
| 126 | 삭제: { | |
| 127 | 삭제: throw new ArchiveException(ArchiveError.OutputUnavailable); | |
| 128 | 삭제: } | |
| 129 | 삭제: return Identity(status); | |
| 130 | 삭제: } | |
| 131 | 삭제: | |
| 132 | 삭제: private static string Identity(byte[] status) | |
| 133 | 삭제: => $"{BitConverter.ToUInt32(status, 136):X8}:{BitConverter.ToUInt32(status, 140):X8}:{BitConverter.ToUInt64(status, 32):X16}"; | |
| 134 | 삭제: | |
| 135 | 삭제: private byte[] Stat(SafeFileHandle directory, string name, int flags, uint mask = 0x7FF) | |
| 136 | 삭제: { | |
| 137 | 삭제: var status = new byte[256]; | |
| 138 | 삭제: if (Statx(directory, name, flags, mask, status) != 0) { ThrowLast(); } | |
| 139 | 삭제: if ((BitConverter.ToUInt32(status, 0) & 0x10F) != 0x10F) | |
| 140 | 삭제: { | |
| 141 | 삭제: throw new ArchiveException(ArchiveError.OutputUnavailable); | |
| 142 | 삭제: } | |
| 143 | 삭제: return status; | |
| 144 | 삭제: } | |
| 145 | 삭제: | |
| 146 | 삭제: protected override void VerifyChildren(Node node, IReadOnlyCollection<string> names) | |
| 147 | 삭제: { | |
| 148 | 삭제: using var enumeration = Open(node.Handle.DangerousGetHandle().ToInt32(), ".", 0x90000, 0, 0x0F); | |
| 149 | 삭제: var buffer = new byte[65536]; | |
| 150 | 삭제: var remaining = new HashSet<string>(names, StringComparer.Ordinal); | |
| 151 | 삭제: while (true) | |
| 152 | 삭제: { | |
| 153 | 삭제: var count = Getdents64(217, enumeration, buffer, (uint)buffer.Length); | |
| 154 | 삭제: if (count < 0) { ThrowLast(); } | |
| 155 | 삭제: if (count == 0) { break; } | |
| 156 | 삭제: for (var offset = 0; offset < count;) | |
| 157 | 삭제: { | |
| 158 | 삭제: if (count - offset < 20) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 159 | 삭제: var size = BitConverter.ToUInt16(buffer, offset + 16); | |
| 160 | 삭제: if (size < 20 || size > count - offset) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 161 | 삭제: var end = Array.IndexOf(buffer, (byte)0, offset + 19, size - 19); | |
| 162 | 삭제: if (end < 0) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 163 | 삭제: var name = new UTF8Encoding(false, true).GetString(buffer, offset + 19, end - offset - 19); | |
| 164 | 삭제: if (name is not ("." or "..") && !remaining.Remove(name)) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 165 | 삭제: offset += size; | |
| 166 | 삭제: } | |
| 167 | 삭제: } | |
| 168 | 삭제: if (remaining.Count != 0) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 169 | 삭제: } | |
| 170 | 삭제: | |
| 171 | 삭제: private void RequireName(Node node) | |
| 172 | 삭제: { | |
| 173 | 삭제: var container = node.Parent?.Handle ?? parent; | |
| 174 | 삭제: if (Inspect(container, true) != (node.Parent?.Identity ?? parentIdentity) || | |
| 175 | 삭제: Identity(Stat(container, node.Name, 0x100)) != node.Identity) | |
| 176 | 삭제: { | |
| 177 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 178 | 삭제: } | |
| 179 | 삭제: } | |
| 180 | 삭제: | |
| 181 | 삭제: private void RequireParentIdentity(SafeFileHandle selectedParent) | |
| 182 | 삭제: { | |
| 183 | 삭제: var pinned = MountStatus(parent); | |
| 184 | 삭제: var selected = MountStatus(selectedParent); | |
| 185 | 삭제: if (parentMountId == 0 || | |
| 186 | 삭제: BitConverter.ToUInt64(pinned, 144) != parentMountId || | |
| 187 | 삭제: BitConverter.ToUInt64(selected, 144) != parentMountId || | |
| 188 | 삭제: Identity(pinned) != parentIdentity || Identity(selected) != parentIdentity || | |
| 189 | 삭제: Inspect(parent, true) != parentIdentity || Inspect(selectedParent, true) != parentIdentity || | |
| 190 | 삭제: FileSystemMagic(selectedParent) != FileSystemMagic(parent)) | |
| 191 | 삭제: { | |
| 192 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 193 | 삭제: } | |
| 194 | 삭제: } | |
| 195 | 삭제: | |
| 196 | 삭제: internal override void Publish(string leaf, CancellationToken token) | |
| 197 | 삭제: { | |
| 198 | 삭제: RequireName(Root); | |
| 199 | 삭제: foreach (var node in Owned.Where(node => node.Directory)) | |
| 200 | 삭제: { | |
| 201 | 삭제: token.ThrowIfCancellationRequested(); | |
| 202 | 삭제: if (Fsync(node.Handle) != 0) { ThrowLast(); } | |
| 203 | 삭제: } | |
| 204 | 삭제: token.ThrowIfCancellationRequested(); | |
| 205 | 삭제: // 원래 경로를 링크 없이 다시 열어 게시 전 교체를 검사함. rename과 원자적이지 않음. | |
| 206 | 삭제: using var selectedParent = Open(-100, parentPath, 0x90000, 0, 0x04); | |
| 207 | 삭제: RequireParentIdentity(selectedParent); | |
| 208 | 삭제: token.ThrowIfCancellationRequested(); | |
| 209 | 삭제: // RENAME_NOREPLACE가 없는 커널/FS에서는 대체 경로 없이 실패함. | |
| 210 | 삭제: if (Renameat2(parent, TemporaryName, parent, leaf, 1) != 0) { ThrowLast(); } | |
| 211 | 삭제: } | |
| 212 | 삭제: | |
| 213 | 삭제: internal override bool Abort() | |
| 214 | 삭제: { | |
| 215 | 삭제: var success = !unboundCreation; | |
| 216 | 삭제: for (var index = Owned.Count - 1; index >= 0; index--) | |
| 217 | 삭제: { | |
| 218 | 삭제: var node = Owned[index]; | |
| 219 | 삭제: try | |
| 220 | 삭제: { | |
| 221 | 삭제: RequireName(node); | |
| 222 | 삭제: if (Unlinkat(node.Parent?.Handle ?? parent, node.Name, node.Directory ? 0x200 : 0) != 0) | |
| 223 | 삭제: { | |
| 224 | 삭제: CleanupError ??= Marshal.GetLastPInvokeError(); | |
| 225 | 삭제: success = false; | |
| 226 | 삭제: } | |
| 227 | 삭제: } | |
| 228 | 삭제: catch (PosixPublicationException failure) { success = false; CleanupError ??= failure.NativeError; } | |
| 229 | 삭제: catch { success = false; } | |
| 230 | 삭제: } | |
| 231 | 삭제: return success; | |
| 232 | 삭제: } | |
| 233 | 삭제: | |
| 234 | 삭제: public override void Dispose() { DisposeOwned(); parent.Dispose(); } | |
| 235 | 삭제: | |
| 236 | 삭제: private SafeFileHandle Open(int directory, string name, ulong flags, ulong mode, ulong resolve) | |
| 237 | 삭제: { | |
| 238 | 삭제: var how = new OpenHow { Flags = flags, Mode = mode, Resolve = resolve }; | |
| 239 | 삭제: var descriptor = Openat2(437, directory, name, ref how, 24); | |
| 240 | 삭제: if (descriptor < 0) { ThrowLast(); } | |
| 241 | 삭제: if (descriptor < 3) | |
| 242 | 삭제: { | |
| 243 | 삭제: var duplicate = Fcntl((int)descriptor, 1030, 3); | |
| 244 | 삭제: var error = Marshal.GetLastPInvokeError(); | |
| 245 | 삭제: Close((int)descriptor); | |
| 246 | 삭제: if (duplicate < 0) { Fail(error); } | |
| 247 | 삭제: descriptor = duplicate; | |
| 248 | 삭제: } | |
| 249 | 삭제: return new SafeFileHandle((nint)descriptor, true); | |
| 250 | 삭제: } | |
| 251 | 삭제: | |
| 252 | 삭제: private void ThrowLast() => Fail(Marshal.GetLastPInvokeError()); | |
| 253 | 삭제: private void Fail(int error) | |
| 254 | 삭제: { | |
| 255 | 삭제: NativeError = error; | |
| 256 | 삭제: throw new PosixPublicationException(error switch | |
| 257 | 삭제: { | |
| 258 | 삭제: 17 => ArchiveError.OutputConflict, | |
| 259 | 삭제: 40 => ArchiveError.UnsafePath, | |
| 260 | 삭제: _ => ArchiveError.OutputUnavailable | |
| 261 | 삭제: }, error); | |
| 262 | 삭제: } | |
| 263 | 삭제: | |
| 264 | 삭제: [StructLayout(LayoutKind.Sequential)] | |
| 265 | 삭제: private struct OpenHow { internal ulong Flags; internal ulong Mode; internal ulong Resolve; } | |
| 266 | 삭제: [DllImport("libc", EntryPoint = "syscall", SetLastError = true)] | |
| 267 | 삭제: private static extern long Openat2(long syscall, int directory, [MarshalAs(UnmanagedType.LPUTF8Str)] string name, | |
| 268 | 삭제: ref OpenHow how, nuint size); | |
| 269 | 삭제: [DllImport("libc", EntryPoint = "syscall", SetLastError = true)] | |
| 270 | 삭제: private static extern long Getdents64(long syscall, SafeFileHandle directory, [Out] byte[] buffer, uint size); | |
| 271 | 삭제: [DllImport("libc", EntryPoint = "statx", SetLastError = true)] | |
| 272 | 삭제: private static extern int Statx(SafeFileHandle directory, [MarshalAs(UnmanagedType.LPUTF8Str)] string name, | |
| 273 | 삭제: int flags, uint mask, [Out] byte[] status); | |
| 274 | 삭제: [DllImport("libc", EntryPoint = "fstatfs", SetLastError = true)] | |
| 275 | 삭제: private static extern int Fstatfs(SafeFileHandle directory, [Out] byte[] status); | |
| 276 | 삭제: [DllImport("libc", EntryPoint = "mkdirat", SetLastError = true)] | |
| 277 | 삭제: private static extern int Mkdirat(SafeFileHandle directory, [MarshalAs(UnmanagedType.LPUTF8Str)] string name, uint mode); | |
| 278 | 삭제: [DllImport("libc", EntryPoint = "renameat2", SetLastError = true)] | |
| 279 | 삭제: private static extern int Renameat2(SafeFileHandle sourceDirectory, [MarshalAs(UnmanagedType.LPUTF8Str)] string source, | |
| 280 | 삭제: SafeFileHandle targetDirectory, [MarshalAs(UnmanagedType.LPUTF8Str)] string target, uint flags); | |
| 281 | 삭제: [DllImport("libc", EntryPoint = "unlinkat", SetLastError = true)] | |
| 282 | 삭제: private static extern int Unlinkat(SafeFileHandle directory, [MarshalAs(UnmanagedType.LPUTF8Str)] string name, int flags); | |
| 283 | 삭제: [DllImport("libc", EntryPoint = "fsync", SetLastError = true)] | |
| 284 | 삭제: private static extern int Fsync(SafeFileHandle file); | |
| 285 | 삭제: [DllImport("libc", EntryPoint = "getpid")] | |
| 286 | 삭제: private static extern int GetProcessId(); | |
| 287 | 삭제: [DllImport("libc", EntryPoint = "gettid")] | |
| 288 | 삭제: private static extern int GetThreadId(); | |
| 289 | 삭제: [DllImport("libc", EntryPoint = "geteuid")] | |
| 290 | 삭제: private static extern uint GetEffectiveUser(); | |
| 291 | 삭제: [DllImport("libc", EntryPoint = "fcntl", SetLastError = true)] | |
| 292 | 삭제: private static extern int Fcntl(int descriptor, int command, int minimum); | |
| 293 | 삭제: [DllImport("libc", EntryPoint = "close")] | |
| 294 | 삭제: private static extern int Close(int descriptor); | |
| 295 | 삭제: } | |
| 296 | 삭제: | |
| 297 | 삭제: internal sealed class PosixPublicationException(ArchiveError code, int error) : Exception(code.ToString()) | |
| 298 | 삭제: { | |
| 299 | 삭제: internal ArchiveError Code { get; } = code; | |
| 300 | 삭제: internal int NativeError { get; } = error; | |
| 301 | 삭제: } |
| @@ -1,98 +0,0 @@ | ||
| 1 | 삭제: using System.Runtime.InteropServices; | |
| 2 | 삭제: using Microsoft.Win32.SafeHandles; | |
| 3 | 삭제: using Zipelo.Core; | |
| 4 | 삭제: | |
| 5 | 삭제: namespace Zipelo.Runtime; | |
| 6 | 삭제: | |
| 7 | 삭제: internal sealed class LinuxPublication : PendingPublication | |
| 8 | 삭제: { | |
| 9 | 삭제: private readonly SafeFileHandle directory; | |
| 10 | 삭제: private readonly SafeFileHandle file; | |
| 11 | 삭제: | |
| 12 | 삭제: private LinuxPublication(SafeFileHandle directory, SafeFileHandle file) | |
| 13 | 삭제: { | |
| 14 | 삭제: this.directory = directory; | |
| 15 | 삭제: this.file = file; | |
| 16 | 삭제: } | |
| 17 | 삭제: | |
| 18 | 삭제: internal override SafeFileHandle Handle => file; | |
| 19 | 삭제: | |
| 20 | 삭제: internal static LinuxPublication Create(string parent) | |
| 21 | 삭제: { | |
| 22 | 삭제: // x64 syscall 번호를 사용함. 호출 전 공통 API에서 아키텍처를 제한함. | |
| 23 | 삭제: var how = new OpenHow { Flags = 0x80000 | 0x10000, Mode = 0, Resolve = 0x04 }; | |
| 24 | 삭제: var descriptor = OpenAt2(437, -100, parent, ref how, (nuint)Marshal.SizeOf<OpenHow>()); | |
| 25 | 삭제: var directory = OwnDescriptor(checked((int)descriptor)); | |
| 26 | 삭제: try | |
| 27 | 삭제: { | |
| 28 | 삭제: // O_TMPFILE | O_RDWR | O_CLOEXEC, 생성 권한은 0600 이하임. | |
| 29 | 삭제: var file = OwnDescriptor(OpenAt(directory, ".", 0x410000 | 2 | 0x80000, 0x180)); | |
| 30 | 삭제: return new(directory, file); | |
| 31 | 삭제: } | |
| 32 | 삭제: catch { directory.Dispose(); throw; } | |
| 33 | 삭제: } | |
| 34 | 삭제: | |
| 35 | 삭제: internal override void Publish(string leaf) | |
| 36 | 삭제: { | |
| 37 | 삭제: // 커널 procfs의 보유 fd를 연결하며 새 목적지 링크는 덮어쓰지 않음. | |
| 38 | 삭제: var descriptorPath = $"/proc/self/fd/{file.DangerousGetHandle().ToInt64()}"; | |
| 39 | 삭제: if (LinkAt(-100, descriptorPath, directory, leaf, 0x400) != 0) { ThrowLastError(); } | |
| 40 | 삭제: } | |
| 41 | 삭제: | |
| 42 | 삭제: // 이름 없는 임시 inode는 마지막 핸들이 닫힐 때 제거됨. | |
| 43 | 삭제: internal override bool Abort() => true; | |
| 44 | 삭제: | |
| 45 | 삭제: public override void Dispose() | |
| 46 | 삭제: { | |
| 47 | 삭제: file.Dispose(); | |
| 48 | 삭제: directory.Dispose(); | |
| 49 | 삭제: } | |
| 50 | 삭제: | |
| 51 | 삭제: private static SafeFileHandle OwnDescriptor(int descriptor) | |
| 52 | 삭제: { | |
| 53 | 삭제: if (descriptor < 0) { ThrowLastError(); } | |
| 54 | 삭제: if (descriptor < 3) | |
| 55 | 삭제: { | |
| 56 | 삭제: var duplicate = DuplicateDescriptor(descriptor, 1030, 3); | |
| 57 | 삭제: var error = Marshal.GetLastPInvokeError(); | |
| 58 | 삭제: Close(descriptor); | |
| 59 | 삭제: if (duplicate < 0) { throw Error(error); } | |
| 60 | 삭제: descriptor = duplicate; | |
| 61 | 삭제: } | |
| 62 | 삭제: return new SafeFileHandle((nint)descriptor, ownsHandle: true); | |
| 63 | 삭제: } | |
| 64 | 삭제: | |
| 65 | 삭제: private static void ThrowLastError() => throw Error(Marshal.GetLastPInvokeError()); | |
| 66 | 삭제: private static ArchiveException Error(int error) => new(error switch | |
| 67 | 삭제: { | |
| 68 | 삭제: 17 => ArchiveError.OutputConflict, | |
| 69 | 삭제: 40 => ArchiveError.UnsafePath, | |
| 70 | 삭제: _ => ArchiveError.OutputUnavailable | |
| 71 | 삭제: }); | |
| 72 | 삭제: | |
| 73 | 삭제: [StructLayout(LayoutKind.Sequential)] | |
| 74 | 삭제: private struct OpenHow | |
| 75 | 삭제: { | |
| 76 | 삭제: internal ulong Flags; | |
| 77 | 삭제: internal ulong Mode; | |
| 78 | 삭제: internal ulong Resolve; | |
| 79 | 삭제: } | |
| 80 | 삭제: | |
| 81 | 삭제: [DllImport("libc", EntryPoint = "syscall", SetLastError = true)] | |
| 82 | 삭제: private static extern long OpenAt2(long number, int directory, | |
| 83 | 삭제: [MarshalAs(UnmanagedType.LPUTF8Str)] string path, ref OpenHow how, nuint size); | |
| 84 | 삭제: | |
| 85 | 삭제: [DllImport("libc", EntryPoint = "openat", SetLastError = true)] | |
| 86 | 삭제: private static extern int OpenAt(SafeFileHandle directory, | |
| 87 | 삭제: [MarshalAs(UnmanagedType.LPUTF8Str)] string path, int flags, uint mode); | |
| 88 | 삭제: | |
| 89 | 삭제: [DllImport("libc", EntryPoint = "linkat", SetLastError = true)] | |
| 90 | 삭제: private static extern int LinkAt(int oldDirectory, [MarshalAs(UnmanagedType.LPUTF8Str)] string oldPath, | |
| 91 | 삭제: SafeFileHandle newDirectory, [MarshalAs(UnmanagedType.LPUTF8Str)] string newPath, int flags); | |
| 92 | 삭제: | |
| 93 | 삭제: [DllImport("libc", EntryPoint = "fcntl", SetLastError = true)] | |
| 94 | 삭제: private static extern int DuplicateDescriptor(int descriptor, int command, int minimum); | |
| 95 | 삭제: | |
| 96 | 삭제: [DllImport("libc", EntryPoint = "close")] | |
| 97 | 삭제: private static extern int Close(int descriptor); | |
| 98 | 삭제: } |
| @@ -1,76 +0,0 @@ | ||
| 1 | 삭제: using System.Runtime.InteropServices; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: | |
| 4 | 삭제: namespace Zipelo.Runtime; | |
| 5 | 삭제: | |
| 6 | 삭제: public static class NewFolderPublisher | |
| 7 | 삭제: { | |
| 8 | 삭제: // 구현 진입 가능 여부임. 일반 UI 활성화나 OS 검증 완료를 뜻하지 않음. | |
| 9 | 삭제: public static bool IsSupportedPlatform => RuntimeInformation.ProcessArchitecture == Architecture.X64 && | |
| 10 | 삭제: (OperatingSystem.IsWindows() || OperatingSystem.IsLinux()); | |
| 11 | 삭제: | |
| 12 | 삭제: public static async Task<ZipPublicationResult> PublishAsync(ZipWorkerResult result, | |
| 13 | 삭제: string destinationPath, CancellationToken token) | |
| 14 | 삭제: { | |
| 15 | 삭제: PendingFolderPublication? pending = null; | |
| 16 | 삭제: var published = false; | |
| 17 | 삭제: var error = ArchiveError.None; | |
| 18 | 삭제: var cleanupFailed = false; | |
| 19 | 삭제: int? posixError = null; | |
| 20 | 삭제: string? temporaryName = null; | |
| 21 | 삭제: PublicationNativeFailure? nativeFailure = null; | |
| 22 | 삭제: PublicationNativeFailure? cleanupNativeFailure = null; | |
| 23 | 삭제: try | |
| 24 | 삭제: { | |
| 25 | 삭제: token.ThrowIfCancellationRequested(); | |
| 26 | 삭제: if (!IsSupportedPlatform) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 27 | 삭제: var entries = ZipExtraction.ValidateResult(result, token, snapshot: true); | |
| 28 | 삭제: if (!Path.IsPathFullyQualified(destinationPath)) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 29 | 삭제: var fullPath = Path.GetFullPath(destinationPath); | |
| 30 | 삭제: if (OperatingSystem.IsLinux()) { _ = OutputPathPolicy.Validate(fullPath[1..], FileNamePolicy.Linux); } | |
| 31 | 삭제: var parent = Path.GetDirectoryName(fullPath); | |
| 32 | 삭제: var leaf = Path.GetFileName(fullPath); | |
| 33 | 삭제: if (parent is null || OutputPathPolicy.Validate(leaf, OutputPathPolicy.CurrentPolicy).Count != 1) | |
| 34 | 삭제: { | |
| 35 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 36 | 삭제: } | |
| 37 | 삭제: pending = OperatingSystem.IsWindows() ? new WindowsFolderPublication(parent) : new LinuxFolderPublication(parent); | |
| 38 | 삭제: pending.Initialize(); | |
| 39 | 삭제: foreach (var entry in entries) { await pending.WriteAsync(entry, token).ConfigureAwait(false); } | |
| 40 | 삭제: pending.Verify(token); | |
| 41 | 삭제: token.ThrowIfCancellationRequested(); | |
| 42 | 삭제: pending.Publish(leaf, token); | |
| 43 | 삭제: published = true; | |
| 44 | 삭제: } | |
| 45 | 삭제: catch (OperationCanceledException) when (token.IsCancellationRequested) { error = ArchiveError.Cancelled; } | |
| 46 | 삭제: catch (PublicationNativeException failure) { error = failure.Code; nativeFailure = failure.Failure; } | |
| 47 | 삭제: catch (PosixPublicationException failure) { error = failure.Code; posixError = failure.NativeError; } | |
| 48 | 삭제: catch (ArchiveException failure) { error = failure.Code; } | |
| 49 | 삭제: catch (ArgumentException) { error = ArchiveError.UnsafePath; } | |
| 50 | 삭제: catch { error = ArchiveError.OutputUnavailable; } | |
| 51 | 삭제: finally | |
| 52 | 삭제: { | |
| 53 | 삭제: if (pending is not null) | |
| 54 | 삭제: { | |
| 55 | 삭제: if (!published) | |
| 56 | 삭제: { | |
| 57 | 삭제: try { cleanupFailed = !pending.Abort(); } | |
| 58 | 삭제: catch { cleanupFailed = true; } | |
| 59 | 삭제: if (cleanupFailed) | |
| 60 | 삭제: { | |
| 61 | 삭제: temporaryName = pending.TemporaryName; | |
| 62 | 삭제: cleanupNativeFailure = pending.CleanupNativeFailure; | |
| 63 | 삭제: } | |
| 64 | 삭제: } | |
| 65 | 삭제: pending.Dispose(); | |
| 66 | 삭제: } | |
| 67 | 삭제: } | |
| 68 | 삭제: return new(published, error, cleanupFailed, temporaryName) | |
| 69 | 삭제: { | |
| 70 | 삭제: NativeFailure = nativeFailure, | |
| 71 | 삭제: CleanupNativeFailure = cleanupNativeFailure, | |
| 72 | 삭제: PosixError = posixError, | |
| 73 | 삭제: CleanupPosixError = (pending as LinuxFolderPublication)?.CleanupError | |
| 74 | 삭제: }; | |
| 75 | 삭제: } | |
| 76 | 삭제: } |
| @@ -1,123 +0,0 @@ | ||
| 1 | 삭제: using System.Runtime.InteropServices; | |
| 2 | 삭제: using Microsoft.Win32.SafeHandles; | |
| 3 | 삭제: using Zipelo.Core; | |
| 4 | 삭제: | |
| 5 | 삭제: namespace Zipelo.Runtime; | |
| 6 | 삭제: | |
| 7 | 삭제: public sealed record ZipPublicationResult(bool Published, ArchiveError Error, bool CleanupFailed, | |
| 8 | 삭제: string? TemporaryFileName = null) | |
| 9 | 삭제: { | |
| 10 | 삭제: public int? PosixError { get; init; } | |
| 11 | 삭제: public int? CleanupPosixError { get; init; } | |
| 12 | 삭제: public PublicationNativeFailure? NativeFailure { get; init; } | |
| 13 | 삭제: public PublicationNativeFailure? CleanupNativeFailure { get; init; } | |
| 14 | 삭제: } | |
| 15 | 삭제: | |
| 16 | 삭제: // 경로와 OS 오류 메시지 없이 고정 API 이름과 숫자 코드만 전달함. | |
| 17 | 삭제: public sealed record PublicationNativeFailure(string Operation, uint Win32Error, int? NtStatus = null); | |
| 18 | 삭제: | |
| 19 | 삭제: internal sealed class PublicationNativeException(ArchiveError code, PublicationNativeFailure failure) | |
| 20 | 삭제: : Exception(code.ToString()) | |
| 21 | 삭제: { | |
| 22 | 삭제: internal ArchiveError Code { get; } = code; | |
| 23 | 삭제: internal PublicationNativeFailure Failure { get; } = failure; | |
| 24 | 삭제: } | |
| 25 | 삭제: | |
| 26 | 삭제: public static class NewZipPublisher | |
| 27 | 삭제: { | |
| 28 | 삭제: // 구현 대상 여부임. OS별 실행 검증 완료나 대상 파일시스템 지원을 뜻하지 않음. | |
| 29 | 삭제: public static bool IsSupportedPlatform => RuntimeInformation.ProcessArchitecture == Architecture.X64 && | |
| 30 | 삭제: (OperatingSystem.IsWindows() || OperatingSystem.IsLinux()); | |
| 31 | 삭제: | |
| 32 | 삭제: public static async Task<ZipPublicationResult> PublishAsync(ZipWorkerResult result, | |
| 33 | 삭제: string destinationPath, CancellationToken token) | |
| 34 | 삭제: { | |
| 35 | 삭제: PendingPublication? pending = null; | |
| 36 | 삭제: var published = false; | |
| 37 | 삭제: var error = ArchiveError.None; | |
| 38 | 삭제: var cleanupFailed = false; | |
| 39 | 삭제: string? temporaryFileName = null; | |
| 40 | 삭제: PublicationNativeFailure? nativeFailure = null; | |
| 41 | 삭제: PublicationNativeFailure? cleanupNativeFailure = null; | |
| 42 | 삭제: try | |
| 43 | 삭제: { | |
| 44 | 삭제: token.ThrowIfCancellationRequested(); | |
| 45 | 삭제: if (!IsSupportedPlatform) { throw new ArchiveException(ArchiveError.OutputUnavailable); } | |
| 46 | 삭제: var bytes = result.CreatedZip; | |
| 47 | 삭제: if (result.Job.State != JobState.Completed || result.Job.Error != ArchiveError.None || | |
| 48 | 삭제: bytes is null || bytes.Length == 0) | |
| 49 | 삭제: { | |
| 50 | 삭제: throw new ArchiveException(ArchiveError.UnsupportedOperation); | |
| 51 | 삭제: } | |
| 52 | 삭제: if (bytes.Length > WorkerProtocol.MaxDataBytes) { throw new ArchiveException(ArchiveError.BudgetExceeded); } | |
| 53 | 삭제: if (!Path.IsPathFullyQualified(destinationPath)) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 54 | 삭제: var fullPath = Path.GetFullPath(destinationPath); | |
| 55 | 삭제: if (OperatingSystem.IsLinux()) | |
| 56 | 삭제: { | |
| 57 | 삭제: _ = OutputPathPolicy.Validate(fullPath[1..], FileNamePolicy.Linux); | |
| 58 | 삭제: } | |
| 59 | 삭제: var parent = Path.GetDirectoryName(fullPath); | |
| 60 | 삭제: var leaf = Path.GetFileName(fullPath); | |
| 61 | 삭제: if (parent is null || OutputPathPolicy.Validate(leaf, OutputPathPolicy.CurrentPolicy).Count != 1) | |
| 62 | 삭제: { | |
| 63 | 삭제: throw new ArchiveException(ArchiveError.UnsafePath); | |
| 64 | 삭제: } | |
| 65 | 삭제: // 호출자가 생성물 배열을 이후 변경해도 쓰는 내용이 달라지지 않도록 복사함. | |
| 66 | 삭제: var snapshot = bytes.ToArray(); | |
| 67 | 삭제: pending = OperatingSystem.IsWindows() ? WindowsPublication.Create(parent) : LinuxPublication.Create(parent); | |
| 68 | 삭제: for (var offset = 0; offset < snapshot.Length; offset += 65536) | |
| 69 | 삭제: { | |
| 70 | 삭제: token.ThrowIfCancellationRequested(); | |
| 71 | 삭제: var count = Math.Min(65536, snapshot.Length - offset); | |
| 72 | 삭제: await RandomAccess.WriteAsync(pending.Handle, snapshot.AsMemory(offset, count), offset, token) | |
| 73 | 삭제: .ConfigureAwait(false); | |
| 74 | 삭제: } | |
| 75 | 삭제: RandomAccess.FlushToDisk(pending.Handle); | |
| 76 | 삭제: token.ThrowIfCancellationRequested(); | |
| 77 | 삭제: pending.Publish(leaf); | |
| 78 | 삭제: // 게시 성공 이후의 늦은 취소는 이미 존재하는 새 파일을 취소 결과로 바꾸지 않음. | |
| 79 | 삭제: published = true; | |
| 80 | 삭제: } | |
| 81 | 삭제: catch (OperationCanceledException) when (token.IsCancellationRequested) { error = ArchiveError.Cancelled; } | |
| 82 | 삭제: catch (PublicationNativeException failure) | |
| 83 | 삭제: { | |
| 84 | 삭제: error = failure.Code; | |
| 85 | 삭제: nativeFailure = failure.Failure; | |
| 86 | 삭제: } | |
| 87 | 삭제: catch (ArchiveException failure) { error = failure.Code; } | |
| 88 | 삭제: catch (ArgumentException) { error = ArchiveError.UnsafePath; } | |
| 89 | 삭제: catch { error = ArchiveError.OutputUnavailable; } | |
| 90 | 삭제: finally | |
| 91 | 삭제: { | |
| 92 | 삭제: if (pending is not null) | |
| 93 | 삭제: { | |
| 94 | 삭제: if (!published) | |
| 95 | 삭제: { | |
| 96 | 삭제: try { cleanupFailed = !pending.Abort(); } | |
| 97 | 삭제: catch { cleanupFailed = true; } | |
| 98 | 삭제: if (cleanupFailed) | |
| 99 | 삭제: { | |
| 100 | 삭제: temporaryFileName = pending.TemporaryFileName; | |
| 101 | 삭제: cleanupNativeFailure = pending.CleanupNativeFailure; | |
| 102 | 삭제: } | |
| 103 | 삭제: } | |
| 104 | 삭제: pending.Dispose(); | |
| 105 | 삭제: } | |
| 106 | 삭제: } | |
| 107 | 삭제: return new(published, error, cleanupFailed, temporaryFileName) | |
| 108 | 삭제: { | |
| 109 | 삭제: NativeFailure = nativeFailure, | |
| 110 | 삭제: CleanupNativeFailure = cleanupNativeFailure | |
| 111 | 삭제: }; | |
| 112 | 삭제: } | |
| 113 | 삭제: } | |
| 114 | 삭제: | |
| 115 | 삭제: internal abstract class PendingPublication : IDisposable | |
| 116 | 삭제: { | |
| 117 | 삭제: internal abstract SafeFileHandle Handle { get; } | |
| 118 | 삭제: internal virtual string? TemporaryFileName => null; | |
| 119 | 삭제: internal virtual PublicationNativeFailure? CleanupNativeFailure => null; | |
| 120 | 삭제: internal abstract void Publish(string leaf); | |
| 121 | 삭제: internal abstract bool Abort(); | |
| 122 | 삭제: public abstract void Dispose(); | |
| 123 | 삭제: } |
| @@ -1,100 +0,0 @@ | ||
| 1 | 삭제: using Microsoft.Win32.SafeHandles; | |
| 2 | 삭제: using Zipelo.Core; | |
| 3 | 삭제: | |
| 4 | 삭제: namespace Zipelo.Runtime; | |
| 5 | 삭제: | |
| 6 | 삭제: internal abstract class PendingFolderPublication : IDisposable | |
| 7 | 삭제: { | |
| 8 | 삭제: protected sealed class Node(string name, Node? parent, SafeFileHandle handle, bool directory, string identity) | |
| 9 | 삭제: { | |
| 10 | 삭제: internal string Name { get; } = name; | |
| 11 | 삭제: internal Node? Parent { get; } = parent; | |
| 12 | 삭제: internal SafeFileHandle Handle { get; set; } = handle; | |
| 13 | 삭제: internal bool Directory { get; } = directory; | |
| 14 | 삭제: internal string Identity { get; } = identity; | |
| 15 | 삭제: } | |
| 16 | 삭제: | |
| 17 | 삭제: protected readonly List<Node> Owned = []; | |
| 18 | 삭제: private readonly Dictionary<string, Node> folders = new(OutputPathPolicy.Comparer(OutputPathPolicy.CurrentPolicy)); | |
| 19 | 삭제: internal string TemporaryName { get; } = $".zipelo-{Guid.NewGuid():N}.tmp"; | |
| 20 | 삭제: internal PublicationNativeFailure? CleanupNativeFailure { get; set; } | |
| 21 | 삭제: protected Node Root => Owned[0]; | |
| 22 | 삭제: protected abstract SafeFileHandle Create(SafeFileHandle parent, string name, bool directory); | |
| 23 | 삭제: protected abstract string Inspect(SafeFileHandle handle, bool directory); | |
| 24 | 삭제: protected abstract void VerifyChildren(Node node, IReadOnlyCollection<string> names); | |
| 25 | 삭제: internal abstract void Initialize(); | |
| 26 | 삭제: internal abstract void Publish(string leaf, CancellationToken token); | |
| 27 | 삭제: internal abstract bool Abort(); | |
| 28 | 삭제: public abstract void Dispose(); | |
| 29 | 삭제: | |
| 30 | 삭제: protected void AddRoot(SafeFileHandle handle) | |
| 31 | 삭제: { | |
| 32 | 삭제: // 검사 실패도 호출자의 Abort가 생성 핸들을 정리하도록 먼저 기록함. | |
| 33 | 삭제: var root = new Node(TemporaryName, null, handle, true, ""); | |
| 34 | 삭제: Owned.Add(root); | |
| 35 | 삭제: var verified = new Node(TemporaryName, null, handle, true, Inspect(handle, true)); | |
| 36 | 삭제: Owned[0] = verified; | |
| 37 | 삭제: folders.Add("", verified); | |
| 38 | 삭제: } | |
| 39 | 삭제: | |
| 40 | 삭제: internal async Task WriteAsync(ZipExtractedEntry item, CancellationToken token) | |
| 41 | 삭제: { | |
| 42 | 삭제: var segments = OutputPathPolicy.Validate(item.Entry.Name, OutputPathPolicy.CurrentPolicy); | |
| 43 | 삭제: var parent = Root; | |
| 44 | 삭제: for (var index = 0; index < segments.Count; index++) | |
| 45 | 삭제: { | |
| 46 | 삭제: token.ThrowIfCancellationRequested(); | |
| 47 | 삭제: var path = string.Join('/', segments.Take(index + 1)); | |
| 48 | 삭제: var directory = index < segments.Count - 1 || item.Entry.Kind == EntryKind.Directory; | |
| 49 | 삭제: if (directory && folders.TryGetValue(path, out var existing)) { parent = existing; continue; } | |
| 50 | 삭제: var handle = Create(parent.Handle, segments[index], directory); | |
| 51 | 삭제: var node = new Node(segments[index], parent, handle, directory, ""); | |
| 52 | 삭제: Owned.Add(node); | |
| 53 | 삭제: node = new Node(node.Name, parent, handle, directory, Inspect(handle, directory)); | |
| 54 | 삭제: Owned[^1] = node; | |
| 55 | 삭제: if (directory) | |
| 56 | 삭제: { | |
| 57 | 삭제: folders.Add(path, node); | |
| 58 | 삭제: parent = node; | |
| 59 | 삭제: continue; | |
| 60 | 삭제: } | |
| 61 | 삭제: var buffer = new byte[65536]; | |
| 62 | 삭제: for (var offset = 0; offset < item.Content.Length; offset += buffer.Length) | |
| 63 | 삭제: { | |
| 64 | 삭제: token.ThrowIfCancellationRequested(); | |
| 65 | 삭제: var count = Math.Min(buffer.Length, item.Content.Length - offset); | |
| 66 | 삭제: await RandomAccess.WriteAsync(handle, item.Content.AsMemory(offset, count), offset, token).ConfigureAwait(false); | |
| 67 | 삭제: } | |
| 68 | 삭제: RandomAccess.FlushToDisk(handle); | |
| 69 | 삭제: if (RandomAccess.GetLength(handle) != item.Content.Length) { throw new ArchiveException(ArchiveError.IntegrityFailure); } | |
| 70 | 삭제: for (var offset = 0; offset < item.Content.Length;) | |
| 71 | 삭제: { | |
| 72 | 삭제: var count = await RandomAccess.ReadAsync(handle, buffer.AsMemory(0, | |
| 73 | 삭제: Math.Min(buffer.Length, item.Content.Length - offset)), offset, token).ConfigureAwait(false); | |
| 74 | 삭제: if (count == 0 || !buffer.AsSpan(0, count).SequenceEqual(item.Content.AsSpan(offset, count))) | |
| 75 | 삭제: { | |
| 76 | 삭제: throw new ArchiveException(ArchiveError.IntegrityFailure); | |
| 77 | 삭제: } | |
| 78 | 삭제: offset += count; | |
| 79 | 삭제: } | |
| 80 | 삭제: } | |
| 81 | 삭제: } | |
| 82 | 삭제: | |
| 83 | 삭제: internal void Verify(CancellationToken token) | |
| 84 | 삭제: { | |
| 85 | 삭제: foreach (var node in Owned) | |
| 86 | 삭제: { | |
| 87 | 삭제: token.ThrowIfCancellationRequested(); | |
| 88 | 삭제: if (Inspect(node.Handle, node.Directory) != node.Identity) { throw new ArchiveException(ArchiveError.UnsafePath); } | |
| 89 | 삭제: if (node.Directory) | |
| 90 | 삭제: { | |
| 91 | 삭제: VerifyChildren(node, Owned.Where(child => child.Parent == node).Select(child => child.Name).ToArray()); | |
| 92 | 삭제: } | |
| 93 | 삭제: } | |
| 94 | 삭제: } | |
| 95 | 삭제: | |
| 96 | 삭제: protected void DisposeOwned() | |
| 97 | 삭제: { | |
| 98 | 삭제: for (var index = Owned.Count - 1; index >= 0; index--) { Owned[index].Handle.Dispose(); } | |
| 99 | 삭제: } | |
| 100 | 삭제: } |
Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기Diff가 표시 한도를 넘어서 생략했어요.
Raw로 열기