예제 #1
0
        public static byte[] BuildStruct(ref object Struct, Encoding Encoding = null)
        {
            MemoryStream Stream = new MemoryStream();
            StructWriter Writer = new StructWriter(Stream, Encoding);

            Writer.WriteStruct(ref Struct);
            byte[] Result = Stream.ToArray();
            Writer.Close();
            Stream?.Close();
            return(Result);
        }
        public static byte[] BuildStruct <T>(ref T Struct, bool BigEndian = false, Encoding Encoding = null)
        {
            MemoryStream Stream = new MemoryStream();
            StructWriter Writer = new StructWriter(Stream, BigEndian, Encoding);

            Writer.WriteStruct(ref Struct);
            byte[] Result = Stream.ToArray();
            Writer.Close();
            Stream?.Close();
            return(Result);
        }