Exemplo n.º 1
0
        public string GetTimeString(StoryInfo storyInfo, uint frame, int offsetSecond, string format)
        {
            for (int i = storyInfo.Chapter.Length - 1; i > 0; i--)
            {
                if (frame >= storyInfo.Chapter[i].StartFrame)
                {
                    frame -= storyInfo.Chapter[i].StartFrame;
                    break;
                }
            }
            int second = GetTotalSecond(storyInfo, frame) + offsetSecond;

            second = second > 0 ? second : 0;

            string sss = second.ToString();
            string s   = (second % 60).ToString();
            string ss  = string.Format("{0:00}", second % 60);
            string m   = (second / 60).ToString();

            string result = format;

            result = result.Replace("<sss>", sss);
            result = result.Replace("<ss>", ss);
            result = result.Replace("<s>", s);
            result = result.Replace("<m>", m);
            return(result);
        }
Exemplo n.º 2
0
        public string GetSeekUrl(StoryInfo storyInfo, uint frame)
        {
            int chapter = 0;

            for (int i = storyInfo.Chapter.Length - 1; i > 0; i--)
            {
                if (frame >= storyInfo.Chapter[i].StartFrame)
                {
                    chapter = i;
                    frame  -= storyInfo.Chapter[i].StartFrame;
                    break;
                }
            }
            string postUrl = GetTimeString(storyInfo, frame, Offset, SeekFormat);

            return(storyInfo.Chapter[chapter].Url + postUrl);
        }
Exemplo n.º 3
0
        public string GetTitleWithSubtitle(StoryInfo storyInfo, uint frame)
        {
            int chapter = 0;

            for (int i = storyInfo.Chapter.Length - 1; i > 0; i--)
            {
                if (frame >= storyInfo.Chapter[i].StartFrame)
                {
                    chapter = i;
                    break;
                }
            }
            if (storyInfo.Chapter[chapter].Subtitle == "")
            {
                return(storyInfo.Title);
            }
            else
            {
                return(storyInfo.Title + " " + storyInfo.Chapter[chapter].Subtitle);
            }
        }
Exemplo n.º 4
0
 public int GetTotalSecond(StoryInfo storyInfo, uint frame)
 {
     return((int)(1.0 * frame / storyInfo.FrameRate));
 }