Summary description for Chapter.
Esempio n. 1
0
        //public static List<Chapter> LoadTextChapters(string filename)
        //{
        //  List<Chapter> list = new List<Chapter>();

        //  int num = 0;
        //  TimeSpan ts = new TimeSpan(0);
        //  string time = String.Empty;
        //  string name = String.Empty;
        //  bool onTime = true;
        //  string[] lines = File.ReadAllLines(filename);
        //  foreach (string line in lines)
        //  {
        //    if (onTime)
        //    {
        //      num++;
        //      //read time
        //      time = line.Replace("CHAPTER" + num.ToString("00") + "=", "");
        //      ts = TimeSpan.Parse(time);
        //    }
        //    else
        //    {
        //      //read name
        //      name = line.Replace("CHAPTER" + num.ToString("00") + "NAME=", "");
        //      //add it to list
        //      list.Add(new Chapter() { Name = name, Time = ts });
        //    }
        //    onTime = !onTime;
        //  }
        //  return list;
        //}

        public static void ImportFromClipboard(List <ChapterEntry> chapters, string clipboard, bool includeDuration)
        {
            clipboard = clipboard.Replace("\t", string.Empty);
            for (int i = 0; i < chapters.Count; i++)
            {
                chapters[i] = new ChapterEntry()
                {
                    Time = chapters[i].Time, Name = ExtractFromCopy(clipboard, i + 1, includeDuration)
                }
            }
            ;
        }
Esempio n. 2
0
        public void ChangeFps(double fps)
        {
            for (int i = 0; i < Chapters.Count; i++)
            {
                ChapterEntry c      = Chapters[i];
                double       frames = c.Time.TotalSeconds * FramesPerSecond;
                Chapters[i] = new ChapterEntry()
                {
                    Name = c.Name, Time = new TimeSpan((long)Math.Round(frames / fps * TimeSpan.TicksPerSecond))
                };
            }

            double totalFrames = Duration.TotalSeconds * FramesPerSecond;

            Duration        = new TimeSpan((long)Math.Round((totalFrames / fps) * TimeSpan.TicksPerSecond));
            FramesPerSecond = fps;
        }
Esempio n. 3
0
        public void ChangeFps(double fps)
        {
            for (int i = 0; i < Chapters.Count; i++)
            {
                ChapterEntry c = Chapters[i];
                double frames = c.Time.TotalSeconds * FramesPerSecond;
                Chapters[i] = new ChapterEntry() { Name = c.Name, Time = new TimeSpan((long)Math.Round(frames / fps * TimeSpan.TicksPerSecond)) };
            }

            double totalFrames = Duration.TotalSeconds * FramesPerSecond;
            Duration = new TimeSpan((long)Math.Round((totalFrames / fps) * TimeSpan.TicksPerSecond));
            FramesPerSecond = fps;
        }
Esempio n. 4
0
        private void ChapterControls_Click(object sender, System.EventArgs e)
        {
            ChapterEntry c;
            string       name = null;
            Button       btn  = (Button)sender;

            switch (btn.Name)
            {
            case "btnAdd":
                TimeSpan ts = new TimeSpan(0);
                try
                {     //try to get a valid time input
                    ts = TimeSpan.Parse(txtChapterTime.Text);
                }
                catch (Exception parse)
                {     //invalid time input
                    txtChapterTime.Focus();
                    txtChapterTime.SelectAll();
                    MessageBox.Show("Invalid time format! Must be in the form of \"00:00:00.000\"" + Environment.NewLine + parse.Message);
                    return;
                }
                //create a new chapter
                c = new ChapterEntry()
                {
                    Time = ts, Name = txtChapterName.Text
                };
                pgc.Chapters.Insert(intIndex, c);
                FreshChapterView();
                break;

            case "btnDelete":
                if (listChapters.Items.Count < 1 || pgc.Chapters.Count < 1)
                {
                    return;
                }
                intIndex = listChapters.SelectedIndices[0];
                pgc.Chapters.Remove(pgc.Chapters[intIndex]);
                if (intIndex != 0)
                {
                    intIndex--;
                }
                FreshChapterView();
                break;

            case "btnUp":
                if (pgc.Chapters.Count < 2 || intIndex < 1)
                {
                    return;
                }
                name = pgc.Chapters[intIndex].Name;
                pgc.Chapters[intIndex] = new ChapterEntry()
                {
                    Name = pgc.Chapters[intIndex - 1].Name, Time = pgc.Chapters[intIndex].Time
                };
                pgc.Chapters[intIndex - 1] = new ChapterEntry()
                {
                    Name = name, Time = pgc.Chapters[intIndex - 1].Time
                };
                intIndex--;
                FreshChapterView();
                break;

            case "btnDn":
                if (pgc.Chapters.Count < 2 || intIndex >= pgc.Chapters.Count - 1)
                {
                    return;
                }
                name = pgc.Chapters[intIndex].Name;
                pgc.Chapters[intIndex] = new ChapterEntry()
                {
                    Name = pgc.Chapters[intIndex + 1].Name, Time = pgc.Chapters[intIndex].Time
                };
                pgc.Chapters[intIndex + 1] = new ChapterEntry()
                {
                    Name = name, Time = pgc.Chapters[intIndex + 1].Time
                };
                intIndex++;
                FreshChapterView();
                break;
            }
        }
Esempio n. 5
0
 private void ChapterControls_Click(object sender, System.EventArgs e)
 {
     ChapterEntry c;
       string name = null;
       Button btn = (Button)sender;
       switch (btn.Name)
       {
     case "btnAdd":
       TimeSpan ts = new TimeSpan(0);
       try
       {//try to get a valid time input
     ts = TimeSpan.Parse(txtChapterTime.Text);
       }
       catch (Exception parse)
       { //invalid time input
     txtChapterTime.Focus();
     txtChapterTime.SelectAll();
     MessageBox.Show("Invalid time format! Must be in the form of \"00:00:00.000\""
       + Environment.NewLine + parse.Message);
     return;
       }
       //create a new chapter
       c = new ChapterEntry() { Time = ts, Name = txtChapterName.Text };
       pgc.Chapters.Insert(intIndex, c);
       FreshChapterView();
       break;
     case "btnDelete":
       if (listChapters.Items.Count < 1 || pgc.Chapters.Count < 1) return;
       intIndex = listChapters.SelectedIndices[0];
       pgc.Chapters.Remove(pgc.Chapters[intIndex]);
       if (intIndex != 0) intIndex--;
       FreshChapterView();
       break;
     case "btnUp":
       if (pgc.Chapters.Count < 2 || intIndex < 1) return;
       name = pgc.Chapters[intIndex].Name;
       pgc.Chapters[intIndex] = new ChapterEntry() { Name = pgc.Chapters[intIndex - 1].Name, Time = pgc.Chapters[intIndex].Time };
       pgc.Chapters[intIndex - 1] = new ChapterEntry() { Name = name, Time = pgc.Chapters[intIndex - 1].Time };
       intIndex--;
       FreshChapterView();
       break;
     case "btnDn":
       if (pgc.Chapters.Count < 2 || intIndex >= pgc.Chapters.Count - 1) return;
       name = pgc.Chapters[intIndex].Name;
       pgc.Chapters[intIndex] = new ChapterEntry() { Name = pgc.Chapters[intIndex + 1].Name, Time = pgc.Chapters[intIndex].Time };
       pgc.Chapters[intIndex + 1] = new ChapterEntry() { Name = name, Time = pgc.Chapters[intIndex + 1].Time };
       intIndex++;
       FreshChapterView();
       break;
       }
 }
Esempio n. 6
0
 //public static List<Chapter> LoadTextChapters(string filename)
 //{
 //  List<Chapter> list = new List<Chapter>();
 //  int num = 0;
 //  TimeSpan ts = new TimeSpan(0);
 //  string time = String.Empty;
 //  string name = String.Empty;
 //  bool onTime = true;
 //  string[] lines = File.ReadAllLines(filename);
 //  foreach (string line in lines)
 //  {
 //    if (onTime)
 //    {
 //      num++;
 //      //read time
 //      time = line.Replace("CHAPTER" + num.ToString("00") + "=", "");
 //      ts = TimeSpan.Parse(time);
 //    }
 //    else
 //    {
 //      //read name
 //      name = line.Replace("CHAPTER" + num.ToString("00") + "NAME=", "");
 //      //add it to list
 //      list.Add(new Chapter() { Name = name, Time = ts });
 //    }
 //    onTime = !onTime;
 //  }
 //  return list;
 //}
 public static void ImportFromClipboard(List<ChapterEntry> chapters, string clipboard, bool includeDuration)
 {
     clipboard = clipboard.Replace("\t", string.Empty);
     for (int i = 0; i < chapters.Count; i++)
         chapters[i] = new ChapterEntry() { Time = chapters[i].Time, Name = ExtractFromCopy(clipboard, i + 1, includeDuration) };
 }