forked from dotnet/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResolvedFile.cs
61 lines (54 loc) · 1.7 KB
/
ResolvedFile.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.IO;
using System;
namespace Microsoft.NET.Build.Tasks
{
internal enum AssetType
{
None,
Runtime,
Native,
Resources
}
internal class ResolvedFile
{
public string SourcePath { get; }
public string DestinationSubDirectory { get; }
public AssetType Asset{ get; }
public string FileName
{
get { return Path.GetFileName(SourcePath); }
}
public string DestinationSubPath
{
get
{
return string.IsNullOrEmpty(DestinationSubDirectory) ?
FileName :
Path.Combine(DestinationSubDirectory, FileName);
}
}
public ResolvedFile(string sourcePath, string destinationSubDirectory, AssetType assetType = AssetType.None)
{
SourcePath = Path.GetFullPath(sourcePath);
DestinationSubDirectory = destinationSubDirectory;
Asset = assetType;
}
public override bool Equals(object obj)
{
ResolvedFile other = obj as ResolvedFile;
return other != null &&
other.Asset == Asset &&
other.SourcePath == SourcePath &&
other.DestinationSubDirectory == DestinationSubDirectory;
}
public override int GetHashCode()
{
unchecked
{
return SourcePath.GetHashCode() + DestinationSubDirectory.GetHashCode();
}
}
}
}