未验证 提交 80d67e01 编写于 作者: L Laurent Ellerbach 提交者: GitHub

adjusting to add missing resources (#1838)

上级 55110789
......@@ -42,6 +42,9 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="../devices/CharacterLcd/BigFontMap.txt" />
<EmbeddedResource Include="../devices/BuildHat/data/firmware.bin" />
<EmbeddedResource Include="../devices/BuildHat/data/signature.bin"/>
<EmbeddedResource Include="../devices/BuildHat/data/version" />
</ItemGroup>
<!-- This target will call into each device binding project to get out the source files for the framework we are building
and then it will add the results to the Compile item group. -->
......
......@@ -10,6 +10,7 @@ using System.Globalization;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using BuildHat.Models;
......@@ -806,8 +807,27 @@ namespace Iot.Device.BuildHat
prompt = PortReadExisting();
// Load both files
byte[] firmware = Resource.firmware;
byte[] signature = Resource.signature;
var assembly = Assembly.GetExecutingAssembly();
string firmwareName = assembly.GetManifestResourceNames().Single(str => str.EndsWith("firmware.bin"));
string signatureName = assembly.GetManifestResourceNames().Single(str => str.EndsWith("signature.bin"));
// Similar to: byte[] firmware = Resource.firmware;
// But need to be more generic because of the way the building dll is built
byte[] firmware;
using (Stream stream = assembly.GetManifestResourceStream(firmwareName)!)
{
firmware = new byte[stream.Length];
stream.Read(firmware, 0, firmware.Length);
}
// Similar to: byte[] signature = Resource.signature;
// But need to be more generic because of the way the building dll is built
byte[] signature;
using (Stream stream = assembly.GetManifestResourceStream(signatureName)!)
{
signature = new byte[stream.Length];
stream.Read(signature, 0, signature.Length);
}
// Step 1: clear and get the prompt
PortWrite("clear\r");
prompt = PortReadLine();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册