X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=inline;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBigSize.cs;fp=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBigSize.cs;h=315e1b622d8c58ffabd9c640459fd2a834bc229d;hb=810f7404202e04f70db946ced7363b64ddaf4ce4;hp=0000000000000000000000000000000000000000;hpb=fa130da4108815a8b17c3c093a91fc3d83754a0f;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/BigSize.cs b/c_sharp/src/org/ldk/structs/BigSize.cs new file mode 100644 index 00000000..315e1b62 --- /dev/null +++ b/c_sharp/src/org/ldk/structs/BigSize.cs @@ -0,0 +1,49 @@ +using org.ldk.impl; +using org.ldk.enums; +using org.ldk.util; +using System; + +namespace org { namespace ldk { namespace structs { + + +/** + * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's + * variable-length integers except that it is serialized in big-endian instead of little-endian. + * + * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be + * encoded in several different ways, which we must check for at deserialization-time. Thus, if + * you're looking for an example of a variable-length integer to use for your own project, move + * along, this is a rather poor design. + */ +public class BigSize : CommonBase { + internal BigSize(object _dummy, long ptr) : base(ptr) { } + ~BigSize() { + if (ptr != 0) { bindings.BigSize_free(ptr); } + } + + public long get_a() { + long ret = bindings.BigSize_get_a(this.ptr); + GC.KeepAlive(this); + return ret; + } + + public void set_a(long val) { + bindings.BigSize_set_a(this.ptr, val); + GC.KeepAlive(this); + GC.KeepAlive(val); + } + + /** + * Constructs a new BigSize given each field + */ + public static BigSize of(long a_arg) { + long ret = bindings.BigSize_new(a_arg); + GC.KeepAlive(a_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.BigSize ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BigSize(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + return ret_hu_conv; + } + +} +} } }