本文整理汇总了C#中ObjectId.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectId.Equals方法的具体用法?C# ObjectId.Equals怎么用?C# ObjectId.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectId
的用法示例。
在下文中一共展示了ObjectId.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SimilarObjectIdsAreEqual
public void SimilarObjectIdsAreEqual()
{
var a = new ObjectId("ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
var b = new ObjectId("ce08fe4884650f067bd5703b6a59a8b3b3c99a09");
(a.Equals(b)).ShouldBeTrue();
(b.Equals(a)).ShouldBeTrue();
(a == b).ShouldBeTrue();
(a != b).ShouldBeFalse();
}
示例2: DifferentObjectIdsAreEqual
public void DifferentObjectIdsAreEqual()
{
var a = new ObjectId(validSha1);
var b = new ObjectId(validSha2);
Assert.False((a.Equals(b)));
Assert.False((b.Equals(a)));
Assert.False((a == b));
Assert.True((a != b));
}
示例3: DifferentObjectIdsAreEqual
public void DifferentObjectIdsAreEqual()
{
var a = new ObjectId(validSha1);
var b = new ObjectId(validSha2);
(a.Equals(b)).ShouldBeFalse();
(b.Equals(a)).ShouldBeFalse();
(a == b).ShouldBeFalse();
(a != b).ShouldBeTrue();
}
示例4: CanLoot
public bool CanLoot(ObjectId looterID) {
bool youCanLootMe = true;
if (looterID.Equals(((IActor)this).KillerID.Pid)) {
if (DateTime.UtcNow < ((IActor)this).TimeOfDeath.AddSeconds(30)) {
youCanLootMe = false;
}
}
return youCanLootMe;
}
示例5: ReadObject
public Tuple<PackObjectType, byte[]> ReadObject(ObjectId objId)
{
long? offset = TryGetOffset(objId);
if (!offset.HasValue)
throw new Exception("Object id not found.");
var ret = ReadObject(offset.Value);
//check hash
string header = string.Format(CultureInfo.InvariantCulture, "{0} {1}\0",
ret.Item1.ToString().ToLowerInvariant(), ret.Item2.Length);
byte[] headerBytes = Encoding.ASCII.GetBytes(header);
var sha = SHA1.Create();
sha.TransformBlock(headerBytes, 0, headerBytes.Length, null, 0);
sha.TransformFinalBlock(ret.Item2, 0, ret.Item2.Length);
var hash = new ObjectId(sha.Hash);
if (!hash.Equals(objId))
throw new Exception("Object from pack file does not have the right hash.");
return ret;
}