예제 #1
0
 private void DoExportElements(IList <IXmlWritable> elements, XmlWriter writer, bool isProject)
 {
     writer.WriteStartDocument();
     if (!isProject)
     {
         writer.WriteStartElement("ExportedElements");
     }
     foreach (IXmlWritable element in elements)
     {
         element.WriteToXml(writer);
         if (element is IBackgroundSoundChoice)
         {
             BackgroundSounds.WriteAdditionalData(writer, element as IBackgroundSoundChoice);
         }
     }
     if (!isProject)
     {
         writer.WriteEndElement();
     }
     writer.WriteEndDocument();
     writer.Flush();
 }
예제 #2
0
 internal IElement CreateElement(System.Xml.XmlReader reader)
 {
     if (reader.IsStartElement("SequentialMusicList"))
     {
         return(new SequentialBackgroundMusicList(reader));
     }
     else if (reader.IsStartElement("RandomMusicList"))
     {
         return(new RandomBackgroundMusicList(reader));
     }
     else if (reader.IsStartElement("BackgroundSounds"))
     {
         return(new BackgroundSounds(reader));
     }
     else if (reader.IsStartElement("SequentialContainer"))
     {
         return(new SequentialContainer(reader));
     }
     else if (reader.IsStartElement("ChoiceContainer"))
     {
         return(new ChoiceContainer(reader));
     }
     else if (reader.IsStartElement("ParallelContainer"))
     {
         return(new ParallelContainer(reader));
     }
     else if (reader.IsStartElement("FileElement"))
     {
         return(new BasicFileElement(reader));
     }
     else if (reader.IsStartElement("WebRadio"))
     {
         return(new WebRadioElement(reader));
     }
     else if (reader.IsStartElement("BackgroundSoundChoice"))
     {
         BackgroundSoundChoice choice = new BackgroundSoundChoice(reader);
         if (reader.IsStartElement("ParallelElementData"))
         {
             BackgroundSounds.AdditionalChoiceData data = BackgroundSounds.ReadAdditionalData(reader);
             return(new BackgroundSounds.ImportedChoice(choice, data));
         }
         else
         {
             return(null);
         }
     }
     else if (reader.IsStartElement("Parallel"))
     {
         return(new ParallelElement(reader));
     }
     else if (reader.IsStartElement("Sequential"))
     {
         return(new SequentialElement(reader));
     }
     else if (reader.IsStartElement("Choice"))
     {
         return(new ChoiceElement(reader));
     }
     else if (reader.IsStartElement("Macro"))
     {
         return(new Macro(reader));
     }
     else if (reader.IsStartElement("ReferenceElement"))
     {
         return(new ReferenceElement(reader));
     }
     else if (reader.IsStartElement("MusicByTags"))
     {
         return(new MusicByTags(reader));
     }
     else
     {
         IMacroCommand macroCommand = DataModule.TheMacroFactory.CreateMacroCommand(reader);
         if (macroCommand != null)
         {
             return(macroCommand);
         }
         else
         {
             reader.ReadOuterXml();
             return(null);
         }
     }
 }