private Package GetDefaultData() { Package package= new Package(); package.Language = "en-US"; package.Provider = "Paramount"; package.Version = "5.0"; Video video = new Video(); video.VideoType = "film"; video.SubType = "feature"; video.VendorOfferCode = "408CH98720X103"; video.VendorID = "09736156444"; video.IsanIdentifier = "0000-0000-03B6-0000-O-0000-0000-2"; video.UniversalProductCode = "09736156444"; video.Counry = "US"; video.OriginalSpokenLocale = "en-US"; video.Title = "Forrest Gump"; video.Synopsis = ""Stupid is as stupid does," says Forrest Gump (played by Tom Hanks in an Oscar-winning performance) as he discusses his relative level of intelligence with a stranger while waiting for a bus. Despite his sub-normal IQ, Gump leads a truly charmed life, with a ringside seat for many of the most memorable events of the second half of the 20th century. Featured alongside Tom Hanks are Sally Field as Forrest's mother; Gary Sinise as his commanding officer in Vietnam; Mykelti Williamson as his ill-fated Army buddy who is familiar with every recipe that involves shrimp; and the special effects artists whose digital magic place Forrest amidst a remarkable array of historical events and people"; video.ProductionCompany = "Paramount Pictures"; video.CopyrightCline = "1994 Paramount Pictures"; video.TheatricalReleaseDate = "2007-05-04"; var genres = new Genre(); genres.GenreName.Add("Comedy"); genres.GenreName.Add("Drama"); video.Genres = genres; var ratings = new List<Rating>(); ratings.Add( new Rating("mpaa","Rated PG-13 for drug content, some sensuality and war violence.", "PG-13")); ratings.Add(new Rating("mpaa", "Rated PG-13 for drug content, some sensuality and war violence.", "PG-12")); video.Ratings = ratings; var casts = new List<Cast>(); casts.Add(new Cast( "top","Tom Hanks","Forrest Gump")); video.Casts = casts; var crews = new List<Crew>(); var roles= new List<Role>(); roles.Add( new Role("Director")); crews.Add( new Crew("top","Robert Zemeckis",roles)); video.Crews = crews; var chapters = new Chapters(); chapters.TimecodeFormat = "format>24/999 1000/nonDrop"; var chapterList = new List<Chapter>(); var artworkFile = new ArtworkFile("chapter01.jpg", new Checksum( "ed93d0f3224a353a4cc8d4175d645130", "md5"), "6591649<"); chapterList.Add(new Chapter("00:00:00:00", "Forrest's Story Begins", "en-US", artworkFile)); chapters.Chapter = chapterList; video.Chapters = chapters; package.Video= video; return package; }
public ActionResult WriteStory(Chapters chapters) { string title = chapters.chapterName; string text = chapters.chatpterText; int bookId = (int)System.Web.HttpContext.Current.Session["BookId"]; chapters.bookId = bookId; InsertChapter(bookId, title, text); TempData["write"] = "<script> alert('Your chapter has been submitted for review');</script>"; return(RedirectToAction("Profile", "Profile", new { @id = (int)System.Web.HttpContext.Current.Session["Id"] })); }
private void DeleteChapter(object chapterObject) { ChapterViewModel chapter = chapterObject as ChapterViewModel; if (chapter != null) { Chapters.Remove(chapter); App.Database2.DeleteItem(chapter.Chapter.Id); } Back(); }
public void OptionTwo() { if (CurrentGameState.name is "Episode 001") { Application.Quit(); } else { CurrentGameState = CurrentGameState.OptionTwoButton; UpdateGameElements(); } }
private void SaveChapter(object chapterObject) { ChapterViewModel chapter = chapterObject as ChapterViewModel; if (chapter != null && chapter.IsValid) { chapter.IsCreated = true; Chapters.Add(chapter); App.Database2.SaveItem(chapter.Chapter); } Back(); }
//get the next level position to make a line between them public NextPosLevels[] GetNextLevelPosition(Levels CuLevel, Chapters CuChapter) { NextPosLevels[] vNewNextPosition = new NextPosLevels[0]; //check if we are at the last level of the chapter to make a connection between chapters and is completed if ((CuLevel.order == vStoryMode.vChapter[CuChapter.order - 1].vLevels.Count()) && (CuLevel.Completed)) { vNewNextPosition = new NextPosLevels[vStoryMode.vChapter[CuChapter.order - 1].UnlockNextChapter.Count()]; int i = 0; foreach (string vUnlockNextChapter in vStoryMode.vChapter[CuChapter.order - 1].UnlockNextChapter) { //get the next position if (vUnlockNextChapter.Trim() != "") { NextPosLevels vNewPosL = new NextPosLevels(); vNewPosL.vNextPosition = vStoryMode.vChapter[int.Parse(vUnlockNextChapter) - 1].vLevels[0].vObject.transform.position; vNewPosL.vNextLevel = vStoryMode.vChapter [int.Parse(vUnlockNextChapter) - 1].vLevels [0];; vNewNextPosition [i] = vNewPosL; vStoryMode.vChapter[int.Parse(vUnlockNextChapter) - 1].vLevels[0].CanShow = true; //make sure we can see the other chapter when unlocked i++; } } } else { //check all the level object and make sure the current level icon is showed foreach (Chapters CChapter in vStoryMode.vChapter) { //only get the current chapters if (CChapter.order == CuChapter.order) { foreach (Levels cLevels in CChapter.vLevels) { //if we get the next levels, then we get the current position if (cLevels.order == CuLevel.order + 1) { vNewNextPosition = new NextPosLevels[1]; NextPosLevels vNewPosL = new NextPosLevels(); vNewPosL.vNextPosition = cLevels.vObject.transform.position; vNewPosL.vNextLevel = cLevels; vNewNextPosition [0] = vNewPosL; } } } } } //return the next position return(vNewNextPosition); }
public ActionResult GetChapter(int tutorialid) { List <Chapters> chapters = new List <Chapters>(); string constring = ConfigurationManager.ConnectionStrings["TutorialsContext"].ConnectionString; using (SqlConnection con = new SqlConnection(constring)) { SqlCommand command = new SqlCommand(); command.CommandText = "select * from Chapters Where TutorialID=@TutorialID"; command.Parameters.AddWithValue("@TutorialID", tutorialid); command.Connection = con; con.Open(); SqlDataReader reader = command.ExecuteReader(); if (reader == null) { if (command != null) { command.Dispose(); } if (command != null) { con.Dispose(); } return(Json("null", JsonRequestBehavior.AllowGet)); } while (reader.Read()) { Chapters c = new Chapters() { ChapterID = (int)reader["ChapterID"], TutorialID = (int)reader["TutorialID"], HierarchyLevel = (int)reader["HierarchyLevel"], ChapterName = (string)reader["ChapterName"], Description = (string)reader["Description"], TypeOfFile = (int)reader["TypeOfFile"], FileContents = (string)reader["FileContents"], }; chapters.Add(c); } if (command != null) { command.Dispose(); } if (command != null) { con.Dispose(); } return(Json(chapters, JsonRequestBehavior.AllowGet)); } }
public Campaign GetCampaign(DataConfig.MISSION_DIFFICULTY difficulty, int stageId) { Chapters chapters = GetChapters(difficulty); foreach (Campaign c in chapters.list) { if (c.stageId == stageId) { return(c); } } return(null); }
public override void RemoveAllReferences() { Chapters.Clear(); Components.Clear(); Documentations.Clear(); Experiences.Clear(); Files.Clear(); Maintenances.Clear(); OrderConfirmations.Clear(); Safeties.Clear(); ServiceLogs.Clear(); SubProjects.Clear(); }
public override void downloadScan(String link, int nb_page, Chapters chapitre, String path) { string[] content2 = HtmlRequest.get_html(link); foreach (String j in content2) { if (j.IndexOf("class=\"img-responsive\"") != -1) { MyPage p = new MyPage(nb_page, chapitre.getMax(), HtmlRequest.cut_str(j, "src=\"", "?u=\" class="), chapitre.getNumber(), chapitre.isChapter()); p.download(path); p = null; } } }
public IActionResult Create([FromBody] Chapters payload) { try { _service.Create(payload); return(Ok(payload)); } catch (AppException ex) { // return error message if there was an exception return(DefaultError(ex)); } }
public void OnPrevPageSelected(object sender, EventArgs args) { int index = CurrentChapter.Index; if (index < 1 || Chapters.Count == 0 || _isLoading) { return; } var prev = Chapters.Where(p => p.Index == index - 1).FirstOrDefault(); if (prev == null) { return; } if (ReaderType == ReaderType.Txt) { string content = _txtContent.Substring(prev.StartLength, CurrentChapter.StartLength - prev.StartLength); _txtView.SetContent(content, ReaderStartMode.Last); } else if (ReaderType == ReaderType.Custom) { var detail = CustomChapterDetailList.Where(p => p.Index == prev.Index).FirstOrDefault(); if (detail != null) { _txtView.SetContent(detail.Content, ReaderStartMode.First); } else { CustomContentRequest?.Invoke(this, new CustomRequestEventArgs(ReaderStartMode.Last, prev)); } } else { var orders = _epubContent.SpecialResources.HtmlInReadingOrder; if (_tempEpubChapterIndex < 1) { return; } _tempEpubChapterIndex -= 1; var prevOrder = orders[_tempEpubChapterIndex]; prev = GetLastEpubChapter(prevOrder); string content = prevOrder?.TextContent ?? prev.Title; _epubView.SetContent(content, ReaderStartMode.Last); } if (!prev.Equals(CurrentChapter)) { CurrentChapter = prev; ChapterChanged?.Invoke(this, prev); } }
public static IEnumerable <ChapterInfo> ToChapterInfo(this Chapters chapters) { var index = 0; foreach (var entry in chapters.EditionEntry) { var info = new ChapterInfo(); foreach (var atom in entry.ChapterAtom) { info.Chapters.AddRange(ToChapter(atom, ++index)); } yield return(info); } }
/// <summary> /// 获取章节语音 /// </summary> /// <param name="chapter">章节</param> /// <param name="setCurrentChapter">是否将其设置为当前章节</param> /// <param name="synthesizer">语音合成器</param> /// <returns></returns> public async Task <MediaPlaybackItem> GetChapterVoiceAsync(Chapter chapter, bool setCurrentChapter = false, SpeechSynthesizer synthesizer = null) { if (Chapters.Count == 0) { throw new InvalidCastException("Chapter not loaded"); } else if (chapter == null || !Chapters.Contains(chapter)) { throw new ArgumentException("The chapter is not in current book"); } // 将章节转化为语音合成流需要时间和额外的系统资源,不宜生成超量的文本 string content = GetReadText(chapter); if (content.Length > SpeechMaxLength) { throw new Exception("The chapter detail text length is too large"); } if (CurrentChapter != chapter) { LoadChapter(chapter); } // 控件原本是按需加载页面,但考虑到用户会对生成的语音流进行进度调整,所以在生成合成语音时会将当前章节未渲染的部分全部渲染 _readerView.RenderAllOverflows(); bool isTempSyn = false; if (synthesizer == null) { synthesizer = new SpeechSynthesizer(); isTempSyn = true; } synthesizer.Options.IncludeSentenceBoundaryMetadata = true; synthesizer.Options.IncludeWordBoundaryMetadata = true; var stream = await synthesizer.SynthesizeTextToStreamAsync(content); _tempSpeechStream = stream; MediaSource source = MediaSource.CreateFromStream(stream, stream.ContentType); if (isTempSyn) { synthesizer.Dispose(); } var playback = new MediaPlaybackItem(source); RegisterForWordBoundaryEvents(playback); return(playback); }
void _truyen_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "CurrentChapters") { if (_truyen.CurrentChapters != null) { foreach (var chapter in _truyen.CurrentChapters) { Chapters.Add(chapter); } } OnPropertyChanged("Chapters"); } }
private void SetProgress(Chapter chapter, int addonLength = 0) { if (Chapters == null || Chapters.Count == 0 || !Chapters.Any(p => p.Equals(chapter))) { throw new ArgumentOutOfRangeException("The chapter list don't have this chapter"); } CurrentChapter = Chapters.Where(p => p.Equals(chapter)).FirstOrDefault(); if (ReaderType == Enums.ReaderType.Txt) { int nextIndex = CurrentChapter.Index + 1; string content = ""; if (nextIndex >= Chapters.Count) { content = _txtContent.Substring(CurrentChapter.StartLength); } else { content = _txtContent.Substring(CurrentChapter.StartLength, Chapters[nextIndex].StartLength - CurrentChapter.StartLength); } _txtView.SetContent(content, Enums.ReaderStartMode.First, addonLength); } else if (ReaderType == Enums.ReaderType.Custom) { var detail = CustomChapterDetailList.Where(p => p.Index == CurrentChapter.Index).FirstOrDefault(); if (detail != null) { _txtView.SetContent(detail.Content, Enums.ReaderStartMode.First, addonLength); } else { CustomContentRequest?.Invoke(this, new CustomRequestEventArgs(Enums.ReaderStartMode.First, CurrentChapter, addonLength)); } } else { var info = _epubContent.SpecialResources.HtmlInReadingOrder.Where(p => p.AbsolutePath.Equals(chapter.Link, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); string content = string.Empty; if (info != null) { content = info.TextContent; _tempEpubChapterIndex = _epubContent.SpecialResources.HtmlInReadingOrder.IndexOf(info); } else { content = chapter.Title; } _epubView.SetContent(content, Enums.ReaderStartMode.First, addonLength); } RaiseProgressChanged(addonLength); }
public Chapter GetChapter(long position) { var foundChapter = Chapters.LastOrDefault(ch => ch.StartTime < position); if (foundChapter == null) { _logger.Error($"Couldn't find chapter for position {position} in book {ShortTitle}. "); return(new Chapter { Title = "Chapter", StartTime = 0, Duration = RawLength }); } return(foundChapter); }
public Chapters Create(Chapters payload) { try { payload.CreatedAt = DateTime.Now; payload.UpdatedAt = DateTime.Now; _context.Chapters.Add(payload); _context.SaveChanges(); return(payload); } catch (Exception ex) { throw ex; } }
public IActionResult Update(int id, [FromBody] Chapters payload) { try { payload.Id = id; var res = _service.Update(payload); return(Ok(res)); } catch (AppException ex) { // return error message if there was an exception return(DefaultError(ex)); } }
private void GetAllChapters(int id) { string query = "SELECT *FROM BookChapters WHERE BOOKID = " + id; DataSet dataSet = new DataSet(); databaseModel = new DatabaseModel(); dataSet = databaseModel.selectFunction(query); for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { Chapters chapters = new Chapters(); chapters.chapterId = Convert.ToInt32(dataSet.Tables[0].Rows[i].ItemArray[0]); chapters.chapterName = dataSet.Tables[0].Rows[i].ItemArray[2].ToString(); chapters.chatpterText = dataSet.Tables[0].Rows[i].ItemArray[3].ToString(); books.chapters.Add(chapters); } }
private void UpdateMarkers() { var markers = new List <MediaMarker>(); if (TimelineMarkers != null) { TimelineMarkers.ForEach(markers.Add); } if (Chapters != null) { Chapters.ForEach(markers.Add); } Markers = markers.ToObservableCollection(); }
public void OnNextPageSelected(object sender, EventArgs args) { int index = CurrentChapter.Index; if (index >= Chapters.Count || Chapters.Count == 0 || _isLoading) { return; } var next = Chapters.Where(p => p.Index == index + 1).FirstOrDefault(); if (next == null) { return; } if (ReaderType == Enums.ReaderType.Txt) { string content = string.Empty; if (next.Index == Chapters.Count - 1) { content = _txtContent.Substring(next.StartLength); } else { content = _txtContent.Substring(next.StartLength, Chapters[next.Index + 1].StartLength - next.StartLength); } _txtView.SetContent(content, Enums.ReaderStartMode.First); } else { var orders = _epubContent.SpecialResources.HtmlInReadingOrder; if (_tempEpubChapterIndex > orders.Count - 2) { return; } _tempEpubChapterIndex += 1; var nextOrder = orders[_tempEpubChapterIndex]; next = GetLastEpubChapter(nextOrder); string content = nextOrder?.TextContent ?? next.Title; _epubView.SetContent(content, Enums.ReaderStartMode.First); } if (!next.Equals(CurrentChapter)) { CurrentChapter = next; ChapterChanged?.Invoke(this, next); } }
private void OnSaveXml() { if (_dialogService.ShowSaveFileDialog("XML files|*.xml", out string file)) { try { var lines = InputText.Split('\n').Select(l => l.Trim()); Chapters xml = MkvXmlFactory.BuildChapters(lines); SerializeXML(xml, file); _dialogService.ShowInfo(Resources.Info_SaveOk); } catch (IOException) { _dialogService.ShowError(Resources.Error_FileWrite); } } }
void addChapter(XmlNode chapter) { Chapter c = new Chapter(); foreach (XmlNode node in chapter.ChildNodes) { switch (node.Name) { case "ID": c.ID = Convert.ToInt32(node.InnerText); break; case "Title": c.Title = node.InnerText; break; case "Desc": c.Description = node.InnerText; break; case "SortOrder": c.SortID = Convert.ToInt32(node.InnerText); break; case "Unused": c.Unused = node.InnerText == "-1"; break; case "Type": c.Type = (Chapter.ChType)Convert.ToInt32(node.InnerText); break; case "Scenes": foreach (XmlNode scene in node.ChildNodes) { int id = Convert.ToInt32(scene.InnerText); Scene s = Scenes[id - 1] as Scene; c.Scenes.Add(s); s.Parent = c; } break; } } Chapters.Add(c); }
/* ------------------------------------------------------------------------ */ private Dictionary <int, TaxonomySummary> InitTaxonomy() { // get the dictionaries of Taxonomy information var summaryDictionary = new Dictionary <int, TaxonomySummary>(); // Fixup the Section-Subsection relationships ILookup <int, ISubsection> sectionsSubSections = Subsections.GetAll().ToLookup(x => x.SectionId); foreach (IGrouping <int, ISubsection> sectionGrouping in sectionsSubSections) { Section section = Sections.Get(sectionGrouping.Key) as Section; if (section != null) { foreach (Subsection subsection in sectionGrouping) { section.Subsections.Add(subsection); subsection.Section = section; } } } // Fixup the Chapter-Section relationships. ILookup <int, ISection> chapterSectionsLookup = Sections.GetAll().ToLookup(x => x.ChapterId); foreach (IGrouping <int, ISection> chapterSectionGrouping in chapterSectionsLookup) { Chapter chapter = Chapters.Get(chapterSectionGrouping.Key) as Chapter; if (chapter != null) { foreach (Section section in chapterSectionGrouping) { chapter.Sections.Add(section); section.Chapter = chapter; } } } // Create dictionary of TaxonomySummaries foreach (Subsection subsection in Subsections.GetAll()) { summaryDictionary.Add(subsection.Id, _taxonomySummaryFactory.CreateSummary(subsection)); } return(summaryDictionary); }
public override void BuildChapters() { Chapters.Clear(); string ncxPath = GetNcxPath(); if (!string.IsNullOrEmpty(ncxPath)) { string path = _opfPath + ncxPath; XDocument xmlDocument = _zip.GetFileStream((_opfPath) + ncxPath, true, true).GetXmlDocument(true); XNamespace ns = XNamespace.Get("http://www.daisy.org/z3986/2005/ncx/"); XElement root = xmlDocument.Root; if (root != null) { XElement navMap = root.Element(ns + "navMap"); ParseItems(navMap, 0, ns, path); } } }
private void CreateChapters() { Chapters.Clear(); int i = 0; foreach (var group in _data) { if (group.IsSelected) // expand { Chapters.Add(group); } else // collapse { Chapters.Add(new ChapterGroup(group.GroupName, group.GroupPath)); } i++; } }
public static void Main(string[] args) { string resultDir = Utility.ResultDirectory; // recreate result files every time! if (Directory.Exists(resultDir)) { Directory.Delete(resultDir, true); } else { Directory.CreateDirectory(resultDir); } Console.WriteLine(""); Console.WriteLine("========================================"); Console.WriteLine("RESULT DIRECTORY: {0}", resultDir); Console.WriteLine("========================================"); Console.WriteLine(""); foreach (string chapter in Chapters.Examples.Keys) { bool madeSubDir = false; foreach (string example in Chapters.Examples[chapter].Keys) { Chapters c = new Chapters() { ChapterName = chapter, ExampleName = example }; if (c.IsPdfResult || c.IsZipResult || c.IsOtherResult) { if (!madeSubDir) { string resultSubDir = Path.Combine(resultDir, chapter); Directory.CreateDirectory(resultSubDir); madeSubDir = true; } Console.WriteLine("Creating output file: {0} => {1} ", chapter, example ); c.SendOutput(); } } } }
/// <summary> /// 添加章节数据 /// </summary> /// <remarks>创建人:李海玉 创建时间:2018-06-02</remarks> /// <param name="model">章节实体</param> /// <returns></returns> public static int Add(Chapters model) { /* * string strSql = string.Format * (@"INSERT INTO Chapters * (NovelId, ChapterUrl, NextUrl, Chapter, ChapterIdx, ChapterName, HeadWord, Content, WordCount) * VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}');" * , model.NovelId, model.ChapterUrl, model.NextUrl, model.Chapter, model.ChapterIdx * , model.ChapterName, model.HeadWord, model.Content, model.WordCount);*/ string strSql = string.Format (@"INSERT INTO Chapters (NovelId, ChapterUrl, NextUrl, Chapter, Content, WordCount, ChapterIdx) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}');" , model.NovelId, model.ChapterUrl, model.NextUrl, model.Chapter, model.Content , model.WordCount, model.ChapterIdx); return(DbHelperSql.ExecuteSql(strSql)); }
public bool OpenStage(Stage stage) { //是否有当前章节 UserChapter uc = null; foreach (var c in Chapters) { if (c.ChapterId == stage.ChapterId) { uc = c; break; } } if (uc != null) { foreach (var s in uc.Stages) { if (stage.StageId == s.StageId) { return(false); } } } else { UserChapter nuc = new UserChapter(); nuc.Stages = new List <UserStage>(); nuc.ChapterId = stage.ChapterId; uc = nuc; Chapters.Add(uc); } UserStage us = new UserStage(); us.StageId = stage.StageId; us.Star = 0; us.Completed = false; uc.Stages.Add(us); DBManager.WriteUserData(); return(true); }
protected void Submit(object sender, EventArgs e) { Chapters c = new Chapters() { ChapterName = DropDownListChapters.Text, ExampleName = DropDownListExamples.Text }; if (c.IsPdfResult || c.IsZipResult || c.IsOtherResult) { try { c.SendOutput(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { //MessageBox.Show() } }