aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2019-05-23 16:29:55 -0700
committerRob Mensching <rob@firegiant.com>2019-05-23 16:34:09 -0700
commit36cfc9509cb6a364f58531ff41eae16243091a3c (patch)
tree7e88ad0e1bea778a35dc393d0d62b889e15eea8d /src
parent26b1860dcd8a84b410ab5cd3df7e37104e6ee1b1 (diff)
downloadwix-36cfc9509cb6a364f58531ff41eae16243091a3c.tar.gz
wix-36cfc9509cb6a364f58531ff41eae16243091a3c.tar.bz2
wix-36cfc9509cb6a364f58531ff41eae16243091a3c.zip
User shared data types from WixToolset.Data
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core.Native/Cabinet.cs6
-rw-r--r--src/WixToolset.Core.Native/CabinetCompressionLevel.cs25
-rw-r--r--src/WixToolset.Core.Native/WixToolset.Core.Native.csproj6
-rw-r--r--src/test/WixToolsetTest.Core.Native/CabinetFixture.cs6
-rw-r--r--src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj4
5 files changed, 15 insertions, 32 deletions
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
5 using System; 5 using System;
6 using System.Collections.Generic; 6 using System.Collections.Generic;
7 using System.Linq; 7 using System.Linq;
8 using WixToolset.Data;
8 9
9 /// <summary> 10 /// <summary>
10 /// Wrapper class around interop with wixcab.dll to compress files into a cabinet. 11 /// Wrapper class around interop with wixcab.dll to compress files into a cabinet.
@@ -29,7 +30,7 @@ namespace WixToolset.Core.Native
29 /// <param name="maxFiles">Maximum number of files that will be added to cabinet.</param> 30 /// <param name="maxFiles">Maximum number of files that will be added to cabinet.</param>
30 /// <param name="maxSize">Maximum size of cabinet.</param> 31 /// <param name="maxSize">Maximum size of cabinet.</param>
31 /// <param name="maxThresh">Maximum threshold for each cabinet.</param> 32 /// <param name="maxThresh">Maximum threshold for each cabinet.</param>
32 public void Compress(IEnumerable<CabinetCompressFile> files, CabinetCompressionLevel compressionLevel, int maxSize = 0, int maxThresh = 0) 33 public void Compress(IEnumerable<CabinetCompressFile> files, CompressionLevel compressionLevel, int maxSize = 0, int maxThresh = 0)
33 { 34 {
34 var compressionLevelVariable = Environment.GetEnvironmentVariable(CompressionLevelVariable); 35 var compressionLevelVariable = Environment.GetEnvironmentVariable(CompressionLevelVariable);
35 36
@@ -38,8 +39,7 @@ namespace WixToolset.Core.Native
38 { 39 {
39 if (!Enum.TryParse(compressionLevelVariable, true, out compressionLevel)) 40 if (!Enum.TryParse(compressionLevelVariable, true, out compressionLevel))
40 { 41 {
41 //throw new WixException(WixErrors.IllegalEnvironmentVariable(CompressionLevelVariable, compressionLevelVariable)); 42 throw new WixException(ErrorMessages.IllegalEnvironmentVariable(CompressionLevelVariable, compressionLevelVariable));
42 throw new ArgumentException();
43 } 43 }
44 } 44 }
45 45
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 @@
1// 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.
2
3namespace WixToolset.Core.Native
4{
5 /// <summary>
6 /// Compression level to use when creating cabinet.
7 /// </summary>
8 public enum CabinetCompressionLevel
9 {
10 /// <summary>Use no compression.</summary>
11 None,
12
13 /// <summary>Use low compression.</summary>
14 Low,
15
16 /// <summary>Use medium compression.</summary>
17 Medium,
18
19 /// <summary>Use high compression.</summary>
20 High,
21
22 /// <summary>Use ms-zip compression.</summary>
23 Mszip
24 }
25} \ 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 @@
1<Project Sdk="Microsoft.NET.Sdk"> 1<Project Sdk="Microsoft.NET.Sdk">
2 2
3 <PropertyGroup> 3 <PropertyGroup>
4 <TargetFramework>netstandard2.0</TargetFramework> 4 <TargetFramework>netstandard2.0</TargetFramework>
@@ -9,6 +9,10 @@
9 </PropertyGroup> 9 </PropertyGroup>
10 10
11 <ItemGroup> 11 <ItemGroup>
12 <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
13 </ItemGroup>
14
15 <ItemGroup>
12 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" /> 16 <PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
13 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> 17 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
14 </ItemGroup> 18 </ItemGroup>
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 @@
2 2
3namespace WixToolsetTest.CoreNative 3namespace WixToolsetTest.CoreNative
4{ 4{
5 using System;
6 using System.IO; 5 using System.IO;
7 using System.Linq; 6 using System.Linq;
8 using WixToolset.Core.Native; 7 using WixToolset.Core.Native;
9 using WixToolsetTest.CoreNative.Utility; 8 using WixToolsetTest.CoreNative.Utility;
9 using WixToolset.Data;
10 using Xunit; 10 using Xunit;
11 11
12 public class CabinetFixture 12 public class CabinetFixture
@@ -22,7 +22,7 @@ namespace WixToolsetTest.CoreNative
22 var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") }; 22 var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") };
23 23
24 var cabinet = new Cabinet(cabPath); 24 var cabinet = new Cabinet(cabPath);
25 cabinet.Compress(files, CabinetCompressionLevel.Low); 25 cabinet.Compress(files, CompressionLevel.Low);
26 26
27 Assert.True(File.Exists(cabPath)); 27 Assert.True(File.Exists(cabPath));
28 } 28 }
@@ -84,7 +84,7 @@ namespace WixToolsetTest.CoreNative
84 var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") }; 84 var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") };
85 85
86 var cabinet = new Cabinet(cabinetPath); 86 var cabinet = new Cabinet(cabinetPath);
87 cabinet.Compress(files, CabinetCompressionLevel.Low); 87 cabinet.Compress(files, CompressionLevel.Low);
88 } 88 }
89 89
90 // Extract. 90 // 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
@@ -17,6 +17,10 @@
17 </ItemGroup> 17 </ItemGroup>
18 18
19 <ItemGroup> 19 <ItemGroup>
20 <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
21 </ItemGroup>
22
23 <ItemGroup>
20 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> 24 <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
21 <PackageReference Include="xunit" Version="2.4.1" /> 25 <PackageReference Include="xunit" Version="2.4.1" />
22 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> 26 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />