feat: add p-rec-annot interactive line-number preview
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user