コード例 #1
0
ファイル: OpfDocument.cs プロジェクト: yonkyunior/epubfixer
        private void AddEntryToGuide(string File, string type, string Title)
        {
            using (new HourGlass())
            {
                //Load existing Guide
                XElement Guide = GetXmlElement("guide");

                if (Guide == null)
                {
                    Guide = new XElement(ns + "guide");
                }

                //remove any Reference already existing
                IEnumerable <string> ExistingRef = GetGuideRefList(type);
                if (ExistingRef != null)
                {
                    Guide.Descendants().Where(x => x.Attribute("type").Value == type &&
                                              ExistingRef.Contains(x.Attribute("href").Value)).Remove();
                }


                //Add new item to Guide
                Guide.Add(
                    new XElement(ns + "reference",
                                 new XAttribute("type", type),
                                 new XAttribute("title", Title),
                                 new XAttribute("href", File)));

                //Replace and update new guide
                ReplaceSection(Guide, "guide");
            }
        }
コード例 #2
0
 public ActionResult Create(Guide AddGuide)
 {
     Guide.Add(AddGuide);
     return(RedirectToAction("List"));
 }