コード例 #1
0
ファイル: MSLens.cs プロジェクト: formist/LinkMe
        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);
            }
        }
コード例 #2
0
ファイル: MSLens.cs プロジェクト: formist/LinkMe
        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);
            }
        }