Esempio n. 1
0
        public LensMessage ConvertBinaryData(byte[] data, string docType)
        {
            try
            {
                byte[] hint = null;
                byte[] body = null;

                if (docType != null)
                {
                    hint = LensMessage.ToBytes(docType);
                }

                if (hint == null || hint.Length < 1)
                {
                    body = new byte[data.Length + 1];
                }
                else
                {
                    body = new byte[hint.Length + data.Length + 1];
                }

                int index = 0;
                if (hint != null)
                {
                    for (int i = 0; i < hint.Length; i++)
                    {
                        body[index++] = hint[i];
                    }
                }
                body[index++] = Convert.ToByte('\0');

                for (int i = 0; i < data.Length; i++)
                {
                    body[index++] = data[i];
                }

                //String messageData = LensMessage.toString(body);
                LensMessage convertMessage = LensMessage.Create(body, LensMessage.CONVERT_TYPE);
                return(SendMessage(convertMessage));
            }
            catch (LensException lex)
            {
                throw lex;
            }
            catch (Exception ex)
            {
                throw new LensException(ErrorIndex.INTERNAL_ERR, ex);
            }
        }
Esempio n. 2
0
 public LensMessage RegisterText(string text, string vendor, string ID, DocKey docKey, char type)
 {
     return(RegisterBinaryData(LensMessage.ToBytes(text), "", vendor, ID, docKey, type));
 }
Esempio n. 3
0
 public LensMessage TagTextWithRTF(string text, string docType, char type)
 {
     return(TagBinaryDataWithRTF(LensMessage.ToBytes(text), docType, type));
 }