예제 #1
0
        private void LoadFromFileName(string filename)
        {
            _fileName = filename;

            StreamReader reader = null;

            try {
                if (PreserveWhitespace)
                {
                    _preservationProvider = new XmlAttributePreservationProvider(filename);
                }

                const int defaultFileStreamBufferSize = 1024;
                var       stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read,
                                                  defaultFileStreamBufferSize, FileOptions.SequentialScan);

                reader = new StreamReader(stream, Encoding.UTF8, true);
                LoadFromTextReader(reader);
            }
            finally {
                if (_preservationProvider != null)
                {
                    _preservationProvider.Close();
                    _preservationProvider = null;
                }
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
예제 #2
0
        private void LoadFromFileName(string filename)
        {
            _fileName = filename;

            StreamReader reader = null;

            try {
                if (PreserveWhitespace)
                {
                    _preservationProvider = new XmlAttributePreservationProvider(filename);
                }

                reader = new StreamReader(filename, true);
                LoadFromTextReader(reader);
            }
            finally {
                if (_preservationProvider != null)
                {
                    _preservationProvider.Close();
                    _preservationProvider = null;
                }
                if (reader != null)
                {
                    reader.Close();
                }
            }
        }
예제 #3
0
        private void LoadFromFileName(string filename)
        {
            this._fileName = filename;
            StreamReader textReader = null;

            try
            {
                if (base.PreserveWhitespace)
                {
                    this._preservationProvider = new XmlAttributePreservationProvider(filename);
                }
                textReader = new StreamReader(filename, true);
                this.LoadFromTextReader(textReader);
            }
            finally
            {
                if (this._preservationProvider != null)
                {
                    this._preservationProvider.Close();
                    this._preservationProvider = null;
                }
                if (textReader != null)
                {
                    textReader.Close();
                }
            }
        }
예제 #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (this._reader != null)
     {
         this._reader.Close();
         this._reader = null;
     }
     if (this._preservationProvider != null)
     {
         this._preservationProvider.Close();
         this._preservationProvider = null;
     }
 }
예제 #5
0
        protected virtual void Dispose(bool disposing)
        {
            if (_reader != null)
            {
                _reader.Dispose();
                _reader = null;
            }

            if (_preservationProvider != null)
            {
                _preservationProvider.Close();
                _preservationProvider = null;
            }
        }
예제 #6
0
        private void LoadFromFileName(string filename) {
            _fileName = filename;

            StreamReader reader = null;
            try {
                if (PreserveWhitespace) {
                    _preservationProvider = new XmlAttributePreservationProvider(filename);
                }

                reader = new StreamReader(filename, true);
                LoadFromTextReader(reader);
            }
            finally {
                if (_preservationProvider != null)
                {
                    _preservationProvider.Close();
                    _preservationProvider = null;
                }
                if (reader != null) {
                    reader.Close();
                }
            }
        }
예제 #7
0
        protected virtual void Dispose(bool disposing)
        {
            if (_reader != null)
            {
                _reader.Close();
                _reader = null;
            }

            if (_preservationProvider != null)
            {
                _preservationProvider.Close();
                _preservationProvider = null;
            }
        }