File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99// ReSharper disable MemberCanBeInternal, no it will be used externally
1010// ReSharper disable UnusedAutoPropertyAccessor.Global
1111
12+ using System . Diagnostics ;
13+
1214namespace 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}
You can’t perform that action at this time.
0 commit comments