JD2022-TU1/main/tools/apps/Orbit.AfterEffects/DTOs/AfterEffectsAsset.cs

88 lines
No EOL
3.1 KiB
C#

using System.IO;
using JD.Shotgun.Service.ShotgunEntities;
namespace Orbit.AfterEffects.DTOs
{
public class AfterEffectsAsset
{
public string AssetName { get; }
public string MapName { get; }
public string MapOpusName { get; }
public ShotgunProductionStudio MapProductionStudio { get; }
public ShotgunAssetType AssetType { get; }
public string ThumbnailUrl { get; }
public string FilePath { get; }
public string FileName { get; }
public string NasProjectCodeName { get; }
public static AfterEffectsAsset Empty { get; } = new AfterEffectsAsset(string.Empty, string.Empty, string.Empty, string.Empty, ShotgunProductionStudio.Paris, ShotgunAssetType.Unknown, string.Empty, string.Empty);
public AfterEffectsAsset(string assetName, string mapName, string mapOpusName, string nasProjectCodeName, ShotgunProductionStudio mapProductionStudio, ShotgunAssetType assetType, string thumbnailUrl, string filePath)
{
AssetName = assetName ?? string.Empty;
MapName = mapName ?? string.Empty;
MapOpusName = mapOpusName ?? string.Empty;
NasProjectCodeName = nasProjectCodeName ?? string.Empty;
MapProductionStudio = mapProductionStudio;
AssetType = assetType;
ThumbnailUrl = thumbnailUrl ?? string.Empty;
FilePath = filePath ?? string.Empty;
FileName = Path.GetFileName(FilePath);
}
public override string ToString()
{
return AssetName;
}
public override bool Equals(object obj)
{
return obj is AfterEffectsAsset asset &&
AssetName == asset.AssetName &&
MapName == asset.MapName &&
MapOpusName == asset.MapOpusName &&
NasProjectCodeName == asset.NasProjectCodeName &&
MapProductionStudio == asset.MapProductionStudio &&
AssetType == asset.AssetType &&
ThumbnailUrl == asset.ThumbnailUrl &&
FilePath == asset.FilePath;
}
public override int GetHashCode()
{
var hashCode = 585312610;
hashCode ^= AssetName.GetHashCode();
hashCode ^= MapName.GetHashCode();
hashCode ^= MapOpusName.GetHashCode();
hashCode ^= NasProjectCodeName.GetHashCode();
hashCode ^= MapProductionStudio.GetHashCode();
hashCode ^= AssetType.GetHashCode();
hashCode ^= ThumbnailUrl.GetHashCode();
hashCode ^= FilePath.GetHashCode();
return hashCode;
}
public static bool operator ==(AfterEffectsAsset asset1, AfterEffectsAsset asset2)
{
if (ReferenceEquals(asset1, null))
{
return ReferenceEquals(asset2, null);
}
return asset1.Equals(asset2);
}
public static bool operator !=(AfterEffectsAsset asset1, AfterEffectsAsset asset2)
{
return !(asset1 == asset2);
}
}
}