Пример #1
0
        public BufferedFileReader(string filename, int bufferSize)
        {
            if (!File.Exists(filename))
            {
                throw new FileNotFoundException("File does not exist!");
            }
            if (bufferSize <= 0)
            {
                throw new ArgumentOutOfRangeException("bufferSize");
            }

            try
            {
                _stream = new BufferedStream(File.OpenRead(filename));
            }
            catch (IOException e)
            {
                MessageBox.Show("Could not open file: " + e.Message);
                throw e;
            }

            _filename       = filename;
            _bufferSize     = bufferSize;
            _lines          = new List <string>();
            _networkIdTable = new NetworkIdTable();
            _data           = new byte[bufferSize];
            _isStreamLoaded = false;

            GuessType();

            TryLoadFile();
        }
Пример #2
0
        public BufferedFileReader(string filename, int bufferSize)
        {
            if (!File.Exists(filename))
                throw new FileNotFoundException("File does not exist!");
            if (bufferSize <= 0)
                throw new ArgumentOutOfRangeException("bufferSize");

            try
            {
                _stream = new BufferedStream(File.OpenRead(filename));
            }
            catch (IOException e)
            {
                MessageBox.Show("Could not open file: " + e.Message);
                throw e;
            }

            _filename = filename;
            _bufferSize = bufferSize;
            _lines = new List<string>();
            _networkIdTable = new NetworkIdTable();
            _data = new byte[bufferSize];
            _isStreamLoaded = false;

            GuessType();

            TryLoadFile();
        }