コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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> ());
            }
        }
コード例 #3
0
        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);
            }
        }