Beispiel #1
0
        public void OutputNonspace(string text, int offset, int length, TextMapping textMapping)
        {
            if (textMapping != TextMapping.Unicode)
            {
                for (var i = offset; i < length; i++)
                {
                    MapAndOutputSymbolCharacter(text[i], textMapping);
                }
                return;
            }

            if (endParagraph)
            {
                InternalDebug.Assert(lineLength == 0);

                output.Write("\r\n");
                linePosition += 2;
                anyNewlines   = true;
                endParagraph  = false;
            }

            if (lineWrapping)
            {
                if (length != 0)
                {
                    WrapPrepareToAppendNonspace(length);

                    if (breakOpportunity == 0)
                    {
                        FlushLine(text[offset]);

                        output.Write(text, offset, length, fallbacks ? this : null);

                        flushedLength += length;
                    }
                    else
                    {
                        text.CopyTo(offset, wrapBuffer, lineLength - flushedLength, length);
                    }

                    lineLength += length;

                    if (lineLength > 2 || text[offset] != '-' || (length == 2 && text[offset + 1] != '-'))
                    {
                        signaturePossible = false;
                    }
                }
            }
            else
            {
                if (tailSpace != 0)
                {
                    FlushTailSpace();
                }

                output.Write(text, offset, length, fallbacks ? this : null);

                lineLength += length;
            }
        }
Beispiel #2
0
 private void Reinitialize()
 {
     endOfFile = false;
     normalizerContext.hasSpace = false;
     normalizerContext.eatSpace = false;
     normalizerContext.oneNL    = false;
     normalizerContext.lastCh   = '\0';
     lineStarted = false;
     wideGap     = false;
     nextParagraphCloseWideGap = true;
     afterFirstParagraph       = false;
     ignoreNextP   = false;
     insideComment = false;
     insidePre     = false;
     insideAnchor  = false;
     if (urlCompareSink != null)
     {
         urlCompareSink.Reset();
     }
     listLevel   = 0;
     listIndex   = 0;
     listOrdered = false;
     if (!convertFragment && injection != null)
     {
         injection.Reset();
         if (injection.HaveHead)
         {
             injection.Inject(true, output);
         }
     }
     textMapping = TextMapping.Unicode;
 }
Beispiel #3
0
        private void OutputNonspaceImpl(char[] buffer, int offset, int count, TextMapping textMapping)
        {
            if (count != 0)
            {
                if (textMapping != TextMapping.Unicode)
                {
                    for (var i = 0; i < count; i++)
                    {
                        MapAndOutputSymbolCharacter(buffer[offset++], textMapping);
                    }
                    return;
                }

                if (endParagraph)
                {
                    InternalDebug.Assert(lineLength == 0);

                    output.Write("\r\n");
                    linePosition += 2;
                    anyNewlines   = true;
                    endParagraph  = false;
                }

                if (lineWrapping)
                {
                    WrapPrepareToAppendNonspace(count);

                    if (breakOpportunity == 0)
                    {
                        FlushLine(buffer[offset]);

                        output.Write(buffer, offset, count, fallbacks ? this : null);

                        flushedLength += count;
                    }
                    else
                    {
                        Buffer.BlockCopy(buffer, offset * 2, wrapBuffer, (lineLength - flushedLength) * 2, count * 2);
                    }

                    lineLength += count;

                    if (lineLength > 2 || buffer[offset] != '-' || (count == 2 && buffer[offset + 1] != '-'))
                    {
                        signaturePossible = false;
                    }
                }
                else
                {
                    if (tailSpace != 0)
                    {
                        FlushTailSpace();
                    }

                    output.Write(buffer, offset, count, fallbacks ? this : null);

                    lineLength += count;
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// Perform encoding.
        /// </summary>
        /// <param name="ucs32Literal">The ucs32 literal to encode.</param>
        /// <param name="textMapping">The text mapping.</param>
        internal void OutputNonspace(int ucs32Literal, TextMapping textMapping)
        {
            if (textMapping != TextMapping.Unicode)
            {
                this.MapAndOutputSymbolCharacter((char)ucs32Literal, textMapping);
                return;
            }

            if (this.endParagraph)
            {
                InternalDebug.Assert(this.lineLength == 0);

                this.output.Write("\r\n");
                this.linePosition += 2;
                this.anyNewlines   = true;
                this.endParagraph  = false;
            }

            if (this.lineWrapping)
            {
                int count = Token.LiteralLength(ucs32Literal);
                this.WrapPrepareToAppendNonspace(count);

                if (this.breakOpportunity == 0)
                {
                    this.FlushLine(Token.LiteralFirstChar(ucs32Literal));

                    this.output.Write(ucs32Literal, this.fallbacks ? this : null);

                    this.flushedLength += count;
                }
                else
                {
                    this.wrapBuffer[this.lineLength - this.flushedLength] = Token.LiteralFirstChar(ucs32Literal);
                    if (count != 1)
                    {
                        this.wrapBuffer[this.lineLength - this.flushedLength + 1] = Token.LiteralLastChar(ucs32Literal);
                    }
                }

                this.lineLength += count;

                if (this.lineLength > 2 || count != 1 || (char)ucs32Literal != '-')
                {
                    this.signaturePossible = false;
                }
            }
            else
            {
                if (this.tailSpace != 0)
                {
                    this.FlushTailSpace();
                }

                this.output.Write(ucs32Literal, this.fallbacks ? this : null);

                this.lineLength += Token.LiteralLength(ucs32Literal);
            }
        }
Beispiel #5
0
 // Token: 0x06001891 RID: 6289 RVA: 0x000C4A65 File Offset: 0x000C2C65
 protected void SetCodePage(ushort codePage, TextMapping textMapping)
 {
     if (codePage != this.currentCodePage)
     {
         this.currentCodePage = codePage;
         this.leadMask        = ParseSupport.GetCodePageLeadMask((int)codePage);
     }
     if (textMapping != this.currentTextMapping)
     {
         this.currentTextMapping = textMapping;
     }
 }
		// Token: 0x060019FC RID: 6652 RVA: 0x000CDB94 File Offset: 0x000CBD94
		private void OutputNonspaceImpl(char[] buffer, int offset, int count, TextMapping textMapping)
		{
			if (count != 0)
			{
				if (textMapping != TextMapping.Unicode)
				{
					for (int i = 0; i < count; i++)
					{
						this.MapAndOutputSymbolCharacter(buffer[offset++], textMapping);
					}
					return;
				}
				if (this.endParagraph)
				{
					this.output.Write("\r\n");
					this.linePosition += 2;
					this.anyNewlines = true;
					this.endParagraph = false;
				}
				if (this.lineWrapping)
				{
					this.WrapPrepareToAppendNonspace(count);
					if (this.breakOpportunity == 0)
					{
						this.FlushLine(buffer[offset]);
						this.output.Write(buffer, offset, count, this.fallbacks ? this : null);
						this.flushedLength += count;
					}
					else
					{
						Buffer.BlockCopy(buffer, offset * 2, this.wrapBuffer, (this.lineLength - this.flushedLength) * 2, count * 2);
					}
					this.lineLength += count;
					if (this.lineLength > 2 || buffer[offset] != '-' || (count == 2 && buffer[offset + 1] != '-'))
					{
						this.signaturePossible = false;
						return;
					}
				}
				else
				{
					if (this.tailSpace != 0)
					{
						this.FlushTailSpace();
					}
					this.output.Write(buffer, offset, count, this.fallbacks ? this : null);
					this.lineLength += count;
				}
			}
		}
		// Token: 0x060019E9 RID: 6633 RVA: 0x000CD3C0 File Offset: 0x000CB5C0
		public void OutputNonspace(string text, int offset, int length, TextMapping textMapping)
		{
			if (textMapping != TextMapping.Unicode)
			{
				for (int i = offset; i < length; i++)
				{
					this.MapAndOutputSymbolCharacter(text[i], textMapping);
				}
				return;
			}
			if (this.endParagraph)
			{
				this.output.Write("\r\n");
				this.linePosition += 2;
				this.anyNewlines = true;
				this.endParagraph = false;
			}
			if (this.lineWrapping)
			{
				if (length != 0)
				{
					this.WrapPrepareToAppendNonspace(length);
					if (this.breakOpportunity == 0)
					{
						this.FlushLine(text[offset]);
						this.output.Write(text, offset, length, this.fallbacks ? this : null);
						this.flushedLength += length;
					}
					else
					{
						text.CopyTo(offset, this.wrapBuffer, this.lineLength - this.flushedLength, length);
					}
					this.lineLength += length;
					if (this.lineLength > 2 || text[offset] != '-' || (length == 2 && text[offset + 1] != '-'))
					{
						this.signaturePossible = false;
						return;
					}
				}
			}
			else
			{
				if (this.tailSpace != 0)
				{
					this.FlushTailSpace();
				}
				this.output.Write(text, offset, length, this.fallbacks ? this : null);
				this.lineLength += length;
			}
		}
		// Token: 0x060019E7 RID: 6631 RVA: 0x000CD34C File Offset: 0x000CB54C
		public void OutputNonspace(char[] buffer, int offset, int count, TextMapping textMapping)
		{
			if (!this.lineWrapping && !this.endParagraph && textMapping == TextMapping.Unicode)
			{
				if (this.tailSpace != 0)
				{
					this.FlushTailSpace();
				}
				this.output.Write(buffer, offset, count, this.fallbacks ? this : null);
				this.lineLength += count;
				return;
			}
			this.OutputNonspaceImpl(buffer, offset, count, textMapping);
		}
 /// <summary>
 /// Perform encoding.
 /// </summary>
 /// <param name="buffer">The buffer to encode.</param>
 /// <param name="offset">The offset to start encoding at.</param>
 /// <param name="count">The number of characters to encode.</param>
 /// <param name="textMapping">The text mapping.</param>
 internal void OutputNonspace(char[] buffer, int offset, int count, TextMapping textMapping)
 {
     if (!lineWrapping && !endParagraph && textMapping == TextMapping.Unicode)
     {
         if (tailSpace != 0)
         {
             FlushTailSpace();
         }
         output.Write(buffer, offset, count, fallbacks ? this : null);
         lineLength += count;
         return;
     }
     OutputNonspaceImpl(buffer, offset, count, textMapping);
 }
 /// <summary>
 /// Perform encoding.
 /// </summary>
 /// <param name="ucs32Literal">The ucs32 literal to encode.</param>
 /// <param name="textMapping">The text mapping.</param>
 internal void OutputNonspace(int ucs32Literal, TextMapping textMapping)
 {
     if (textMapping != TextMapping.Unicode)
     {
         MapAndOutputSymbolCharacter((char)ucs32Literal, textMapping);
         return;
     }
     if (endParagraph)
     {
         output.Write("\r\n");
         linePosition += 2;
         anyNewlines   = true;
         endParagraph  = false;
     }
     if (lineWrapping)
     {
         int num = Token.LiteralLength(ucs32Literal);
         WrapPrepareToAppendNonspace(num);
         if (breakOpportunity == 0)
         {
             FlushLine(Token.LiteralFirstChar(ucs32Literal));
             output.Write(ucs32Literal, fallbacks ? this : null);
             flushedLength += num;
         }
         else
         {
             wrapBuffer[lineLength - flushedLength] = Token.LiteralFirstChar(ucs32Literal);
             if (num != 1)
             {
                 wrapBuffer[lineLength - flushedLength + 1] = Token.LiteralLastChar(ucs32Literal);
             }
         }
         lineLength += num;
         if (lineLength > 2 || num != 1 || (ushort)ucs32Literal != 45)
         {
             signaturePossible = false;
             return;
         }
     }
     else
     {
         if (tailSpace != 0)
         {
             FlushTailSpace();
         }
         output.Write(ucs32Literal, fallbacks ? this : null);
         lineLength += Token.LiteralLength(ucs32Literal);
     }
 }
Beispiel #11
0
        private static void ConvertMappingStringToList()
        {
            string[] conversions = BrailleGrade2Mapping.mappingTable.Split('\n');

            foreach (string line in conversions)
            {
                if (line != null && line.Length > 0)
                {
                    string[] keyConversionPair = line.Split(' ');
                    if (keyConversionPair.Length == 2 && keyConversionPair[0] != null && keyConversionPair[0].Length > 0 && keyConversionPair[1] != null && keyConversionPair[1].Length > 0)
                    {
                        if (keyConversionPair[0] != "//")
                        {
                            TextMapping mapping = new TextMapping(keyConversionPair[0], keyConversionPair[1]);
                            if (mapping.Key == mapping.Key.ToUpper())                           //if in all caps it is an exact match
                            {
                                exactTextMappings.Add(mapping);
                            }
                            else if (mapping.Key[0] == '+' && mapping.Key[mapping.Key.Length - 1] == '+')                         //check between
                            {
                                mapping.Key = mapping.Key.Trim('+');
                                betweenTextMappings.Add(mapping);
                            }
                            else if (mapping.Key[0] == '+')
                            {
                                mapping.Key = mapping.Key.Trim('+');
                                afterTextMappings.Add(mapping);
                            }
                            else if (mapping.Key[mapping.Key.Length - 1] == '+')
                            {
                                mapping.Key = mapping.Key.Trim('+');
                                beforeTextMappings.Add(mapping);
                            }
                            else if (mapping.Key.Contains("*"))
                            {
                                //TODO - implement words before/after key
                            }
                            else                            //if not a special type then it is an anyPositionMapping
                            {
                                anyPositionMappings.Add(mapping);
                            }
                        }
                    }
                }
            }
        }
        private void Reinitialize()
        {
            this.endOfFile = false;

            this.normalizerContext.hasSpace = false;
            this.normalizerContext.eatSpace = false;
            this.normalizerContext.oneNL    = false;
            this.normalizerContext.lastCh   = '\0';

            this.lineStarted = false;
            this.wideGap     = false;
            this.nextParagraphCloseWideGap = true;
            this.afterFirstParagraph       = false;
            this.ignoreNextP = false;

            this.insideComment = false;
            this.insidePre     = false;
            this.insideAnchor  = false;
            if (this.urlCompareSink != null)
            {
                this.urlCompareSink.Reset();
            }

            this.listLevel   = 0;
            this.listIndex   = 0;
            this.listOrdered = false;

            if (!this.convertFragment)
            {
                if (this.injection != null)
                {
                    this.injection.Reset();

                    if (this.injection.HaveHead)
                    {
                        this.injection.Inject(true, this.output);
                    }
                }
            }

            this.textMapping = TextMapping.Unicode;
        }
        public void CreateMappings()
        {
            TextMapping map = new TextMapping();
            map.DefaultAssembly = "TopDown.TopFramework.DataAccess.Tests";
            map.DefaultNamespace = "TopDown.TopFramework.DataAccess.Tests.Entities";
            map.MappedClass = new ClassMapper();
            map.MappedClass.Name = "NFeEntity";

            IList<PropertyMapperBase> mappings = new List<PropertyMapperBase>();
            mappings.Add(new PropertyMapper { Name = "Id", IsNullable = false });
            mappings.Add(new PropertyMapper { Name = "Numero", IsNullable = false });
            mappings.Add(new PropertyMapper { Name = "Versao", IsNullable = false });
            mappings.Add(new PropertyMapper { Name = "Xml", IsNullable = false });
            mappings.Add(new PropertyMapper { Name = "DataUpload", IsNullable = false });
            mappings.Add(new ManyToOneMapper { Name = "Empresa", ClassName = "EmpresaEntity", PropertyName = "Id", IsNullable = false });
            map.MappedClass.Mappings = mappings.ToArray();

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(TextMapping));
            using (var fs = new FileStream(@"NFeEntity.txtmap", FileMode.Create))
            {
                xmlSerializer.Serialize(fs, map);
            }

            map = new TextMapping();
            map.DefaultAssembly = "TopDown.TopFramework.DataAccess.Tests";
            map.DefaultNamespace = "TopDown.TopFramework.DataAccess.Tests.Entities";
            map.MappedClass = new ClassMapper();
            map.MappedClass.Name = "EmpresaEntity";

            mappings = new List<PropertyMapperBase>();
            mappings.Add(new PropertyMapper { Name = "Id", IsNullable = false });
            mappings.Add(new PropertyMapper { Name = "RazaoSocial", IsNullable = false });
            mappings.Add(new PropertyMapper { Name = "Cnpj", IsNullable = false });
            map.MappedClass.Mappings = mappings.ToArray();

            xmlSerializer = new XmlSerializer(typeof(TextMapping));
            using (var fs = new FileStream(@"EmpresaEntity.txtmap", FileMode.Create))
            {
                xmlSerializer.Serialize(fs, map);
            }
        }
Beispiel #14
0
 private static int SortOnKeySize(TextMapping x, TextMapping y)
 {
     return(y.Key.Length.CompareTo(x.Key.Length));
 }
Beispiel #15
0
        private static void ConvertMappingStringToList()
        {
            string[] conversions = BrailleGrade2Mapping.mappingTable.Split('\n');

            foreach (string inLine in conversions)
            {
                string line = inLine.Replace("\r", "").Trim();
                if (line != null && line.Length > 0)
                {
                    string[] keyConversionPair = line.Split(' ');
                    if (keyConversionPair.Length == 2 && keyConversionPair[0] != null && keyConversionPair[0].Length > 0 && keyConversionPair[1] != null && keyConversionPair[1].Length > 0)
                    {
                        if (keyConversionPair[0] != "//")
                        {
                            TextMapping mapping = new TextMapping(keyConversionPair[0], keyConversionPair[1]);

                            if (IsNumeric(mapping.Key))
                            {
                                numberMappngs.Add(mapping);
                            }
                            else if (mapping.Key == mapping.Key.ToUpper())                            //if in all caps it is an exact match
                            {
                                mapping.Key = mapping.Key.ToLower();
                                if (mapping.Key.Contains("*"))
                                {
                                    if (mapping.Key[0] == '*')
                                    {
                                        mapping.Key = mapping.Key.Trim('*');
                                        postWordPunctuationMappings.Add(mapping);
                                    }
                                    else
                                    {
                                        mapping.Key = mapping.Key.Trim('*');
                                        beforeWordsMappings.Add(mapping);
                                    }
                                }
                                else
                                {
                                    exactTextMappings.Add(mapping);
                                }
                            }
                            else if (mapping.Key[0] == '+' && mapping.Key[mapping.Key.Length - 1] == '+')                            //check between
                            {
                                mapping.Key = mapping.Key.Trim('+');
                                betweenTextMappings.Add(mapping);
                            }
                            else if (mapping.Key[0] == '+')
                            {
                                mapping.Key = mapping.Key.Trim('+');
                                afterTextMappings.Add(mapping);
                            }
                            else if (mapping.Key[mapping.Key.Length - 1] == '+')
                            {
                                mapping.Key = mapping.Key.Trim('+');
                                beforeTextMappings.Add(mapping);
                            }
                            else if (mapping.Key.Contains("*"))
                            {
                                if (mapping.Key[0] == '*')
                                {
                                    mapping.Key = mapping.Key.Trim('*');
                                    postWordPunctuationMappings.Add(mapping);
                                }
                                else
                                {
                                    mapping.Key = mapping.Key.Trim('*');
                                    beforeWordsMappings.Add(mapping);
                                }
                            }
                            else                            //if not a special type then it is an anyPositionMapping
                            {
                                anyPositionMappings.Add(mapping);
                            }
                        }
                    }
                }
            }
        }
Beispiel #16
0
        private void PopElement(HtmlDtd.TagDefinition tagDef)
        {
            HtmlTagIndex tagIndex = tagDef.tagIndex;

            if (tagIndex <= HtmlTagIndex.Listing)
            {
                if (tagIndex <= HtmlTagIndex.DT)
                {
                    if (tagIndex <= HtmlTagIndex.BR)
                    {
                        if (tagIndex != HtmlTagIndex.A)
                        {
                            if (tagIndex != HtmlTagIndex.BR)
                            {
                                goto IL_1D6;
                            }
                            goto IL_173;
                        }
                        else
                        {
                            if (insideAnchor)
                            {
                                EndAnchor();
                                goto IL_1E5;
                            }
                            goto IL_1E5;
                        }
                    }
                    else
                    {
                        switch (tagIndex)
                        {
                        case HtmlTagIndex.Comment:
                            break;

                        case HtmlTagIndex.DD:
                            goto IL_1E5;

                        case HtmlTagIndex.Del:
                        case HtmlTagIndex.Dfn:
                            goto IL_1D6;

                        case HtmlTagIndex.Dir:
                            goto IL_196;

                        default:
                            if (tagIndex != HtmlTagIndex.DT)
                            {
                                goto IL_1D6;
                            }
                            goto IL_1E5;
                        }
                    }
                }
                else if (tagIndex <= HtmlTagIndex.HR)
                {
                    if (tagIndex == HtmlTagIndex.Font)
                    {
                        goto IL_1CD;
                    }
                    if (tagIndex != HtmlTagIndex.HR)
                    {
                        goto IL_1D6;
                    }
                    EndParagraph(false);
                    OutputText("________________________________");
                    EndParagraph(false);
                    goto IL_1E5;
                }
                else
                {
                    switch (tagIndex)
                    {
                    case HtmlTagIndex.Image:
                    case HtmlTagIndex.Img:
                        goto IL_1E5;

                    default:
                        if (tagIndex != HtmlTagIndex.Listing)
                        {
                            goto IL_1D6;
                        }
                        goto IL_1BD;
                    }
                }
            }
            else if (tagIndex <= HtmlTagIndex.Style)
            {
                if (tagIndex <= HtmlTagIndex.Script)
                {
                    switch (tagIndex)
                    {
                    case HtmlTagIndex.Menu:
                    case HtmlTagIndex.OL:
                        goto IL_196;

                    case HtmlTagIndex.Meta:
                    case HtmlTagIndex.NextId:
                    case HtmlTagIndex.NoBR:
                    case HtmlTagIndex.NoScript:
                    case HtmlTagIndex.Object:
                    case HtmlTagIndex.OptGroup:
                    case HtmlTagIndex.Param:
                        goto IL_1D6;

                    case HtmlTagIndex.NoEmbed:
                    case HtmlTagIndex.NoFrames:
                        break;

                    case HtmlTagIndex.Option:
                        goto IL_173;

                    case HtmlTagIndex.P:
                        EndParagraph(nextParagraphCloseWideGap);
                        nextParagraphCloseWideGap = true;
                        goto IL_1E5;

                    case HtmlTagIndex.PlainText:
                    case HtmlTagIndex.Pre:
                        goto IL_1BD;

                    default:
                        if (tagIndex != HtmlTagIndex.Script)
                        {
                            goto IL_1D6;
                        }
                        break;
                    }
                }
                else
                {
                    if (tagIndex == HtmlTagIndex.Span)
                    {
                        goto IL_1CD;
                    }
                    if (tagIndex != HtmlTagIndex.Style)
                    {
                        goto IL_1D6;
                    }
                }
            }
            else
            {
                if (tagIndex <= HtmlTagIndex.Title)
                {
                    if (tagIndex != HtmlTagIndex.TD)
                    {
                        switch (tagIndex)
                        {
                        case HtmlTagIndex.TH:
                            break;

                        case HtmlTagIndex.Thead:
                            goto IL_1D6;

                        case HtmlTagIndex.Title:
                            goto IL_130;

                        default:
                            goto IL_1D6;
                        }
                    }
                    lineStarted = true;
                    goto IL_1E5;
                }
                if (tagIndex == HtmlTagIndex.UL)
                {
                    goto IL_196;
                }
                if (tagIndex != HtmlTagIndex.Xmp)
                {
                    goto IL_1D6;
                }
                goto IL_1BD;
            }
IL_130:
            insideComment = false;
            goto IL_1E5;
IL_173:
            EndLine();
            goto IL_1E5;
IL_196:
            if (listLevel != 0)
            {
                listLevel--;
            }
            EndParagraph(listLevel == 0);
            goto IL_1E5;
IL_1BD:
            EndParagraph(true);
            insidePre = false;
            goto IL_1E5;
IL_1CD:
            textMapping = TextMapping.Unicode;
            goto IL_1E5;
IL_1D6:
            if (tagDef.blockElement)
            {
                EndParagraph(false);
            }
IL_1E5:
            ignoreNextP = false;
        }
Beispiel #17
0
 public void SetCodePage(int codePage, TextMapping textMapping)
 {
     this.textCodePage = codePage;
     this.textMapping  = textMapping;
 }
 public void OutputNonspace(char[] buffer, int offset, int count, TextMapping textMapping)
 {
     writer.WriteLine("TXT ({1}) \"{0}\"", SFromBuffer(buffer, offset, count), textMapping == TextMapping.Unicode ? "U" : "S");
     writer.Flush();
 }
Beispiel #19
0
        private void ProcessStartTagAttributes(HtmlDtd.TagDefinition tagDef)
        {
            HtmlTagIndex tagIndex = tagDef.tagIndex;

            if (tagIndex <= HtmlTagIndex.Font)
            {
                if (tagIndex != HtmlTagIndex.A)
                {
                    if (tagIndex != HtmlTagIndex.Font)
                    {
                        return;
                    }
                    HtmlToken.AttributeEnumerator enumerator = token.Attributes.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        HtmlAttribute current = enumerator.Current;
                        if (current.NameIndex == HtmlNameIndex.Face)
                        {
                            scratch.Reset();
                            scratch.AppendHtmlAttributeValue(current, 4096);
                            RecognizeInterestingFontName recognizeInterestingFontName = default(RecognizeInterestingFontName);
                            int num = 0;
                            while (num < scratch.Length && !recognizeInterestingFontName.IsRejected)
                            {
                                recognizeInterestingFontName.AddCharacter(scratch.Buffer[num]);
                                num++;
                            }
                            textMapping = recognizeInterestingFontName.TextMapping;
                            return;
                        }
                    }
                    return;
                }
                else if (outputAnchorLinks)
                {
                    HtmlToken.AttributeEnumerator enumerator2 = token.Attributes.GetEnumerator();
                    while (enumerator2.MoveNext())
                    {
                        HtmlAttribute current2 = enumerator2.Current;
                        if (current2.NameIndex == HtmlNameIndex.Href)
                        {
                            if (current2.IsAttrBegin)
                            {
                                urlScratch.Reset();
                            }
                            urlScratch.AppendHtmlAttributeValue(current2, 4096);
                            break;
                        }
                    }
                    if (token.IsTagEnd)
                    {
                        BufferString bufferString = urlScratch.BufferString;
                        bufferString.TrimWhitespace();
                        if (bufferString.Length != 0 && bufferString[0] != '#' && bufferString[0] != '?' && bufferString[0] != ';')
                        {
                            if (!lineStarted)
                            {
                                StartParagraphOrLine();
                            }
                            string text = bufferString.ToString();
                            if (text.IndexOf(' ') != -1)
                            {
                                text = text.Replace(" ", "%20");
                            }
                            output.AnchorUrl = text;
                            insideAnchor     = true;
                            if (urlCompareSink == null)
                            {
                                urlCompareSink = new UrlCompareSink();
                            }
                            urlCompareSink.Initialize(text);
                        }
                        urlScratch.Reset();
                        return;
                    }
                }
            }
            else
            {
                switch (tagIndex)
                {
                case HtmlTagIndex.Image:
                case HtmlTagIndex.Img:
                    if (outputImageLinks)
                    {
                        HtmlToken.AttributeEnumerator enumerator3 = token.Attributes.GetEnumerator();
                        while (enumerator3.MoveNext())
                        {
                            HtmlAttribute current3 = enumerator3.Current;
                            if (current3.NameIndex == HtmlNameIndex.Src)
                            {
                                if (current3.IsAttrBegin)
                                {
                                    urlScratch.Reset();
                                }
                                urlScratch.AppendHtmlAttributeValue(current3, 4096);
                            }
                            else if (current3.NameIndex == HtmlNameIndex.Alt)
                            {
                                if (current3.IsAttrBegin)
                                {
                                    imageAltText.Reset();
                                }
                                imageAltText.AppendHtmlAttributeValue(current3, 4096);
                            }
                            else if (current3.NameIndex == HtmlNameIndex.Height)
                            {
                                if (!current3.Value.IsEmpty)
                                {
                                    PropertyValue propertyValue;
                                    if (current3.Value.IsContiguous)
                                    {
                                        propertyValue = HtmlSupport.ParseNumber(current3.Value.ContiguousBufferString, HtmlSupport.NumberParseFlags.Length);
                                    }
                                    else
                                    {
                                        scratch.Reset();
                                        scratch.AppendHtmlAttributeValue(current3, 4096);
                                        propertyValue = HtmlSupport.ParseNumber(scratch.BufferString, HtmlSupport.NumberParseFlags.Length);
                                    }
                                    if (propertyValue.IsAbsRelLength)
                                    {
                                        imageHeightPixels = propertyValue.PixelsInteger;
                                        if (imageHeightPixels == 0)
                                        {
                                            imageHeightPixels = 1;
                                        }
                                    }
                                }
                            }
                            else if (current3.NameIndex == HtmlNameIndex.Width && !current3.Value.IsEmpty)
                            {
                                PropertyValue propertyValue2;
                                if (current3.Value.IsContiguous)
                                {
                                    propertyValue2 = HtmlSupport.ParseNumber(current3.Value.ContiguousBufferString, HtmlSupport.NumberParseFlags.Length);
                                }
                                else
                                {
                                    scratch.Reset();
                                    scratch.AppendHtmlAttributeValue(current3, 4096);
                                    propertyValue2 = HtmlSupport.ParseNumber(scratch.BufferString, HtmlSupport.NumberParseFlags.Length);
                                }
                                if (propertyValue2.IsAbsRelLength)
                                {
                                    imageWidthPixels = propertyValue2.PixelsInteger;
                                    if (imageWidthPixels == 0)
                                    {
                                        imageWidthPixels = 1;
                                    }
                                }
                            }
                        }
                        if (token.IsTagEnd)
                        {
                            string       imageUrl      = null;
                            string       text2         = null;
                            BufferString bufferString2 = imageAltText.BufferString;
                            bufferString2.TrimWhitespace();
                            if (bufferString2.Length != 0)
                            {
                                text2 = bufferString2.ToString();
                            }
                            if (text2 == null || output.ImageRenderingCallbackDefined)
                            {
                                BufferString bufferString3 = urlScratch.BufferString;
                                bufferString3.TrimWhitespace();
                                if (bufferString3.Length != 0)
                                {
                                    imageUrl = bufferString3.ToString();
                                }
                            }
                            if (!lineStarted)
                            {
                                StartParagraphOrLine();
                            }
                            output.OutputImage(imageUrl, text2, imageWidthPixels, imageHeightPixels);
                            urlScratch.Reset();
                            imageAltText.Reset();
                            imageHeightPixels = 0;
                            imageWidthPixels  = 0;
                            return;
                        }
                    }
                    break;

                default:
                    if (tagIndex != HtmlTagIndex.P)
                    {
                        if (tagIndex != HtmlTagIndex.Span)
                        {
                            return;
                        }
                        HtmlToken.AttributeEnumerator enumerator4 = token.Attributes.GetEnumerator();
                        while (enumerator4.MoveNext())
                        {
                            HtmlAttribute current4 = enumerator4.Current;
                            if (current4.NameIndex == HtmlNameIndex.Style)
                            {
                                scratch.Reset();
                                scratch.AppendHtmlAttributeValue(current4, 4096);
                                RecognizeInterestingFontNameInInlineStyle recognizeInterestingFontNameInInlineStyle = default(RecognizeInterestingFontNameInInlineStyle);
                                int num2 = 0;
                                while (num2 < scratch.Length && !recognizeInterestingFontNameInInlineStyle.IsFinished)
                                {
                                    recognizeInterestingFontNameInInlineStyle.AddCharacter(scratch.Buffer[num2]);
                                    num2++;
                                }
                                textMapping = recognizeInterestingFontNameInInlineStyle.TextMapping;
                                return;
                            }
                        }
                    }
                    else if (token.Attributes.Find(HtmlNameIndex.Class))
                    {
                        HtmlAttribute current5 = token.Attributes.Current;
                        if (current5.Value.CaseInsensitiveCompareEqual("msonormal"))
                        {
                            wideGap = false;
                            nextParagraphCloseWideGap = false;
                            return;
                        }
                    }
                    break;
                }
            }
        }
		private static void ConvertMappingStringToList()
		{
			string[] conversions = BrailleGrade2Mapping.mappingTable.Split('\n'); 

			foreach(string inLine in conversions)
			{
				string line = inLine.Replace("\r", "").Trim();
				if(line != null && line.Length>0)
				{
					string[] keyConversionPair = line.Split(' ');
					if(keyConversionPair.Length == 2 && keyConversionPair[0] != null && keyConversionPair[0].Length > 0 && keyConversionPair[1] != null && keyConversionPair[1].Length >0)
					{
						if(keyConversionPair[0] != "//")
						{
							TextMapping mapping = new TextMapping(keyConversionPair[0],keyConversionPair[1]);

							if(IsNumeric(mapping.Key))
							{
								numberMappngs.Add(mapping);
							}							
							else if(mapping.Key == mapping.Key.ToUpper())//if in all caps it is an exact match
							{
								mapping.Key = mapping.Key.ToLower();
								if (mapping.Key.Contains("*"))
								{
									if (mapping.Key[0] == '*')
									{
										mapping.Key = mapping.Key.Trim('*');
										postWordPunctuationMappings.Add(mapping);
									}
									else
									{
										mapping.Key = mapping.Key.Trim('*');
										beforeWordsMappings.Add(mapping);
									}
								}
								else
								{
									exactTextMappings.Add(mapping);
								}
								
							}
							else if(mapping.Key[0] == '+' && mapping.Key[mapping.Key.Length-1] == '+')//check between
							{
								mapping.Key = mapping.Key.Trim('+');
								betweenTextMappings.Add(mapping);
							}
							else if (mapping.Key[0] == '+') 
							{
								mapping.Key = mapping.Key.Trim('+');
								afterTextMappings.Add(mapping);
							}
							else if(mapping.Key[mapping.Key.Length-1] == '+')
							{
								mapping.Key = mapping.Key.Trim('+');
								beforeTextMappings.Add(mapping);
							}
							else if(mapping.Key.Contains("*"))
							{								
								if(mapping.Key[0] == '*')
								{
									mapping.Key = mapping.Key.Trim('*');
									postWordPunctuationMappings.Add(mapping);
								}
								else
								{
									mapping.Key = mapping.Key.Trim('*');
									beforeWordsMappings.Add(mapping);
								}
								
							}
							else//if not a special type then it is an anyPositionMapping
							{
								anyPositionMappings.Add(mapping);
							}
						}
					}
				}
			}

		}
        private void PopElement(HtmlDtd.TagDefinition tagDef)
        {
            switch (tagDef.tagIndex)
            {
            case HtmlTagIndex.Title:
            case HtmlTagIndex.Comment:
            case HtmlTagIndex.Script:
            case HtmlTagIndex.Style:

            case HtmlTagIndex.NoEmbed:
            case HtmlTagIndex.NoFrames:

                this.insideComment = false;
                break;

            case HtmlTagIndex.A:


                if (this.insideAnchor)
                {
                    this.EndAnchor();
                }
                break;

            case HtmlTagIndex.Image:
            case HtmlTagIndex.Img:

                break;

            case HtmlTagIndex.TD:
            case HtmlTagIndex.TH:

                this.lineStarted = true;
                break;

            case HtmlTagIndex.P:

                this.EndParagraph(this.nextParagraphCloseWideGap);
                this.nextParagraphCloseWideGap = true;
                break;


            case HtmlTagIndex.BR:
            case HtmlTagIndex.Option:

                this.EndLine();
                break;


            case HtmlTagIndex.HR:

                this.EndParagraph(false);
                this.OutputText("________________________________");
                this.EndParagraph(false);
                break;


            case HtmlTagIndex.OL:
            case HtmlTagIndex.UL:
            case HtmlTagIndex.Dir:
            case HtmlTagIndex.Menu:

                if (this.listLevel != 0)
                {
                    this.listLevel--;
                }

                this.EndParagraph(this.listLevel == 0);
                break;

            case HtmlTagIndex.DT:

                break;

            case HtmlTagIndex.DD:

                break;


            case HtmlTagIndex.Pre:
            case HtmlTagIndex.PlainText:
            case HtmlTagIndex.Listing:
            case HtmlTagIndex.Xmp:

                this.EndParagraph(true);
                this.insidePre = false;
                break;

            case HtmlTagIndex.Font:
            case HtmlTagIndex.Span:

                this.textMapping = TextMapping.Unicode;
                break;

            default:
                if (tagDef.blockElement)
                {
                    this.EndParagraph(false);
                }
                break;
            }

            this.ignoreNextP = false;
        }
Beispiel #22
0
 /// <summary>
 /// Add non spaces to the output.
 /// </summary>
 /// <param name="text">The text the replace with non spaces.</param>
 /// <param name="textMapping">The text mapping.</param>
 internal void OutputNonspace(string text, TextMapping textMapping)
 {
     this.OutputNonspace(text, 0, text.Length, textMapping);
 }
		private static int SortOnKeySize(TextMapping x, TextMapping y)
		{
			return y.Key.Length.CompareTo(x.Key.Length);
		}
		private static void ConvertMappingStringToList()
		{
			string[] conversions = BrailleGrade2Mapping.mappingTable.Split('\n'); 

			foreach(string line in conversions)
			{
				if(line != null && line.Length>0)
				{
					string[] keyConversionPair = line.Split(' ');
					if(keyConversionPair.Length == 2 && keyConversionPair[0] != null && keyConversionPair[0].Length > 0 && keyConversionPair[1] != null && keyConversionPair[1].Length >0)
					{
						if(keyConversionPair[0] != "//")
						{
							TextMapping mapping = new TextMapping(keyConversionPair[0],keyConversionPair[1]);
							if(mapping.Key == mapping.Key.ToUpper())//if in all caps it is an exact match
							{
								exactTextMappings.Add(mapping);
							}
							else if(mapping.Key[0] == '+' && mapping.Key[mapping.Key.Length-1] == '+')//check between
							{
								mapping.Key = mapping.Key.Trim('+');
								betweenTextMappings.Add(mapping);
							}
							else if (mapping.Key[0] == '+') 
							{
								mapping.Key = mapping.Key.Trim('+');
								afterTextMappings.Add(mapping);
							}
							else if(mapping.Key[mapping.Key.Length-1] == '+')
							{
								mapping.Key = mapping.Key.Trim('+');
								beforeTextMappings.Add(mapping);
							}
							else if(mapping.Key.Contains("*"))
							{
								//TODO - implement words before/after key
							}
							else//if not a special type then it is an anyPositionMapping
							{
								anyPositionMappings.Add(mapping);
							}
						}
					}
				}
			}

		}
 public void OutputNonspace(int ucs32Literal, TextMapping textMapping)
 {
     writer.WriteLine("TXT ({1}) \"{0}\"", SFromLiteral(ucs32Literal), textMapping == TextMapping.Unicode ? "U" : "S");
 }
Beispiel #26
0
        // Token: 0x0600190E RID: 6414 RVA: 0x000C7F8C File Offset: 0x000C618C
        public static bool IsSymbolField(ref ScratchBuffer scratch, out TextMapping textMapping, out char symbol, out short points)
        {
            textMapping = TextMapping.Unicode;
            symbol      = '\0';
            points      = 0;
            int num    = 0;
            int length = scratch.Length;

            while (num != scratch.Length && ParseSupport.WhitespaceCharacter(ParseSupport.GetCharClass(scratch[num])))
            {
                num++;
            }
            if (scratch.Length - num <= 7 || scratch[num] != 'S' || scratch[num + 1] != 'Y' || scratch[num + 2] != 'M' || scratch[num + 3] != 'B' || scratch[num + 4] != 'O' || scratch[num + 5] != 'L' || scratch[num + 6] != ' ')
            {
                return(false);
            }
            num += 7;
            int  num2;
            int  num3;
            int  num4;
            int  num5;
            int  fieldArgument = RtfSupport.GetFieldArgument(ref scratch, num, out num2, out num3, out num4, out num5);
            int  num6;
            char c;

            if (num3 > 2 && scratch.Buffer[num2] == '0' && (ushort)(scratch.Buffer[num2 + 1] | ' ') == 120)
            {
                num6 = 2;
                while (num6 < num3 && (c = scratch.Buffer[num2 + num6]) <= 'f')
                {
                    if (('0' > c || c > '9') && ('a' > c || c > 'f'))
                    {
                        if ('A' > c)
                        {
                            break;
                        }
                        if (c > 'F')
                        {
                            break;
                        }
                    }
                    symbol = (symbol << 4) + ((c <= '9') ? (c - '0') : ((c & 'O') - 'A' + '\n'));
                    num6++;
                }
            }
            else
            {
                num6 = 0;
                while (num6 < num3 && (c = scratch.Buffer[num2 + num6]) <= '9' && '0' <= c)
                {
                    symbol = '\n' * symbol + (c - '0');
                    num6++;
                }
            }
            num          += fieldArgument;
            fieldArgument = RtfSupport.GetFieldArgument(ref scratch, num, out num2, out num3, out num4, out num5);
            if (num3 != 2 || scratch[num2] != '\\' || scratch[num2 + 1] != 'f')
            {
                return(false);
            }
            num          += fieldArgument;
            fieldArgument = RtfSupport.GetFieldArgument(ref scratch, num, out num2, out num3, out num4, out num5);
            if (num5 == 0)
            {
                return(false);
            }
            RecognizeInterestingFontName recognizeInterestingFontName = default(RecognizeInterestingFontName);

            num6 = 0;
            while (num6 < num5 && !recognizeInterestingFontName.IsRejected)
            {
                recognizeInterestingFontName.AddCharacter(scratch.Buffer[num4 + num6]);
                num6++;
            }
            textMapping = recognizeInterestingFontName.TextMapping;
            if (textMapping == TextMapping.Unicode)
            {
                textMapping = TextMapping.OtherSymbol;
            }
            num          += fieldArgument;
            fieldArgument = RtfSupport.GetFieldArgument(ref scratch, num, out num2, out num3, out num4, out num5);
            if (num3 != 2 || scratch[num2] != '\\' || scratch[num2 + 1] != 's')
            {
                return(true);
            }
            num          += fieldArgument;
            fieldArgument = RtfSupport.GetFieldArgument(ref scratch, num, out num2, out num3, out num4, out num5);
            num6          = 0;
            while (num6 < num3 && (c = scratch.Buffer[num2 + num6]) <= '9' && '0' <= c)
            {
                points = 10 * points + (short)(c - '0');
                num6++;
            }
            return(true);
        }
Beispiel #27
0
 public void OutputNonspace(string text, TextMapping textMapping)
 {
     OutputNonspace(text, 0, text.Length, textMapping);
 }
 public FixedLengthProvider(TextMapping mapping)
 {
     Mapping = mapping;
 }
        private void ProcessStartTagAttributes(HtmlDtd.TagDefinition tagDef)
        {
            switch (tagDef.tagIndex)
            {
            case HtmlTagIndex.A:


                if (this.outputAnchorLinks)
                {
                    foreach (HtmlAttribute attr in this.token.Attributes)
                    {
                        if (attr.NameIndex == HtmlNameIndex.Href)
                        {
                            if (attr.IsAttrBegin)
                            {
                                this.urlScratch.Reset();
                            }

                            this.urlScratch.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);
                            break;
                        }
                    }

                    if (this.token.IsTagEnd)
                    {
                        BufferString url = this.urlScratch.BufferString;

                        url.TrimWhitespace();

                        if (url.Length != 0 && url[0] != '#' && url[0] != '?' && url[0] != ';')
                        {
                            if (!this.lineStarted)
                            {
                                this.StartParagraphOrLine();
                            }



                            string urlString = url.ToString();

                            if (urlString.IndexOf(' ') != -1)
                            {
                                urlString = urlString.Replace(" ", "%20");
                            }

                            this.output.AnchorUrl = urlString;
                            this.insideAnchor     = true;

                            if (this.urlCompareSink == null)
                            {
                                this.urlCompareSink = new UrlCompareSink();
                            }

                            this.urlCompareSink.Initialize(urlString);
                        }

                        this.urlScratch.Reset();
                    }
                }
                break;

            case HtmlTagIndex.Image:
            case HtmlTagIndex.Img:



                if (this.outputImageLinks)
                {
                    foreach (HtmlAttribute attr in this.token.Attributes)
                    {
                        if (attr.NameIndex == HtmlNameIndex.Src)
                        {
                            if (attr.IsAttrBegin)
                            {
                                this.urlScratch.Reset();
                            }

                            this.urlScratch.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);
                        }
                        else if (attr.NameIndex == HtmlNameIndex.Alt)
                        {
                            if (attr.IsAttrBegin)
                            {
                                this.imageAltText.Reset();
                            }

                            this.imageAltText.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);
                        }
                        else if (attr.NameIndex == HtmlNameIndex.Height)
                        {
                            if (!attr.Value.IsEmpty)
                            {
                                PropertyValue value;

                                if (attr.Value.IsContiguous)
                                {
                                    value = HtmlSupport.ParseNumber(attr.Value.ContiguousBufferString, HtmlSupport.NumberParseFlags.Length);
                                }
                                else
                                {
                                    this.scratch.Reset();
                                    this.scratch.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);
                                    value = HtmlSupport.ParseNumber(this.scratch.BufferString, HtmlSupport.NumberParseFlags.Length);
                                }

                                if (value.IsAbsRelLength)
                                {
                                    this.imageHeightPixels = value.PixelsInteger;
                                    if (this.imageHeightPixels == 0)
                                    {
                                        this.imageHeightPixels = 1;
                                    }
                                }
                            }
                        }
                        else if (attr.NameIndex == HtmlNameIndex.Width)
                        {
                            if (!attr.Value.IsEmpty)
                            {
                                PropertyValue value;

                                if (attr.Value.IsContiguous)
                                {
                                    value = HtmlSupport.ParseNumber(attr.Value.ContiguousBufferString, HtmlSupport.NumberParseFlags.Length);
                                }
                                else
                                {
                                    this.scratch.Reset();
                                    this.scratch.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);
                                    value = HtmlSupport.ParseNumber(this.scratch.BufferString, HtmlSupport.NumberParseFlags.Length);
                                }

                                if (value.IsAbsRelLength)
                                {
                                    this.imageWidthPixels = value.PixelsInteger;
                                    if (this.imageWidthPixels == 0)
                                    {
                                        this.imageWidthPixels = 1;
                                    }
                                }
                            }
                        }
                    }



                    if (this.token.IsTagEnd)
                    {
                        string urlString = null;
                        string altString = null;



                        BufferString alt = this.imageAltText.BufferString;

                        alt.TrimWhitespace();

                        if (alt.Length != 0)
                        {
                            altString = alt.ToString();
                        }

                        if (altString == null || this.output.ImageRenderingCallbackDefined)
                        {
                            BufferString url = this.urlScratch.BufferString;

                            url.TrimWhitespace();

                            if (url.Length != 0)
                            {
                                urlString = url.ToString();
                            }
                        }

                        if (!this.lineStarted)
                        {
                            this.StartParagraphOrLine();
                        }

                        this.output.OutputImage(urlString, altString, this.imageWidthPixels, this.imageHeightPixels);

                        this.urlScratch.Reset();
                        this.imageAltText.Reset();
                        this.imageHeightPixels = 0;
                        this.imageWidthPixels  = 0;
                    }
                }
                break;

            case HtmlTagIndex.P:



                if (this.token.Attributes.Find(HtmlNameIndex.Class) && this.token.Attributes.Current.Value.CaseInsensitiveCompareEqual("msonormal"))
                {
                    this.wideGap = false;
                    this.nextParagraphCloseWideGap = false;
                }
                break;

            case HtmlTagIndex.Font:

                foreach (HtmlAttribute attr in this.token.Attributes)
                {
                    if (attr.NameIndex == HtmlNameIndex.Face)
                    {
                        this.scratch.Reset();
                        this.scratch.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);

                        RecognizeInterestingFontName fontRecognizer = new RecognizeInterestingFontName();

                        for (int i = 0; i < this.scratch.Length && !fontRecognizer.IsRejected; i++)
                        {
                            fontRecognizer.AddCharacter(this.scratch.Buffer[i]);
                        }

                        this.textMapping = fontRecognizer.TextMapping;
                        break;
                    }
                }

                break;


            case HtmlTagIndex.Span:

                foreach (HtmlAttribute attr in this.token.Attributes)
                {
                    if (attr.NameIndex == HtmlNameIndex.Style)
                    {
                        this.scratch.Reset();
                        this.scratch.AppendHtmlAttributeValue(attr, HtmlSupport.MaxAttributeSize);

                        RecognizeInterestingFontNameInInlineStyle fontRecognizer = new RecognizeInterestingFontNameInInlineStyle();

                        for (int i = 0; i < this.scratch.Length && !fontRecognizer.IsFinished; i++)
                        {
                            fontRecognizer.AddCharacter(this.scratch.Buffer[i]);
                        }

                        this.textMapping = fontRecognizer.TextMapping;
                        break;
                    }
                }

                break;
            }
        }
		// Token: 0x06001A02 RID: 6658 RVA: 0x000CE218 File Offset: 0x000CC418
		private void MapAndOutputSymbolCharacter(char ch, TextMapping textMapping)
		{
			if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
			{
				this.OutputNonspace((int)ch, TextMapping.Unicode);
				return;
			}
			string text = null;
			if (textMapping == TextMapping.Wingdings)
			{
				if (ch <= 'Ø')
				{
					switch (ch)
					{
					case 'J':
						text = "☺";
						break;
					case 'K':
						text = ":|";
						break;
					case 'L':
						text = "☹";
						break;
					default:
						if (ch == 'Ø')
						{
							text = ">";
						}
						break;
					}
				}
				else
				{
					switch (ch)
					{
					case 'ß':
						text = "<--";
						break;
					case 'à':
						text = "-->";
						break;
					default:
						switch (ch)
						{
						case 'ç':
							text = "<==";
							break;
						case 'è':
							text = "==>";
							break;
						default:
							switch (ch)
							{
							case 'ï':
								text = "<=";
								break;
							case 'ð':
								text = "=>";
								break;
							case 'ó':
								text = "<=>";
								break;
							}
							break;
						}
						break;
					}
				}
			}
			if (text == null)
			{
				text = "•";
			}
			this.OutputNonspace(text, TextMapping.Unicode);
		}
Beispiel #31
0
        /// <summary>
        /// Encodes the symbol character.
        /// </summary>
        /// <param name="ch">The character to encode.</param>
        /// <param name="textMapping">The text mapping.</param>
        private void MapAndOutputSymbolCharacter(char ch, TextMapping textMapping)
        {
            if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
            {
                this.OutputNonspace((int)ch, TextMapping.Unicode);
                return;
            }

            string substitute = null;

            if (textMapping == TextMapping.Wingdings)
            {
                switch ((int)ch)
                {
                case 74:
                    substitute = "\x263A";
                    break;

                case 75:
                    substitute = ":|";
                    break;

                case 76:
                    substitute = "\x2639";
                    break;

                case 216:
                    substitute = ">";
                    break;

                case 223:
                    substitute = "<--";
                    break;

                case 224:
                    substitute = "-->";
                    break;

                case 231:
                    substitute = "<==";
                    break;

                case 232:
                    substitute = "==>";
                    break;

                case 239:
                    substitute = "<=";
                    break;

                case 240:
                    substitute = "=>";
                    break;

                case 243:
                    substitute = "<=>";
                    break;
                }
            }

            if (substitute == null)
            {
                substitute = "\x2022";
            }

            this.OutputNonspace(substitute, TextMapping.Unicode);
        }
 public void OutputNonspace(string text, int offset, int length, TextMapping textMapping)
 {
     writer.WriteLine("TXT ({1}) \"{0}\"", SFromString(text, offset, length), textMapping == TextMapping.Unicode ? "U" : "S");
     writer.Flush();
 }