/// <summary> /// Parse las partes comunes de todas las respuestas a comandos. /// </summary> /// /// <param name="cmd">El lector de comandos.</param> protected void ParseAnswerHeader(BinReader cmd) { cmd.Ptr = 1; printerStatus = cmd.ReadNext() * 0x100 + cmd.ReadNext(); SkipFieldSep(cmd); fiscalStatus = cmd.ReadNext() * 0x100 + cmd.ReadNext(); SkipFieldSep(cmd); // Reserved 1 SkipFieldSep(cmd); errorCode = cmd.ReadNext() * 0x100 + cmd.ReadNext(); if (errorCode != 0) { this.Error = "Codigo: 0x" + errorCode.ToString("X").PadLeft(4, '0'); } SkipFieldSep(cmd); // Reserved 1 }
/// <summary> /// Extrae un campo HORA /// </summary> /// <param name="cmd"></param> /// <param name="length"></param> /// <param name="optional"></param> /// <returns></returns> protected int Extract_T(BinReader cmd, int length, bool optional) { return(Extract_D(cmd, length, optional)); }
/// <summary> /// Extrae un campo FECHA /// </summary> /// <param name="cmd"></param> /// <param name="length"></param> /// <param name="optional"></param> /// <returns></returns> protected int Extract_D(BinReader cmd, int length, bool optional) { string text = Extract_RT(cmd, length, optional); return(int.Parse(text)); }
/// <summary> /// Extrae un campo ASCII /// </summary> /// <param name="cmd"></param> /// <param name="length"></param> /// <param name="optional"></param> /// <returns></returns> protected string Extract_A(BinReader cmd, int length, bool optional) { return(Extract_RT(cmd, length, optional)); }