Пример #1
0
        public TextReader GetTextReader(TextReaderType textReaderType, TextReaderParameters textReaderParameters)
        {
            LoadTextReaderFactories();

            if (_textReaderFactoriesHash.ContainsKey(textReaderType))
            {
                return _textReaderFactoriesHash[textReaderType].Create(textReaderParameters);
            }

            throw new ArgumentException(string.Format("No Factory defined for type {0}", textReaderType));
        }
        public TextReader Create(TextReaderParameters textReaderParameters)
        {
            if (textReaderParameters != null)
            {
                var streamReaderParameters = textReaderParameters as StreamReaderParameters;

                if (streamReaderParameters != null)
                {
                    return _streamReaderFactory.Create(streamReaderParameters.Stream);
                }

                throw new ArgumentException("TextReaderParameters must be of type StreamReaderParameters, no default constructor defined!");
            }

            throw new ArgumentNullException("textReaderParameters");
        }