public static DaemonKey GetDaemonKey(this IFuseLauncher fuseLauncher) { //var p = _fuseLauncher.Start("daemon", new []{ "--get-key" }); // Temporary workaround for slow startup. return(DaemonKey.GetDaemonKey()); }
static void SendHello(string clientName, NetworkStream stream) { var helloPayload = "{" + "\"Name\": \"Hello\", " + "\"Id\": 0, " + "\"Arguments\": " + "{" + "\"Identifier\": \"" + clientName + "\"," + "\"DaemonKey\": \"" + DaemonKey.GetDaemonKey() + "\"," + "\"EventFilter\": \"Strict\"" + "}" + "}"; var helloPayloadBytes = Encoding.UTF8.GetBytes(helloPayload); var helloRequestHead = Encoding.UTF8.GetBytes("Request\n" + helloPayloadBytes.Length + "\n"); var helloRequest = helloRequestHead.Concat(helloPayloadBytes).ToArray(); stream.Write(helloRequest, 0, helloRequest.Length); while (true) { var reader = new BinaryReader(stream); var messageType = Encoding.UTF8.GetString(reader.ReadLine()); var lengthBytes = Encoding.UTF8.GetString(reader.ReadLine()); int length; if (!int.TryParse(lengthBytes, out length)) { throw new ExitWithError("Failed to parse message length of expected Hello response."); } // We need to read all data, even if we don't care about other things than hello response. reader.ReadBytes(length); if (messageType == "Response") { // TODO: We should probably verify that the response is a hello response. break; } } }
public DaemonKey GetDaemonKey() { return(DaemonKey.GetDaemonKey()); }