Advertisement
penright

Untitled

Oct 3rd, 2023
1,657
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.33 KB | None | 0 0
  1.    Sub FixNDAgent()
  2.         '9/25/2020 PE
  3.         'Added logic to
  4.         Dim NDStoreList_path As String = "C:\BraumsRecovery\ini\NDStoreList.csv"
  5.         Dim NDStoreList_Lines() As String = IO.File.ReadAllLines(NDStoreList_path)
  6.         Dim StoreRestID As String = ""
  7.         Dim StorePassword As String = ""
  8.         Dim UserName As String = ""
  9.  
  10.         Dim PagerIP As String = ""
  11.  
  12.         Dim PagerNumbers As String = "1+2+3+4"
  13.         If IO.File.Exists("C:\user\braums\com\PagerHub.exe") Then
  14.             PagerIP = "10.77.77.30:7777"
  15.         Else
  16.             PagerIP = "10.10" & StoreNumber.ToString.PadLeft(3, "0"c).Substring(0, 1) & "." & CIntNull(StoreNumber.ToString.PadLeft(3, "0"c).Substring(1)).ToString & ".242"
  17.         End If
  18.         For xLoop As Integer = 0 To NDStoreList_Lines.Count - 1
  19.             Dim tmpInfo() As String = NDStoreList_Lines(xLoop).Split(","c)
  20.             If tmpInfo.Count > 0 Then
  21.                 If CIntNull(tmpInfo(1)) = StoreNumber Then
  22.                     StoreRestID = "'" & tmpInfo(0) & "'"
  23.                     UserName = "'" & tmpInfo(2) & "'"
  24.                     StorePassword = "'" & tmpInfo(3) & "'"
  25.                 End If
  26.             End If
  27.         Next
  28.         If StoreNumber > 470 Then
  29.             PagerNumbers = "101+102+103+104"
  30.         End If
  31.  
  32.         Dim config_update_path = "C:\ProgramData\NovaDine\NDAgent\config_update.yml"
  33.         Dim config_update_Lines = ""
  34.         'general area
  35.         config_update_Lines &= "general:" & NewLine
  36.         config_update_Lines &= "  restid: " & StoreRestID & NewLine
  37.         If StoreNumber = 476 Then
  38.             config_update_Lines &= "  url: 'https://braums-dev-kc.novadine.com'" & NewLine
  39.             config_update_Lines &= "  username: " & UserName & NewLine
  40.             config_update_Lines &= "  password: " & StorePassword & NewLine
  41.             config_update_Lines &= "  debug_logging: true" & NewLine
  42.         ElseIf StoreNumber > 400 Then
  43.             config_update_Lines &= "  url: 'https://braums-staging.novadine.com'" & NewLine
  44.             config_update_Lines &= "  username: " & UserName & NewLine
  45.             config_update_Lines &= "  password: " & StorePassword & NewLine
  46.             config_update_Lines &= "  debug_logging: true" & NewLine
  47.         Else
  48.             config_update_Lines &= "  url: 'https://braums.novadine.com'" & NewLine
  49.             config_update_Lines &= "  username: " & UserName & NewLine
  50.             config_update_Lines &= "  password: " & StorePassword & NewLine
  51.             config_update_Lines &= "  debug_logging: false" & NewLine
  52.         End If
  53.         'pager area
  54.         config_update_Lines &= "pager:" & NewLine
  55.         config_update_Lines &= "  host: " & PagerIP & NewLine
  56.         config_update_Lines &= "  number: " & PagerNumbers & NewLine
  57.         IO.File.WriteAllText(config_update_path, config_update_Lines)
  58.         'Dim FoundPager As Boolean = False
  59.         'For xloop As Integer = 0 To yaml_Lines.Count - 1
  60.         '    If FoundPager AndAlso yaml_Lines(xloop).Trim.StartsWith("ip:") Then
  61.         '        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"
  62.         '    End If
  63.         '    If yaml_Lines(xloop).StartsWith("pager:") Then FoundPager = True
  64.         'Next
  65.  
  66.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement