示例#1
0
 internal SIContentE32Image(SymbianImageE32 aImage, string aName, uint aSize, long aImageContentOffset)
     :  base(aImage)
 {
     iName     = aName;
     iFileSize = aSize;
     iFileSize = aSize;
 }
        public override SIImage CreateImage(ITracer aTracer, Stream aStream, string aName)
        {
            SIImage ret = null;
            //
            bool isSupported = SymbianImageE32.IsImageFile(aStream);

            if (isSupported)
            {
                ret = new SymbianImageE32(aName, (uint)aStream.Length, aStream.Position, new SIStream(aStream), aTracer);
            }
            //
            return(ret);
        }
示例#3
0
        public static SIContent New(SIROFS aImage, string aName, uint aSize, long aPosition, TCheckedUid aUids)
        {
            SIContent ret = null;
            //
            bool isImage = SymbianImageE32.IsImageFile((Stream)aImage.Stream, aPosition);

            if (!isImage)
            {
                // We create either a code file (binary) or data file depending on the type of file at the specified location.
                ret = new SIContentROFSData(aImage, aName, aSize, aPosition, aUids);
            }
            else
            {
                ret = new SIContentROFSCode(aImage, aName, aSize, aPosition);
            }
            //
            return(ret);
        }
        internal SIContentROFSCode(SIROFS aImage, string aName, uint aSize, long aPosition)
            : base(aImage)
        {
            // We need to give the E32Image access to the underlying ROFS image stream, but we don't
            // want to transfer ownership - ownership remains entirely with the SymbianImageROFS object.
            SIStream e32ImageStream = new SIStream((Stream)ImageStream, SIStream.TOwnershipType.EOwnedExternally);

            try
            {
                iE32Image = new SymbianImageE32(aName, aSize, aPosition, e32ImageStream, aImage);
                if (iE32Image.Count == 0)
                {
                    throw new Exception("Invalid E32Image file");
                }
            }
            catch (Exception e)
            {
                e32ImageStream.Close();
                throw e;
            }
        }