summaryrefslogtreecommitdiff
path: root/src/Notepad/Domain/FileSystem
diff options
context:
space:
mode:
Diffstat (limited to 'src/Notepad/Domain/FileSystem')
-rw-r--r--src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs34
-rw-r--r--src/Notepad/Domain/FileSystem/IFilePath.cs7
2 files changed, 41 insertions, 0 deletions
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<IFilePath> {
+ string RawPathToFile();
+ }
+} \ No newline at end of file