private void textBoxConfiguration_TextChanged(object sender, EventArgs e) { bool Error = false; var type = Program.AnalyseConfigurationString(textBoxConfiguration.Text); if (type == Program.TypeConfig.JSON) { // Let's check JSON syntax and that it conforms to the widevine template class try { var jo = JObject.Parse(textBoxConfiguration.Text); WidevineTemplate jow = Newtonsoft.Json.JsonConvert.DeserializeObject <WidevineTemplate>(textBoxConfiguration.Text); } catch (Exception ex) { labelWarningJSON.Text = string.Format(_labelWarningJSON, ex.Message); Error = true; } } labelWarningJSON.Visible = Error; }
private void radioButtonAdvanced_CheckedChanged(object sender, EventArgs e) { if (radioButtonAdvanced.Checked) { WidevineTemplate template = new WidevineTemplate() { AllowedTrackTypes = "SD_HD", ContentKeySpecs = new ContentKeySpec[] { new ContentKeySpec() { TrackType = "SD", SecurityLevel = 1, RequiredOutputProtection = new OutputProtection() { HDCP = "HDCP_NONE" } } }, PolicyOverrides = new PolicyOverrides() { CanPlay = true, CanPersist = true, CanRenew = false, RentalDurationSeconds = 2592000, PlaybackDurationSeconds = 10800, LicenseDurationSeconds = 604800, } }; textBoxConfiguration.Text = Newtonsoft.Json.JsonConvert.SerializeObject(template, Newtonsoft.Json.Formatting.Indented); } else { textBoxConfiguration.Text = "{}"; } }