Created
April 8, 2018 09:07
-
-
Save dmaidon/c81b805b251f44795e2870a6cc936e38 to your computer and use it in GitHub Desktop.
VB.Net code for reading clientraw.txt file and displaying to RichTextBox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.IO | |
Imports System.Text | |
Imports CrReader.Forms | |
Imports Microsoft.VisualBasic.FileIO | |
Namespace Modules.RichTextBoxes | |
Public Module Rtb1 | |
Friend Sub PopulateRtb1(fn As String) | |
''178 records | |
''used following page to verify field values | |
''http://indiantrailweather.com/wxclientrawparser.php | |
If File.Exists(fn) Then | |
FrmMain.RtbLog.AppendText($"Loading Rtb1: {fn}{vbCrLf}") | |
Else | |
FrmMain.RtbLog.AppendText($"File does not exist: {fn}{vbCrLf}") | |
FrmMain.rtb1.AppendText($"{fn}{vbCrLf}File does not exist.") | |
Exit Sub | |
End If | |
Try | |
FrmMain.txtRaw.BackColor = Color.NavajoWhite | |
FrmMain.txtRaw.Text = File.ReadAllText(fn) | |
Catch ex As Exception | |
FrmMain.RtbLog.AppendText(String.Format(My.Resources.ERR_Error_String, ex.Message, vbCrLf, ex.TargetSite.ToString, ex.StackTrace.ToString)) | |
Finally | |
'' | |
End Try | |
Dim aa As Object = FrmMain.rtb1 | |
Try | |
Using csvreader As New TextFieldParser(fn) | |
csvreader.TextFieldType = FieldType.Delimited | |
csvreader.Delimiters = New String() {" ", " "} | |
Dim curRow() As String | |
Dim bb As String | |
While Not csvreader.EndOfData | |
Try | |
curRow = csvreader.ReadFields().ToArray | |
aa.Clear() | |
aa.SelectionColor = Color.Red | |
aa.AppendText($"[000] Header: {curRow(0)} [ClientRaw] Records: {curRow.Length - 1}{vbCrLf}") | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[001] Avg Wind Speed: Kts: {curRow(1)} (Mph: {ConvertK2Mph(curRow(1))}) (Kmh: {ConvertK2Kmh(curRow(1))}){vbCrLf}") | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[002] Current Wind Spd: Kts: {curRow(2)} (Mph: {ConvertK2Mph(curRow(2))}) (Kmh: {ConvertK2Kmh(curRow(2))}){vbCrLf}") | |
aa.SelectionColor = Color.Green | |
aa.AppendText($"[003] Current Wind Direction: {curRow(3)}° ({GetWindDirection(curRow(3))}){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[004] Current Temp: {curRow(4)}°C ({ConvertC2F(curRow(4))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[005] Current Relative Humidity (Outside): {curRow(5)}%{vbCrLf}") | |
aa.SelectionColor = Color.DarkRed | |
aa.AppendText($"[006] Current Baro Pressure: {curRow(6)} hPa ({ConvertHpa2Inhg(curRow(6))} inHg){vbCrLf}") | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[007] Rain Today: {curRow(7)} mm ({Convertmm2In(curRow(7))}{Chr(34)}){vbCrLf}") | |
FrmRecords.tDailyRain.Text = $"{curRow(7)} mm ({Convertmm2In(curRow(7))}{Chr(34)})" | |
FrmRecords.tTotalRain.Text = $"{curRow(7)} mm ({Convertmm2In(curRow(7))}{Chr(34)})" | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[008] Monthly Rain: {curRow(8)} mm ({Convertmm2In(curRow(8))}{Chr(34)}){vbCrLf}") | |
FrmRecords.moTotalRain.Text = $"{curRow(8)} mm ({Convertmm2In(curRow(8))}{Chr(34)})" | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[009] Yearly Rain: {curRow(9)} mm ({Convertmm2In(curRow(9))}{Chr(34)}){vbCrLf}") | |
FrmRecords.yrTotalRain.Text = $"{curRow(9)} mm ({Convertmm2In(curRow(9))}{Chr(34)})" | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[010] Rain Rate/Hour: {curRow(10)} mm ({Convertmm2In(curRow(10))}{Chr(34)}){vbCrLf}") | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[011] Rain Rate/Hour (Maximum): {curRow(11)} mm ({Convertmm2In(curRow(11))}{Chr(34)}){vbCrLf}") | |
FrmRecords.tHourlyRain.Text = $"{curRow(11)} mm ({Convertmm2In(curRow(11))}{Chr(34)})" | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[012] Temp (Indoor): {curRow(12)}°C ({ConvertC2F(curRow(12))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[013] Relative Humidity (Indoor): {curRow(13)}%{vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[014] Soil Temp: {curRow(14)}°C ({ConvertC2F(curRow(14))}°F){vbCrLf}") | |
FrmRecords.tHighSoil.Text = $"{curRow(14)}°C ({ConvertC2F(curRow(14))}°F)" | |
FrmRecords.rTtip.SetToolTip(FrmRecords.tHighSoil, "Current") | |
aa.SelectionColor = Color.Black | |
Dim ii As Object | |
Select Case Iconz | |
Case 1 | |
ii = GetForecastIcon_1(curRow(15)) | |
Case 2 | |
ii = GetForecastIcon_2(curRow(15)) | |
Case Else | |
ii = GetForecastIcon_3(curRow(15)) | |
End Select | |
aa.AppendText($"[015] Forecast Icon: {curRow(15)} ({ii}){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[016] WMR968 Extra Temp: {curRow(16)}°C ({ConvertC2F(curRow(16))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[017] WMR968 Extra Humidity: {curRow(17)}%{vbCrLf}") | |
aa.SelectionColor = Color.Navy | |
aa.AppendText($"[018] WMR968 Extra Sensor: {curRow(18)}{vbCrLf}") | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[019] Rain Yesterday: {curRow(19)} mm ({Convertmm2In(curRow(19))}{Chr(34)}){vbCrLf}") | |
FrmRecords.yDailyRain.Text = $"{curRow(19)} mm ({Convertmm2In(curRow(19))}{Chr(34)})" | |
FrmRecords.yTotalRain.Text = $"{curRow(19)} mm ({Convertmm2In(curRow(19))}{Chr(34)})" | |
''extra Temp sensors | |
For j = 20 To 25 | |
bb = If((curRow(j) = "-100.0") Or (curRow(j) = "255.0"), "- Unused -", $"{curRow(j)}°C ({ConvertC2F(curRow(20))}°F)") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[{j.ToString("00#")}] Extra Temp Sensor {j - 19}: {bb}{vbCrLf}") | |
Next | |
''Extra humidity sensors | |
For j = 26 To 28 | |
bb = If((curRow(j) = "-100"), "- Unused -", $"{curRow(j)}%") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[{j.ToString("00#")}] Extra Humidity Sensor {j - 25}: {bb} {vbCrLf}") | |
Application.DoEvents() | |
Next | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[029] Hour: {curRow(29)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[030] Minutes: {curRow(30)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[031] Seconds: {curRow(31)}{vbCrLf}") | |
''set station name - Row 32 Ex: CarolinaWx-2:51:55_PM | |
Dim ct As Integer = InStr(curRow(32), "-") | |
Dim cl As Integer = curRow(32).Length | |
Dim station As String = Left(curRow(32), ct - 1) | |
station = station.Replace("_", " ") | |
If station.Trim = String.Empty Or station.Trim.ToLower = "last.updated" Then | |
station = My.Resources.unknown_station | |
End If | |
'If station.Trim.ToLower = "last.updated" Then | |
' station = My.Resources.unknown_station | |
'End If | |
FrmMain.lblStation.Text = CompactString(station, FrmMain.lblStation.Width, FrmMain.lblStation.Font, TextFormatFlags.WordEllipsis) | |
Dim ftime As String = Right(curRow(32), cl - ct) | |
FrmMain.lblFileTime.Text = ftime.Replace("_", " ") | |
''handle non US date formats. If it throws an error, just print the string | |
Try | |
Dim fDate As Date = curRow(74).ToString | |
FrmMain.lblFileDate.Text = fDate.ToString("D") | |
Catch ex As InvalidCastException | |
FrmMain.lblFileDate.Text = curRow(74).ToString | |
Catch ex As Exception | |
FrmMain.lblFileDate.Text = curRow(74).ToString | |
Finally | |
'' | |
End Try | |
aa.SelectionColor = Color.Black | |
bb = curRow(32).Replace("_", " ").Replace("-", " @ ") | |
aa.AppendText($"[032] Station: {bb}{vbCrLf}") | |
''end station name | |
aa.appendtext($"[033] Dallas Lightning Count: {curRow(33)}{vbCrLf}") | |
aa.appendtext($"[034] Solar Reading: {curRow(34)}{vbCrLf}") | |
aa.appendtext($"[035] Day: {curRow(35)}{vbCrLf}") | |
aa.appendtext($"[036] Month: {curRow(36)}{vbCrLf}") | |
For j = 37 To 43 | |
aa.SelectionColor = Color.Chocolate | |
aa.appendtext($"[{j.ToString("00#")}] WMR968 Battery {j - 36}: {curRow(j)}%{vbCrLf}") | |
Application.DoEvents() | |
Next | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[044] Windchill: {curRow(44)}°C ({ConvertC2F(curRow(44))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[045] Humidex: {curRow(45)}°C ({ConvertC2F(curRow(45))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[046] Maximum Day Temp: {curRow(46)}°C ({ConvertC2F(curRow(46))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[047] Minimum Day Temp: {curRow(47)}°C ({ConvertC2F(curRow(47))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
Dim ik As Object | |
Select Case Iconz | |
Case 1 | |
ik = GetForecastIcon_1(curRow(48)) | |
Case 2 | |
ik = GetForecastIcon_2(curRow(48)) | |
Case Else | |
ik = GetForecastIcon_3(curRow(48)) | |
End Select | |
aa.AppendText($"[048] Icon Type: {curRow(48)} ({ik}){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[049] Wx Description: {curRow(49).Replace("_", " ").Replace("/", ", ")}{vbCrLf}") | |
aa.SelectionColor = Color.DarkRed | |
aa.AppendText($"[050] BaroBarometer Trend: {curRow(50)} hPa ({ConvertHpa2Inhg(curRow(50))} inHg){vbCrLf}") | |
For j = 51 To 70 | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[{j.ToString("00#")}] Windspd (Hr: {(j - 50).ToString("0#")}): Kts: {curRow(j)} (Mph: {ConvertK2Mph(curRow(j))}) (Kmh: { _ | |
ConvertK2Kmh(curRow(j))}){vbCrLf}") | |
Next | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[071] Max gust today: Kts: {curRow(71)} (Mph: {ConvertK2Mph(curRow(71))}) (Kmh: {ConvertK2Kmh(curRow(71))}){vbCrLf}") | |
aa.SelectionColor = Color.Green | |
aa.AppendText($"[072] Current DewPoint: {curRow(72)}°C ({ConvertC2F(curRow(72))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Orange | |
aa.AppendText($"[073] Cloud Base: {curRow(73)} Meters ({ConvertM2F(curRow(73))} Feet){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[074] Date: {curRow(74)}{vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[075] Max Humidex: {curRow(75)}°C ({ConvertC2F(curRow(75))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[076] Min Humidex: {curRow(76)}°C ({ConvertC2F(curRow(76))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[077] Max Windchill: {curRow(77)}°C ({ConvertC2F(curRow(77))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[078] Min Windchill: {curRow(78)}°C ({ConvertC2F(curRow(78))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Navy | |
aa.AppendText($"[079] Davis VP UV: {CDbl(curRow(79)).ToString("0.0")}{vbCrLf}") | |
FrmRecords.tUV.Text = $"{CDbl(curRow(79)).ToString("0.0")}" | |
FrmRecords.rTtip.SetToolTip(FrmRecords.tUV, "Current") | |
Dim es As String | |
For j = 80 To 89 | |
Select Case j | |
Case 89 | |
es = "6 min ago" | |
Case 88 | |
es = "12 min ago" | |
Case 87 | |
es = "18 min ago" | |
Case 86 | |
es = "24 min ago" | |
Case 85 | |
es = "30 min ago" | |
Case 84 | |
es = "36 min ago" | |
Case 83 | |
es = "42 min ago" | |
Case 82 | |
es = "48 min ago" | |
Case 81 | |
es = "54 min ago" | |
Case Else | |
es = "60 min ago" | |
End Select | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[{j.ToString("00#")}] Windspd ({es}): {curRow(j)} (Mph: {ConvertK2Mph(curRow(j))}) (Kmh: {ConvertK2Kmh(curRow(j))}){vbCrLf}") | |
Application.DoEvents() | |
Next | |
For j = 90 To 99 | |
Select Case j - 10 | |
Case 89 | |
es = "6 min ago" | |
Case 88 | |
es = "12 min ago" | |
Case 87 | |
es = "18 min ago" | |
Case 86 | |
es = "24 min ago" | |
Case 85 | |
es = "30 min ago" | |
Case 84 | |
es = "36 min ago" | |
Case 83 | |
es = "42 min ago" | |
Case 82 | |
es = "48 min ago" | |
Case 81 | |
es = "54 min ago" | |
Case Else | |
es = "60 min ago" | |
End Select | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[{j.ToString("00#")}] Temp ({es}): {curRow(j)}°C ({ConvertC2F(curRow(j))}°F){vbCrLf}") | |
Application.DoEvents() | |
Next | |
For j = 100 To 109 | |
Select Case j - 20 | |
Case 89 | |
es = "6 min ago" | |
Case 88 | |
es = "12 min ago" | |
Case 87 | |
es = "18 min ago" | |
Case 86 | |
es = "24 min ago" | |
Case 85 | |
es = "30 min ago" | |
Case 84 | |
es = "36 min ago" | |
Case 83 | |
es = "42 min ago" | |
Case 82 | |
es = "48 min ago" | |
Case 81 | |
es = "54 min ago" | |
Case Else | |
es = "60 min ago" | |
End Select | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[{j.ToString("00#")}] Rain ({es}): {curRow(j)} mm ({Convertmm2In(curRow(j))}{Chr(34)}){vbCrLf}") | |
Application.DoEvents() | |
Next | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[110] Max Heat Index: {curRow(110)}°C ({ConvertC2F(curRow(110))}°F){vbCrLf}") | |
aa.SelectionColor = Color.MediumPurple | |
aa.AppendText($"[111] Min Heat Index: {curRow(111)}°C ({ConvertC2F(curRow(111))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[112] Heat Index: {curRow(112)}°C ({ConvertC2F(curRow(112))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[113] Max Avg Spd: Kts: {curRow(113)} (Mph: {ConvertK2Mph(curRow(113))}) (Kmh: {ConvertK2Kmh(curRow(113))}){vbCrLf}") | |
aa.SelectionColor = Color.Navy | |
aa.AppendText($"[114] # Lightning Strikes Last Minute: {curRow(114)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[115] Last Lightning Strike (Time): {curRow(115)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[116] Last Lightning Strike (Date): {curRow(116)}{vbCrLf}") | |
aa.SelectionColor = Color.Green | |
aa.AppendText($"[117] Average Wind Direction: {curRow(117)}° ({GetWindDirection(curRow(117))}){vbCrLf}") | |
FrmRecords.tWindDir.Text = $"{curRow(117)}° ({GetWindDirection(curRow(117))})" | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[118] Nexstorm Distance: {curRow(118)} Km ({ConvertKm2Mph(curRow(118))} Mi){vbCrLf}") | |
aa.SelectionColor = Color.Green | |
aa.AppendText($"[119] Nexstorm Direction: {curRow(119)}° ({GetWindDirection(curRow(119))}){vbCrLf}") | |
For j = 120 To 121 | |
Select Case curRow(j) | |
Case "-100.0" | |
bb = "- Unused -" | |
Case Else | |
bb = $"{curRow(j)}%" | |
End Select | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[{j.ToString("00#")}] Extra Temp Sensor {(j - 113).ToString("#")}: {bb}{vbCrLf}") | |
Application.DoEvents() | |
Next | |
For j = 122 To 126 | |
bb = If((curRow(j) = "-100") Or (curRow(j) = "0"), "- Unused -", $"{curRow(j)}%") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[{j.ToString("00#")}] Extra Humidity Sensor {j - 118}: {bb}{vbCrLf}") | |
Application.DoEvents() | |
Next | |
aa.SelectionColor = Color.Navy | |
aa.AppendText($"[127] VP Solar Radiation: {curRow(127)}{vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[128] Max Indoor Temp: {curRow(128)}°C ({ConvertC2F(curRow(128))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[129] Min Indoor Temp: {curRow(129)}°C ({ConvertC2F(curRow(129))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[130] Apparent Temp: {curRow(130)}°C ({ConvertC2F(curRow(130))}°F){vbCrLf}") | |
aa.SelectionColor = Color.DarkRed | |
aa.AppendText($"[131] Maximum Barometer: {curRow(131)} hPa ({ConvertHpa2Inhg(curRow(131))} inHg){vbCrLf}") | |
aa.SelectionColor = Color.DarkRed | |
aa.AppendText($"[132] Minimum Barometer: {curRow(132)} hPa ({ConvertHpa2Inhg(curRow(132))} inHg){vbCrLf}") | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[133] Max Gust Last Hr: {curRow(133)} (Mph: {ConvertK2Mph(curRow(133))}) (Kmh: {ConvertK2Kmh(curRow(133))}){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[134] Max Gust Last Hr Time: {curRow(134).Replace("A", " A").Replace("P", " P")}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[135] Max Gust Today Time: {curRow(135).Replace("_", " ")}{vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[136] Max Apparent Temp: {curRow(136)}°C ({ConvertC2F(curRow(136))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[137] Min Apparent Temp: {curRow(137)}°C ({ConvertC2F(curRow(137))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[138] Max Dewpoint: {curRow(138)}°C ({ConvertC2F(curRow(138))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[139] Min Dewpoint: {curRow(139)}°C ({ConvertC2F(curRow(139))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[140] Max Gust in Last Minute: {curRow(140)} (Mph: {ConvertK2Mph(curRow(140))}) (Kmh: {ConvertK2Kmh(curRow(140))}){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[141] Current Year: {curRow(141)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[142] THSWS: {curRow(142)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[143] Temp Trend: {GetTrend(curRow(143))}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[144] Humidity Trend: {GetTrend(curRow(144))}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[145] Humidex Trend: {GetTrend(curRow(145))}{vbCrLf}") | |
For j = 146 To 155 | |
Select Case j - 66 | |
Case 89 | |
es = "6 min ago" | |
Case 88 | |
es = "12 min ago" | |
Case 87 | |
es = "18 min ago" | |
Case 86 | |
es = "24 min ago" | |
Case 85 | |
es = "30 min ago" | |
Case 84 | |
es = "36 min ago" | |
Case 83 | |
es = "42 min ago" | |
Case 82 | |
es = "48 min ago" | |
Case 81 | |
es = "54 min ago" | |
Case Else | |
es = "60 min ago" | |
End Select | |
aa.SelectionColor = Color.Green | |
aa.AppendText($"[{j.ToString("00#")}] Wind Dir {es}: {curRow(j)}° ({GetWindDirection(curRow(j))}){vbCrLf}") | |
Application.DoEvents() | |
Next | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[156] Leaf Wetness: {curRow(156)}°C ({ConvertC2F(curRow(156))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[157] Soil Moisture: {curRow(157)}°C ({ConvertC2F(curRow(157))}°F){vbCrLf}") | |
aa.SelectionColor = Color.Blue | |
aa.AppendText($"[158] 10 Min Avg Wind Spd: {curRow(158)} (Mph: {ConvertK2Mph(curRow(158))}) (Kmh: {ConvertK2Kmh(curRow(158))}){vbCrLf}") | |
aa.SelectionColor = Color.Purple | |
aa.AppendText($"[159] Wet Bulb Temp: {curRow(159)}°C ({ConvertC2F(curRow(159))}°F){vbCrLf}") | |
Latitude = curRow(160) | |
Longitude = curRow(161) | |
''get hyphen variables from registry | |
Latitude = If(Kss.GetValue("Latitude Hyphen", 0) = 1, $"-{Latitude}", Latitude.Replace("-", String.Empty)) | |
Longitude = If(Kss.GetValue("Longitude Hyphen", 0) = 1, $"-{Longitude}", Longitude.Replace("-", String.Empty)) | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[160] Station Latitude: {Latitude}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[161] Station Longitude: {Longitude}{vbCrLf}") | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[162] 9am Rain Reset total: {curRow(162)} mm ({Convertmm2In(curRow(162))}{Chr(34)}){vbCrLf}") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[163] Daily High Humidity: {curRow(163)}%{vbCrLf}") | |
aa.SelectionColor = Color.Chocolate | |
aa.AppendText($"[164] Daily Low Humidity: {curRow(164)}%{vbCrLf}") | |
aa.SelectionColor = Color.Teal | |
aa.AppendText($"[165] Midnight Rain Reset total: {curRow(165)} mm ({Convertmm2In(curRow(165))}{Chr(34)}){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[166] Low Windchill Time: {curRow(166).Replace("_", " ")}{vbCrLf}") | |
For j = 167 To 172 | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[{j.ToString("00#")}] Current Cost Watts Channel {(j - 166).ToString("0#")}: {curRow(j)}{vbCrLf}") | |
Application.DoEvents() | |
Next | |
aa.SelectionColor = Color.Blue | |
aa.appendtext($"[173] Daily Wind Run: {curRow(173)} Kilometers (Miles: {ConvertKm2Mph(curRow(173))}){vbCrLf}") | |
Try | |
If InStr(curRow(174), "!") Then | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[174] WD Ver: {Mid(curRow(174), 4, 6)} rev: {Mid(curRow(174), 10, 3).Replace("!", String.Empty)}{vbCrLf}") | |
Else | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[174] Temp Max Day Time: {curRow(174).Replace("_", " ")}{vbCrLf}") | |
End If | |
Catch ex As FormatException | |
If InStr(curRow(174), "!") Then | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[174] WD Ver: {Mid(curRow(174), 4, 6)} rev: {Mid(curRow(174), 10, 3).Replace("!", String.Empty)}{vbCrLf}") | |
Else | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[174] Miscellaneous: {curRow(174).Replace("_", " ")}{vbCrLf}") | |
End If | |
Catch ex As Exception | |
If InStr(curRow(174), "!") Then | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[174] WD Ver: {Mid(curRow(174), 4, 6)} rev: {Mid(curRow(174), 10, 3).Replace("!", String.Empty)}{vbCrLf}") | |
Else | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[174] Extra: {curRow(174)}{vbCrLf}") | |
End If | |
Finally | |
'' | |
End Try | |
Try | |
If curRow(175).Trim = String.Empty Then | |
Exit Sub | |
End If | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[175] Temp Min Day Time: {curRow(175).Replace("_", " ")}{vbCrLf}") | |
Catch ex As FormatException | |
If InStr(curRow(175), "!") Then | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[175] WD Ver: {Mid(curRow(175), 4, 6)} rev: {Mid(curRow(175), 10, 3).Replace("!", String.Empty)}{vbCrLf}") | |
Else | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[175] Miscellaneous: {curRow(175).Replace("_", " ")}{vbCrLf}") | |
End If | |
Catch ex As Exception | |
If InStr(curRow(175), "!") Then | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[175] WD Ver: {Mid(curRow(175), 4, 6)} rev: {Mid(curRow(175), 10, 3).Replace("!", String.Empty)}{vbCrLf}") | |
Else | |
aa.SelectionColor = Color.Black | |
aa.AppendText($"[175] Extra: {curRow(175)}{vbCrLf}") | |
End If | |
Finally | |
'' | |
End Try | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[176] Avg Wind Dir (10 Min): {curRow(176)}° ({GetWindDirection(curRow(176))}){vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[177] File Type: {Mid(curRow(177), 3, 1)}{vbCrLf}") | |
aa.SelectionColor = Color.Black | |
aa.appendtext($"[177] WD Ver: {Mid(curRow(177), 4, 6)} rev: {Mid(curRow(177), 10, 3).Replace("!", String.Empty)}") | |
FrmMain.TsslVersion.Text = $"WD Ver: {Mid(curRow(177), 4, 6)} rev: {Mid(curRow(177), 10, 3).Replace("!", String.Empty)}{Space(5)}" | |
''set current conditions | |
Dim sb = New StringBuilder | |
sb.Append($"Current conditions for {station}{vbCrLf}") | |
sb.Append($"{ii} and {ConvertC2F(curRow(4))}°F, Winds {GetWindDirection(curRow(3))} at {ConvertK2Mph(curRow(1))} Mph.") | |
FrmMain.ttip.SetToolTip(FrmMain.pbIcon, sb.ToString) | |
Catch ex As MalformedLineException | |
FrmMain.RtbLog.AppendText(String.Format(My.Resources.ERR_Error_String, ex.Message, vbCrLf, ex.TargetSite.ToString, ex.StackTrace.ToString)) | |
FrmMain.RtbLog.AppendText(String.Format(My.Resources.ERR_Error_String, ex.Message, vbCrLf, ex.TargetSite.ToString, ex.StackTrace.ToString)) | |
Catch ex As Exception | |
FrmMain.RtbLog.AppendText(String.Format(My.Resources.ERR_Error_String, ex.Message, vbCrLf, ex.TargetSite.ToString, ex.StackTrace.ToString)) | |
Finally | |
'' | |
End Try | |
End While | |
End Using | |
Catch ex As IndexOutOfRangeException | |
FrmMain.RtbLog.AppendText(String.Format(My.Resources.ERR_Error_String, ex.Message, vbCrLf, ex.TargetSite.ToString, ex.StackTrace.ToString)) | |
Catch ex As Exception | |
FrmMain.RtbLog.AppendText(String.Format(My.Resources.ERR_Error_String, ex.Message, vbCrLf, ex.TargetSite.ToString, ex.StackTrace.ToString)) | |
Finally | |
'' | |
End Try | |
FrmMain.RtbLog.AppendText($"Loaded Rtb1: {fn}{vbCrLf}") | |
SetStationMap() | |
End Sub | |
End Module | |
End Namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment