Пример #1
0
        private static void scanFile(TextDecoder decoder, int stringLength, string outFile, Encoding encoding)
        {
            int filePosition = 0;

            try {
                using (StreamWriter writer = new StreamWriter(outFile, false, encoding))
                {
                    foreach (var textString in decoder.GetDecodedStrings())
                    {
                        if (textString.TextString.Count >= stringLength)
                        {
                            writer.WriteLine("Position: " + filePosition.ToString("X"));
                            writer.WriteLine(string.Concat(textString.TextString));
                            writer.WriteLine();
                        }
                        filePosition += textString.BytesRead + 1;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return;
            }
        }
Пример #2
0
        public void MultiLineDecode()
        {
            TextDecoder decoder = initDecoder();

            decoder.SetHexBlock(new byte[] { 0, 3, 1, 3, 2 });
            var decodedStrings = decoder.GetDecodedStrings("0");

            Assert.Equal(3, decodedStrings.Count());
        }