feat: add p-rec-annot interactive line-number preview

This commit is contained in:
codex
2026-08-07 08:54:31 +03:00
parent 066a9f3d94
commit 58f71267a2
2 changed files with 63 additions and 1 deletions
@@ -0,0 +1,24 @@
using PRecAnnot.Abstractions;
using PRecAnnot.Core;
namespace PRecAnnot.Plant3D2026;
internal sealed record LineNumberRuntimeConfiguration(LineNumberAnnotationSettings Annotations, AnnotateLineNumbersAssets Assets);
internal static class LineNumberRuntimeConfigurationReader
{
public static LineNumberRuntimeConfiguration Read()
{
var annotationPath = RequiredLocalFile("P_REC_ANNOT_LINE_NUMBER_ANNOTATION_SETTINGS_PATH");
var drawingPath = RequiredLocalFile("P_REC_ANNOT_LINE_NUMBER_DRAWING_SETTINGS_PATH");
return new(new LineNumberAnnotationSettingsLoader().Load(File.ReadAllText(annotationPath)), new AnnotateLineNumbersSettingsLoader().Load(File.ReadAllText(drawingPath)));
}
private static string RequiredLocalFile(string variable)
{
var path = Environment.GetEnvironmentVariable(variable);
if (string.IsNullOrWhiteSpace(path) || !Path.IsPathFullyQualified(path) || path.StartsWith("\\\\", StringComparison.Ordinal) || !File.Exists(path))
throw new InvalidOperationException($"LINE_NUMBER_CONFIGURATION_REQUIRED:{variable}");
return path;
}
}