Skip to content

Commit e521632

Browse files
authored
Merge pull request #205 from mcrossley/main
v4.1.3 - b4028
2 parents de21df5 + 0846c46 commit e521632

13 files changed

+341
-108
lines changed

CumulusMX.sln

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio Version 17
43
VisualStudioVersion = 17.4.33205.214
@@ -13,13 +12,19 @@ EndProject
1312
Global
1413
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1514
Debug|Any CPU = Debug|Any CPU
15+
Debug|x86 = Debug|x86
1616
Release|Any CPU = Release|Any CPU
17+
Release|x86 = Release|x86
1718
EndGlobalSection
1819
GlobalSection(ProjectConfigurationPlatforms) = postSolution
1920
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2021
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Debug|x86.ActiveCfg = Debug|x86
23+
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Debug|x86.Build.0 = Debug|x86
2124
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
2225
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Release|x86.ActiveCfg = Release|x86
27+
{67A70E28-25C7-4C7F-BD7B-959AE6834B2C}.Release|x86.Build.0 = Release|x86
2328
EndGlobalSection
2429
GlobalSection(SolutionProperties) = preSolution
2530
HideSolutionNode = FALSE

CumulusMX/Cumulus.cs

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
using Swan;
4848

49-
using static System.Net.WebRequestMethods;
5049
using static CumulusMX.EmailSender;
5150

5251
using File = System.IO.File;
@@ -589,6 +588,8 @@ public void Initialise(int HTTPport, bool DebugEnabled, string startParms)
589588

590589
boolWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
591590

591+
LogMessage("Dotnet Version: " + RuntimeInformation.FrameworkDescription);
592+
592593
// Some .NET 8 clutures use a non-"standard" minus symbol, this causes all sorts of parsing issues down the line and for external scripts
593594
// the simplest solution is to override this and set all cultures to use the hypen-minus
594595
if (CultureInfo.CurrentCulture.NumberFormat.NegativeSign != "-")
@@ -3911,6 +3912,7 @@ private void ReadIniFile()
39113912
WllApiKey = ini.GetValue("WLL", "WLv2ApiKey", string.Empty);
39123913
WllApiSecret = ini.GetValue("WLL", "WLv2ApiSecret", string.Empty);
39133914
WllStationId = ini.GetValue("WLL", "WLStationId", -1, -1);
3915+
WllStationUuid = ini.GetValue("WLL", "WLStationUuid", "");
39143916
WllTriggerDataStoppedOnBroadcast = ini.GetValue("WLL", "DataStoppedOnBroadcast", true);
39153917
WLLAutoUpdateIpAddress = ini.GetValue("WLL", "AutoUpdateIpAddress", true);
39163918
WllBroadcastDuration = ini.GetValue("WLL", "BroadcastDuration", WllBroadcastDuration);
@@ -5608,6 +5610,7 @@ internal void WriteIniFile()
56085610
ini.SetValue("WLL", "WLv2ApiKey", Crypto.EncryptString(WllApiKey, Program.InstanceId, "WllApiKey"));
56095611
ini.SetValue("WLL", "WLv2ApiSecret", Crypto.EncryptString(WllApiSecret, Program.InstanceId, "WllApiSecret"));
56105612
ini.SetValue("WLL", "WLStationId", WllStationId);
5613+
ini.SetValue("WLL", "WLStationUuid", WllStationUuid);
56115614
ini.SetValue("WLL", "DataStoppedOnBroadcast", WllTriggerDataStoppedOnBroadcast);
56125615
ini.SetValue("WLL", "PrimaryRainTxId", WllPrimaryRain);
56135616
ini.SetValue("WLL", "PrimaryTempHumTxId", WllPrimaryTempHum);
@@ -7301,6 +7304,7 @@ public void WriteStringsFile()
73017304
internal string WllApiKey;
73027305
internal string WllApiSecret;
73037306
internal int WllStationId;
7307+
internal string WllStationUuid;
73047308
internal int WllParentId;
73057309
internal bool WllTriggerDataStoppedOnBroadcast; // trigger a data stopped state if broadcasts stop being received but current data is OK
73067310
/// <value>Read-only setting, default 20 minutes (1200 sec)</value>
@@ -11140,17 +11144,17 @@ private async Task<bool> UploadString(HttpClient httpclient, bool incremental, s
1114011144
if (FtpOptions.PhpCompression == "gzip")
1114111145
{
1114211146
using var zipped = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Compress, true);
11143-
await zipped.WriteAsync(byteData, 0, byteData.Length, cancellationToken);
11147+
await zipped.WriteAsync(byteData.AsMemory(0, byteData.Length), cancellationToken);
1114411148
}
1114511149
else if (FtpOptions.PhpCompression == "deflate")
1114611150
{
1114711151
using var zipped = new System.IO.Compression.DeflateStream(ms, System.IO.Compression.CompressionMode.Compress, true);
11148-
await zipped.WriteAsync(byteData, 0, byteData.Length, cancellationToken);
11152+
await zipped.WriteAsync(byteData.AsMemory(0, byteData.Length), cancellationToken);
1114911153
}
1115011154

1115111155
ms.Position = 0;
1115211156
byte[] compressed = new byte[ms.Length];
11153-
await ms.ReadAsync(compressed, 0, compressed.Length, cancellationToken);
11157+
await ms.ReadAsync(compressed.AsMemory(0, compressed.Length), cancellationToken);
1115411158

1115511159
outStream = new MemoryStream(compressed);
1115611160
streamContent = new StreamContent(outStream);
@@ -12498,7 +12502,6 @@ public void RealtimeFTPLogin()
1249812502
Credentials = new NetworkCredential(FtpOptions.Username, FtpOptions.Password),
1249912503
};
1250012504

12501-
RealtimeFTP.Config.SocketPollInterval = 20000; // increase beyond the timeout value
1250212505
RealtimeFTP.Config.LogPassword = false;
1250312506

1250412507
SetRealTimeFtpLogging(FtpOptions.Logging);
@@ -12908,50 +12911,80 @@ public async Task GetLatestVersion()
1290812911
var body = await retval.Content.ReadAsStringAsync();
1290912912
var releases = body.FromJson<List<GithubRelease>>();
1291012913

12911-
var latestBuild = releases.Find(x => !x.draft && x.prerelease == beta);
12914+
var latestBeta = releases.Find(x => !x.draft && x.prerelease);
1291212915
var latestLive = releases.Find(x => !x.draft && !x.prerelease);
1291312916
var cmxBuild = int.Parse(Build);
12914-
var veryLatest = Math.Max(int.Parse(latestBuild.tag_name[1..]), int.Parse(latestLive.tag_name[1..]));
12917+
int veryLatest;
12918+
if (latestBeta == null)
12919+
veryLatest = int.Parse(latestLive.tag_name[1..]);
12920+
else
12921+
veryLatest = Math.Max(int.Parse(latestBeta.tag_name[1..]), int.Parse(latestLive.tag_name[1..]));
1291512922

1291612923
if (string.IsNullOrEmpty(latestLive.name))
1291712924
{
1291812925
if (releases.Count == 0)
1291912926
{
1292012927
LogMessage("Failed to get the latest build version from GitHub");
1292112928
}
12929+
return;
1292212930
}
12923-
else if (string.IsNullOrEmpty(latestBuild.name))
12924-
{
12925-
LogMessage($"Failed to get the latest {(beta ? "beta" : "release")} build version from GitHub");
12926-
}
12927-
else if (beta && int.Parse(latestLive.tag_name[1..]) > cmxBuild)
12928-
{
12929-
var msg = $"You are running a beta version of Cumulus MX, and a later release build {latestLive.name} is available.";
12930-
LogConsoleMessage(msg, ConsoleColor.Cyan);
12931-
LogWarningMessage(msg);
12932-
UpgradeAlarm.LastMessage = $"Release build {latestLive.name} is available";
12933-
UpgradeAlarm.Triggered = true;
12934-
LatestBuild = latestLive.tag_name[1..];
12935-
}
12936-
else if (int.Parse(latestBuild.tag_name[1..]) > cmxBuild)
12931+
else if (latestBeta != null && string.IsNullOrEmpty(latestBeta.name))
1293712932
{
12938-
var msg = $"You are not running the latest {(beta ? "beta" : "release")} version of Cumulus MX, build {latestBuild.name} is available.";
12939-
LogConsoleMessage(msg, ConsoleColor.Cyan);
12940-
LogWarningMessage(msg);
12941-
UpgradeAlarm.LastMessage = $"{(beta ? "Beta" : "Release")} build {latestBuild.name} is available";
12942-
UpgradeAlarm.Triggered = true;
12943-
LatestBuild = latestBuild.tag_name[1..];
12933+
LogMessage("Failed to get the latest beta build version from GitHub");
12934+
return;
1294412935
}
12945-
else if (int.Parse(latestBuild.tag_name[1..]) == cmxBuild)
12936+
12937+
if (beta)
1294612938
{
12947-
LogMessage($"This Cumulus MX instance is running the latest {(beta ? "beta" : "release")} version");
12948-
UpgradeAlarm.Triggered = false;
12949-
LatestBuild = latestBuild.tag_name[1..];
12939+
if (int.Parse(latestLive.tag_name[1..]) > cmxBuild)
12940+
{
12941+
var msg = $"You are running a beta version of Cumulus MX, and a later release build {latestLive.name} is available.";
12942+
LogConsoleMessage(msg, ConsoleColor.Cyan);
12943+
LogWarningMessage(msg);
12944+
UpgradeAlarm.LastMessage = $"Release build {latestLive.name} is available";
12945+
UpgradeAlarm.Triggered = true;
12946+
LatestBuild = latestLive.tag_name[1..];
12947+
}
12948+
else if (latestBeta != null && int.Parse(latestBeta.tag_name[1..]) == cmxBuild)
12949+
{
12950+
LogMessage($"This Cumulus MX instance is running the latest beta version");
12951+
UpgradeAlarm.Triggered = false;
12952+
LatestBuild = latestLive.tag_name[1..];
12953+
}
12954+
else if (latestBeta != null && int.Parse(latestBeta.tag_name[1..]) > cmxBuild)
12955+
{
12956+
LogMessage($"This Cumulus MX beta instance is not running the latest beta version of Cumulsus MX, build {latestBeta.name} is available.");
12957+
UpgradeAlarm.Triggered = false;
12958+
LatestBuild = latestLive.tag_name[1..];
12959+
}
12960+
else
12961+
{
12962+
LogWarningMessage($"This Cumulus MX instance appears to be running a beta test version. This build={Build}, latest available build={veryLatest}");
12963+
LatestBuild = veryLatest.ToString();
12964+
}
1295012965
}
12951-
else if (int.Parse(latestBuild.tag_name[1..]) < cmxBuild)
12966+
else // Live release
1295212967
{
12953-
LogWarningMessage($"This Cumulus MX instance appears to be running a test version. This build={Build}, latest available build={veryLatest}");
12954-
LatestBuild = veryLatest.ToString();
12968+
if (int.Parse(latestLive.tag_name[1..]) > cmxBuild)
12969+
{
12970+
var msg = $"You are not running the latest version of Cumulus MX, build {latestLive.name} is available.";
12971+
LogConsoleMessage(msg, ConsoleColor.Cyan);
12972+
LogWarningMessage(msg);
12973+
UpgradeAlarm.LastMessage = $"Release build {latestLive.name} is available";
12974+
UpgradeAlarm.Triggered = true;
12975+
LatestBuild = latestBeta != null ? latestBeta.tag_name[1..] : latestLive.tag_name[1..];
12976+
}
12977+
else if (int.Parse(latestLive.tag_name[1..]) == cmxBuild)
12978+
{
12979+
LogMessage($"This Cumulus MX instance is running the latest release version");
12980+
UpgradeAlarm.Triggered = false;
12981+
LatestBuild = latestBeta != null ? latestBeta.tag_name[1..] : latestLive.tag_name[1..];
12982+
}
12983+
else
12984+
{
12985+
LogWarningMessage($"This Cumulus MX instance appears to be running a test version. This build={Build}, latest available build={veryLatest}");
12986+
LatestBuild = veryLatest.ToString();
12987+
}
1295512988
}
1295612989
}
1295712990
catch (Exception ex)

CumulusMX/CumulusMX.csproj

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<IsPublishable>False</IsPublishable>
1616
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
1717
<Nullable>annotations</Nullable>
18+
<Platforms>AnyCPU;x86</Platforms>
1819
</PropertyGroup>
1920

2021
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -25,6 +26,14 @@
2526
<WarningLevel>4</WarningLevel>
2627
</PropertyGroup>
2728

29+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
30+
<OutputPath />
31+
<DefineConstants>TRACE;DEBUG;USE_SQLITEPCL_RAW</DefineConstants>
32+
<NoWarn>1701;1702</NoWarn>
33+
<WarningsAsErrors>NU1605</WarningsAsErrors>
34+
<WarningLevel>4</WarningLevel>
35+
</PropertyGroup>
36+
2837
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
2938
<OutputPath></OutputPath>
3039
<DebugType>none</DebugType>
@@ -35,8 +44,18 @@
3544
<WarningLevel>4</WarningLevel>
3645
</PropertyGroup>
3746

47+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
48+
<OutputPath />
49+
<DebugType>none</DebugType>
50+
<DebugSymbols>false</DebugSymbols>
51+
<DefineConstants>TRACE;USE_SQLITEPCL_RAW</DefineConstants>
52+
<NoWarn>1701;1702</NoWarn>
53+
<WarningsAsErrors>NU1605</WarningsAsErrors>
54+
<WarningLevel>4</WarningLevel>
55+
</PropertyGroup>
56+
3857
<PropertyGroup>
39-
<Version>4.1.2.4027</Version>
58+
<Version>4.1.3.4028</Version>
4059
<Copyright>Copyright © 2015-$([System.DateTime]::Now.ToString('yyyy')) Cumulus MX</Copyright>
4160
</PropertyGroup>
4261

@@ -69,19 +88,19 @@
6988
<PackageReference Include="BouncyCastle.Cryptography" Version="2.4.0" />
7089
<PackageReference Include="FluentFTP.Logging" Version="1.0.0" />
7190
<PackageReference Include="Microsoft.Win32.SystemEvents" Version="8.0.0" />
72-
<PackageReference Include="NReco.Logging.File" Version="1.2.0" />
91+
<PackageReference Include="NReco.Logging.File" Version="1.2.1" />
7392
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
74-
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.8" />
93+
<PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.9" />
7594
<PackageReference Include="System.CodeDom" Version="8.0.0" />
7695
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
7796
<PackageReference Include="EmbedIO" Version="3.5.2" />
78-
<PackageReference Include="FluentFTP" Version="50.0.1" />
97+
<PackageReference Include="FluentFTP" Version="51.0.0" />
7998
<PackageReference Include="HidSharp" Version="2.1.0" />
80-
<PackageReference Include="MailKit" Version="4.6.0" />
99+
<PackageReference Include="MailKit" Version="4.7.1.1" />
81100
<PackageReference Include="MQTTnet" Version="4.3.6.1152" />
82101
<PackageReference Include="MySqlConnector" Version="2.3.7" />
83-
<PackageReference Include="ServiceStack.Text" Version="8.2.2" />
84-
<PackageReference Include="SSH.NET" Version="2024.0.0" />
102+
<PackageReference Include="ServiceStack.Text" Version="8.3.0" />
103+
<PackageReference Include="SSH.NET" Version="2024.1.0" />
85104
<PackageReference Include="System.IO.Ports" Version="8.0.0" />
86105
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
87106
</ItemGroup>

0 commit comments

Comments
 (0)