static async Task <int> MainWithParsedAsync(ConnectArgs options) { try { var stratHelp = InstantiateConnector(options.Algorithm, options.DifficultyMultiplier); var serverInfo = FromArgs(options); return(await MainWithParsedAsync(serverInfo, stratHelp)); } catch (BadInitializationException ex) { Console.Error.WriteLine(ex.Message); return(-3); } }
private static ServerConnectionInfo FromArgs(ConnectArgs options) { // Pool server needs some additional parsing while I grok the documentation and find out if the lib can parse for me. string poolurl; ushort poolport; { var parts = options.Pool.Split(':'); if (parts.Length != 2) { throw new BadInitializationException("Does not look like valid POOL:PORT endpoint!"); } poolurl = parts[0]; poolport = ushort.Parse(parts[1]); } var presentingAs = options.SubscribeAs ?? MyCanonicalSubscription(); return(new ServerConnectionInfo(poolurl, poolport, presentingAs, options.UserName, options.WorkerName, options.SillyPassword)); }