private int GetIntFromOpeType(OPE_TYPE ot) { int iRes = -1; switch (ot) { case OPE_TYPE.OPEINS: { iRes = 1; break; } case OPE_TYPE.RECINS: { iRes = 2; break; } case OPE_TYPE.TARSAL: { iRes = 3; break; } } return(iRes); }
protected override void DoParseMessage() { foreach (XmlNode node in _root.ChildNodes) { switch (node.Name) { case "u": _unit = Convert.ToInt32(node.InnerText); break; case "d": _date = OPS.Comm.Dtx.StringToDtx(node.InnerText); break; case "tt": { if (node.InnerText == "1") { _cardType = CARD_TYPE.PRE_PAY; } else if (node.InnerText == "2") { _cardType = CARD_TYPE.POST_PAY; } break; } case "to": { switch (node.InnerText) { case "1": { _opeType = OPE_TYPE.OPEINS; break; } case "2": { _opeType = OPE_TYPE.RECINS; break; } case "3": { _opeType = OPE_TYPE.TARSAL; break; } } break; } case "t": { _cardId = uint.Parse(node.InnerText); break; } case "q": { _amount = int.Parse(node.InnerText); break; } case "bl": { // descomprimir int rest = node.InnerText.Length % 2; if (rest == 0) // es par { byte [] byCompressed = new byte[node.InnerText.Length / 2]; byCompressed = StringToByteArray(node.InnerText); /* * bool bCompressed = false; * byte [] byCmpr = CompressBodyToSend(byCompressed, ref bCompressed); * string sCmpr = BitConverter.ToString(byCmpr); * sCmpr = sCmpr.Replace("-",""); */ byte [] byUncompressed = UnCompress(byCompressed); string result = BitConverter.ToString(byUncompressed); result = result.Replace("-", ""); if (result.Length == NUM_CHARS) { _bytes = result; } else { // Error bad format } } break; } } } }