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); } }
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); } }
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); } }