Update to NET Framework 4.7.2 and cleanup warnings

This commit is contained in:
Ryan Wagoner 2021-12-15 19:58:04 -05:00
parent e7613741d3
commit b5298a1e74
8 changed files with 58 additions and 62 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup> </startup>
</configuration> </configuration>

View file

@ -26,23 +26,21 @@ namespace OmniLinkBridge.Notifications
}; };
mail.To.Add(address); mail.To.Add(address);
using (SmtpClient smtp = new SmtpClient(Global.mail_server, Global.mail_port)) using SmtpClient smtp = new SmtpClient(Global.mail_server, Global.mail_port);
smtp.EnableSsl = Global.mail_tls;
if (!string.IsNullOrEmpty(Global.mail_username))
{ {
smtp.EnableSsl = Global.mail_tls; smtp.UseDefaultCredentials = false;
if (!string.IsNullOrEmpty(Global.mail_username)) smtp.Credentials = new NetworkCredential(Global.mail_username, Global.mail_password);
{ }
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential(Global.mail_username, Global.mail_password);
}
try try
{ {
smtp.Send(mail); smtp.Send(mail);
} }
catch (Exception ex) catch (Exception ex)
{ {
log.Error(ex, "An error occurred sending email notification"); log.Error(ex, "An error occurred sending email notification");
}
} }
} }
} }

View file

@ -25,12 +25,10 @@ namespace OmniLinkBridge.Notifications
"description=" + description "description=" + description
}; };
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; client.UploadStringAsync(URI, string.Join("&", parameters.ToArray()));
client.UploadStringAsync(URI, string.Join("&", parameters.ToArray())); client.UploadStringCompleted += Client_UploadStringCompleted;
client.UploadStringCompleted += Client_UploadStringCompleted;
}
} }
} }

View file

@ -24,11 +24,9 @@ namespace OmniLinkBridge.Notifications
{ "message", description } { "message", description }
}; };
using (WebClient client = new WebClient()) using WebClient client = new WebClient();
{ client.UploadValues(URI, parameters);
client.UploadValues(URI, parameters); client.UploadStringCompleted += Client_UploadStringCompleted;
client.UploadStringCompleted += Client_UploadStringCompleted;
}
} }
} }

View file

@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OmniLinkBridge</RootNamespace> <RootNamespace>OmniLinkBridge</RootNamespace>
<AssemblyName>OmniLinkBridge</AssemblyName> <AssemblyName>OmniLinkBridge</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
@ -174,7 +174,7 @@
<Version>4.5.0</Version> <Version>4.5.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="MQTTnet.Extensions.ManagedClient"> <PackageReference Include="MQTTnet.Extensions.ManagedClient">
<Version>3.0.17</Version> <Version>3.1.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version> <Version>13.0.1</Version>
@ -189,7 +189,7 @@
<Version>1.5.0</Version> <Version>1.5.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Serilog.Sinks.Console"> <PackageReference Include="Serilog.Sinks.Console">
<Version>4.0.0</Version> <Version>4.0.1</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Serilog.Sinks.File"> <PackageReference Include="Serilog.Sinks.File">
<Version>5.0.0</Version> <Version>5.0.0</Version>

View file

@ -13,14 +13,15 @@ namespace OmniLinkBridge.WebAPI
public static AreaContract ToContract(this clsArea area) public static AreaContract ToContract(this clsArea area)
{ {
AreaContract ret = new AreaContract(); AreaContract ret = new AreaContract
{
ret.id = (ushort)area.Number; id = (ushort)area.Number,
ret.name = area.Name; name = area.Name,
ret.burglary = area.AreaBurglaryAlarmText; burglary = area.AreaBurglaryAlarmText,
ret.co = area.AreaGasAlarmText; co = area.AreaGasAlarmText,
ret.fire = area.AreaFireAlarmText; fire = area.AreaFireAlarmText,
ret.water = area.AreaWaterAlarmText; water = area.AreaWaterAlarmText
};
if (area.ExitTimer > 0) if (area.ExitTimer > 0)
{ {
@ -37,12 +38,13 @@ namespace OmniLinkBridge.WebAPI
public static ZoneContract ToContract(this clsZone zone) public static ZoneContract ToContract(this clsZone zone)
{ {
ZoneContract ret = new ZoneContract(); ZoneContract ret = new ZoneContract
{
ret.id = (ushort)zone.Number; id = (ushort)zone.Number,
ret.zonetype = zone.ZoneType; zonetype = zone.ZoneType,
ret.name = zone.Name; name = zone.Name,
ret.status = zone.StatusText(); status = zone.StatusText()
};
if (zone.IsTemperatureZone()) if (zone.IsTemperatureZone())
ret.temp = zone.TempText(); ret.temp = zone.TempText();
@ -54,10 +56,11 @@ namespace OmniLinkBridge.WebAPI
public static UnitContract ToContract(this clsUnit unit) public static UnitContract ToContract(this clsUnit unit)
{ {
UnitContract ret = new UnitContract(); UnitContract ret = new UnitContract
{
ret.id = (ushort)unit.Number; id = (ushort)unit.Number,
ret.name = unit.Name; name = unit.Name
};
if (unit.Status > 100) if (unit.Status > 100)
ret.level = (ushort)(unit.Status - 100); ret.level = (ushort)(unit.Status - 100);
@ -71,17 +74,16 @@ namespace OmniLinkBridge.WebAPI
public static ThermostatContract ToContract(this clsThermostat unit) public static ThermostatContract ToContract(this clsThermostat unit)
{ {
ThermostatContract ret = new ThermostatContract(); ThermostatContract ret = new ThermostatContract
{
id = (ushort)unit.Number,
name = unit.Name
};
ret.id = (ushort)unit.Number; ushort.TryParse(unit.TempText(), out ushort temp);
ret.name = unit.Name; ushort.TryParse(unit.HeatSetpointText(), out ushort heat);
ushort.TryParse(unit.CoolSetpointText(), out ushort cool);
ushort temp, heat, cool, humidity; ushort.TryParse(unit.HumidityText(), out ushort humidity);
ushort.TryParse(unit.TempText(), out temp);
ushort.TryParse(unit.HeatSetpointText(), out heat);
ushort.TryParse(unit.CoolSetpointText(), out cool);
ushort.TryParse(unit.HumidityText(), out humidity);
ret.temp = temp; ret.temp = temp;
ret.humidity = humidity; ret.humidity = humidity;

View file

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OmniLinkBridgeTest</RootNamespace> <RootNamespace>OmniLinkBridgeTest</RootNamespace>
<AssemblyName>OmniLinkBridgeTest</AssemblyName> <AssemblyName>OmniLinkBridgeTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion> <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
@ -59,10 +59,10 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MSTest.TestAdapter"> <PackageReference Include="MSTest.TestAdapter">
<Version>2.2.7</Version> <Version>2.2.8</Version>
</PackageReference> </PackageReference>
<PackageReference Include="MSTest.TestFramework"> <PackageReference Include="MSTest.TestFramework">
<Version>2.2.7</Version> <Version>2.2.8</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -6,7 +6,7 @@ You can use docker to build an image from git or download the [binary here](http
## Requirements ## Requirements
- [Docker](https://www.docker.com/) - [Docker](https://www.docker.com/)
- .NET Framework 4.5.2 (or Mono equivalent) - .NET Framework 4.7.2 (or Mono equivalent)
## Operation ## Operation
OmniLink Bridge is divided into the following modules and configurable settings. Configuration settings can also be set as environment variables by using their name in uppercase. Refer to [OmniLinkBridge.ini](https://github.com/excaliburpartners/OmniLinkBridge/blob/master/OmniLinkBridge/OmniLinkBridge.ini) for specifics. OmniLink Bridge is divided into the following modules and configurable settings. Configuration settings can also be set as environment variables by using their name in uppercase. Refer to [OmniLinkBridge.ini](https://github.com/excaliburpartners/OmniLinkBridge/blob/master/OmniLinkBridge/OmniLinkBridge.ini) for specifics.