/// <inheritdoc /> public async Task <bool> SetRebootState(RebootState newRebootState, CancellationToken cancellationToken) { if (RebootState == newRebootState) { return(true); } reattachInformation.RebootState = newRebootState; return(await SendCommand(String.Format(CultureInfo.InvariantCulture, "{0}&{1}={2}", byondTopicSender.SanitizeString(Constants.DMTopicChangeReboot), byondTopicSender.SanitizeString(Constants.DMParameterData), (int)newRebootState), cancellationToken).ConfigureAwait(false) == Constants.DMResponseSuccess); }
/// <summary> /// Construct a <see cref="ReattachInformationBase"/> from a given <paramref name="copy"/> /// </summary> /// <param name="copy">The <see cref="ReattachInformationBase"/> to copy values from</param> protected ReattachInformationBase(ReattachInformationBase copy) : base(copy) { if (copy == null) { throw new ArgumentNullException(nameof(copy)); } AccessIdentifier = copy.AccessIdentifier; IsPrimary = copy.IsPrimary; Port = copy.Port; ProcessId = copy.ProcessId; RebootState = copy.RebootState; }
/// <inheritdoc /> public async Task <bool> SetRebootState(RebootState newRebootState, CancellationToken cancellationToken) { if (RebootState == newRebootState) { return(true); } logger.LogTrace("Changing reboot state to {0}", newRebootState); reattachInformation.RebootState = newRebootState; var result = await SendCommand( new TopicParameters(newRebootState), cancellationToken) .ConfigureAwait(false); return(result?.InteropResponse != null && result.InteropResponse?.ErrorMessage == null); }
/// <summary> /// Initializes a new instance of the <see cref="TopicParameters"/> <see langword="class"/>. /// </summary> /// <param name="newRebootState">The value of <see cref="NewRebootState"/>.</param> public TopicParameters(RebootState newRebootState) : this(TopicCommandType.ChangeRebootState) { NewRebootState = newRebootState; }