Skip to content

Commit fd33799

Browse files
author
LoneWandererProductions
committed
some small format stuff
1 parent 0c5d280 commit fd33799

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

FileHandler/FileDetails.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@
99
// ReSharper disable MemberCanBeInternal, no it will be used externally
1010
// ReSharper disable UnusedAutoPropertyAccessor.Global
1111

12+
using System.Diagnostics;
13+
1214
namespace FileHandler
1315
{
1416
/// <summary>
1517
/// The file details class.
1618
/// </summary>
19+
[DebuggerDisplay("{ToString(),nq}")]
1720
public sealed class FileDetails
1821
{
1922
/// <summary>
@@ -65,5 +68,20 @@ public sealed class FileDetails
6568
/// Gets or sets the product version.
6669
/// </summary>
6770
public string ProductVersion { get; internal init; }
71+
72+
/// <summary>
73+
/// Returns a string representation of the file details.
74+
/// </summary>
75+
/// <returns>
76+
/// A <see cref="System.String" /> that represents this instance.
77+
/// </returns>
78+
public override string ToString()
79+
{
80+
return $"{FileName}{(string.IsNullOrEmpty(Extension) ? "" : "." + Extension)} " +
81+
$"[{Size} bytes]" +
82+
$"{(!string.IsNullOrEmpty(ProductName) ? $" - {ProductName}" : "")}" +
83+
$"{(!string.IsNullOrEmpty(FileVersion) ? $" v{FileVersion}" : "")}" +
84+
$"{(!string.IsNullOrEmpty(CompanyName) ? $" by {CompanyName}" : "")}";
85+
}
6886
}
6987
}

0 commit comments

Comments
 (0)