/////////////////////////////////////////////////////////////////////////// private void LoadImageResources(BinaryReverseReader reader) { Debug.WriteLine("LoadImageResources started at " + reader.BaseStream.Position.ToString()); m_imageResources.Clear(); uint imgResLength = reader.ReadUInt32(); if (imgResLength <= 0) return; long startPosition = reader.BaseStream.Position; while ((reader.BaseStream.Position - startPosition) < imgResLength) { ImageResource imgRes = new ImageResource(reader); ResourceIDs resID = (ResourceIDs)imgRes.ID; switch (resID) { case ResourceIDs.ResolutionInfo: imgRes = new ResolutionInfo(imgRes); break; case ResourceIDs.Thumbnail1: case ResourceIDs.Thumbnail2: imgRes = new Thumbnail(imgRes); break; case ResourceIDs.AlphaChannelNames: imgRes = new AlphaChannels(imgRes); break; } m_imageResources.Add(imgRes); } //----------------------------------------------------------------------- // make shure we are not on a wrong offset, so set the stream position // manually reader.BaseStream.Position = startPosition + imgResLength; }
public ImageResource(ImageResource imgRes) { m_id = imgRes.m_id; m_name = imgRes.m_name; m_data = new byte[imgRes.m_data.Length]; imgRes.m_data.CopyTo(m_data, 0); }
// This method implements the test condition for // finding the ResolutionInfo. private static bool IsResolutionInfo(ImageResource res) { return res.ID == (int)ResourceIDs.ResolutionInfo; }