Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub ParseXML_PlanetInfo()
- Dim xmlDoc As New XmlDocument
- Dim ParseNodes As XmlNodeList
- Dim ParseNode As XmlNode
- Dim rawData As String
- rawData = XMLData
- xmlDoc.LoadXml(rawData)
- ParseNodes = xmlDoc.GetElementsByTagName("header")
- For Each ParseNode In ParseNodes
- ParseType.Uni = ParseNode.Attributes("universe").Value
- Next
- If Not ParseType.Uni = ogProfile.Uni.UniName Then
- ' An dieser Stelle sollte zusätzlich geprüft werden, ob ein Profil für die Daten vorhanden ist.
- '
- '
- '
- MsgBox(getLngTxt("XMLParse", "WrongUni"), MsgBoxStyle.Critical)
- Exit Sub
- End If
- ParseNodes = Nothing
- ParseNodes = xmlDoc.GetElementsByTagName("planetinfo")
- For Each ParseNode In ParseNodes
- 'Spielername auslesen
- ParseType.OwnerName = ParseNode.Attributes("playername").Value
- 'Planetenname auslesen
- ParseType.Planet.Planet.Name = ParseNode.Attributes("planetname").Value
- 'Koordinaten des Planeten auslesen
- ParseType.Planet.Koords.Galaxie = ParseNode.Attributes("galaxy").Value
- ParseType.Planet.Koords.System = ParseNode.Attributes("system").Value
- ParseType.Planet.Koords.Number = ParseNode.Attributes("planet").Value
- 'Hier wird geprüft ob es sich hierbei um einen Planeten oder Mond handelt
- If CBool(ParseNode.Attributes("moon").Value) = False Then
- ParseType.Planet.Planet.Name = ParseNode.Attributes("planetname").Value
- Else
- ParseType.Planet.Moon.Name = ParseNode.Attributes("planetname").Value
- End If
- Next
- ParseNodes = Nothing
- ParseNodes = xmlDoc.GetElementsByTagName("entry")
- sPlanetInfoPage = ""
- For Each ParseNode In ParseNodes
- '#####################################################
- 'Ermitteln der Ressourcen
- 'Energie wäre zwar auch möglich macht aber keinen Sinn, da wir das lieber mit hilfe der
- 'Gebäude und Forschungen errechnen =D
- If ParseNode.Attributes("name").Value = "Metal" Then
- ParseType.Planet.Planet.Supplies.Metal = ParseNode.Attributes("amount").Value
- End If
- If ParseNode.Attributes("name").Value = "Crystal" Then
- ParseType.Planet.Planet.Supplies.Crystal = ParseNode.Attributes("amount").Value
- End If
- If ParseNode.Attributes("name").Value = "Deuterium" Then
- ParseType.Planet.Planet.Supplies.Deuterium = ParseNode.Attributes("amount").Value
- End If
- '#####################################################
- 'Ermitteln der Gebäude (Ressourcen)
- If ParseNode.Attributes("name").Value = "Metal Mine" Then
- ParseType.Planet.Planet.Resources.MetalMine = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Crystal Mine" Then
- ParseType.Planet.Planet.Resources.CrystalMine = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Deuterium Synthesizer" Then
- ParseType.Planet.Planet.Resources.DeuteriumSynthesizer = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Solar Plant" Then
- ParseType.Planet.Planet.Resources.SolarPlant = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Fusion Reactor" Then
- ParseType.Planet.Planet.Resources.FusionReactor = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Solar Satellite" Then
- ParseType.Planet.Planet.Resources.SolarSatellite = ParseNode.Attributes("amount").Value
- ' An dieser Stelle wird der Seitenname NICHT übergeben! Könnte ja auch die Flottenseite sein.
- End If
- If ParseNode.Attributes("name").Value = "Metal Storage" Then
- ParseType.Planet.Planet.Resources.MetalStorage = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Crystal Storage" Then
- ParseType.Planet.Planet.Resources.CrystalStorage = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- If ParseNode.Attributes("name").Value = "Deuterium Tank" Then
- ParseType.Planet.Planet.Resources.DeuteriumTank = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "ress"
- End If
- '#####################################################
- 'Ermitteln der Gebäude (Facilities)
- If ParseNode.Attributes("name").Value = "Robotics Factory" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- If ParseNode.Attributes("name").Value = "Nanite Factory" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- If ParseNode.Attributes("name").Value = "Shipyard" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- If ParseNode.Attributes("name").Value = "Research Lab" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- If ParseNode.Attributes("name").Value = "Terraformer" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- If ParseNode.Attributes("name").Value = "Alliance Depot" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- If ParseNode.Attributes("name").Value = "Missile Silo" Then
- ParseType.Planet.Planet.Facilities.RoboticFactory = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "faci"
- End If
- '#####################################################
- 'Ermitteln der Forschungen (Research)
- If ParseNode.Attributes("name").Value = "Espionage Technology" Then
- ParseType.Research.EspionageTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Computer Technology" Then
- ParseType.Research.ComputerTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Weapons Technology" Then
- ParseType.Research.WeaponsTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Shielding Technology" Then
- ParseType.Research.ShieldingTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Armour Technology" Then
- ParseType.Research.ArmorTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Energy Technology" Then
- ParseType.Research.EnergyTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Hyperspace Technology" Then
- ParseType.Research.HyperspaceTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Combustion Drive" Then
- ParseType.Research.CombustionDrive = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Impulse Drive" Then
- ParseType.Research.ImpulseDrive = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Hyperspace Drive" Then
- ParseType.Research.HyperspaceDrive = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Laser Technology" Then
- ParseType.Research.LaserTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Ion Technology" Then
- ParseType.Research.IonTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Plasma Technology" Then
- ParseType.Research.PlasmaTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Intergalactic Research Network" Then
- ParseType.Research.IntergalacticResearch = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Astrophysics" Then
- ParseType.Research.Astrophysics = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- If ParseNode.Attributes("name").Value = "Graviton Technology" Then
- ParseType.Research.GravitonTechnology = ParseNode.Attributes("amount").Value
- sPlanetInfoPage = "rese"
- End If
- Next
- ParseNodes = Nothing
- ParseNodes = xmlDoc.GetElementsByTagName("officers")
- sPlanetInfoPage = ""
- For Each ParseNode In ParseNodes
- If ParseNode.Attributes("officer name").Value = "commander" Then
- ParseType.Officers.Commander = ParseNode.Attributes("enabled").Value
- MsgBox(ParseType.Officers.Commander)
- sPlanetInfoPage = "over"
- End If
- If ParseNode.Attributes("officer name").Value = "admiral" Then
- ParseType.Officers.Admiral = ParseNode.Attributes("enabled").Value
- sPlanetInfoPage = "over"
- End If
- If ParseNode.Attributes("officer name").Value = "engineer" Then
- ParseType.Officers.Engineer = ParseNode.Attributes("enabled").Value
- sPlanetInfoPage = "over"
- End If
- If ParseNode.Attributes("officer name").Value = "geologist" Then
- ParseType.Officers.Geologist = ParseNode.Attributes("enabled").Value
- sPlanetInfoPage = "over"
- End If
- If ParseNode.Attributes("officer name").Value = "technocrat" Then
- ParseType.Officers.Technocrat = ParseNode.Attributes("enabled").Value
- sPlanetInfoPage = "over"
- End If
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement