Example #1
0
        //----- Open Entity Buttons Section Start -----
        private void openEntityToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            HidePanels();
            openEntityFile.InitialDirectory = myCurrentEntityFolderPath;
            if (openEntityFile.InitialDirectory == "")
            {
                openEntityFile.InitialDirectory = Directory.GetCurrentDirectory();
            }

            openEntityFile.ShowDialog();
            if (openEntityFile.SafeFileName != "")
            {
                myCurrentEntity = myEntityReader.LoadFile(openEntityFile.FileName, this);

                myCurrentEntityFilePath   = openEntityFile.FileName;
                myCurrentEntityFolderPath = myCurrentEntityFilePath.Replace(openEntityFile.SafeFileName, "");
                myDataFolderPath          = StringUtilities.GetDataFolderPath(myCurrentEntityFolderPath);
                myShootingComponentPanel.ReloadXML(myDataFolderPath);
                Properties.Settings.Default.DefaultEntityFolderPath = myCurrentEntityFolderPath;
                Properties.Settings.Default.DefaultEntityFileName   = myCurrentEntityFilePath;
                Properties.Settings.Default.Save();

                DisplayEntityData();
            }
        }
Example #2
0
        public Entity.EntityData LoadFile(String aFilePath, Form aParent)
        {
            myEntityData = new Entity.EntityData();
            if (aFilePath == "")
            {
                return(myEntityData);
            }
            myFilePath = aFilePath;
            string entityListPath = StringUtilities.GetDataFolderPath(aFilePath) + "Script/LI_list_entity.xml";

            if (myEntityList.myPaths == null)
            {
                myEntityList.myPaths = new List <string>();
            }
            XmlDocument entityDoc   = myXMLWrapper.Open(myFilePath);
            XmlNode     rootElement = myXMLWrapper.FindFirstElement();
            XmlNode     entityElement;

            entityElement = myXMLWrapper.FindFirstChildElement(rootElement);
            if (rootElement.Name != "root")
            {
                entityElement = rootElement;
            }
            myXMLWrapper.ReadAttribute(entityElement, "name", ref myEntityData.myName);
            for (XmlNode e = myXMLWrapper.FindFirstChildElement(entityElement); e != null; e = myXMLWrapper.FindNextSiblingElement(e))
            {
                ReadElement(e);
            }

            XmlDocument entityListDoc = myXMLWrapper.Open(entityListPath);

            rootElement = myXMLWrapper.FindFirstElement();
            for (XmlNode e = myXMLWrapper.FindFirstChildElement(rootElement); e != null; e = myXMLWrapper.FindNextSiblingElement(e))
            {
                ReadEntityListFile(e);
            }

            EntityEditorForm entityForm = (EntityEditorForm)aParent;

            entityForm.SetEntityList(myEntityList);

            return(myEntityData);
        }
Example #3
0
        public Entity.EntityListXML LoadFiles(string aCurrentFilePath)
        {
            if (myEntityList.myPaths == null)
            {
                myEntityList.myPaths = new List<string>();
            }

            myEntityData = new Entity.EntityData();
            if (aCurrentFilePath == "") return myEntityList;
            string entityListPath = StringUtilities.GetDataFolderPath(aCurrentFilePath) + "Script/LI_list_entity.xml";

            XmlDocument entityListDoc = myXMLWrapper.Open(entityListPath);
            XmlNode rootElement = myXMLWrapper.FindFirstElement();
            for (XmlNode e = myXMLWrapper.FindFirstChildElement(rootElement); e != null; e = myXMLWrapper.FindNextSiblingElement(e))
            {
                ReadEntityListFile(e);
            }
            return myEntityList;
        }
Example #4
0
        public Entity.EntityListXML LoadFiles(string aCurrentFilePath)
        {
            if (myEntityList.myPaths == null)
            {
                myEntityList.myPaths = new List <string>();
            }

            myEntityData = new Entity.EntityData();
            if (aCurrentFilePath == "")
            {
                return(myEntityList);
            }
            string entityListPath = StringUtilities.GetDataFolderPath(aCurrentFilePath) + "Script/LI_list_entity.xml";

            XmlDocument entityListDoc = myXMLWrapper.Open(entityListPath);
            XmlNode     rootElement   = myXMLWrapper.FindFirstElement();

            for (XmlNode e = myXMLWrapper.FindFirstChildElement(rootElement); e != null; e = myXMLWrapper.FindNextSiblingElement(e))
            {
                ReadEntityListFile(e);
            }
            return(myEntityList);
        }
Example #5
0
        public Entity.EntityData LoadFile(String aFilePath, Form aParent)
        {
            myEntityData = new Entity.EntityData();
            if (aFilePath == "") return myEntityData;
            myFilePath = aFilePath;
            string entityListPath = StringUtilities.GetDataFolderPath(aFilePath) + "Script/LI_list_entity.xml";

            if (myEntityList.myPaths == null)
            {
                myEntityList.myPaths = new List<string>();
            }
            XmlDocument entityDoc = myXMLWrapper.Open(myFilePath);
            XmlNode rootElement = myXMLWrapper.FindFirstElement();
            XmlNode entityElement;
            entityElement = myXMLWrapper.FindFirstChildElement(rootElement);
            if (rootElement.Name != "root")
            {
                entityElement = rootElement;
            }
            myXMLWrapper.ReadAttribute(entityElement, "name", ref myEntityData.myName);
            for (XmlNode e = myXMLWrapper.FindFirstChildElement(entityElement); e != null; e = myXMLWrapper.FindNextSiblingElement(e))
            {
                ReadElement(e);
            }

            XmlDocument entityListDoc = myXMLWrapper.Open(entityListPath);
            rootElement = myXMLWrapper.FindFirstElement();
            for (XmlNode e = myXMLWrapper.FindFirstChildElement(rootElement); e != null; e = myXMLWrapper.FindNextSiblingElement(e))
            {
                ReadEntityListFile(e);
            }

            EntityEditorForm entityForm = (EntityEditorForm)aParent;
            entityForm.SetEntityList(myEntityList);

            return myEntityData;
        }
Example #6
0
        //----- Open Entity Buttons Section Start -----
        private void openEntityToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            HidePanels();
            openEntityFile.InitialDirectory = myCurrentEntityFolderPath;
            if (openEntityFile.InitialDirectory == "")
            {
                openEntityFile.InitialDirectory = Directory.GetCurrentDirectory();
            }

            openEntityFile.ShowDialog();
            if (openEntityFile.SafeFileName != "")
            {
                myCurrentEntity = myEntityReader.LoadFile(openEntityFile.FileName, this);

                myCurrentEntityFilePath = openEntityFile.FileName;
                myCurrentEntityFolderPath = myCurrentEntityFilePath.Replace(openEntityFile.SafeFileName, "");
                myDataFolderPath = StringUtilities.GetDataFolderPath(myCurrentEntityFolderPath);
                myShootingComponentPanel.ReloadXML(myDataFolderPath);
                Properties.Settings.Default.DefaultEntityFolderPath = myCurrentEntityFolderPath;
                Properties.Settings.Default.DefaultEntityFileName = myCurrentEntityFilePath;
                Properties.Settings.Default.Save();

                DisplayEntityData();
            }
        }