コード例 #1
0
        private static TDataType[,] StreamReadData <TDataType>(string filePath, int colCount)
        {
            FileStream   stream = null;
            BinaryReader reader = null;

            try
            {
                long byteSize = FileUtil.InitBinReadStream(ref stream, ref reader, filePath);
                return(FileUtil.StreamReadFromBinFile <TDataType>(reader, byteSize, colCount, 0));
            }
            catch (SeeSharpFileException)
            {
                throw;
            }
            catch (ApplicationException ex)
            {
                throw new SeeSharpFileException(SeeSharpFileErrorCode.RuntimeError,
                                                i18n.GetFStr("Runtime.ReadFail", ex.Message), ex);
            }
            finally
            {
                FileUtil.ReleaseResource(reader);
                FileUtil.ReleaseResource(stream);
            }
        }
コード例 #2
0
        private static string[] StreamReadStr(string filePath)
        {
            FileStream   stream = null;
            BinaryReader reader = null;

            try
            {
                FileUtil.InitBinReadStream(ref stream, ref reader, filePath);
                return(FileUtil.StreamReadStrFromBinFile(reader));
            }
            catch (SeeSharpFileException)
            {
                throw;
            }
            catch (ApplicationException ex)
            {
                throw new SeeSharpFileException(SeeSharpFileErrorCode.RuntimeError,
                                                i18n.GetFStr("Runtime.ReadFail", ex.Message), ex);
            }
            finally
            {
                FileUtil.ReleaseResource(reader);
                FileUtil.ReleaseResource(stream);
            }
        }
コード例 #3
0
 private void InitStreamAndReader()
 {
     try
     {
         FileUtil.InitBinReadStream(ref _stream, ref _reader, _filePath);
     }
     catch (ApplicationException ex)
     {
         FileUtil.ReleaseResource(_reader);
         FileUtil.ReleaseResource(_stream);
         throw new SeeSharpFileException(SeeSharpFileErrorCode.RuntimeError,
                                         i18n.GetFStr("Runtime.OpenfileFail", ex.Message), ex);
     }
 }