// 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]}";
}
}
}
}