コード例 #1
0
        private async void buttonLaunch_Click(object sender, EventArgs e)
        {
            comboIp.Enabled      = false;
            buttonLaunch.Enabled = false;

            await _modifier.SaveIpAsync(comboIp.Text);
        }
コード例 #2
0
        /// <param name="address">IP Address of the server, will prompt if not specified</param>
        /// <param name="name">Name for server region</param>
        private static Task Main(string address = null, string name = AmongUsModifier.DefaultRegionName)
        {
            Modifier.RegionName = name;
            Modifier.Error     += ModifierOnError;
            Modifier.Saved     += ModifierOnSaved;

            Console.WriteLine("Welcome to Impostor");

            if (Modifier.TryLoadRegionInfo(out var regionInfo))
            {
                Console.WriteLine($"Currently selected region: {regionInfo.Name} ({regionInfo.Ping}, {regionInfo.Servers.Count} server(s))");
            }

            if (address != null)
            {
                return(Modifier.SaveIpAsync(address));
            }

            return(PromptAsync());
        }
コード例 #3
0
        internal static Task <int> Main(string[] args)
        {
            var rootCommand = new RootCommand
            {
                new Option <string>(
                    "--address",
                    "IP Address of the server, will prompt if not specified"
                    ),
                new Option <string>(
                    "--name",
                    () => AmongUsModifier.DefaultRegionName,
                    "Name for server region"
                    )
            };

            rootCommand.Handler = CommandHandler.Create <string, string>((address, name) =>
            {
                Modifier.RegionName = name;
                Modifier.Error     += ModifierOnError;
                Modifier.Saved     += ModifierOnSaved;

                Console.WriteLine("Welcome to Impostor");

                if (Modifier.TryLoadRegionInfo(out var regionInfo))
                {
                    Console.WriteLine($"Currently selected region: {regionInfo.Name} ({regionInfo.Ping}, {regionInfo.Servers.Count} server(s))");
                }

                if (address != null)
                {
                    return(Modifier.SaveIpAsync(address));
                }

                return(PromptAsync());
            });

            return(rootCommand.InvokeAsync(args));
        }