Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub FixNDAgent()
- '9/25/2020 PE
- 'Added logic to
- Dim NDStoreList_path As String = "C:\BraumsRecovery\ini\NDStoreList.csv"
- Dim NDStoreList_Lines() As String = IO.File.ReadAllLines(NDStoreList_path)
- Dim StoreRestID As String = ""
- Dim StorePassword As String = ""
- Dim UserName As String = ""
- Dim PagerIP As String = ""
- Dim PagerNumbers As String = "1+2+3+4"
- If IO.File.Exists("C:\user\braums\com\PagerHub.exe") Then
- PagerIP = "10.77.77.30:7777"
- Else
- PagerIP = "10.10" & StoreNumber.ToString.PadLeft(3, "0"c).Substring(0, 1) & "." & CIntNull(StoreNumber.ToString.PadLeft(3, "0"c).Substring(1)).ToString & ".242"
- End If
- For xLoop As Integer = 0 To NDStoreList_Lines.Count - 1
- Dim tmpInfo() As String = NDStoreList_Lines(xLoop).Split(","c)
- If tmpInfo.Count > 0 Then
- If CIntNull(tmpInfo(1)) = StoreNumber Then
- StoreRestID = "'" & tmpInfo(0) & "'"
- UserName = "'" & tmpInfo(2) & "'"
- StorePassword = "'" & tmpInfo(3) & "'"
- End If
- End If
- Next
- If StoreNumber > 470 Then
- PagerNumbers = "101+102+103+104"
- End If
- Dim config_update_path = "C:\ProgramData\NovaDine\NDAgent\config_update.yml"
- Dim config_update_Lines = ""
- 'general area
- config_update_Lines &= "general:" & NewLine
- config_update_Lines &= " restid: " & StoreRestID & NewLine
- If StoreNumber = 476 Then
- config_update_Lines &= " url: 'https://braums-dev-kc.novadine.com'" & NewLine
- config_update_Lines &= " username: " & UserName & NewLine
- config_update_Lines &= " password: " & StorePassword & NewLine
- config_update_Lines &= " debug_logging: true" & NewLine
- ElseIf StoreNumber > 400 Then
- config_update_Lines &= " url: 'https://braums-staging.novadine.com'" & NewLine
- config_update_Lines &= " username: " & UserName & NewLine
- config_update_Lines &= " password: " & StorePassword & NewLine
- config_update_Lines &= " debug_logging: true" & NewLine
- Else
- config_update_Lines &= " url: 'https://braums.novadine.com'" & NewLine
- config_update_Lines &= " username: " & UserName & NewLine
- config_update_Lines &= " password: " & StorePassword & NewLine
- config_update_Lines &= " debug_logging: false" & NewLine
- End If
- 'pager area
- config_update_Lines &= "pager:" & NewLine
- config_update_Lines &= " host: " & PagerIP & NewLine
- config_update_Lines &= " number: " & PagerNumbers & NewLine
- IO.File.WriteAllText(config_update_path, config_update_Lines)
- 'Dim FoundPager As Boolean = False
- 'For xloop As Integer = 0 To yaml_Lines.Count - 1
- ' If FoundPager AndAlso yaml_Lines(xloop).Trim.StartsWith("ip:") Then
- ' yaml_Lines(xloop) = yaml_Lines(xloop).Substring(0, yaml_Lines(xloop).IndexOf("ip:") + 3) & " 10.10" & StoreNumber.ToString.PadLeft(3, "0"c).Substring(0, 1) & "." & CIntNull(StoreNumber.ToString.PadLeft(3, "0"c).Substring(1)).ToString & ".242"
- ' End If
- ' If yaml_Lines(xloop).StartsWith("pager:") Then FoundPager = True
- 'Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement