public static RtfTokenId TokenIdFromRunKind(RtfRunKind runKind) { if (runKind >= RtfRunKind.Text) { return(RtfTokenId.Text); } return((RtfTokenId)(runKind >> 12)); }
private void ParseAndWatch() { while (!this.parser.ParseRun()) { if (this.parser.ParseBufferFull) { this.Restart(RtfEncapsulation.None); return; } if (!this.parser.ReadMoreData(false)) { return; } } RtfRunKind runKind = this.parser.RunKind; if (runKind != RtfRunKind.Ignore) { if (runKind != RtfRunKind.Begin) { if (runKind != RtfRunKind.Keyword) { this.Restart(RtfEncapsulation.None); } else { if (this.countTokens++ > 10) { this.Restart(RtfEncapsulation.None); return; } if (this.parser.KeywordId == 292) { if (this.parser.KeywordValue >= 1) { this.Restart(RtfEncapsulation.Html); return; } this.Restart(RtfEncapsulation.None); return; } else if (this.parser.KeywordId == 329) { this.Restart(RtfEncapsulation.Text); return; } } } else if (this.countTokens++ != 0) { this.Restart(RtfEncapsulation.None); return; } } }
public RtfPreviewStream(Stream inputRtfStream, int inputBufferSize) { this.InputRtfStream = inputRtfStream; this.Parser = new RtfParserBase(inputBufferSize, false, null); int offset; int num = this.Parser.GetBufferSpace(false, out offset); num = this.InputRtfStream.Read(this.Parser.ParseBuffer, offset, num); this.Parser.ReportMoreDataAvailable(num, num == 0); int num2 = 0; while (this.Parser.ParseRun()) { RtfRunKind runKind = this.Parser.RunKind; if (runKind != RtfRunKind.Ignore) { if (runKind != RtfRunKind.Begin) { if (runKind != RtfRunKind.Keyword) { return; } if (num2++ > 10) { return; } if (this.Parser.KeywordId == 292) { if (this.Parser.KeywordValue >= 1) { this.rtfEncapsulation = RtfEncapsulation.Html; return; } break; } else if (this.Parser.KeywordId == 329) { this.rtfEncapsulation = RtfEncapsulation.Text; return; } } else if (num2++ != 0) { return; } } } }
// Token: 0x0600191D RID: 6429 RVA: 0x000C8724 File Offset: 0x000C6924 internal void Initialize(RtfRunKind kind, int length, int unescaped, bool skip, bool lead) { ushort num = (ushort)kind; if (skip) { num |= 1024; } if (lead) { num |= 512; } this.bitFields = num; this.length = (ushort)length; this.value = unescaped; }
private bool CopyCurrentRunToBuffer() { if (this.byteBuffer == null) { this.byteBuffer = new byte[256]; } if (this.byteBuffer.Length == this.byteBufferCount) { return(false); } RtfRunKind kind = this.runQueue[this.currentRun].Kind; if (kind != RtfRunKind.Text) { if (kind == RtfRunKind.Escape) { this.byteBuffer[this.byteBufferOffet + this.byteBufferCount] = (byte)this.runQueue[this.currentRun].Value; this.byteBufferCount++; return(true); } if (kind == RtfRunKind.Zero) { int num = Math.Min((int)this.runQueue[this.currentRun].Length - this.currentRunDelta, this.byteBuffer.Length - this.byteBufferCount); if (!this.stripZeroBytes) { for (int i = 0; i < num; i++) { this.byteBuffer[this.byteBufferOffet + this.byteBufferCount] = 32; this.byteBufferCount++; } } this.currentRunDelta += num; } } else { int num = Math.Min((int)this.runQueue[this.currentRun].Length - this.currentRunDelta, this.byteBuffer.Length - this.byteBufferCount); System.Buffer.BlockCopy(this.dataBuffer, this.currentRunOffset + this.currentRunDelta, this.byteBuffer, this.byteBufferOffet + this.byteBufferCount, num); this.byteBufferCount += num; this.currentRunDelta += num; } return(this.currentRunDelta == (int)this.runQueue[this.currentRun].Length); }
// Token: 0x0600191C RID: 6428 RVA: 0x000C870B File Offset: 0x000C690B internal void Initialize(RtfRunKind kind, int length, int value) { this.bitFields = (ushort)kind; this.length = (ushort)length; this.value = value; }