User shared data types from WixToolset.Data
Rob Mensching committed
May 23, 2019 at 16:29 UTC
36cfc9509cb6a364f58531ff41eae16243091a3c
6 files changed
+16
-32
nuget.config
+1
@@ -2,6 +2,7 @@
2
<configuration>
3
<packageSources>
4
<clear />
5
+ <add key="wixtoolset-data" value="https://ci.appveyor.com/nuget/wixtoolset-data" />
6
<add key="wixtoolset-dutil" value="https://ci.appveyor.com/nuget/wixtoolset-dutil" />
7
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
8
</packageSources>
src/WixToolset.Core.Native/Cabinet.cs
+3
-3
@@ -5,6 +5,7 @@ namespace WixToolset.Core.Native
5
using System;
6
using System.Collections.Generic;
7
using System.Linq;
8
+ using WixToolset.Data;
9
10
/// <summary>
11
/// Wrapper class around interop with wixcab.dll to compress files into a cabinet.
@@ -29,7 +30,7 @@ namespace WixToolset.Core.Native
30
/// <param name="maxFiles">Maximum number of files that will be added to cabinet.</param>
31
/// <param name="maxSize">Maximum size of 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)
34
{
35
var compressionLevelVariable = Environment.GetEnvironmentVariable(CompressionLevelVariable);
36
@@ -38,8 +39,7 @@ namespace WixToolset.Core.Native
39
{
40
if (!Enum.TryParse(compressionLevelVariable, true, out compressionLevel))
41
{
41
- //throw new WixException(WixErrors.IllegalEnvironmentVariable(CompressionLevelVariable, compressionLevelVariable));
42
- throw new ArgumentException();
42
+ throw new WixException(ErrorMessages.IllegalEnvironmentVariable(CompressionLevelVariable, compressionLevelVariable));
43
}
44
}
45
src/WixToolset.Core.Native/CabinetCompressionLevel.cs
deleted
-25
@@ -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
-
3
-namespace 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
src/WixToolset.Core.Native/WixToolset.Core.Native.csproj
+5
-1
@@ -1,4 +1,4 @@
1
-<Project Sdk="Microsoft.NET.Sdk">
1
+<Project Sdk="Microsoft.NET.Sdk">
2
3
<PropertyGroup>
4
<TargetFramework>netstandard2.0</TargetFramework>
@@ -8,6 +8,10 @@
8
<!-- <BeforePack>SetNuspecProperties</BeforePack> -->
9
</PropertyGroup>
10
11
+ <ItemGroup>
12
+ <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
13
+ </ItemGroup>
14
+
15
<ItemGroup>
16
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
17
<PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
src/test/WixToolsetTest.Core.Native/CabinetFixture.cs
+3
-3
@@ -2,11 +2,11 @@
2
3
namespace WixToolsetTest.CoreNative
4
{
5
- using System;
5
using System.IO;
6
using System.Linq;
7
using WixToolset.Core.Native;
8
using WixToolsetTest.CoreNative.Utility;
9
+ using WixToolset.Data;
10
using Xunit;
11
12
public class CabinetFixture
@@ -22,7 +22,7 @@ namespace WixToolsetTest.CoreNative
22
var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") };
23
24
var cabinet = new Cabinet(cabPath);
25
- cabinet.Compress(files, CabinetCompressionLevel.Low);
25
+ cabinet.Compress(files, CompressionLevel.Low);
26
27
Assert.True(File.Exists(cabPath));
28
}
@@ -84,7 +84,7 @@ namespace WixToolsetTest.CoreNative
84
var files = new[] { new CabinetCompressFile(TestData.Get(@"TestData\test.txt"), "test.txt") };
85
86
var cabinet = new Cabinet(cabinetPath);
87
- cabinet.Compress(files, CabinetCompressionLevel.Low);
87
+ cabinet.Compress(files, CompressionLevel.Low);
88
}
89
90
// Extract.
src/test/WixToolsetTest.Core.Native/WixToolsetTest.Core.Native.csproj
+4
@@ -16,6 +16,10 @@
16
<ProjectReference Include="..\..\WixToolset.Core.Native\WixToolset.Core.Native.csproj" />
17
</ItemGroup>
18
19
+ <ItemGroup>
20
+ <PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
21
+ </ItemGroup>
22
+
23
<ItemGroup>
24
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
25
<PackageReference Include="xunit" Version="2.4.1" />