private TextSubMode GetSymbolSubmode(TextModeDefinitionEntry entry) { TextSubMode textSubMode; if (!this.textSubModes.TryGetValue(entry.TypeIndex, out textSubMode)) { return(TextSubMode.Punctuation); } return(textSubMode); }
internal TextModeDefinitionEntry GetNextValidCharacter( string remainingData) { TextModeDefinitionEntry characterInTable = TextMode.FindCharacterInTable((int)remainingData[0]); if (characterInTable != null || remainingData.Length <= 1) { return(characterInTable); } remainingData = remainingData.Substring(1); return(this.GetNextValidCharacter(remainingData)); }
internal void InitializeFormatData(string data) { this.formattedDataInt = new List <long>(); int num1 = 0; while (num1 < data.Length) { TextModeDefinitionEntry nextValidCharacter = this.GetNextValidCharacter(data.Substring(num1)); if (nextValidCharacter != null) { this.CurrentSymbolSubmode = this.GetSymbolSubmode(nextValidCharacter); if (num1 == 0) { if (nextValidCharacter.TypeIndex == 1) { this.formattedDataInt.Add(27L); this.CurrentSubmodeSwitch = 27; } else if (nextValidCharacter.TypeIndex == 2) { this.formattedDataInt.Add(28L); this.CurrentSubmodeSwitch = 28; } else if (nextValidCharacter.TypeIndex == 3) { this.formattedDataInt.Add(29L); this.CurrentSubmodeSwitch = 29; } if (this.IsStringIdentical(data, nextValidCharacter.TypeIndex)) { this.AddRangeToFormattedDataInt(data); int num2 = num1 + data.Length; break; } int firstSegmentLength = this.GetFirstSegmentLength(data); num1 += firstSegmentLength; this.AddRangeToFormattedDataInt(data.Substring(0, firstSegmentLength)); this.SetCurrentSwitch(this.GetNextValidCharacter(data.Substring(num1 - 1)), data, num1 - 1); } else { this.formattedDataInt.Add((long)nextValidCharacter.RowIndex); if (num1 != data.Length - 1) { this.SetCurrentSwitch(nextValidCharacter, data, num1); } ++num1; } } } }
private bool IsStringIdentical(string data, int typeIndex) { bool flag = true; for (int startIndex = 0; startIndex < data.Length - 1; ++startIndex) { TextModeDefinitionEntry nextValidCharacter1 = this.GetNextValidCharacter(data.Substring(startIndex)); TextModeDefinitionEntry nextValidCharacter2 = this.GetNextValidCharacter(data.Substring(startIndex + 1)); if (nextValidCharacter1.TypeIndex != nextValidCharacter2.TypeIndex || nextValidCharacter1.TypeIndex != typeIndex || nextValidCharacter2.TypeIndex != typeIndex) { flag = false; break; } } return(flag); }
private void SetCurrentSwitch(TextModeDefinitionEntry currentEntry, string data, int dataIndex) { TextModeDefinitionEntry nextValidCharacter = this.GetNextValidCharacter(data.Substring(dataIndex + 1)); if (nextValidCharacter == null) { return; } if (currentEntry.TypeIndex != 3) { this.SetCurrentSwitchCore(currentEntry.TypeIndex, nextValidCharacter.TypeIndex); } else { TextSubMode?previousSymbolSubmode = this.PreviousSymbolSubmode; TextSubMode symbolSubmode = this.GetSymbolSubmode(nextValidCharacter); if ((previousSymbolSubmode.GetValueOrDefault() != symbolSubmode ? 0 : (previousSymbolSubmode.HasValue ? 1 : 0)) != 0) { this.CurrentSubmodeSwitch = this.PreviousSubmodeSwitch; } else if (this.PreviousSymbolSubmode.HasValue) { this.SetCurrentSwitchCore((int)this.PreviousSymbolSubmode.Value, nextValidCharacter.TypeIndex); } else if (nextValidCharacter.TypeIndex == 1) { this.formattedDataInt.Add(27L); this.CurrentSubmodeSwitch = 27; } else if (nextValidCharacter.TypeIndex == 2 && this.CurrentSubmodeSwitch != 28) { this.formattedDataInt.Add(28L); this.CurrentSubmodeSwitch = 28; } else { if (nextValidCharacter.TypeIndex != 3) { return; } this.formattedDataInt.Add(29L); this.CurrentSubmodeSwitch = 29; } } }
private int GetFirstSegmentLength(string data) { int num = data.Length <= 0 ? 0 : 1; for (int startIndex = 0; startIndex < data.Length; ++startIndex) { TextModeDefinitionEntry nextValidCharacter1 = this.GetNextValidCharacter(data.Substring(startIndex)); TextModeDefinitionEntry nextValidCharacter2 = this.GetNextValidCharacter(data.Substring(startIndex + 1)); if (nextValidCharacter1 != null && nextValidCharacter2 != null && nextValidCharacter1.TypeIndex == nextValidCharacter2.TypeIndex) { ++num; } else { break; } } return(num); }