So I have a weird situation that I will preface as I'm new to this, more "experienced" in VBS and have migrated a lot of my scripting to PowerShell. I'm writing a WinForms program to read an INI file stored online so I can download updates listed in the INI. In the INI each downloadable file is stored in a block of text (see below) and I need to go through each block, find the "Source=" and "Destination=" lines, download the file from the source and place it in the "Destination=" folder. On the WinForm, the user has to choose the download location so I need to append the "Destination=" to the user's input.
Web based INI file content:
[.Net4.6.1FrameworkFull]
DisplayName=.Net Framework 4.6.1 Full
Source=https://download.microsoft.com/download/E/4/1/E4173890-A24A-4936-9FC9-AF930FE3FA40/NDP461-KB3102436-x86-x64-AllOS-ENU.exe
Destination=Redist\Microsoft .net\4.6.1\Full\NDP461-KB3102436-x86-x64-AllOS-ENU.exe
Size=67681000
[.Net4.6.1FrameworkWeb]
DisplayName=.Net Framework 4.6.1 Web
Source=https://download.microsoft.com/download/3/5/9/35980F81-60F4-4DE3-88FC-8F962B97253B/NDP461-KB3102438-Web.exe
Destination=Redist\Microsoft .net\4.6.1\Web\NDP461-KB3102438-Web.exe
Size=1424328
Here's what I have so far to read the INI file and dump it to the console:
Dim inStream As StreamReader
Dim webRequest As WebRequest
Dim webresponse As WebResponse
webRequest = WebRequest.Create(DlSrc.Text)
webresponse = webRequest.GetResponse()
inStream = New StreamReader(webresponse.GetResponseStream())
Console.WriteLine(inStream.ReadToEnd)
I can send the output of inStream to the console with no problems but I can't figure out how to check each block for the Source/Destination lines so I can then download and place them into the right folders. I've tried creating an array for the string but that just bounces back with an error saying it can't be converted from a string to an object.
Like I said at the top of this post, I'm really new to this and have no idea what I'm actually doing which makes most of this a lot of CopyPasta from Google. Please do me a favour and ELI5 any help you can provide because I'll likely have no idea what you're talking about.