public async Task <string> ReadValueAsync(RegistryBaseKey baseKey, string key, string valueName, string defaultValue) { var command = new RegistryReadStringValueCommand(baseKey, key, valueName, defaultValue); IServiceCommandResponse response = await _commandBridge.SendCommandAsync(command); response.ThrowIfError(); return((string)response.Result); }
private static bool TryDeserialize( BridgeMessageDeserializer deserializer, out IServiceCommand command, out IServiceCommandResponse errorResponse) { switch (deserializer.CommandName) { case ServiceCommandName.ShutdownServer: command = new ShutdownServerCommand(); break; case ServiceCommandName.Echo: command = new EchoCommand(deserializer); break; case ServiceCommandName.RegistryReadIntValue: command = new RegistryReadIntValueCommand(deserializer); break; case ServiceCommandName.RegistryReadStringValue: command = new RegistryReadStringValueCommand(deserializer); break; case ServiceCommandName.RegistryWriteIntValue: command = new RegistryWriteIntValueCommand(deserializer); break; case ServiceCommandName.RegistryWriteStringValue: command = new RegistryWriteStringValueCommand(deserializer); break; case ServiceCommandName.Unknown: default: throw new InvalidOperationException( "This should be unreachable because the deserializer should have detected an invalid command name"); } if (deserializer.HadError) { command = null; } errorResponse = deserializer.LastError; return(!deserializer.HadError); }