User shared data types from WixToolset.Data
This commit is contained in:
Родитель
26b1860dcd
Коммит
36cfc9509c
|
@ -2,6 +2,7 @@
|
|||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="wixtoolset-data" value="https://ci.appveyor.com/nuget/wixtoolset-data" />
|
||||
<add key="wixtoolset-dutil" value="https://ci.appveyor.com/nuget/wixtoolset-dutil" />
|
||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
|
||||
</packageSources>
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace WixToolset.Core.Native
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WixToolset.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper class around interop with wixcab.dll to compress files into a cabinet.
|
||||
|
@ -29,7 +30,7 @@ namespace WixToolset.Core.Native
|
|||
/// <param name="maxFiles">Maximum number of files that will be added to cabinet.</param>
|
||||
/// <param name="maxSize">Maximum size of cabinet.</param>
|
||||
/// <param name="maxThresh">Maximum threshold for each cabinet.</param>
|
||||
public void Compress(IEnumerable<CabinetCompressFile> files, CabinetCompressionLevel compressionLevel, int maxSize = 0, int maxThresh = 0)
|
||||
public void Compress(IEnumerable<CabinetCompressFile> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Compression level to use when creating cabinet.
|
||||
/// </summary>
|
||||
public enum CabinetCompressionLevel
|
||||
{
|
||||
/// <summary>Use no compression.</summary>
|
||||
None,
|
||||
|
||||
/// <summary>Use low compression.</summary>
|
||||
Low,
|
||||
|
||||
/// <summary>Use medium compression.</summary>
|
||||
Medium,
|
||||
|
||||
/// <summary>Use high compression.</summary>
|
||||
High,
|
||||
|
||||
/// <summary>Use ms-zip compression.</summary>
|
||||
Mszip
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
|
@ -8,6 +8,10 @@
|
|||
<!-- <BeforePack>SetNuspecProperties</BeforePack> -->
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
<ProjectReference Include="..\..\WixToolset.Core.Native\WixToolset.Core.Native.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="WixToolset.Data" Version="4.0.*" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче