Public Sub ConvertBalToJsonInMemory(Dir As String, FileName As String) As Map
Dim reader As RandomAccessFile
reader.Initialize2(Dir, FileName, True, True)
Dim design As Map
Dim lh As Map = ReadLayoutHeader(reader)
If lh.Get("Version") < 3 Then
#If UI
Dim xui As XUI
xui.MsgboxAsync("Unsupported version: " & FileName, "")
#end if
#If NON_UI
Log("Unsupported version: " & FileName)
#End If
Return design
End If
design.Initialize
design.Put("LayoutHeader", lh)
Dim cache() As String = LoadStringsCache(reader)
Dim numberOfVariants As Int = reader.ReadInt(reader.CurrentPosition)
Dim variants As List
variants.Initialize
For i = 0 To numberOfVariants - 1
variants.Add(ReadVariantFromStream(reader))
Next
'design.Put("Variants", variants)
'design.Put("Data", ReadMap(reader, cache))
'reader.ReadInt(reader.CurrentPosition) '0
' design.Put("FontAwesome", reader.ReadSignedByte(reader.CurrentPosition) = 1)
'design.Put("MaterialIcons", reader.ReadSignedByte(reader.CurrentPosition) = 1)
'############################# MY CODE to get params START ##############################
' D:\F\android apps\ONLINE\wwwSAGITALnet\The Giant Duel\PICS-STUFF\testbal\Files
Dim dmap As Map = ReadMap(reader, cache)
Dim kidsmap As Map = dmap.Get(":kids")
' Dim map2 As Map = kidsmap.Get("1")
' Dim kidsmap2 As Map = map2.Get(":kids")
Dim mymap, refmap As Map
mymap.Initialize
refmap.Initialize
' Dim hasnokids As Boolean = False
For Each key As String In kidsmap.Keys
mymap.Put(key,returnviewprops(kidsmap.Get(key)))
Next
'check if all views exists and log them
For Each key As String In mymap.Keys 'relevant code
Dim myitem As mapItem = mymap.Get(key)
Log(myitem.name)
Log(myitem.left)
Log(myitem.top)
Log(myitem.width)
Log(myitem.height)
Log("---------------------")
Next
'
' csType
' Type
' animationDuration
' drawable
' eventName
' fullScreen
' includeTitle
' javaType
' name
' parent
' tag
' title
' titleColor
' visible
' variant0
' :kids
reader.Close
Return design
End Sub
Sub returnviewprops(m As Map) As mapItem 'relevant code
Dim myitem As mapItem
myitem.Initialize
myitem.name = m.Get("name")
If m.ContainsKey("variant0") Then
Dim varmap As Map = m.Get("variant0")
myitem.left = varmap.Get("left")
myitem.top = varmap.Get("top")
myitem.width = varmap.Get("width")
myitem.height = varmap.Get("height")
End If
Return myitem
End Sub
'############################# MY CODE to get params END ##############################