public bool from_byte(byte[] buffer, ref long pos) { this.name = Cmd.to_string(buffer, ref pos); long len = Cmd.to_long(buffer, ref pos); this.content = null; if (len > 0) { this.content = new byte[len]; Array.Copy(buffer, pos, this.content, 0, len); pos += len; } return(true); }
public override Cmd unpack(byte[] buffer, ref long pos) { long tmp_pos = pos; try { long size = Cmd.to_long(buffer, ref tmp_pos); Cmd cmd = CmdUnpacker.parse_cmd(buffer, tmp_pos, size); pos = cmd == null ? pos : tmp_pos + size; return(cmd); } catch { return(null); } }