public void LoadTimecodes(String argTimecodesFilename) { try { _Failed = false; //Load the Timecodes _VideoFrameList.LoadTimecodes(argTimecodesFilename, false, 3); _TimecodesFile = argTimecodesFilename; } catch (Exception) { _Failed = true; throw; } }
private void ParseProject(String prFile) { //Open the project file StreamReader sr = new StreamReader(prFile, Encoding.UTF8); //Start parsing the file while (!sr.EndOfStream) { String line = sr.ReadLine(); //Check for comments if (line.StartsWith("#")) { //Ignore line continue; } //Check for section names else if (line.StartsWith("[")) { //Ignore line continue; } //Check if it is a proper property else if (line.Contains("=")) { String[] elements = line.Split(new String[] { "=" }, StringSplitOptions.None); if (elements[0].Trim().ToLower() == "usefaketimecodes") { useFakeTimecodes = Int32.Parse(elements[1].Trim()) == 1 ? true : false; } else if (elements[0].Trim().ToLower() == "videofile") { videoFile = elements[1].Trim().Replace("\"", ""); } else if (elements[0].Trim().ToLower() == "avisynthoutput") { aviSynthOutputFile = elements[1].Trim().Replace("\"", ""); } else if (elements[0].Trim().ToLower() == "timecodesfile") { timecodesFile = elements[1].Trim().Replace("\"", ""); //Check for fake timecodes if (!useFakeTimecodes) { //Read the timecodes into the list vfl.LoadTimecodes(timecodesFile, false, 3); //Check if the timecodes were valid if (vfl.Count == 0) { throw new AcException("Error parsing project file! Timecodes file didn't contain any frames!"); } //Create a new section VideoFrameSection vfs = new VideoFrameSection("Whole_Video", 0, vfl.Count - 1); vfl.AddSection(vfs); } } } //Check if it contains a proper frame directive else if (line.Contains(":")) { String[] elements = line.Split(new String[] { ":" }, StringSplitOptions.None); if (elements[0].Trim().ToLower() == "del") { vfl.FrameSections[0].AddToDelete(vfl.FrameList[Convert.ToInt32(elements[1].Trim().ToLower())]); } else if (elements[0].Trim().ToLower() == "dup") { vfl.FrameSections[0].AddToDuplicate(vfl.FrameList[Convert.ToInt32(elements[1].Trim().ToLower())]); } } } sr.Close(); }