コード例 #1
0
 public BidirectionalPassthroughSignalTally(ISignalSource parentSignalSource)
 {
     ParentSignalSource       = parentSignalSource;
     tallyState               = new PassthroughSignalTallyState(ParentSignalSource);
     tallyReceiver            = new PassthroughSignalTallyReceiver();
     tallyState.StateChanged += tallyStateChanged;
     tallyReceiver.Got       += (r, rc) => Got?.Invoke(r, rc);
     tallyReceiver.Revoked   += (r, rc) => Revoked?.Invoke(r, rc);
 }
コード例 #2
0
        /// <summary>
        /// Converts the <see cref="EnvelopeKeyRecord"/> to a <see cref="JObject"/> format:
        /// <code>
        /// {
        ///   "Created": Creation time of the encrypted key,
        ///   "ParentKeyMeta": Parent key meta of the encrypted key(if present),
        ///   "Key": Encrypted Key,
        ///   "Revoked": True/False
        /// }
        /// </code>
        /// </summary>
        ///
        /// <returns>The <see cref="EnvelopeKeyRecord"/> converted to a <see cref="JObject"/>.</returns>
        public JObject ToJson()
        {
            Json json = new Json();

            json.Put("Created", Created);
            json.Put("Key", EncryptedKey);
            ParentKeyMeta.IfSome(keyMeta => json.Put("ParentKeyMeta", keyMeta.ToJson()));
            Revoked.IfSome(revoked => json.Put("Revoked", revoked));
            return(json.ToJObject());
        }