You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
1 year ago
|
namespace StabilityMatrix.Core.Models.FileInterfaces;
|
||
1 year ago
|
|
||
1 year ago
|
public class FileSystemPath : IEquatable<FileSystemPath>, IEquatable<string>
|
||
1 year ago
|
{
|
||
|
public string FullPath { get; }
|
||
|
|
||
|
protected FileSystemPath(string path)
|
||
|
{
|
||
|
FullPath = path;
|
||
|
}
|
||
|
|
||
|
protected FileSystemPath(FileSystemPath path) : this(path.FullPath)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
protected FileSystemPath(params string[] paths) : this(Path.Combine(paths))
|
||
|
{
|
||
|
}
|
||
1 year ago
|
|
||
|
public override string ToString()
|
||
|
{
|
||
|
return FullPath;
|
||
|
}
|
||
1 year ago
|
|
||
|
public bool Equals(FileSystemPath? other)
|
||
|
{
|
||
|
if (ReferenceEquals(null, other)) return false;
|
||
|
if (ReferenceEquals(this, other)) return true;
|
||
|
return FullPath == other.FullPath;
|
||
|
}
|
||
|
|
||
|
public bool Equals(string? other)
|
||
|
{
|
||
|
return string.Equals(FullPath, other);
|
||
|
}
|
||
|
|
||
|
public override bool Equals(object? obj)
|
||
|
{
|
||
|
return obj switch
|
||
|
{
|
||
|
FileSystemPath path => Equals(path),
|
||
|
string path => Equals(path),
|
||
|
_ => false
|
||
|
};
|
||
|
}
|
||
|
|
||
|
public override int GetHashCode()
|
||
|
{
|
||
|
return FullPath.GetHashCode();
|
||
|
}
|
||
1 year ago
|
}
|