private string ReadFile(string path) { try { var sr = new StreamReader(path); return(sr.ReadToEnd()); } catch (Exception e) { EquipmentControllerTest.log("Exception: " + e.Message); return(string.Empty); } }
private List <string> ReadCommandsFromJson(string commandsJson) { try { var options = new JsonSerializerOptions { AllowTrailingCommas = true }; return(JsonSerializer.Deserialize <List <string> > (commandsJson, options)); } catch (Exception e) { EquipmentControllerTest.log("Exception: " + e.Message); return(new List <string> ()); } }
private ControllerConfig ReadConfigFromJsonString(string configJson) { try { var options = new JsonSerializerOptions { AllowTrailingCommas = true }; return(JsonSerializer.Deserialize <ControllerConfig> (configJson, options)); } catch (Exception e) { EquipmentControllerTest.log("Exception: " + e.Message); return(null); } }