private string EnumerateWebAPI() { var allAdresses = serverAddresses.Addresses.ToArray(); var nr = 0; var groups = api.ApiDescriptionGroups; var allCommands = new CLI_Commands(); foreach (var g in groups.Items) { foreach (var api in g.Items) { foreach (var adress in allAdresses) { var v1 = serviceProvider.GetService(typeof(ICLICommand_v1)) as ICLICommand_v1; v1.NameCommand = $"Command{(++nr).ToString("00#")}"; //v1.Host = new Uri(adress).GetLeftPart(UriPartial.Authority); v1.Host = new Uri(adress).GetLeftPart(UriPartial.Scheme); v1.RelativeRequestUrl = api.RelativePath; v1.Verb = api.HttpMethod; v1.DataToSend = GetJsonFromParameters(api.ParameterDescriptions.ToArray()); allCommands.AddCommand(v1); } } } var serialize = CLI_Commandserialize.Serialize(allCommands); return(serialize); }
internal static CLI_Commands FindAllCommands() { string nameFile = "cli.txt"; if (!File.Exists(nameFile)) { throw new FileNotFoundException( $"cannot find {nameFile} in {Environment.CurrentDirectory}", nameFile); } var fileContents = File.ReadAllText(nameFile).Trim(); var s = CLI_Commandserialize.DeSerialize(fileContents); return(s); }