Exemple #1
0
        public LensMessage RegisterFile(FileInfo file, string vendor, string ID, DocKey docKey, char type)
        {
            try
            {
                if (!file.Exists)
                {
                    throw new LensException(ErrorIndex.FILE_NOT_EXISTS);
                }

                byte[] data    = LensMessage.ReadFile(file);
                String docType = LensMessage.GetDocType(file.Name);

                return(RegisterBinaryData(data, docType, vendor, ID, docKey, type));
            }
            catch (LensException lex)
            {
                throw lex;
            }
            catch (SocketException sex)
            {
                throw new LensException(ErrorIndex.IO_READ_ERROR, sex);
            }
            catch (IOException iex)
            {
                throw new LensException(ErrorIndex.IO_READ_ERROR, iex);
            }
            catch (Exception ex)
            {
                throw new LensException(ErrorIndex.INTERNAL_ERR, ex);
            }
        }
Exemple #2
0
        public LensMessage ConvertFile(FileInfo file)
        {
            try
            {
                if (!file.Exists)
                {
                    throw new LensException(ErrorIndex.FILE_NOT_EXISTS);
                }

                String docType = LensMessage.GetDocType(file.Name);

                byte[] data = LensMessage.ReadFile(file.FullName);

                return(ConvertBinaryData(data, docType));
            }
            catch (SocketException sex)
            {
                throw new LensException(ErrorIndex.IO_READ_ERROR, sex);
            }
            catch (LensException lex)
            {
                throw lex;
            }
            catch (IOException iex)
            {
                throw new LensException(ErrorIndex.IO_READ_ERROR, iex);
            }
            catch (Exception ex)
            {
                throw new LensException(ErrorIndex.INTERNAL_ERR, ex);
            }
        }
Exemple #3
0
        public LensMessage TagFile(FileInfo file, char type)
        {
            try
            {
                if (!file.Exists)
                {
                    throw new LensException(ErrorIndex.FILE_NOT_EXISTS);
                }

                string docType  = "";
                int    extIndex = file.Name.LastIndexOf(".");
                if (extIndex != -1)
                {
                    string fname = file.Name;
                    docType = fname.Substring(extIndex, file.Name.Length - extIndex);
                    docType = file.Name.Substring(extIndex, file.Name.Length - extIndex);
                }

                byte[] data = LensMessage.ReadFile(file);

                return(TagBinaryData(data, docType, type));
            }
            catch (SocketException sex)
            {
                throw new LensException(ErrorIndex.IO_READ_ERROR, sex);
            }
            catch (LensException lex)
            {
                throw lex;
            }
            catch (IOException iex)
            {
                throw new LensException(ErrorIndex.IO_READ_ERROR, iex);
            }
            catch (Exception ex)
            {
                throw new LensException(ErrorIndex.INTERNAL_ERR, ex);
            }
        }