本文整理汇总了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
};
}
示例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;
}
示例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);
}