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"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
</startup>
</configuration>

View file

@ -26,8 +26,7 @@ namespace OmniLinkBridge.Notifications
};
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))
{
@ -46,5 +45,4 @@ namespace OmniLinkBridge.Notifications
}
}
}
}
}

View file

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

View file

@ -24,13 +24,11 @@ namespace OmniLinkBridge.Notifications
{ "message", description }
};
using (WebClient client = new WebClient())
{
using WebClient client = new WebClient();
client.UploadValues(URI, parameters);
client.UploadStringCompleted += Client_UploadStringCompleted;
}
}
}
private void Client_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
{

View file

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

View file

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

View file

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OmniLinkBridgeTest</RootNamespace>
<AssemblyName>OmniLinkBridgeTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
@ -59,10 +59,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter">
<Version>2.2.7</Version>
<Version>2.2.8</Version>
</PackageReference>
<PackageReference Include="MSTest.TestFramework">
<Version>2.2.7</Version>
<Version>2.2.8</Version>
</PackageReference>
</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
- [Docker](https://www.docker.com/)
- .NET Framework 4.5.2 (or Mono equivalent)
- .NET Framework 4.7.2 (or Mono equivalent)
## 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.