From 36cfc9509cb6a364f58531ff41eae16243091a3c Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Thu, 23 May 2019 16:29:55 -0700 Subject: User shared data types from WixToolset.Data --- src/WixToolset.Core.Native/Cabinet.cs | 6 +++--- .../CabinetCompressionLevel.cs | 25 ---------------------- .../WixToolset.Core.Native.csproj | 6 +++++- .../WixToolsetTest.Core.Native/CabinetFixture.cs | 6 +++--- .../WixToolsetTest.Core.Native.csproj | 4 ++++ 5 files changed, 15 insertions(+), 32 deletions(-) delete mode 100644 src/WixToolset.Core.Native/CabinetCompressionLevel.cs (limited to 'src') diff --git a/src/WixToolset.Core.Native/Cabinet.cs b/src/WixToolset.Core.Native/Cabinet.cs index 27b0ec74..3f5fa715 100644 --- a/src/WixToolset.Core.Native/Cabinet.cs +++ b/src/WixToolset.Core.Native/Cabinet.cs @@ -5,6 +5,7 @@ namespace WixToolset.Core.Native using System; using System.Collections.Generic; using System.Linq; + using WixToolset.Data; /// /// Wrapper class around interop with wixcab.dll to compress files into a cabinet. @@ -29,7 +30,7 @@ namespace WixToolset.Core.Native /// Maximum number of files that will be added to cabinet. /// Maximum size of cabinet. /// Maximum threshold for each cabinet. - public void Compress(IEnumerable files, CabinetCompressionLevel compressionLevel, int maxSize = 0, int maxThresh = 0) + public void Compress(IEnumerable files, CompressionLevel compressionLevel, int maxSize = 0, int maxThresh = 0) { var compressionLevelVariable = Environment.GetEnvironmentVariable(CompressionLevelVariable); @@ -38,8 +39,7 @@ namespace WixToolset.Core.Native { if (!Enum.TryParse(compressionLevelVariable, true, out compressionLevel)) { - //throw new WixException(WixErrors.IllegalEnvironmentVariable(CompressionLevelVariable, compressionLevelVariable)); - throw new ArgumentException(); + throw new WixException(ErrorMessages.IllegalEnvironmentVariable(CompressionLevelVariable, compressionLevelVariable)); } } diff --git a/src/WixToolset.Core.Native/CabinetCompressionLevel.cs b/src/WixToolset.Core.Native/CabinetCompressionLevel.cs deleted file mode 100644 index fce1ff41..00000000 --- a/src/WixToolset.Core.Native/CabinetCompressionLevel.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. - -namespace WixToolset.Core.Native -{ - /// - /// Compression level to use when creating cabinet. - /// - public enum CabinetCompressionLevel - { - /// Use no compression. - None, - - /// Use low compression. - Low, - - /// Use medium compression. - Medium, - - /// Use high compression. - High, - - /// Use ms-zip compression. - Mszip - } -} \ No newline at end of file diff --git a/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj b/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj index c93ff5bc..b4b1082f 100644 --- a/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj +++ b/src/WixToolset.Core.Native/WixToolset.Core.Native.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -8,6 +8,10 @@ + + + + diff --git a/src/test/WixToolsetTest.Core.Native/CabinetFixture.cs b/src/test/WixToolsetTest.Core.Native/CabinetFixture.cs index bc8f0ff8..fba0d5c9 100644 --- a/src/test/WixToolsetTest.Core.Native/CabinetFixture.cs +++ b/src/test/WixToolsetTest.Core.Native/CabinetFixture.cs @@ -2,11 +2,11 @@ namespace WixToolsetTest.CoreNative { - using System; using System.IO; using System.Linq; using WixToolset.Core.Native; using WixToolsetTest.CoreNative.Utility; + using WixToolset.Data; using Xunit; public class CabinetFixture @@ -22,7 +22,7 @@ namespace WixToolsetTest.CoreNative var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") }; var cabinet = new Cabinet(cabPath); - cabinet.Compress(files, CabinetCompressionLevel.Low); + cabinet.Compress(files, CompressionLevel.Low); Assert.True(File.Exists(cabPath)); } @@ -84,7 +84,7 @@ namespace WixToolsetTest.CoreNative var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") }; var cabinet = new Cabinet(cabinetPath); - cabinet.Compress(files, CabinetCompressionLevel.Low); + cabinet.Compress(files, CompressionLevel.Low); } // Extract. diff --git a/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj b/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj index 47396ead..263712bb 100644 --- a/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj +++ b/src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj @@ -16,6 +16,10 @@ + + + + -- cgit v1.2.3-55-g6feb