Example #1
0
        public frmAreas(frmMain aMainForm)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            mMainForm = aMainForm;

            mlstAreas = new ArrayList();
            mlstTypes = new ArrayList();

            XmlDocument Doc = new XmlDocument();

            try     {
                Doc.Load("MapEditor.cfg");
            }
            catch (XmlException e) {
                MessageBox.Show("Couldn't load 'MapEditor.cfg'!\n" + e.ToString(), "Error");
                return;
            }

            XmlElement CfgElem = (XmlElement)Doc.FirstChild;

            foreach (XmlElement CfgElemChild in CfgElem.ChildNodes)
            {
                if (CfgElemChild.Name == "Areas")
                {
                    foreach (XmlElement PartElem in CfgElemChild.ChildNodes)
                    {
                        cAreaType AType = new cAreaType();
                        AType.msName    = cHplXml.GetStr(PartElem, "Name", "");
                        AType.msDesc[0] = cHplXml.GetStr(PartElem, "XDesc", "");
                        AType.msDesc[1] = cHplXml.GetStr(PartElem, "YDesc", "");
                        AType.msDesc[2] = cHplXml.GetStr(PartElem, "ZDesc", "");

                        objTypeList.Items.Add(AType.msName);
                        mlstTypes.Add(AType);
                        objTypeList.SelectedIndex = 0;
                    }
                    break;
                }
            }
        }
Example #2
0
		public frmAreas(frmMain aMainForm)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
			
			mMainForm = aMainForm;
			
			mlstAreas = new ArrayList();
			mlstTypes = new ArrayList();
			
			XmlDocument Doc = new XmlDocument();
			try	{
				Doc.Load("MapEditor.cfg");
			}
			catch(XmlException e) {

				MessageBox.Show("Couldn't load 'MapEditor.cfg'!\n"+e.ToString(), "Error");
				return;
			}
            
			XmlElement CfgElem = (XmlElement)Doc.FirstChild;
			foreach(XmlElement CfgElemChild in CfgElem.ChildNodes)
			{
				if(CfgElemChild.Name == "Areas")
				{
					foreach(XmlElement PartElem in CfgElemChild.ChildNodes)
					{
						cAreaType AType = new cAreaType();
						AType.msName = cHplXml.GetStr(PartElem,"Name","");
						AType.msDesc[0] = cHplXml.GetStr(PartElem,"XDesc","");
						AType.msDesc[1] = cHplXml.GetStr(PartElem,"YDesc","");
						AType.msDesc[2] = cHplXml.GetStr(PartElem,"ZDesc","");

						objTypeList.Items.Add(AType.msName);
						mlstTypes.Add(AType);
						objTypeList.SelectedIndex =0;
					}
					break;
				}
			}	
		}