1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| Public Function Load(ByVal fileName As String) As Tracks
'//try to read the Xml file
Try
'//load the Xml and create the new Tracks
Dim doc = XDocument.Load(fileName)
Dim Tracks = New Tracks()
'//get all Track
For Each elTrack In doc.<root>.<TrackName>
Dim Track As New Track(elTrack.@name)
Track.Nom = elTrack.<Nom>.Value
Track.Description = elTrack.<Description>.Value
For Each elLayout In doc.<root>.<TrackName>.<TrackLayout>
Dim Layout As New Layout(elLayout.@name)
Layout.Nom = elLayout.<Nom>.Value
Layout.Description = elLayout.<Description>.Value
Track.Layouts.Add(Layout.LayoutName, Layout)
Next
Tracks.Add(Track.Name, Track)
Next
Return Tracks
Catch ex As Exception
Return Nothing
End Try
End Function |
Partager