From b13d5d13227d514e36c814b2cdf5c96b8240bb2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 01:46:11 +0000 Subject: [PATCH 01/18] Bump Microsoft.NET.Test.Sdk from 18.11.1 to 18.12.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.12.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index e6746b9..1b330be 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -11,7 +11,7 @@ - + From c3899c63e180b10a5f232578d9ef96fd62c7c37e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Nov 2026 01:46:39 +0000 Subject: [PATCH 02/18] Bump Microsoft.SourceLink.GitHub from 10.0.403 to 10.0.404 --- updated-dependencies: - dependency-name: Microsoft.SourceLink.GitHub dependency-version: 10.0.404 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index e6746b9..f0c1938 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,7 @@ - + From 946d20cba3fea6bee0df2b546f8ee6c3b008f346 Mon Sep 17 00:00:00 2001 From: mahach666 Date: Fri, 20 Nov 2026 02:26:07 +0300 Subject: [PATCH 03/18] Write a standalone HTML viewer of the drawing DwgViewerExport.SaveViewer converts the drawing to an IOScene scene and embeds it with the IOViewer WebGL runtime into one interactive HTML file (no server, no external scripts); the default viewer title follows the scene. dwgio drawing.dwg out.html drives it through the output extension, next to OBJ, GLB and JSON. --- CHANGELOG.md | 2 + Directory.Packages.props | 2 + README.md | 8 ++ docs/public-api.md | 1 + src/DwgIO.Cli/Program.cs | 8 +- src/DwgIO.Scene/DwgIO.Scene.csproj | 1 + src/DwgIO.Scene/DwgViewerExport.cs | 67 ++++++++++++++++ tests/DwgIO.Tests/DwgViewerExportTests.cs | 97 +++++++++++++++++++++++ 8 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 src/DwgIO.Scene/DwgViewerExport.cs create mode 100644 tests/DwgIO.Tests/DwgViewerExportTests.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b2bacc..87ae920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ API between minor releases. - `DwgSvgExporter` and `dwgio svg [--scale n]` draw model space to SVG (#32): LINE, CIRCLE, ARC and POINT in the top view with the y axis up, in their ACI colours, inside a view box that contains every exported entity. Polylines, curves and text follow as the core decodes them. +- `DwgViewerExport.SaveViewer` and `dwgio drawing.dwg out.html` write a standalone interactive 3D HTML viewer + (the IOViewer WebGL runtime embedded with the IOScene scene document; no server, no external scripts). ### Fixed - Packed 16-bit and 32-bit integers in their full-width form are read little-endian. They were read with their bytes diff --git a/Directory.Packages.props b/Directory.Packages.props index 847b947..adb5083 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,6 +14,8 @@ IOScene.Formats (GLB and OBJ writers) ships as a preview and needs IOScene 0.1.1 or later. --> + + diff --git a/README.md b/README.md index 4e9493c..72f49e4 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ DwgIO is a .NET library and command line tool that reads Autodesk AutoCAD drawin - Converts a drawing into a neutral [IOScene](https://www.nuget.org/packages/IOScene) scene document (`DwgIO.Scene` package): geometry in metres, ACI entity colours, one element per entity with its handle. - Exports the scene to Wavefront OBJ (with an MTL colour library) and binary glTF (GLB). - Draws model space to SVG (`dwgio svg`): LINE, CIRCLE, ARC and POINT in the top view, in their ACI colours. +- Writes a standalone interactive 3D HTML viewer (`.html`): the WebGL viewer of [IOViewer](https://github.com/IOExtend/IOViewer) embedded with the scene, no server or external scripts. ## Install @@ -78,6 +79,12 @@ Draw model space to SVG (X to the right, Y up, ACI colours; `--scale` sets pixel dwgio svg drawing.dwg drawing.svg --scale 2 ``` +Open the drawing in a standalone interactive 3D HTML viewer: + +```sh +dwgio drawing.dwg drawing.html +``` + Errors go to standard error. ### Exit codes @@ -150,6 +157,7 @@ The documentation site with the API reference is at Print version + section table dwgio Export metadata, section catalog and entities to JSON, - or the scene to OBJ (.obj) or GLB (.glb) + or the scene to OBJ (.obj), GLB (.glb) or a standalone + interactive 3D HTML viewer (.html) dwgio extract
Write a named section's decompressed bytes dwgio preview Write the embedded thumbnail image dwgio scene [--unit u] Export a neutral IOScene scene document @@ -187,6 +188,11 @@ private static int Export(string[] args) var glbResult = DwgSceneExport.SaveGlb(doc, output); Console.WriteLine($"{doc.Version} elements={glbResult.ElementCount} ({glbResult.ElementsWithGeometry} with geometry) -> {output}"); } + else if (Path.GetExtension(output).Equals(".html", StringComparison.OrdinalIgnoreCase)) + { + var htmlResult = DwgViewerExport.SaveViewer(doc, output); + Console.WriteLine($"{doc.Version} elements={htmlResult.ElementCount} ({htmlResult.ElementsWithGeometry} with geometry) -> {output}"); + } else { DwgJsonExporter.WriteFile(doc, output, DwgJsonExportOptions.Default); diff --git a/src/DwgIO.Scene/DwgIO.Scene.csproj b/src/DwgIO.Scene/DwgIO.Scene.csproj index 33967db..c333a16 100644 --- a/src/DwgIO.Scene/DwgIO.Scene.csproj +++ b/src/DwgIO.Scene/DwgIO.Scene.csproj @@ -12,6 +12,7 @@ + diff --git a/src/DwgIO.Scene/DwgViewerExport.cs b/src/DwgIO.Scene/DwgViewerExport.cs new file mode 100644 index 0000000..aa86662 --- /dev/null +++ b/src/DwgIO.Scene/DwgViewerExport.cs @@ -0,0 +1,67 @@ +using IOViewer.Exporters; +using IOScene; + +namespace DwgIO.Scene; + +/// +/// Exports a drawing as a standalone interactive 3D HTML viewer: one self-contained file with the scene and the +/// WebGL viewer runtime embedded, no server and no external scripts. The viewer is generated by +/// IOViewer from the IOScene scene document, so the +/// drawing shows exactly what the scene JSON and the OBJ/GLB exports describe. +/// +public static class DwgViewerExport +{ + /// Converts the drawing and writes it to a standalone interactive HTML viewer file. + /// The drawing, for example from . + /// Path to the HTML file. + /// Scene conversion options; null uses the defaults. + /// Viewer options (title, initial mode, vertex budget); null uses the defaults. + /// The conversion report. is the scene the viewer embeds. + public static DwgSceneResult SaveViewer( + DwgDocument document, + string htmlPath, + DwgSceneOptions? options = null, + HtmlViewerOptions? viewerOptions = null) + { + var result = DwgSceneReader.Read(document, ViewerOptionsFor(document, htmlPath, options)); + WriteViewer(result.Document, htmlPath, viewerOptions); + return result; + } + + /// Writes a scene to a standalone interactive HTML viewer file. + /// The scene to embed. + /// Path to the HTML file. + /// Viewer options; null uses the defaults. + public static void WriteViewer(SceneDocument scene, string htmlPath, HtmlViewerOptions? viewerOptions = null) + { + ArgumentNullException.ThrowIfNull(scene); + ArgumentException.ThrowIfNullOrEmpty(htmlPath); + if (viewerOptions is null) + { + // Default options take their title from the scene; a caller's options are respected as given, + // with an empty title filled from the scene. + viewerOptions = new HtmlViewerOptions { Title = scene.Title }; + } + else if (string.IsNullOrEmpty(viewerOptions.Title)) + { + viewerOptions.Title = scene.Title; + } + + HtmlViewerExporter.Save(scene, htmlPath, viewerOptions); + } + + private static DwgSceneOptions ViewerOptionsFor(DwgDocument document, string path, DwgSceneOptions? options) + { + if (options?.ModelKey is { Length: > 0 }) + { + return options; + } + + // The export file name doubles as the model key; a document from memory falls back to it. + return new DwgSceneOptions + { + LengthUnit = options?.LengthUnit ?? "m", + ModelKey = Path.GetFileName(path), + }; + } +} diff --git a/tests/DwgIO.Tests/DwgViewerExportTests.cs b/tests/DwgIO.Tests/DwgViewerExportTests.cs new file mode 100644 index 0000000..9ae16b6 --- /dev/null +++ b/tests/DwgIO.Tests/DwgViewerExportTests.cs @@ -0,0 +1,97 @@ +using DwgIO.Model; +using DwgIO.Scene; +using Xunit; + +namespace DwgIO.Tests; + +public class DwgViewerExportTests : IDisposable +{ + private readonly string _directory = Path.Combine(Path.GetTempPath(), "dwgio-tests-" + Guid.NewGuid().ToString("N")); + + public DwgViewerExportTests() + { + Directory.CreateDirectory(_directory); + } + + public void Dispose() + { + GC.SuppressFinalize(this); + try + { + Directory.Delete(_directory, recursive: true); + } + catch (DirectoryNotFoundException) + { + } + } + + private static DwgDocument CreateDocument(params DwgEntity[] entities) => + new( + "synthetic.dwg", + new DwgFileHeader + { + Version = new DwgVersionInfo + { + Magic = "AC1024", + Release = "R2010", + Family = DwgContainerFamily.R2004Family, + Year = 2010, + }, + MaintenanceVersion = 0, + PreviewOffset = 0, + Codepage = 30, + }, + entities); + + private static DwgDocument SampleDrawing() => CreateDocument( + new DwgEntity + { + Handle = 0x2A, + TypeCode = 0x13, + TypeName = "LINE", + Kind = DwgEntityKind.Line, + Geometry = [0.0, 0.0, 0.0, 10.0, 0.0, 0.0], + ColorIndex = 1, + }, + new DwgEntity + { + Handle = 0x2B, + TypeCode = 0x12, + TypeName = "CIRCLE", + Kind = DwgEntityKind.Circle, + Geometry = [5.0, 0.0, 0.0, 5.0], + ColorIndex = 40, + }); + + [Fact] + public void SaveViewer_WritesSelfContainedHtml() + { + string htmlPath = Environment.GetEnvironmentVariable("DWGIO_VIEWER_DEBUG_PATH") is { Length: > 0 } debug + ? debug + : Path.Combine(_directory, "drawing.html"); + + var result = DwgViewerExport.SaveViewer(SampleDrawing(), htmlPath); + + Assert.Equal(2, result.ElementCount); + string html = File.ReadAllText(htmlPath); + // A standalone viewer: the WebGL runtime is embedded, no external script or stylesheet is referenced. + Assert.Contains("", html, StringComparison.OrdinalIgnoreCase); + Assert.Contains("canvas", html, StringComparison.Ordinal); + Assert.DoesNotContain("", metaStart, StringComparison.Ordinal); + using var metadata = JsonDocument.Parse(html[metaStart..metaEnd]); + Assert.Equal(3, metadata.RootElement.GetProperty("geometries").GetArrayLength()); Assert.Contains("id=\"ioviewer-bin\"", html, StringComparison.Ordinal); } diff --git a/tests/DwgIO.Tests/EncryptedSectionTests.cs b/tests/DwgIO.Tests/EncryptedSectionTests.cs index 04ceb06..8dba824 100644 --- a/tests/DwgIO.Tests/EncryptedSectionTests.cs +++ b/tests/DwgIO.Tests/EncryptedSectionTests.cs @@ -7,7 +7,9 @@ namespace DwgIO.Tests; /// A section map with an encrypted entry: the section is skipped with a diagnostic, not silently (#38). public class EncryptedSectionTests { - private static DwgDocument CreateDocument(params SectionEntry[] entries) + private static DwgDocument CreateDocument(params SectionEntry[] entries) => CreateDocument(readMetadata: false, entries); + + private static DwgDocument CreateDocument(bool readMetadata, params SectionEntry[] entries) { var container = new R2004Container { @@ -52,7 +54,7 @@ private static DwgDocument CreateDocument(params SectionEntry[] entries) PreviewOffset = 0, Codepage = 30, }, - new DwgReaderOptions { ReadSummaryInfo = false, ReadMetadata = false, ReadObjects = false }); + new DwgReaderOptions { ReadSummaryInfo = false, ReadMetadata = readMetadata, ReadObjects = false }); return document; } @@ -69,6 +71,20 @@ private static DwgDocument CreateDocument(params SectionEntry[] entries) }; + [Theory] + [InlineData(0u)] + [InlineData(1u)] + public void PreviewCommand_WhenSectionCannotBeRead_ReturnsParseError(uint encryption) + { + var document = CreateDocument(readMetadata: true, Section("AcDb:Preview", encryption)); + using var output = new StringWriter(); + using var error = new StringWriter(); + + Assert.Equal(4, Cli.Program.PreviewDocument(document, "unused", output, error)); + Assert.Contains("AcDb:Preview:", error.ToString(), StringComparison.Ordinal); + Assert.Empty(output.ToString()); + } + [Fact] public void TryGetReadableSection_EncryptedEntry_IsSkippedWithADiagnostic() { diff --git a/tests/DwgIO.Tests/EntityTypeTests.cs b/tests/DwgIO.Tests/EntityTypeTests.cs index e1142e4..69931f5 100644 --- a/tests/DwgIO.Tests/EntityTypeTests.cs +++ b/tests/DwgIO.Tests/EntityTypeTests.cs @@ -25,6 +25,7 @@ public void DrawableFixedCodes_AreEntities(ushort typeCode) [Theory] [InlineData(0x00)] // UNUSED + [InlineData(0x09)] // reserved in the supported versions [InlineData(0x30)] // BLOCK CONTROL OBJ public void ObjectsAndOutOfRangeCodes_AreNotEntities(ushort typeCode) { diff --git a/tests/DwgIO.Tests/HistorySectionsTests.cs b/tests/DwgIO.Tests/HistorySectionsTests.cs index 8a63859..7c938ba 100644 --- a/tests/DwgIO.Tests/HistorySectionsTests.cs +++ b/tests/DwgIO.Tests/HistorySectionsTests.cs @@ -93,10 +93,9 @@ public void AuxHeader_ParsesTheFixedLayout() Assert.Equal(0x2Bul, aux.Handseed); Assert.Equal(2460311u, aux.CreatedRaw.JulianDay); Assert.Equal(43200000u, aux.CreatedRaw.Milliseconds); - Assert.NotNull(aux.CreatedUtc); - Assert.InRange(aux.CreatedUtc!.Value.Year, 2020, 2030); - Assert.NotNull(aux.ModifiedUtc); - Assert.InRange(aux.ModifiedUtc!.Value.Year, 2020, 2030); + var midnight = new DateTime(2024, 1, 1, 0, 0, 0, DateTimeKind.Utc); + Assert.Equal(midnight.AddHours(12), aux.CreatedUtc); + Assert.Equal(midnight.AddDays(1).AddMilliseconds(-1), aux.ModifiedUtc); } [Fact] @@ -126,53 +125,6 @@ public void AuxHeader_Truncated_Throws() Assert.Throws(() => AuxHeaderParser.Parse(new byte[50])); } - // ------------------------------------------------------------------ AppInfoHistory - - [Fact] - public void AppInfoHistory_WalksTheRecordSequence() - { - var data = new List(); - WriteAnsiAppInfo(data, "AppInfoDataList", "1.0", "First"); - WriteAnsiAppInfo(data, "AppInfoDataList", "2.0", "Second"); - - var diagnostics = new List(); - var records = AppInfoHistoryParser.Parse([.. data], 30, diagnostics.Add); - - Assert.Equal(2, records.Count); - Assert.Equal("1.0", records[0].Version); - Assert.Equal("2.0", records[1].Version); - Assert.Empty(diagnostics); - } - - [Fact] - public void AppInfoHistory_TruncatedTail_IsReported() - { - var data = new List(); - WriteAnsiAppInfo(data, "AppInfoDataList", "1.0", "First"); - data.AddRange([0x00, 0x00]); // two trailing bytes: too small for a record - - var diagnostics = new List(); - var records = AppInfoHistoryParser.Parse([.. data], 30, diagnostics.Add); - - Assert.Single(records); - Assert.Contains(diagnostics, d => d.Contains("too small for a record", StringComparison.Ordinal)); - } - - [Fact] - public void AppInfoHistory_BrokenRecord_IsReported() - { - var data = new List(); - WriteAnsiAppInfo(data, "AppInfoDataList", "1.0", "First"); - // A record whose string runs past the payload. - data.AddRange([0x20, 0x00, (byte)'x', (byte)'y']); - - var diagnostics = new List(); - var records = AppInfoHistoryParser.Parse([.. data], 30, diagnostics.Add); - - Assert.Single(records); - Assert.Contains(diagnostics, d => d.Contains("does not decode", StringComparison.Ordinal)); - } - private static void WriteAnsiString16(List data, string text) { var bytes = System.Text.Encoding.ASCII.GetBytes(text); @@ -180,13 +132,4 @@ private static void WriteAnsiString16(List data, string text) data.AddRange(bytes); data.Add(0); } - - private static void WriteAnsiAppInfo(List data, string name, string version, string product) - { - WriteAnsiString16(data, name); - data.AddRange([0x00, 0x00, 0x00, 0x00]); // u32 marker/unknown word - WriteAnsiString16(data, string.Empty); - WriteAnsiString16(data, $""); - WriteAnsiString16(data, version); - } } diff --git a/tests/DwgIO.Tests/JsonExporterTests.cs b/tests/DwgIO.Tests/JsonExporterTests.cs index 7ab59d9..11afcaa 100644 --- a/tests/DwgIO.Tests/JsonExporterTests.cs +++ b/tests/DwgIO.Tests/JsonExporterTests.cs @@ -35,6 +35,29 @@ private static DwgEntity CreateEntity(double[] geometry) => Geometry = geometry, }; + [Fact] + public void Write_LeavesObjectTypeCodesAndAddsNames() + { + var header = new DwgFileHeader + { + Version = DwgVersionInfo.FromMagic("AC1032"u8.ToArray()), + Codepage = 30, MaintenanceVersion = 0, PreviewOffset = 0, + }; + var item = new DwgObjectInfo + { + TypeCode = 0x13, Handle = 1, StreamHandle = new DwgHandle(0, 1, 1), + StreamOffset = 4, SizeBytes = 2, BitsStart = 6, BitsLength = 16, + }; + var document = new DwgDocument("synthetic.dwg", header, [], objects: [item]); + using var buffer = new MemoryStream(); + DwgJsonExporter.Write(document, buffer, DwgJsonExportOptions.Default); + using var json = JsonDocument.Parse(buffer.ToArray()); + var objects = json.RootElement.GetProperty("objects"); + + Assert.Equal(1, objects.GetProperty("byType").GetProperty("13").GetInt32()); + Assert.Equal(1, objects.GetProperty("byTypeName").GetProperty("LINE").GetInt32()); + } + [Fact] public void Write_NonFiniteGeometry_WritesNullAndRecordsDiagnostic() { diff --git a/tests/DwgIO.Tests/MetadataParserTests.cs b/tests/DwgIO.Tests/MetadataParserTests.cs index c7dc503..c957281 100644 --- a/tests/DwgIO.Tests/MetadataParserTests.cs +++ b/tests/DwgIO.Tests/MetadataParserTests.cs @@ -156,6 +156,18 @@ public void AppInfo_Product_ComesFromTheXmlNameAttribute() Assert.Equal("AutoCAD", appInfo.Product); } + [Theory] + [InlineData("", "AutoCAD")] + [InlineData("", "AutoCAD LT")] + [InlineData("", "A & B")] + [InlineData("", "Writer")] + public void AppInfo_Product_HandlesXmlAttributeForms(string xml, string expected) + { + var data = BuildUnicodeAppInfo("AppInfoDataList", (ProductXmlEntryId, xml)); + + Assert.Equal(expected, AppInfoParser.Parse(data, 30).Product); + } + [Fact] public void AppInfo_Product_IsEmptyWithoutANameAttribute() { diff --git a/tests/DwgIO.Tests/ObjectStreamGapTests.cs b/tests/DwgIO.Tests/ObjectStreamGapTests.cs index e9e1840..cde7768 100644 --- a/tests/DwgIO.Tests/ObjectStreamGapTests.cs +++ b/tests/DwgIO.Tests/ObjectStreamGapTests.cs @@ -70,6 +70,21 @@ public void Walk_ZeroGapWithoutMap_EndsCleanly() Assert.Empty(diagnostics); } + [Fact] + public void CountUnreachedObjects_UsesBothHandleAndOffset() + { + var stream = new RecordBitWriter(); + stream.WriteRecord(r => r.WriteLineRecord()); + var objects = ObjectStreamWalker.Walk(stream.ToArray(), r2010Plus: true); + var item = Assert.Single(objects); + var map = new DwgHandleMap + { + Entries = [new DwgHandleMapEntry(item.Handle, (ulong)item.StreamOffset + 1)], + }; + + Assert.Equal(1, DwgDocument.CountUnreachedObjects(objects, map)); + } + [Fact] public void Walk_TruncatedTailWithoutRecovery_ReportsTheStop() { diff --git a/tests/DwgIO.Tests/OpenStreamTests.cs b/tests/DwgIO.Tests/OpenStreamTests.cs index 71423f8..2a5272e 100644 --- a/tests/DwgIO.Tests/OpenStreamTests.cs +++ b/tests/DwgIO.Tests/OpenStreamTests.cs @@ -99,22 +99,19 @@ public void Open_Stream_DefaultName_IsStream() private static string Core(string message) => message[(message.IndexOf(": ", StringComparison.Ordinal) + 2)..]; [SkippableFact] - public void Open_Stream_MatchesPath_OnEveryAvailableDrawing() + public void Open_Stream_MatchesPath_OnEveryAvailableDrawing() => DwgFixtureTests.CheckAll(path => { - // The same-results gate of #37; runs when private drawings are available (see docs/test-fixtures.md). - foreach (string path in TestFiles.DwgFiles()) - { - var fromPath = DwgDocument.Open(path, new DwgReaderOptions { ReadObjects = true }); - byte[] bytes = File.ReadAllBytes(path); - using var stream = new MemoryStream(bytes); - var fromStream = DwgDocument.Open(stream, Path.GetFileName(path), new DwgReaderOptions { ReadObjects = true }); - - Assert.Equal(fromPath.Version.Magic, fromStream.Version.Magic); - Assert.Equal(fromPath.FileSize, fromStream.FileSize); - Assert.Equal(fromPath.Sections.Count, fromStream.Sections.Count); - Assert.Equal(fromPath.Objects.Count, fromStream.Objects.Count); - Assert.Equal(fromPath.Entities.Count, fromStream.Entities.Count); - Assert.Equal(fromPath.Diagnostics.Count, fromStream.Diagnostics.Count); - } - } + var fromPath = DwgDocument.Open(path); + using var stream = File.OpenRead(path); + var fromStream = DwgDocument.Open(stream, path); + using var fileJson = new MemoryStream(); + using var streamJson = new MemoryStream(); + Json.DwgJsonExporter.Write(fromPath, fileJson, Json.DwgJsonExportOptions.Default); + Json.DwgJsonExporter.Write(fromStream, streamJson, Json.DwgJsonExportOptions.Default); + + Assert.Equal(fromPath.Diagnostics, fromStream.Diagnostics); + Assert.True(fileJson.GetBuffer().AsSpan(0, (int)fileJson.Length) + .SequenceEqual(streamJson.GetBuffer().AsSpan(0, (int)streamJson.Length))); + return true; + }, "a readable container"); } From 22b3cfc3fce40bfbf99c924504761179ac59c55a Mon Sep 17 00:00:00 2001 From: mahach666 Date: Fri, 20 Nov 2026 04:38:29 +0300 Subject: [PATCH 18/18] Apply protected ACL fixtures to both OBJ output files --- tests/DwgIO.Tests/DwgSceneExportTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/DwgIO.Tests/DwgSceneExportTests.cs b/tests/DwgIO.Tests/DwgSceneExportTests.cs index 1d317d3..9402f1e 100644 --- a/tests/DwgIO.Tests/DwgSceneExportTests.cs +++ b/tests/DwgIO.Tests/DwgSceneExportTests.cs @@ -232,13 +232,13 @@ public void SaveObj_Overwrite_PreservesBothFilesAccessRules() if (OperatingSystem.IsWindows()) { var user = System.Security.Principal.WindowsIdentity.GetCurrent().User!; - var acl = new System.Security.AccessControl.FileSecurity(); - acl.SetAccessRuleProtection(true, preserveInheritance: false); - acl.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule(user, - System.Security.AccessControl.FileSystemRights.FullControl, - System.Security.AccessControl.AccessControlType.Allow)); foreach (string path in paths) { + var acl = new System.Security.AccessControl.FileSecurity(); + acl.SetAccessRuleProtection(true, preserveInheritance: false); + acl.AddAccessRule(new System.Security.AccessControl.FileSystemAccessRule(user, + System.Security.AccessControl.FileSystemRights.FullControl, + System.Security.AccessControl.AccessControlType.Allow)); new FileInfo(path).SetAccessControl(acl); }