From 5ee1f55497a4e30322a56f133f897ecde1612967 Mon Sep 17 00:00:00 2001 From: mo Date: Sun, 4 Nov 2018 15:22:16 -0700 Subject: initial commit. --- src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs | 34 +++++++++++++++++++++++ src/Notepad/Domain/FileSystem/IFilePath.cs | 7 +++++ 2 files changed, 41 insertions(+) create mode 100644 src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs create mode 100644 src/Notepad/Domain/FileSystem/IFilePath.cs (limited to 'src/Notepad/Domain/FileSystem') diff --git a/src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs b/src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs new file mode 100644 index 0000000..31ef07b --- /dev/null +++ b/src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs @@ -0,0 +1,34 @@ +namespace Notepad.Domain.FileSystem { + public class AbsoluteFilePath : IFilePath { + private readonly string rawFilePath; + + public AbsoluteFilePath(string rawFilePath) { + this.rawFilePath = rawFilePath; + } + + public string RawPathToFile() { + return rawFilePath; + } + + public bool Equals(IFilePath other) { + if (ReferenceEquals(null, other)) { + return false; + } + return ReferenceEquals(this, other) || Equals(other.RawPathToFile(), rawFilePath); + } + + public override bool Equals(object other) { + if (ReferenceEquals(null, other)) { + return false; + } + if (ReferenceEquals(this, other)) { + return true; + } + return other.GetType() == typeof (AbsoluteFilePath) && Equals((AbsoluteFilePath) other); + } + + public override int GetHashCode() { + return (rawFilePath != null ? rawFilePath.GetHashCode() : 0); + } + } +} \ No newline at end of file diff --git a/src/Notepad/Domain/FileSystem/IFilePath.cs b/src/Notepad/Domain/FileSystem/IFilePath.cs new file mode 100644 index 0000000..094907a --- /dev/null +++ b/src/Notepad/Domain/FileSystem/IFilePath.cs @@ -0,0 +1,7 @@ +using System; + +namespace Notepad.Domain.FileSystem { + public interface IFilePath : IEquatable { + string RawPathToFile(); + } +} \ No newline at end of file -- cgit v1.2.3