public Wirecast Parse(ExpandoObject input) { IDictionary <string, object> json = input as IDictionary <string, object>; //JsonConvert.DeserializeObject<Wirecast>(input.ToString()); Wirecast wirecast = new Wirecast(); object value; if (json.TryGetValue("isBroadcasting", out value)) { wirecast.isBroadcasting = (bool)value; } if (json.TryGetValue("isRecording", out value)) { wirecast.isRecording = (bool)value; } if (json.TryGetValue("previewShotId", out value)) { wirecast.previewShotId = (int)value; } if (json.TryGetValue("programShotId", out value)) { wirecast.programShotId = (int)value; } return(wirecast); }
public Wirecast Set(dynamic input) { if (input == null) { return(null); } log.Info("setting with input: " + input.ToString()); Wirecast inputWirecast = Parse(input); if (inputWirecast == null) { return(null); } if (inputWirecast.isRecording != IsRecording()) { if (inputWirecast.isRecording) { StartRecording(); } else { StopRecording(); } } if (inputWirecast.isBroadcasting != IsBroadcasting()) { if (inputWirecast.isBroadcasting) { StartBroadcast(); } else { StopBroadcast(); } } return(Get()); }