public bool Equals(Asset other) { if (other == null) { return(false); } var ret = RelativePath.Equals(other.RelativePath, StringComparison.InvariantCultureIgnoreCase); return(ret); }
public override bool Equals(object obj) { Log otherLog = obj as Log; if (otherLog == null) { return(false); } return(RelativePath.Equals(otherLog.RelativePath, StringComparison.InvariantCultureIgnoreCase)); }
public override bool Equals(object obj) { Report report = obj as Report; if (report == null) { return(false); } return(RelativePath.Equals(report.RelativePath, StringComparison.InvariantCultureIgnoreCase)); }
public void Equality() { var st = new StringTable(0); RelativePath a1 = RelativePath.Create(st, @"AAA\CCC"); RelativePath a2 = RelativePath.Create(st, @"AAA\CCC"); RelativePath a3 = RelativePath.Create(st, @"BBB\CCC"); XAssert.IsTrue(a1.Equals(a1)); XAssert.IsTrue(a1.Equals(a2)); XAssert.IsTrue(a2.Equals(a1)); XAssert.IsFalse(a1.Equals(a3)); XAssert.IsFalse(a2.Equals(a3)); XAssert.IsTrue(a1.Equals((object)a1)); XAssert.IsTrue(a1.Equals((object)a2)); XAssert.IsTrue(a2.Equals((object)a1)); XAssert.IsFalse(a1.Equals((object)a3)); XAssert.IsFalse(a2.Equals((object)a3)); XAssert.IsFalse(a2.Equals("XYZ")); XAssert.IsTrue(a1 == a2); XAssert.IsTrue(a2 == a1); XAssert.IsFalse(a1 == a3); XAssert.IsFalse(a2 == a3); XAssert.IsFalse(a1 != a2); XAssert.IsFalse(a2 != a1); XAssert.IsTrue(a1 != a3); XAssert.IsTrue(a2 != a3); int h1 = a1.GetHashCode(); int h2 = a2.GetHashCode(); XAssert.AreEqual(h1, h2); a1 = RelativePath.Create(st, string.Empty); XAssert.AreEqual(0, a1.GetHashCode()); XAssert.IsFalse(a1.Equals(a2)); }
public void Equality() { var st = new StringTable(0); RelativePath a1 = RelativePath.Create(st, @"usr/src"); RelativePath a2 = RelativePath.Create(st, @"usr/src"); RelativePath a3 = RelativePath.Create(st, @"lib/src"); XAssert.IsTrue(a1.Equals(a1)); XAssert.IsTrue(a1.Equals(a2)); XAssert.IsTrue(a2.Equals(a1)); XAssert.IsFalse(a1.Equals(a3)); XAssert.IsFalse(a2.Equals(a3)); XAssert.IsTrue(a1.Equals((object)a1)); XAssert.IsTrue(a1.Equals((object)a2)); XAssert.IsTrue(a2.Equals((object)a1)); XAssert.IsFalse(a1.Equals((object)a3)); XAssert.IsFalse(a2.Equals((object)a3)); XAssert.IsFalse(a2.Equals("home")); XAssert.IsTrue(a1 == a2); XAssert.IsTrue(a2 == a1); XAssert.IsFalse(a1 == a3); XAssert.IsFalse(a2 == a3); XAssert.IsFalse(a1 != a2); XAssert.IsFalse(a2 != a1); XAssert.IsTrue(a1 != a3); XAssert.IsTrue(a2 != a3); int h1 = a1.GetHashCode(); int h2 = a2.GetHashCode(); XAssert.AreEqual(h1, h2); a1 = RelativePath.Create(st, string.Empty); XAssert.AreEqual(HashCodeHelper.Fnv1Basis32, a1.GetHashCode()); XAssert.IsFalse(a1.Equals(a2)); }
public bool Equals(SnapshotFilesystemItem other) { if (other == null) { return(false); } return(RelativePath.Equals(other.RelativePath, StringComparison.InvariantCultureIgnoreCase) && LastModified == other.LastModified && LastAccess == other.LastAccess && Attributes == other.Attributes && WasReadable == other.WasReadable); }
/// <inheridoc /> public bool Equals(ParsedPath other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(m_absolutePath.Equals(other.m_absolutePath) && m_packageRelativePath.Equals(other.m_packageRelativePath) && m_fileRelativePath.Equals(other.m_fileRelativePath) && m_parentCount == other.m_parentCount); }
private void btnAdd_Click(object sender, EventArgs e) { string RelativePath; try { string NewFile = textNewEntry.Text.Trim(); if (NewFile.Length < 1) { MessageBox.Show("Please type a filename in the box to the left or click Browse before clicking Add."); return; } if (!Alphaleonis.Win32.Filesystem.File.Exists(NewFile)) { if (MessageBox.Show("The file does not presently exist. Do you want to add it to the exclusion list anyway?", "Confirm", MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes) { return; } } RelativePath = Utility.GetRelativePath(BasePath, NewFile); } catch (Exception exc) { MessageBox.Show(exc.Message); return; } textNewEntry.Text = ""; textNewEntry.Focus(); foreach (string Existing in listFiles.Items) { if (RelativePath.Equals(Existing, StringComparison.OrdinalIgnoreCase)) { labelPrompt.Text = Existing + " is already on the list."; labelPrompt.ForeColor = System.Drawing.Color.Red; return; } } listFiles.Items.Add(RelativePath); labelPrompt.Text = OriginalPrompt; labelPrompt.ForeColor = System.Drawing.Color.Black; }
public bool EqualTo(DirectoryInfo dirInfo, string dirInfoRootPath) { if (dirInfo == null) { return(false); } if (RelativePath.Equals(dirInfo.TrimPath(dirInfoRootPath), StringComparison.InvariantCultureIgnoreCase)) { return(false); } if (Attributes != dirInfo.Attributes.ToString()) { return(false); } return(true); }
public bool EqualTo(FileInfo other, string fileInfoRootPath) { if (other == null) { return(false); } if (!RelativePath.Equals(other.TrimPath(fileInfoRootPath))) { return(false); } if (LastWriteTimeUtc != other.LastWriteTimeUtc) { return(false); } if (Size != other.Length) { return(false); } if (Attributes != other.Attributes.ToString()) { return(false); } return(true); }
public void RelativePath_Unit_Equals1_ObjIsEqualString() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; Char separator = RelativePath.ForwardSlash; RelativePath target = new RelativePath(nodes, separator); Object obj = nodes.Join(separator); Boolean actual = target.Equals(obj); Assert.AreEqual(true, actual); }
public void RelativePath_Unit_Equals1_UnequivalentRelativePath3() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; RelativePath target = new RelativePath(nodes, RelativePath.ForwardSlash); Object obj = new RelativePath(nodes.Concat(new String[] { "test" }).ToArray(), RelativePath.Backslash); Boolean actual = target.Equals(obj); Assert.AreEqual(false, actual); }
public void RelativePath_Unit_Equals1_UnequivalentRelativePath1() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; Char separator = RelativePath.ForwardSlash; RelativePath target = new RelativePath(nodes, separator); Object obj = new RelativePath(nodes.Select(node => node.ToUpperInvariant()).ToArray(), separator); Boolean actual = target.Equals(obj); Assert.AreEqual(false, actual); }
public void RelativePath_Unit_Equals2_ObjIsSameReference() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; Char separator = RelativePath.ForwardSlash; RelativePath target = new RelativePath(nodes, separator); RelativePath other = target; Boolean actual = target.Equals(other); Assert.AreEqual(true, actual); }
public void RelativePath_Unit_Equals3_ObjIsNull() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; Char separator = RelativePath.ForwardSlash; RelativePath target = new RelativePath(nodes, separator); String other = null; Boolean actual = target.Equals(other); Assert.AreEqual(false, actual); }
public void RelativePath_Unit_Equals3_ObjIsNonEqualString() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; Char separator = RelativePath.ForwardSlash; RelativePath target = new RelativePath(nodes, separator); String other = nodes.Select(node => node.ToUpperInvariant()).ToArray().Join(separator); Boolean actual = target.Equals(other); Assert.AreEqual(false, actual); }
public void RelativePath_Unit_Equals2_UnequivalentRelativePath2() { String[] nodes = new String[] { "sites", "Chad", "Greer" }; RelativePath target = new RelativePath(nodes, RelativePath.ForwardSlash); RelativePath other = new RelativePath(nodes, RelativePath.Backslash); Boolean actual = target.Equals(other); Assert.AreEqual(false, actual); }