From dbfd015eccc20d69e758dfbe16b07327717a5072 Mon Sep 17 00:00:00 2001 From: Salih Date: Mon, 13 Nov 2023 15:41:14 +0300 Subject: [PATCH] Update BundleFile.cs --- .../AspNetCore/Mvc/UI/Bundling/BundleFile.cs | 61 ++++++++++++++++++- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs index fbd6c3eaa1..53fceef714 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling.Abstractions/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleFile.cs @@ -2,11 +2,11 @@ using System; namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling; -public class BundleFile +public class BundleFile : IEquatable, IComparable { - public string FileName { get; set; } + public string FileName { get; } - public bool IsExternalFile { get; set; } + public bool IsExternalFile { get; } public BundleFile(string fileName) { @@ -28,4 +28,59 @@ public class BundleFile { return new BundleFile(fileName); } + + public bool Equals(BundleFile? other) + { + if (ReferenceEquals(null, other)) + { + return false; + } + + if (ReferenceEquals(this, other)) + { + return true; + } + + return FileName == other.FileName; + } + + public override bool Equals(object? obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != this.GetType()) + { + return false; + } + + return Equals((BundleFile)obj); + } + + public override int GetHashCode() + { + return FileName.GetHashCode(); + } + + public int CompareTo(BundleFile? other) + { + if (ReferenceEquals(this, other)) + { + return 0; + } + + if (ReferenceEquals(null, other)) + { + return 1; + } + + return string.Compare(FileName, other.FileName, StringComparison.Ordinal); + } }