Exemplo n.º 1
0
 public FieldValue(StaticFldDesc stFld, string val)
 {
     m_fldDesc = stFld;
     m_value = val;
 }
Exemplo n.º 2
0
 public FieldValue(StaticFldDesc stFld)
 {
     m_fldDesc = stFld;
 }
Exemplo n.º 3
0
        private string GetFldValueAsString(StaticFldDesc.FieldType fieldType, List<byte> osiBytes)
        {
            //Encoding enc = ASCIIEncoding;

            Encoding enc = Encoding.GetEncoding(0);

            if (fieldType == StaticFldDesc.FieldType.BCD)
                return BCDUtils.BCDToString(osiBytes);

            if (fieldType == StaticFldDesc.FieldType.CHAR)
                return enc.GetString(osiBytes.ToArray());

            if (fieldType == StaticFldDesc.FieldType.NUM)
            {
                ulong v = 0;
                foreach (byte b in osiBytes)
                {
                    v <<= 8;
                    v |= b;
                }
                return v.ToString();
            }

            throw new Exception("BUG");
        }
Exemplo n.º 4
0
        private string GetFldValueAsString(StaticFldDesc.FieldType fieldType, byte b)
        {
            byte[] w = new byte[1];
            if (b < 10)
                w[0] = (byte)('0' + b);
            else
                w[0] = (byte)('A' + b - 10);

            return ASCIIEncoding.ASCII.GetString(w);
        }
Exemplo n.º 5
0
 static int sizeInHalfBytes(StaticFldDesc[] arr)
 {
     int ret = 0;
     foreach (StaticFldDesc f in arr)
         ret += f.m_sizeInHalfBytes;
     return ret;
 }