fix: restore DOCX workbench runtime path
This commit is contained in:
@@ -7,6 +7,27 @@ public interface IDocumentInspector
|
||||
DocumentInspectionResult Inspect(string docxPath);
|
||||
}
|
||||
|
||||
public sealed class UnsupportedDocumentFormatException(string message) : InvalidOperationException(message);
|
||||
|
||||
public enum WorkbenchState { Empty, InputsSelected, Analyzed, ReadyToBuild, Building, BuildSucceeded, BuildFailed, Validating, ValidationSucceeded, ValidationFailed }
|
||||
|
||||
public sealed class WorkbenchStateController
|
||||
{
|
||||
public WorkbenchState State { get; private set; } = WorkbenchState.Empty;
|
||||
public bool CanBuild => State == WorkbenchState.ReadyToBuild;
|
||||
public bool CanValidate => State == WorkbenchState.BuildSucceeded;
|
||||
public bool CanOpenDocx { get; private set; }
|
||||
public bool CanOpenPdf { get; private set; }
|
||||
public void InputsSelected(bool selected) { State = selected ? WorkbenchState.InputsSelected : WorkbenchState.Empty; if (!selected) ClearArtifacts(); }
|
||||
public void AnalysisCompleted(bool templateOk, bool bodyOk, bool insertionPointFound) { State = templateOk && bodyOk && insertionPointFound ? WorkbenchState.ReadyToBuild : WorkbenchState.Analyzed; ClearArtifacts(); }
|
||||
public void BeginBuild() { if (!CanBuild) throw new InvalidOperationException("Build is unavailable in the current state."); State = WorkbenchState.Building; ClearArtifacts(); }
|
||||
public void BuildSucceeded() { State = WorkbenchState.BuildSucceeded; CanOpenDocx = true; CanOpenPdf = true; }
|
||||
public void BuildFailed() { State = WorkbenchState.BuildFailed; ClearArtifacts(); }
|
||||
public void BeginValidation() { if (!CanValidate) throw new InvalidOperationException("Validation is available only after a successful build."); State = WorkbenchState.Validating; }
|
||||
public void ValidationCompleted(bool success) => State = success ? WorkbenchState.ValidationSucceeded : WorkbenchState.ValidationFailed;
|
||||
private void ClearArtifacts() { CanOpenDocx = false; CanOpenPdf = false; }
|
||||
}
|
||||
|
||||
public interface IWordDocumentService
|
||||
{
|
||||
Task<WordDocumentResult> BuildDocumentAsync(WordDocumentBuildRequest request, IProgress<string>? progress, CancellationToken cancellationToken);
|
||||
|
||||
Reference in New Issue
Block a user