Guest User

Untitled

a guest
Mar 26th, 2015
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. class Program
  2. {
  3.     static void Main(string[] args)
  4.     {
  5.         int pos = 0;
  6.         var lines = File.ReadAllText("B:/Temp/file.txt");
  7.         //bool[] num = new bool[8];
  8.         BitArray bits = new BitArray(new bool[8]);
  9.         int[] number = new int[1];
  10.         int bit = 0;
  11.         int numcount = 0;
  12.         while (pos != -1)
  13.         {
  14.             pos = lines.IndexOf("mrout" + (bit + 1).ToString() + ":=", pos + 1);
  15.             bits.Set(bit, lines[pos + 8] == 'T');
  16.             if (bit == 7)
  17.             {
  18.                 bits.CopyTo(number, 0);
  19.                 var str = Convert.ToString(number[0], 2).PadLeft(8, '0');
  20.                 //Console.Write("2#" + str + ", ");
  21.                 Console.Write(number[0] + ", ");
  22.                 numcount++;
  23.                 //if ((numcount % 5) == 0) Console.WriteLine();
  24.             }
  25.             bit = (bit + 1) % 8;
  26.         }
  27.         Console.WriteLine();
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment