Advertisement
Guest User

Untitled

a guest
Aug 4th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. public async Task PerformDecodeAsync(string sourcepath, string targetPath)
  2. {
  3.     using (var streamWriter = File.AppendText(targetPath))
  4.     {
  5.         foreach(var tempLine in File.ReadLines(sourcePath))
  6.         {
  7.             short decodeCounter = 0;
  8.             StringBuilder line = new StringBuilder();
  9.             foreach (var singleChar in tempLine)
  10.             {
  11.                 var positionInDecodeKey = decodingKeysList[decodeCounter].IndexOf(singleChar);
  12.  
  13.                 if (positionInDecodeKey > 0)
  14.                     line.Append(model.Substring(positionInDecodeKey, 1));
  15.                 else
  16.                     line.Append(singleChar);
  17.  
  18.                 if (decodeCounter > 18)
  19.                     decodeCounter = 0;
  20.                 else ++decodeCounter;
  21.             }
  22.            
  23.             await streamWriter.WriteLineAsync(line);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement