Exemplo n.º 1
0
 private void GetBlocks(XElement curNode)
 {
     if (curNode.Name.Equals(Xns + "img"))
     {
         int        id     = ImageBlocks.Count;
         ImageBlock iBlock = new ImageBlock(id, curNode, this);
         ImageBlocks.Add(iBlock);
         curNode.SetAttributeValue("id", iBlock.B_ID);
         Blocks.Add(iBlock);
     }
     foreach (XNode childNode in curNode.Nodes())
     {
         if (childNode is XText)
         {
             XText        textNode = childNode as XText;
             int          id       = ContentBlocks.Count;
             String       text     = textNode.Value;
             ContentBlock cBlock   = new ContentBlock(id, text, this);
             ContentBlocks.Add(cBlock);
             textNode.Value = cBlock.B_ID;
             Blocks.Add(cBlock);
         }
         else if (childNode is XElement)
         {
             GetBlocks(childNode as XElement);
         }
     }
 }
Exemplo n.º 2
0
 public void SetCaption(String text)
 {
     ImageBlock.SetAltText(text);
     foreach (Sentence sentence in ImageBlock.Sentences)
     {
         sentence.GetCachedSound();
         foreach (Word word in sentence.Words)
         {
             new RunWord(word);
         }
     }
 }
Exemplo n.º 3
0
 public RunImage(ImageBlock imageBlock)
 {
     ImageBlock     = imageBlock;
     ImageBlock.Run = this;
     foreach (Sentence sentence in ImageBlock.Sentences)
     {
         sentence.GetCachedSound();
         foreach (Word word in sentence.Words)
         {
             new RunWord(word);
         }
     }
     Text = "<IMG SOURCE=\"" + ImageBlock.Source + "\">";
 }
Exemplo n.º 4
0
        public Content(String contentPath, ProjectInfo projectInfo)
        {
            Source      = contentPath;
            ProjectInfo = projectInfo;
            using (StreamReader streamReader = new StreamReader(ContentResource))
            {
                Root = XElement.Parse(streamReader.ReadToEnd());
                Xns  = Root.Attribute("xmlns") != null?Root.Attribute("xmlns").Value : XNamespace.None;

                streamReader.Close();
            }
            using (StreamReader streamReader = new StreamReader(ContentSave))
            {
                XElement xContent = XElement.Parse(streamReader.ReadToEnd());
                ID            = int.Parse(xContent.Attribute("id").Value);
                Blocks        = new List <Block>();
                ContentBlocks = new List <ContentBlock>();
                ImageBlocks   = new List <ImageBlock>();
                foreach (XElement xBlock in xContent.Element("Blocks").Elements())
                {
                    if (xBlock.Name == "ContentBlock")
                    {
                        ContentBlock block = new ContentBlock(xBlock, this);
                        ContentBlocks.Add(block);
                        Blocks.Add(block);
                    }
                    else
                    {
                        ImageBlock block = new ImageBlock(xBlock, this);
                        ImageBlocks.Add(block);
                        Blocks.Add(block);
                    }
                }
                streamReader.Close();
            }
        }
Exemplo n.º 5
0
 private static String GetXhtmlID(ImageBlock iBlock)
 {
     return(iBlock.Content.CID + "-" + iBlock.B_ID);
 }