Skip to content

Commit

Permalink
Merge pull request #5 from SigmaDolphin/XMLdb
Browse files Browse the repository at this point in the history
XML database change
  • Loading branch information
SigmaDolphin authored May 7, 2020
2 parents 47201e8 + e706e80 commit 33b9ab5
Show file tree
Hide file tree
Showing 7 changed files with 2,415 additions and 562 deletions.
2 changes: 1 addition & 1 deletion Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ Public Class Form1
'get skylander ID
skylanderID = SwapEndianness(skylanderData(16), skylanderData(17))

skyInfo = Split(ReadIni(exepath & "SkylanderDB.ini", "Skylanders", skylanderID, ""), "_")
skyInfo = searchXML(exepath, skylanderID)

If skyInfo(0) = "" Then
'if figure ID is not in database
Expand Down
44 changes: 38 additions & 6 deletions HatControl.vb
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
Option Explicit On
Imports System.Data.OleDb
Imports System.Xml

Module HatControl
'we get the hat IDs and names from the database
Public Sub hatsimulator(ByVal exepath As String)
Dim buffer As String
Dim count As Integer
Dim xmlFile As XmlReader
xmlFile = XmlReader.Create(exepath & "SkylanderDB.xml")
Dim ds As New DataSet
Dim dv As DataView
ds.ReadXml(xmlFile)

dv = New DataView(ds.Tables(3))
dv.Sort = "index"

count = 0
Do
buffer = ReadIni(exepath & "SkylanderDB.ini", "skyhats", count, "")
If buffer <> "" Then
Form1.ComboBox1.Items.Insert(count, buffer)
Else
Dim index As Integer = dv.Find(count)
If index = -1 Then
Exit Do
Else
Form1.ComboBox1.Items.Insert(count, dv(index)("name").ToString())
End If
count = count + 1
Loop
Expand All @@ -32,4 +41,27 @@ Module HatControl
Return 0
End If
End Function


Public Function searchXML(ByVal exepath As String, ByVal SkyNum As Integer) As String()
Dim SkyXML(2) As String
Dim xmlFile As XmlReader
xmlFile = XmlReader.Create(exepath & "SkylanderDB.xml")
Dim ds As New DataSet
Dim dv As DataView
ds.ReadXml(xmlFile)

dv = New DataView(ds.Tables(1))
dv.Sort = "index"
Dim index As Integer = dv.Find(SkyNum)

If index = -1 Then
SkyXML(0) = ""
Else
SkyXML(0) = dv(index)("name").ToString()
SkyXML(1) = dv(index)("element").ToString()
End If

Return SkyXML
End Function
End Module
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,8 @@ Swapper reading is more reliable
replaced the MSAccess DB for a simple INI file containing the same data

several bugfixes

1.0.1a -

replaced INI file with an XML file in an attempt to use a more neutral format

Loading

0 comments on commit 33b9ab5

Please sign in to comment.