/// <summary> /// Get multiple properties asynchronously /// </summary> /// <param name="props"></param> /// <returns></returns> public async Task <Dictionary <PROPERTIES, object> > GetProps(PROPERTIES props) { List <object> names = props.GetRealNames(); CommandResult <List <string> > commandResult = await ExecuteCommandWithResponse <List <string> >( method : METHODS.GetProp, id : ((int)METHODS.GetProp),// + 1000 + props.Count, parameters : names ); if (commandResult != null) { Dictionary <PROPERTIES, object> result = new Dictionary <PROPERTIES, object>(); for (int n = 0; n < names.Count; n++) { string name = names[n].ToString(); if (Enum.TryParse <PROPERTIES>(name, out PROPERTIES p)) { result.Add(p, commandResult.Result[n]); } } return(result); } return(null); }
/// <summary> /// Get multiple properties asynchronously /// </summary> /// <param name="props"></param> /// <returns></returns> public async Task <Dictionary <PROPERTIES, object> > GetProps(PROPERTIES props) { List <object> names = props.GetRealNames(); List <string> results = new List <string>(); if (names.Count <= 20) { CommandResult <List <string> > commandResult = await ExecuteCommandWithResponse <List <string> >( method : METHODS.GetProp, id : ((int)METHODS.GetProp),// + 1000 + props.Count, parameters : names ); results.AddRange(commandResult?.Result); } else { CommandResult <List <string> > commandResult1 = await ExecuteCommandWithResponse <List <string> >( method : METHODS.GetProp, id : ((int)METHODS.GetProp),// + 1000 + props.Count, parameters : names.Take(20).ToList() ); CommandResult <List <string> > commandResult2 = await ExecuteCommandWithResponse <List <string> >( method : METHODS.GetProp, id : ((int)METHODS.GetProp),// + 1000 + props.Count, parameters : names.Skip(20).ToList() ); results.AddRange(commandResult1?.Result); results.AddRange(commandResult2?.Result); } if (results.Count > 0) { Dictionary <PROPERTIES, object> result = new Dictionary <PROPERTIES, object>(); for (int n = 0; n < names.Count; n++) { string name = names[n].ToString(); if (Enum.TryParse <PROPERTIES>(name, out PROPERTIES p)) { result.Add(p, results[n]); } } return(result); } return(null); }