Skip to content

Commit 1b4edb7

Browse files
committed
Fix so it also detects if the snippit should be inverted
1 parent cd5b374 commit 1b4edb7

File tree

1 file changed

+20
-13
lines changed
  • b2sbackglassdesigner/b2sbackglassdesigner/classes/Tab

1 file changed

+20
-13
lines changed

b2sbackglassdesigner/b2sbackglassdesigner/classes/Tab/B2STabPage.vb

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,23 +1079,30 @@ Public Class B2STabPage
10791079
.Location = loc
10801080
.Image = image
10811081
.IsImageSnippit = True
1082-
If Char.IsDigit(name.Last()) Then
1083-
Dim copy As String = name
1084-
Dim numbers As String = ""
1085-
While Char.IsDigit(copy.Last())
1086-
numbers = copy.Last() + numbers
1087-
copy = copy.Substring(0, copy.Length - 1)
1082+
1083+
If name.Length AndAlso Char.IsDigit(name.Last()) Then
1084+
Dim romtype As String = name
1085+
Dim romid As String = ""
1086+
1087+
While romtype.Length AndAlso Char.IsDigit(romtype.Last())
1088+
romid = romtype.Last() + romid
1089+
romtype = romtype.Substring(0, romtype.Length - 1)
10881090
End While
1089-
If numbers.Length AndAlso copy.Length Then
1090-
If copy.Substring(copy.Length - 1, 1) = "L" Then
1091-
.RomID = CInt(numbers)
1091+
1092+
If romid.Length Then
1093+
.RomID = CInt(romid)
1094+
End If
1095+
1096+
If romid.Length AndAlso romtype.Length Then
1097+
If romtype.EndsWith("L") Then
10921098
.RomIDType = eRomIDType.Lamp
1093-
ElseIf copy.Substring(copy.Length - 1, 1) = "S" Then
1094-
.RomID = CInt(numbers)
1099+
.RomInverted = romtype.EndsWith("iL")
1100+
ElseIf romtype.EndsWith("S") Then
10951101
.RomIDType = eRomIDType.Solenoid
1096-
ElseIf copy.Length > 1 AndAlso copy.Substring(copy.Length - 2, 2) = "Gi" Then
1097-
.RomID = CInt(numbers)
1102+
.RomInverted = romtype.EndsWith("iS")
1103+
ElseIf romtype.EndsWith("Gi") Then
10981104
.RomIDType = eRomIDType.GIString
1105+
.RomInverted = romtype.EndsWith("iGi")
10991106
End If
11001107
End If
11011108
End If

0 commit comments

Comments
 (0)