Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 KB | None | 0 0
  1. private static void OpenStandardStreamOut(string stringData)
  2.         {
  3.             // We need to send the 4 bytes of length information
  4.             int DataLength = stringData.Length;
  5.  
  6.             // Set the encoding
  7.             Console.OutputEncoding = new UTF8Encoding();
  8.             Console.InputEncoding = new UTF8Encoding();
  9.             Console.Title = "FirePrint Console";
  10.  
  11.             Stream stdout = Console.OpenStandardOutput();
  12.             stdout.WriteByte((byte)((DataLength >> 0) & 0xFF));
  13.             stdout.WriteByte((byte)((DataLength >> 8) & 0xFF));
  14.             stdout.WriteByte((byte)((DataLength >> 16) & 0xFF));
  15.             stdout.WriteByte((byte)((DataLength >> 24) & 0xFF));
  16.  
  17.             using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Utilisateur\Desktop\native-messaging\app\debug.txt", true, Encoding.UTF8))
  18.             {
  19.                 file.WriteLine(Console.OutputEncoding);
  20.                 file.WriteLine(stringData);
  21.             }
  22.  
  23.             // Available total length : 4,294,967,295 ( FF FF FF FF )
  24.             Console.Write(stringData);
  25.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement