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


C# Maybe.Do方法代码示例

本文整理汇总了C#中Maybe.Do方法的典型用法代码示例。如果您正苦于以下问题:C# Maybe.Do方法的具体用法?C# Maybe.Do怎么用?C# Maybe.Do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Maybe的用法示例。


在下文中一共展示了Maybe.Do方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SenderKeyState

        private SenderKeyState(UInt32 id, UInt32 iteration, byte[] chainKey,
		                       ECPublicKey signatureKeyPublic,
		                       Maybe<ECPrivateKey> signatureKeyPrivate)
        {
            var senderChainKeyStructure = new SenderKeyStateStructure.SenderChainKey {
                Iteration = (uint)iteration,
                Seed = chainKey
            };

            var signingKeyStructure = new SenderKeyStateStructure.SenderSigningKey {
                PublicKey = signatureKeyPublic.Serialize()
            };

            signatureKeyPrivate.Do (SKp => {
                signingKeyStructure.PrivateKey = SKp.Serialize();
            });

            Structure = new SenderKeyStateStructure {
                SenderKeyId = (uint)id,
                senderChainKey = senderChainKeyStructure,
                senderSigningKey = signingKeyStructure
            };
        }
开发者ID:Muraad,项目名称:libaxolotl-net,代码行数:23,代码来源:SenderKeyState.cs

示例2: SetUnacknowledgedPreKeyMessage

        public void SetUnacknowledgedPreKeyMessage(Maybe<UInt32> preKeyId, UInt32 signedPreKeyId, ECPublicKey baseKey)
        {
            // TODO: check~
            var pending = new PendingPreKey {
                signedPreKeyId = signedPreKeyId,
                baseKey = baseKey.Serialize()
            };
            preKeyId.Do(pKid => pending.preKeyId = pKid);

            Structure.PendPreKey = pending;
        }
开发者ID:Muraad,项目名称:libaxolotl-net,代码行数:11,代码来源:SessionState.cs

示例3: PreKeyWhisperMessage

        public PreKeyWhisperMessage(UInt32 messageVersion, UInt32 registrationId, Maybe<UInt32> preKeyId,
		                            UInt32 signedPreKeyId, ECPublicKey baseKey, IdentityKey identityKey,
		                            WhisperMessage message)
        {
            MessageVersion = messageVersion;
            RegistrationId = registrationId;
            PreKeyId = preKeyId;
            SignedPreKeyId = signedPreKeyId;
            BaseKey = baseKey;
            IdentityKey = identityKey;
            Message = message;

            var preKeyMessage = new WhisperProtos.PreKeyWhisperMessage {
                signedPreKeyId = SignedPreKeyId,
                baseKey = BaseKey.Serialize(),
                identityKey = IdentityKey.Serialize(),
                message = Message.Serialize(),
                registrationId = registrationId
            };

            preKeyId.Do(pKid => preKeyMessage.preKeyId = pKid);

            byte[] versionBytes = { ByteUtil.IntsToByteHighAndLow(MessageVersion, CURRENT_VERSION) };

            byte[] messageBytes;
            using(var stream = new MemoryStream())
            {
                Serializer.Serialize(stream, preKeyMessage);
                messageBytes = stream.ToArray();
            }

            _serialized = ByteUtil.Combine(versionBytes, messageBytes);
        }
开发者ID:Muraad,项目名称:libaxolotl-net,代码行数:33,代码来源:PreKeyWhisperMessage.cs


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