Exemple #1
0
 private void AddXMLLoader(IXMLLoader loader, LoadMode mode)
 {
     InitXMLLoader(loader);
     if (loader.AppliesTo != null && loader.SupportsMode(mode))
     {
         m_xmlLoaders.Add(loader.AppliesTo, loader);
     }
 }
Exemple #2
0
 private void AddXMLLoader(IXMLLoader loader, LoadMode mode)
 {
     InitXMLLoader(loader);
     if (loader.AppliesTo != null && loader.SupportsMode(mode))
     {
         m_xmlLoaders.Add(loader.AppliesTo, loader);
     }
 }
Exemple #3
0
 public HomeController(
     IHostingEnvironment env,
     IXMLLoader xmlLoader
     )
 {
     _env       = env;
     _xmlLoader = xmlLoader;
 }
Exemple #4
0
 //private ScriptFactory ScriptFactory
 //{
 //    get { return m_scriptFactory; }
 //}
 private void AddXMLLoader(IXMLLoader loader)
 {
     InitXMLLoader(loader);
     if (loader.AppliesTo != null)
     {
         m_xmlLoaders.Add(loader.AppliesTo, loader);
     }
 }
        //private ScriptFactory ScriptFactory
        //{
        //    get { return m_scriptFactory; }
        //}

        private void AddXMLLoader(IXMLLoader loader)
        {
            InitXMLLoader(loader);
            if (loader.AppliesTo != null)
            {
                m_xmlLoaders.Add(loader.AppliesTo, loader);
            }
        }
Exemple #6
0
        private void LoadXML(string filename, XmlReader reader)
        {
            Element    current       = null;
            IXMLLoader currentLoader = null;

            // Set the "IsEditorLibrary" flag for any library with type="editor", and its sub-libraries
            bool isEditorLibrary = false;

            if (m_currentFile.Count > 0 && m_currentFile.Peek().IsEditorLibrary)
            {
                isEditorLibrary = true;
            }
            if (reader.GetAttribute("type") == "editor")
            {
                isEditorLibrary = true;
            }

            if (!IsCompiledFile && m_currentFile.Count == 0 && m_worldModel.Version >= WorldModelVersion.v530)
            {
                ScanForTemplates(filename);
            }

            FileData data = new FileData
            {
                Filename        = reader.BaseURI,
                IsEditorLibrary = isEditorLibrary
            };

            m_currentFile.Push(data);
            UpdateLoadStatus();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                    currentLoader = GetLoader(reader.Name, current);
                    currentLoader.StartElement(reader, ref current);
                    break;

                case XmlNodeType.EndElement:
                    GetLoader(reader.Name, current).EndElement(reader, ref current);
                    break;

                case XmlNodeType.Text:
                case XmlNodeType.CDATA:
                    currentLoader.SetText(reader.ReadContentAsString(), ref current);
                    // if we've eaten the content of this element, then the reader will have gone
                    // past the EndElement already, so we need to trigger the EndElement here
                    GetLoader(reader.Name, current).EndElement(reader, ref current);
                    currentLoader = null;
                    break;
                }
            }

            m_currentFile.Pop();
            UpdateLoadStatus();
        }
Exemple #7
0
        private void AddXMLLoaders(LoadMode mode)
        {
            // Use Reflection to create instances of all IXMLLoaders
            foreach (Type t in TextAdventures.Utility.Classes.GetImplementations(System.Reflection.Assembly.GetExecutingAssembly(),
                typeof(IXMLLoader)))
            {
                AddXMLLoader((IXMLLoader)Activator.CreateInstance(t), mode);
            }

            m_defaultXmlLoader = new DefaultXMLLoader();
            InitXMLLoader(m_defaultXmlLoader);
        }
Exemple #8
0
        private void AddXMLLoaders(LoadMode mode)
        {
            // Use Reflection to create instances of all IXMLLoaders
            foreach (Type t in TextAdventures.Utility.Classes.GetImplementations(System.Reflection.Assembly.GetExecutingAssembly(),
                                                                                 typeof(IXMLLoader)))
            {
                AddXMLLoader((IXMLLoader)Activator.CreateInstance(t), mode);
            }

            m_defaultXmlLoader = new DefaultXMLLoader();
            InitXMLLoader(m_defaultXmlLoader);
        }
Exemple #9
0
 private void InitXMLLoader(IXMLLoader loader)
 {
     loader.GameLoader = this;
     loader.AddError += AddError;
     loader.LoadNestedXML += LoadXML;
 }
Exemple #10
0
 private void InitXMLLoader(IXMLLoader loader)
 {
     loader.GameLoader     = this;
     loader.AddError      += AddError;
     loader.LoadNestedXML += LoadXML;
 }