当前位置: 首页>>代码示例>>C#>>正文


C# FactMemento.AddPredecessor方法代码示例

本文整理汇总了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;
 }
开发者ID:wuttic,项目名称:CorrespondenceDistributor,代码行数:7,代码来源:TestBase.cs

示例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;
        }
开发者ID:wuttic,项目名称:CorrespondenceDistributor,代码行数:14,代码来源:DistributorService.cs

示例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;
 }
开发者ID:wuttic,项目名称:CorrespondenceDistributor,代码行数:7,代码来源:RepositoryTests.cs

示例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);
        }
开发者ID:wuttic,项目名称:CorrespondenceDistributor,代码行数:35,代码来源:FactTreeSerializer.cs


注:本文中的FactMemento.AddPredecessor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。