Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Case "find", "seek", "search", "findup", "seekup", "searchup"
- Dim Up As Boolean = Operation.EndsWith("up")
- If FindAll <> "" Then
- Throw New Exception("findall operation not followed by insert, add, replace or delete at line " & myXmlReader.LineNumber & " of " & ModXMLPath)
- End If
- If Source <> "" Then
- If Up Then
- Pos1 -= 1
- If Pos1 >= 0 Then Pos1 = s.LastIndexOf(Source, Pos1 - 1)
- Else
- Pos1 = s.IndexOf(Source, Pos2)
- End If
- If Pos1 < 0 Then
- Dim SoughtDisplay As String = ""
- For Each Line As String In Source.Split(Convert.ToChar(10))
- Line = Line.Trim
- If Line <> "" Then
- SoughtDisplay = Line
- Exit For
- End If
- Next Line
- 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.")
- Else
- Pos2 = Pos1 + Source.Length
- End If
- Else
- Select Case Position
- Case "before", "begin", "start", "head"
- Pos1 = 0
- Pos2 = 0
- Case "after", "end", "tail", "eof"
- Pos1 = s.Length
- Pos2 = Pos1
- Case ""
- Throw New Exception("find operation without parameters at line " & myXmlReader.LineNumber & " of " & ModXMLPath)
- Case Else
- Dim tInt As Integer
- If Integer.TryParse(Position, tInt) Then
- If Up Then
- Pos1 -= tInt
- Else
- Pos1 += tInt
- End If
- If Pos1 < 0 Then Pos1 = 0
- If Pos1 > s.Length Then Pos1 = s.Length
- If Up Then
- Pos2 -= tInt
- Else
- Pos2 += tInt
- End If
- If Pos2 < 0 Then Pos2 = 0
- If Pos2 > s.Length Then Pos2 = s.Length
- Else
- Throw New Exception("find operation with invalid position parameter at line " & myXmlReader.LineNumber & " of " & ModXMLPath)
- End If
- End Select
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement