protected void RunGeneratesCorrectChecksumForFirmware() { var bundle = new FirmwareBundle(); bundle.Load(ResourceManager.GetFirmwareBundle(), GetZip()); Assert.AreEqual(bundle.Manifest.Firmware.CRC, Crc32.Calculate(bundle.Firmware)); }
protected void RunCanLoadInformationFromFirmwareBundle() { Stream testBundle = ResourceManager.GetFirmwareBundle(); var bundle = new FirmwareBundle(); bundle.Load( testBundle, GetZip() ); Assert.IsNotNull( bundle.Firmware ); Assert.IsNotNull( bundle.Manifest ); Assert.IsNotNull( bundle.Manifest.Firmware ); Assert.AreEqual( "tintin_fw.bin", bundle.Manifest.Firmware.Filename ); Assert.AreEqual( new DateTime( 2014, 5, 6, 6, 32, 23 ), bundle.Manifest.Firmware.TimestampDT ); Assert.AreEqual( 2824806042, bundle.Manifest.Firmware.CRC ); Assert.AreEqual( "v1_5", bundle.Manifest.Firmware.HardwareRevision ); Assert.AreEqual( "normal", bundle.Manifest.Firmware.Type ); Assert.AreEqual( 434731, bundle.Manifest.Firmware.Size ); Assert.IsTrue( bundle.HasResources ); Assert.IsNotNull( bundle.Resources ); }
private async void OnUpdateFirmware() { var openDialog = new OpenFileDialog { CheckFileExists = true, CheckPathExists = true, DefaultExt = "*.pbz", Filter = "Pebble Firmware|*.pbz|All Files|*", RestoreDirectory = true, Title = "Pebble Firmware" }; if (openDialog.ShowDialog() == true) { var bundle = new FirmwareBundle(); using (var zip = new Zip()) { bundle.Load(openDialog.OpenFile(), zip); } if (_pebble.IsAlive == false) return; await _pebble.InstallFirmwareAsync(bundle); } }