Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Case "find", "seek", "search", "findup", "seekup", "searchup"
  2.                                                         Dim Up As Boolean = Operation.EndsWith("up")
  3.                                                         If FindAll <> "" Then
  4.                                                             Throw New Exception("findall operation not followed by insert, add, replace or delete at line " & myXmlReader.LineNumber & " of " & ModXMLPath)
  5.                                                         End If
  6.                                                         If Source <> "" Then
  7.                                                             If Up Then
  8.                                                                 Pos1 -= 1
  9.                                                                 If Pos1 >= 0 Then Pos1 = s.LastIndexOf(Source, Pos1 - 1)
  10.                                                             Else
  11.                                                                 Pos1 = s.IndexOf(Source, Pos2)
  12.                                                             End If
  13.                                                             If Pos1 < 0 Then
  14.                                                                 Dim SoughtDisplay As String = ""
  15.                                                                 For Each Line As String In Source.Split(Convert.ToChar(10))
  16.                                                                     Line = Line.Trim
  17.                                                                     If Line <> "" Then
  18.                                                                         SoughtDisplay = Line
  19.                                                                         Exit For
  20.                                                                     End If
  21.                                                                 Next Line
  22.                                                                 Throw New Exception("Could not find string starting with """ & SoughtDisplay & """ as sought by line " & myXmlReader.LineNumber & " of " & ModXMLPath & Environment.NewLine & Environment.NewLine & "This may be caused by the mod being outdated or by an incompatibility with another enabled mod.")
  23.                                                             Else
  24.                                                                 Pos2 = Pos1 + Source.Length
  25.                                                             End If
  26.                                                         Else
  27.                                                             Select Case Position
  28.                                                                 Case "before", "begin", "start", "head"
  29.                                                                     Pos1 = 0
  30.                                                                     Pos2 = 0
  31.                                                                 Case "after", "end", "tail", "eof"
  32.                                                                     Pos1 = s.Length
  33.                                                                     Pos2 = Pos1
  34.                                                                 Case ""
  35.                                                                     Throw New Exception("find operation without parameters at line " & myXmlReader.LineNumber & " of " & ModXMLPath)
  36.                                                                 Case Else
  37.                                                                     Dim tInt As Integer
  38.                                                                     If Integer.TryParse(Position, tInt) Then
  39.                                                                         If Up Then
  40.                                                                             Pos1 -= tInt
  41.                                                                         Else
  42.                                                                             Pos1 += tInt
  43.                                                                         End If
  44.                                                                         If Pos1 < 0 Then Pos1 = 0
  45.                                                                         If Pos1 > s.Length Then Pos1 = s.Length
  46.                                                                         If Up Then
  47.                                                                             Pos2 -= tInt
  48.                                                                         Else
  49.                                                                             Pos2 += tInt
  50.                                                                         End If
  51.                                                                         If Pos2 < 0 Then Pos2 = 0
  52.                                                                         If Pos2 > s.Length Then Pos2 = s.Length
  53.                                                                     Else
  54.                                                                         Throw New Exception("find operation with invalid position parameter at line " & myXmlReader.LineNumber & " of " & ModXMLPath)
  55.                                                                     End If
  56.                                                             End Select
  57.                                                         End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement