Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- namespace iOSTest
- {
- public class TextTransponder : MemoryStream
- {
- private static readonly bool[] _charTable = new bool[256];
- static TextTransponder()
- {
- int len = _charTable.Length;
- while (len > 0) _charTable [--len] = true;
- len = 0;
- while (len < 8) _charTable [len++] = false;
- len = 14;
- while (len < 32) _charTable [len++] = false;
- _charTable [11] = _charTable [12] = false;
- }
- public TextTransponder (FileStream src) : base(src.Length)
- {
- long oldPos = src.Position;
- src.Position = 0;
- int len = src.Length;
- while (len-- > 0) {
- byte c = src.ReadByte ();
- if (_charTable [c])
- this.WriteByte (c);
- }
- src.Position = oldPos;
- this.Position = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement