Esempio n. 1
0
 public void CombineChar(SingleChar targetChar,
                         ref Dictionary <byte, SingleChar> charsDict,
                         ref Dictionary <byte, CharCode> charCodes)
 {
     foreach (var char1 in Chars)
     {
         charCodes[char1].AddBit(true);
     }
     foreach (var char2 in targetChar.Chars)
     {
         charCodes[char2].AddBit(false);
     }
     Chars  = Chars.Union(targetChar.Chars).ToList();
     Count += targetChar.Count;
     charsDict.Remove(charsDict.First(c => c.Value == targetChar).Key);
 }
Esempio n. 2
0
 private void ReadBuffer(byte[] buffer)
 {
     _charsDict = new Dictionary <byte, SingleChar>();
     _charCodes = new Dictionary <byte, CharCode>();
     _buffer    = buffer;
     foreach (var currentChar in _buffer)
     {
         if (_charsDict.ContainsKey(currentChar))
         {
             _charsDict[currentChar].Count++;
             _charCodes[currentChar].Count++;
         }
         else
         {
             _charsDict[currentChar] = new SingleChar(currentChar);
             _charCodes[currentChar] = new CharCode(currentChar);
         }
     }
 }