Inheritance: BundleBase
Ejemplo n.º 1
0
        public void GeneratesCorrectChecksumForApp()
        {
            var bundle = new AppBundle();
            bundle.Load(ResourceManager.GetAppBundle(), new ZipImplementation());

            Assert.AreEqual(bundle.Manifest.Application.CRC, Crc32.Calculate(bundle.App));
        }
Ejemplo n.º 2
0
        public void CanLoadInformationFromAppBundle()
        {
            Stream testBundle = ResourceManager.GetAppBundle();
            var bundle = new AppBundle();
            bundle.Load(testBundle, new ZipImplementation());
            
            var manifest = bundle.Manifest;
            Assert.IsNotNull(manifest);
            Assert.AreEqual(new DateTime(2013, 4, 13, 18, 3, 16), manifest.GeneratedAtDateTime);
            Assert.AreEqual("frontier", manifest.GeneratedBy);
            Assert.AreEqual(1, manifest.ManifestVersion);
            Assert.AreEqual("application", manifest.Type);
            Assert.IsTrue(manifest.Resources.Size > 0);
            Assert.IsTrue(bundle.HasResources);

            Assert.AreEqual(1, bundle.AppMetadata.AppMajorVersion);
            Assert.AreEqual(0, bundle.AppMetadata.AppMinorVersion);
            Assert.AreEqual("Shades", bundle.AppMetadata.AppName);
            Assert.AreEqual("1.0", bundle.AppMetadata.AppVersion);
            Assert.AreEqual("Barometz", bundle.AppMetadata.CompanyName);
            Assert.AreEqual((uint)1515157755, bundle.AppMetadata.CRC);
            Assert.AreEqual((uint)1, bundle.AppMetadata.Flags);
            Assert.AreEqual("PBLAPP", bundle.AppMetadata.Header);
            Assert.AreEqual((uint)0, bundle.AppMetadata.IconResourceID);
            Assert.AreEqual((uint)552, bundle.AppMetadata.Offset);
            Assert.AreEqual((uint)2, bundle.AppMetadata.RelocationListItemCount);
            Assert.AreEqual((uint)3860, bundle.AppMetadata.RelocationListStart);
            Assert.AreEqual(3, bundle.AppMetadata.SDKMajorVersion);
            Assert.AreEqual(1, bundle.AppMetadata.SDKMinorVersion);
            Assert.AreEqual("3.1", bundle.AppMetadata.SDKVersion);
            Assert.AreEqual(3860, bundle.AppMetadata.Size);
            Assert.AreEqual(8, bundle.AppMetadata.StructMajorVersion);
            Assert.AreEqual(1, bundle.AppMetadata.StructMinorVersion);
            Assert.AreEqual("8.1", bundle.AppMetadata.StructVersion);
            Assert.AreEqual((uint)2796, bundle.AppMetadata.SymbolTableAddress);
            Assert.AreEqual("ae9984f3-0404-409b-8a17-d50478c02d3e", bundle.AppMetadata.UUID.ToString());
        }
Ejemplo n.º 3
0
        private async void OnInstallApp()
        {
            var openDialog = new OpenFileDialog
            {
                CheckFileExists = true,
                CheckPathExists = true,
                DefaultExt = "*.pbw",
                Filter = "Pebble Apps|*.pbw|All Files|*",
                RestoreDirectory = true,
                Title = "Pebble App"
            };
            if ( openDialog.ShowDialog() == true )
            {
                var bundle = new AppBundle();
                using (var zip = new Zip.Zip())
                {
                    bundle.Load(openDialog.OpenFile(), zip);
                }

                if ( _pebble.IsAlive == false )
                    return;
                await _pebble.InstallAppAsync( bundle );
                await LoadAppsAsync();
            }
        }