public override void OnSectionDeActivated() { // save settings config.Port = (int)port.Value; config.UseWebserver = useWebserver.Checked; config.ManageTV4Home = manageTV4Home.Checked; config.Username = userName.Text; config.Password = password.Text; config.EnableAuthentication = requireAuthentication.Checked; config.SiteRoot = siteroot.Text; config.TranscoderLog = logTranscoder.Checked; // transcoders List<ExtendedTranscoderProfile> newTranscoderList = new List<ExtendedTranscoderProfile>(); foreach (DataGridViewRow row in transcoders.Rows) { if(row.Cells[0].Value != null) { if (row.Tag == null) row.Tag = ++lastTranscoderId; ExtendedTranscoderProfile oldProfile = config.GetTranscoder((int)row.Tag); ExtendedTranscoderProfile newProfile = new ExtendedTranscoderProfile() { Name = row.Cells[0].Value != null ? row.Cells[0].Value.ToString() : "", UseTranscoding = row.Cells[1].Value != null ? (bool)row.Cells[1].Value : false, InputMethod = row.Cells[2].Value != null ? (TransportMethod)Enum.Parse(typeof(TransportMethod), row.Cells[2].Value.ToString(), true) : TransportMethod.NamedPipe, OutputMethod = row.Cells[3].Value != null ? (TransportMethod)Enum.Parse(typeof(TransportMethod), row.Cells[3].Value.ToString(), true) : TransportMethod.NamedPipe, Transcoder = row.Cells[4].Value != null ? row.Cells[4].Value.ToString() : "", Parameters = row.Cells[5].Value != null ? row.Cells[5].Value.ToString() : "", Id = (int)row.Tag, MIME = row.Cells[6].Value != null ? row.Cells[6].Value.ToString() : "", }; newProfile.Type = newProfile.DataEquals(oldProfile) && oldProfile.Type == TranscoderProfileType.System ? TranscoderProfileType.System : TranscoderProfileType.User; newTranscoderList.Add(newProfile); } } config.Transcoders = newTranscoderList; config.Write(); base.OnSectionDeActivated(); }
internal Transcoder(ExtendedTranscoderProfile transcoder) : this(transcoder.Id, transcoder.Name, transcoder.UseTranscoding) { }