Exemplo n.º 1
0
 private void GetManifestInfoFromFile(IAppxFactory appxFactory, string manifestPath)
 {
     Console.WriteLine("Reading manifest info from: " + manifestPath);
     using (var stream = new StreamWrapper(File.OpenRead(manifestPath)))
     {
         IAppxManifestReader manifestReader;
         appxFactory.CreateManifestReader(stream, out manifestReader);
         GetManifestInfo(manifestReader);
     }
 }
Exemplo n.º 2
0
 private static void ExtractFile(string tempDir, IAppxFile appxFile)
 {
     var fileName = appxFile.GetName();
     var dest = Path.Combine(tempDir, fileName);
     Directory.CreateDirectory(Path.GetDirectoryName(dest));
     var fileStream = appxFile.GetStream();
     System.Runtime.InteropServices.ComTypes.STATSTG stats;
     fileStream.Stat(out stats, 0);
     using (var wrappedStream = new StreamWrapper(File.OpenWrite(dest)))
     {
         var read = Marshal.AllocHGlobal(sizeof(long));
         var written = Marshal.AllocHGlobal(sizeof(long));
         fileStream.CopyTo(wrappedStream, stats.cbSize, read, written);
         Debug.Assert(Marshal.ReadInt64(read) == Marshal.ReadInt64(written));
         Marshal.FreeHGlobal(read);
         Marshal.FreeHGlobal(written);
     }
 }
Exemplo n.º 3
0
 public void Clone(out IStream ppstm)
 {
     var clone = new StreamWrapper(this.stream);
     ppstm = clone;
 }