本文整理汇总了C#中FactMemento.AddPredecessor方法的典型用法代码示例。如果您正苦于以下问题:C# FactMemento.AddPredecessor方法的具体用法?C# FactMemento.AddPredecessor怎么用?C# FactMemento.AddPredecessor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FactMemento
的用法示例。
在下文中一共展示了FactMemento.AddPredecessor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoom
protected static FactMemento CreateRoom(long domainId)
{
FactMemento room = new FactMemento(TypeRoom);
room.Data = new byte[] { 1, 2, 3, 4 };
room.AddPredecessor(RoleRoomDomain, new FactID { key = domainId }, true);
return room;
}
示例2: TranslateMemento
private static FactMemento TranslateMemento(Dictionary<FactID, FactID> localIdByRemoteId, IdentifiedFactMemento identifiedFact)
{
FactMemento translatedMemento = new FactMemento(identifiedFact.Memento.FactType);
translatedMemento.Data = identifiedFact.Memento.Data;
foreach (PredecessorMemento remote in identifiedFact.Memento.Predecessors)
{
FactID localPredecessorId;
if (!localIdByRemoteId.TryGetValue(remote.ID, out localPredecessorId))
return null;
translatedMemento.AddPredecessor(remote.Role, localPredecessorId, remote.IsPivot);
}
return translatedMemento;
}
示例3: NewMove
private static FactMemento NewMove(FactID gameId, byte moveIndex)
{
var move = new FactMemento(MoveType);
move.Data = new byte[] { moveIndex };
move.AddPredecessor(MoveGame, gameId, true);
return move;
}
示例4: DeserlializeIdentifiedFactMemento
private IdentifiedFactMemento DeserlializeIdentifiedFactMemento(BinaryReader factReader, long factId)
{
short dataSize;
byte[] data;
short predecessorCount;
CorrespondenceFactType factType = GetFactType(BinaryHelper.ReadShort(factReader));
dataSize = BinaryHelper.ReadShort(factReader);
if (dataSize > MaxDataLength)
throw new CorrespondenceException("Maximum data length exceeded.");
data = dataSize > 0 ? factReader.ReadBytes(dataSize) : new byte[0];
predecessorCount = BinaryHelper.ReadShort(factReader);
if (predecessorCount > MaxPredecessorCount)
throw new CorrespondenceException("Maximum predecessor count exceeded.");
FactMemento factMemento = new FactMemento(factType);
factMemento.Data = data;
for (short i = 0; i < predecessorCount; i++)
{
bool isPivot;
long predecessorFactId;
RoleMemento role = GetRole(BinaryHelper.ReadShort(factReader));
isPivot = BinaryHelper.ReadBoolean(factReader);
predecessorFactId = BinaryHelper.ReadLong(factReader);
factMemento.AddPredecessor(
role,
new FactID() { key = predecessorFactId },
isPivot
);
}
return new IdentifiedFactMemento(new FactID { key = factId }, factMemento);
}