diff options
| author | mo <mo.khan@gmail.com> | 2018-11-04 15:22:16 -0700 |
|---|---|---|
| committer | mo <mo.khan@gmail.com> | 2018-11-04 15:22:16 -0700 |
| commit | 5ee1f55497a4e30322a56f133f897ecde1612967 (patch) | |
| tree | bf544e0879234c3623869627d8786776cb19b8e9 /src/Notepad/Domain | |
Diffstat (limited to 'src/Notepad/Domain')
| -rw-r--r-- | src/Notepad/Domain/FileSystem/AbsoluteFilePath.cs | 34 | ||||
| -rw-r--r-- | src/Notepad/Domain/FileSystem/IFilePath.cs | 7 | ||||
| -rw-r--r-- | src/Notepad/Domain/Repositories/IRepository.cs | 7 |
3 files changed, 48 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 diff --git a/src/Notepad/Domain/Repositories/IRepository.cs b/src/Notepad/Domain/Repositories/IRepository.cs new file mode 100644 index 0000000..fd25072 --- /dev/null +++ b/src/Notepad/Domain/Repositories/IRepository.cs @@ -0,0 +1,7 @@ +using System.Collections.Generic;
+
+namespace Notepad.Domain.Repositories {
+ public interface IRepository<T> {
+ IEnumerable<T> All();
+ }
+}
\ No newline at end of file |
