Ejemplo 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)
                }
            }
            ;
        }
Ejemplo 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;
        }
Ejemplo 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;
        }