/// <summary> /// Restores the state to before the installation. /// </summary> /// <param name="state">The installer state.</param> private void Restore(IDictionary state) { string uriPrefix = (string)state[InstallTools.GetStateKey(this, "UriPrefix")]; string account = (string)state[InstallTools.GetStateKey(this, "Account")]; HttpSys.RemovePrefixReservation(uriPrefix, account); }
/// <summary> /// Installs the registry key. /// </summary> /// <param name="state">The installer state.</param> public override void Install(IDictionary state) { base.Install(state); state[InstallTools.GetStateKey(this, "UriPrefix")] = uriPrefix; state[InstallTools.GetStateKey(this, "Account")] = account; HttpSys.AddPrefixReservation(uriPrefix, account); }
/// <summary> /// Executes the specified INI command. /// </summary> /// <param name="args">The command arguments.</param> /// <returns>0 on success, a non-zero error code otherwise.</returns> public static int Execute(string[] args) { const string usage = @" Usage: ------------------------------------------------------------------------------- vegomatic http reserve <uri-prefix> <user> Commands the low-level HTTP.SYS Windows layer to add a prefix reservation allowing the specified Windows account to create HTTP listeners on the specified URI prefix. Note that the prefix must include a scheme, host name or wildcard, a port number, and optionally, a virtual path, following the Windows prefix rules. ------------------------------------------------------------------------------- vegomatic http unreserve <uri-prefix> <user> Commands the low-level HTTP.SYS Windows layer to remove the prefix reservation for the specified Windows account. "; if (args.Length != 3) { Program.Error(usage); return(1); } switch (args[0].ToLowerInvariant()) { case "reserve": HttpSys.AddPrefixReservation(args[1], args[2]); Console.WriteLine("Reservation added for [{0}] and account [{1}].", args[1], args[2]); return(0); case "unreserve": HttpSys.RemovePrefixReservation(args[1], args[2]); Console.WriteLine("Reservation removed for [{0}] and account [{1}].", args[1], args[2]); return(0); default: Program.Error(usage); return(1); } }