-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c72b6fe
commit d1cdff9
Showing
21 changed files
with
561 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace TailBlazer.Domain.FileHandling | ||
{ | ||
public class RecentFile : IEquatable<RecentFile> | ||
{ | ||
public DateTime Timestamp { get; } | ||
public string Name { get; } | ||
|
||
public RecentFile(FileInfo fileInfo) | ||
{ | ||
Name = fileInfo.FullName; | ||
Timestamp = DateTime.Now; | ||
} | ||
|
||
public RecentFile(DateTime timestamp, string name) | ||
{ | ||
Timestamp = timestamp; | ||
Name = name; | ||
} | ||
|
||
#region Equality | ||
|
||
public bool Equals(RecentFile other) | ||
{ | ||
if (ReferenceEquals(null, other)) return false; | ||
if (ReferenceEquals(this, other)) return true; | ||
return Timestamp.Equals(other.Timestamp) && string.Equals(Name, other.Name); | ||
} | ||
|
||
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((RecentFile) obj); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
unchecked | ||
{ | ||
return (Timestamp.GetHashCode()*397) ^ (Name != null ? Name.GetHashCode() : 0); | ||
} | ||
} | ||
|
||
public static bool operator ==(RecentFile left, RecentFile right) | ||
{ | ||
return Equals(left, right); | ||
} | ||
|
||
public static bool operator !=(RecentFile left, RecentFile right) | ||
{ | ||
return !Equals(left, right); | ||
} | ||
|
||
#endregion | ||
|
||
public override string ToString() | ||
{ | ||
return $"{Name} ({Timestamp})"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.