From ea3d18595a610ee07b03f07af4f03cf75b5ab420 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Wed, 29 Nov 2017 14:08:08 -0800 Subject: Improved cabinet handling --- src/WixToolset.Core.Native/CabinetCompressFile.cs | 65 +++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 src/WixToolset.Core.Native/CabinetCompressFile.cs (limited to 'src/WixToolset.Core.Native/CabinetCompressFile.cs') diff --git a/src/WixToolset.Core.Native/CabinetCompressFile.cs b/src/WixToolset.Core.Native/CabinetCompressFile.cs new file mode 100644 index 00000000..6778f4a1 --- /dev/null +++ b/src/WixToolset.Core.Native/CabinetCompressFile.cs @@ -0,0 +1,65 @@ +// 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 +{ + /// + /// Information to compress file into a cabinet. + /// + public sealed class CabinetCompressFile + { + /// + /// Cabinet compress file. + /// + /// Path to file to add. + /// The token for the file. + public CabinetCompressFile(string path, string token) + { + this.Path = path; + this.Token = token; + this.Hash = null; + } + + /// + /// Cabinet compress file. + /// + /// Path to file to add. + /// The token for the file. + /// Hash 1 + /// Hash 2 + /// Hash 3 + /// Hash 4 + public CabinetCompressFile(string path, string token, int hash1, int hash2, int hash3, int hash4) + { + this.Path = path; + this.Token = token; + this.Hash = new[] { hash1, hash2, hash3, hash4 }; + } + + /// + /// Gets the path to the file to compress. + /// + public string Path { get; } + + /// + /// Gets the token for the file to compress. + /// + public string Token { get; } + + /// + /// Gets the hash of the file to compress. + /// + public int[] Hash { get; } + + internal string ToWixNativeStdinLine() + { + if (this.Hash == null) + { + return $"{this.Path}\t{this.Token}"; + } + else + { + return $"{this.Path}\t{this.Token}\t{this.Hash[0]}\t{this.Hash[1]}\t{this.Hash[2]}\t{this.Hash[3]}"; + } + } + } +} -- cgit v1.2.3-55-g6feb