public static string Format(IRLPElement element) { var output = new StringBuilder(); if (element == null) { throw new Exception("RLPElement object can't be null"); } var rlpCollection = element as RLPCollection; if (rlpCollection != null) { output.Append("["); foreach (var innerElement in rlpCollection) { Format(innerElement); } output.Append("]"); } else { output.Append(element.RLPData.ToHex() + ", "); } return(output.ToString()); }
public bool RlpCompare(IRlpType rlpType, IRLPElement iRLPElement) { if (rlpType is RlpList vCollection) { if (iRLPElement is RLPCollection nCollection && vCollection.Count == nCollection.Count) { for (var i = 0; i < vCollection.Count; i++) { if (!RlpCompare(vCollection[i], nCollection[i])) { return(false); } } } else { return(false); } }
public static string Format(IRLPElement element) { var output = new StringBuilder(); if (element == null) throw new Exception("RLPElement object can't be null"); var rlpCollection = element as RLPCollection; if (rlpCollection != null) { output.Append("["); foreach (var innerElement in rlpCollection) Format(innerElement); output.Append("]"); } else { output.Append(element.RLPData.ToHex() + ", "); } return output.ToString(); }
public IRlpItem Decode(byte[] bytes) { IRLPElement rLPElement = RLP.Decode(bytes); return(new RlpItem(rLPElement.RLPData)); }