private bool addSelectedSection() { CutSection s = new CutSection(); s.startFrame = (int)startFrame.Value; s.endFrame = (int)endFrame.Value; if (s.endFrame <= s.startFrame) { MessageBox.Show("The end frame must be larger than the start frame", "Invalid section configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (!cuts.addSection(s)) { MessageBox.Show("Section overlaps with another", "Invalid configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } return(true); }
private bool addSelectedSection() { CutSection s = new CutSection(); s.startFrame = (int)startFrame.Value; s.endFrame = (int)endFrame.Value; if (s.endFrame <= s.startFrame) { MessageBox.Show("The end frame must be larger than the start frame", "Invalid section configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return false; } if (!cuts.addSection(s)) { MessageBox.Show("Section overlaps with another", "Invalid configuration", MessageBoxButtons.OK, MessageBoxIcon.Stop); return false; } return true; }
public void CreateMeGUIScript(String argMeGUIOutputScript) { try { _Failed = false; //Create a new MeGUI Cuts Object MeguiCuts mcuts = new MeguiCuts(); mcuts.Style = TransitionStyle.NO_TRANSITION; mcuts.Framerate = _TargetFramerate; //Sort the sections //vfl.FrameSections.Sort( ; CutSection sectionToAdd = null; for (Int32 i = 0; i < _VideoFrameList.FrameSections.Count; i++) { //If no section exists, create a new one if (sectionToAdd == null) { sectionToAdd = new CutSection(); } //Check if no start frame is declared if (sectionToAdd.startFrame == -1) { sectionToAdd.startFrame = _VideoFrameList.FrameSections[i].FrameStart; } //Check if we are at the last section if (i == _VideoFrameList.FrameSections.Count - 1) { sectionToAdd.endFrame = _VideoFrameList.FrameSections[i].FrameEnd; mcuts.AllCuts.Add(sectionToAdd); sectionToAdd = null; continue; } else { //Check next section's first frame //1. if it is the same frame with this section's last frame //2. if it is the next frame of this section's last frame if (_VideoFrameList.FrameSections[i + 1].FrameStart == _VideoFrameList.FrameSections[i].FrameEnd || _VideoFrameList.FrameSections[i + 1].FrameStart == _VideoFrameList.FrameSections[i].FrameEnd + 1) { continue; } else { sectionToAdd.endFrame = _VideoFrameList.FrameSections[i].FrameEnd; mcuts.AllCuts.Add(sectionToAdd); sectionToAdd = null; continue; } } } using (TextWriter textWriter = new StreamWriter(argMeGUIOutputScript, false, Encoding.UTF8)) { XmlSerializer serializer = new XmlSerializer(typeof(MeguiCuts)); serializer.Serialize(textWriter, mcuts); } } catch (Exception) { _Failed = true; throw; } }