public static void ReadWriteC(this BitcoinStream bs, ref Network network) { if (bs.Serializing) { var str = network.ToString(); bs.ReadWriteC(ref str); } else { var str = string.Empty; bs.ReadWriteC(ref str); network = NetworkRegistration.GetNetwork(str); } }
public static void ReadWriteC(this BitcoinStream bs, ref PoupardSternProof proof) { if (bs.Serializing) { if (proof == null) { uint o = 0; bs.ReadWriteAsVarInt(ref o); return; } var len = (uint)proof.XValues.Length; bs.ReadWriteAsVarInt(ref len); for (int i = 0; i < len; i++) { var n = proof.XValues[i]; bs.ReadWriteC(ref n); } var yvalue = proof.YValue; bs.ReadWriteC(ref yvalue); } else { uint len = 0; bs.ReadWriteAsVarInt(ref len); if (len == 0) { proof = null; return; } if (len > bs.MaxArraySize) { throw new ArgumentOutOfRangeException("Array is too big"); } var xValues = new BigInteger[len]; for (int i = 0; i < len; i++) { BigInteger b = null; bs.ReadWriteC(ref b); xValues[i] = b; } BigInteger yValue = null; bs.ReadWriteC(ref yValue); proof = new PoupardSternProof(Tuple.Create(xValues, yValue)); } }
public void ReadWrite(BitcoinStream stream) { stream.ReadWriteC(ref this._Value); }