Example #1
0
        public POParser(POParserSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (settings.ReadHeaderOnly)
            {
                _flags |= Flags.ReadHeaderOnly;
            }

            if (settings.ReadContentTypeHeaderOnly)
            {
                _flags |= Flags.ReadContentTypeHeaderOnly;
            }

            if (settings.SkipInfoHeaders)
            {
                _flags |= Flags.SkipInfoHeaders;
            }

            if (settings.SkipComments)
            {
                _flags |= Flags.SkipComments;
            }
            else
            {
                _commentBuffer = new List <KeyValuePair <TextLocation, string> >();
            }

            _builder = new StringBuilder();
        }
Example #2
0
        public POParser(POParserSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (settings.ReadContentTypeHeaderOnly)
            {
                _flags |= Flags.ReadContentTypeHeaderOnly;
            }

            if (settings.ReadHeaderOnly)
            {
                _flags |= Flags.ReadHeaderOnly;
            }

#if USE_COMMON
            if (settings.PreserveHeadersOrder)
            {
                _flags |= Flags.PreserveHeadersOrder;
            }
#endif

            if (settings.SkipInfoHeaders)
            {
                _flags |= Flags.SkipInfoHeaders;
            }

            if (settings.SkipComments)
            {
                _flags |= Flags.SkipComments;
            }
            else
            {
                _commentBuffer = new List <KeyValuePair <TextLocation, string> >();
            }

            _keyStringNewLine         = POString.NewLine(settings.StringDecodingOptions?.KeepKeyStringsPlatformIndependent ?? false);
            _translationStringNewLine = POString.NewLine(settings.StringDecodingOptions?.KeepTranslationStringsPlatformIndependent ?? false);

            _builder = new StringBuilder();
        }