コード例 #1
0
 public void Open(Stream stream)
 {
     using (BinaryReader br = new BinaryReader(stream))
     {
         iconDirectory.Populate(br);
         iconImages = new ICONIMAGE[iconDirectory.EntryCount];
         // Loop through and read in each image
         for (int i = 0; i < iconImages.Length; i++)
         {
             // Seek to the location in the file that has the image
             //  SetFilePointer( hFile, pIconDir->idEntries[i].dwImageOffset, NULL, FILE_BEGIN );
             br.BaseStream.Seek(iconDirectory.Entries[i].ImageOffset, SeekOrigin.Begin);
             // Read the image data
             //  ReadFile( hFile, pIconImage, pIconDir->idEntries[i].dwBytesInRes, &dwBytesRead, NULL );
             // Here, pIconImage is an ICONIMAGE structure. Party on it :)
             iconImages[i] = new ICONIMAGE();
             iconImages[i].Populate(br);
         }
     }
 }
コード例 #2
0
ファイル: IconHolder.cs プロジェクト: gr0ss/RegistryMonitor
 public void Open(Stream stream)
 {
     using (BinaryReader br = new BinaryReader(stream))
     {
         iconDirectory.Populate(br);
         iconImages = new ICONIMAGE[iconDirectory.EntryCount];
         // Loop through and read in each image
         for(int i=0; i < iconImages.Length; i++)
         {
             // Seek to the location in the file that has the image
             //  SetFilePointer( hFile, pIconDir->idEntries[i].dwImageOffset, NULL, FILE_BEGIN );
             br.BaseStream.Seek(iconDirectory.Entries[i].ImageOffset, SeekOrigin.Begin);
             // Read the image data
             //  ReadFile( hFile, pIconImage, pIconDir->idEntries[i].dwBytesInRes, &dwBytesRead, NULL );
             // Here, pIconImage is an ICONIMAGE structure. Party on it :)
             iconImages[i] = new ICONIMAGE();
             iconImages[i].Populate(br);
         }
     }
 }