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); }
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); }
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); } }
public int GetTotalSecond(StoryInfo storyInfo, uint frame) { return((int)(1.0 * frame / storyInfo.FrameRate)); }