Advertisement
Guest User

Programmcode

a guest
Oct 6th, 2016
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         Dim lst As New List(Of Serie)
  2.         If alphabetic Then
  3.             Dim json As String = GetSourceWithGet("http://url.endung/list.json) 'Holt den Quelltext mit einer GET-Anfrage und WebRequests
  4.            json = json.Split("["c)(1).Split("]"c)(0)
  5.            json = json.Replace(vbCrLf, "<NewLine>").Replace(vbCr, "<NewLine>").Replace(vbLf, "<NewLine>").Replace("<NewLine>", vbCrLf)
  6.            json = json.Replace("{", "{" & vbCrLf).Replace("}", vbCrLf & "}" & vbCrLf).Replace(",""", "," & vbCrLf & """").Replace("}" & vbCrLf & ",{", "}," & vbCrLf & "{").Replace("\/", "/")
  7.            Dim id As Integer = 0
  8.            Dim name As String = ""
  9.            Dim link As String = ""
  10.            Dim cover As String = ""
  11.            Dim background As String = ""
  12.            Dim description As String = ""
  13.            Dim trailer As String = ""
  14.            Dim fsk As Integer = -1
  15.            For Each line As String In json.Split({vbCrLf}, StringSplitOptions.RemoveEmptyEntries)
  16.                If line.StartsWith("""id""") Then
  17.                    id = Integer.Parse(line.Substring(Len("""id"":")).Replace(",", ""))
  18.                End If
  19.                If line.StartsWith("""name""") Then
  20.                    name = line.Substring(Len("""name"":""")).Replace(""",", "")
  21.                End If
  22.                If line.StartsWith("""link""") Then
  23.                    link = line.Substring(Len("""link"":""")).Replace(""",", "")
  24.                End If
  25.                If line.StartsWith("""cover""") Then
  26.                    cover = line.Substring(Len("""cover"":""")).Replace(""",", "")
  27.                End If
  28.                If line.StartsWith("""background""") Then
  29.                    background = line.Substring(Len("""background"":""")).Replace(""",", "")
  30.                End If
  31.                If line.StartsWith("""description""") Then
  32.                    description = line.Substring(Len("""description"":""")).Replace(""",", "")
  33.                End If
  34.                If line.StartsWith("""trailer""") Then
  35.                    trailer = line.Substring(Len("""trailer"":""")).Replace(""",", "")
  36.                End If
  37.                If line.StartsWith("""fsk""") Then
  38.                    fsk = Integer.Parse(line.Substring(Len("""fsk"":")))
  39.                    lst.Add(New Serie(id, ReplaceUnicode(name), link, "http://url.endung" & cover, "http://url.endung" & background, ReplaceUnicode(description), trailer, fsk))
  40.                    'ReplaceUnicode ersetzt \u in &H und führt ChrW(CharCode) aus
  41.                End If
  42.            Next
  43.        End If
  44.        Return lst.ToArray
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement