Guest User

Untitled

a guest
Feb 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.43 KB | None | 0 0
  1.     Private Sub ExtractCode()
  2.         SetProgressVisible(True)
  3.         'UI
  4.         SetStatusText("Load the web page")
  5.         ShowBusy("Extracting the source code...")
  6.         Dim htmlpage As String = NormalizeCode(GetHTMLCode2(urlSourceCdoe))
  7.         'Look for code
  8.         If htmlpage = String.Empty Then
  9.             'No code --Error
  10.             SetStatusText("Can't load the page")
  11.             SetProgressVisible(False)
  12.             ShowMessage(Color.Red, "Can't reach the server")
  13.         Else
  14.  
  15.             Dim Opener As String = "<div id=""code_frame"">"
  16.             If htmlpage.Contains(Opener) Then
  17.                 SetStatusText("Source code founded")
  18.                 Dim Closer = "<div class=""content_title"">"
  19.                 Dim StartIndex As Integer = htmlpage.IndexOf(Opener)
  20.                 Dim EndiIndex As Integer = htmlpage.IndexOf(Closer, StartIndex)
  21.                 'Get the code source
  22.                 '   Dim source = htmlpage.Substring(StartIndex, EndiIndex - StartIndex).Trim
  23.                 'Calculate CSS and Html
  24.                 'Return Value
  25.                 SetStatusText("Code extracted")
  26.                 ResultCode = htmlpage.Substring(StartIndex, EndiIndex - StartIndex).Trim
  27.             Else
  28.                 SetStatusText("Can't find the source code")
  29.                 ShowMessage(Color.Red, "Can't extract the source code")
  30.             End If
  31.         End If
  32.         SetProgressVisible(False)
  33.     End Sub
Add Comment
Please, Sign In to add comment