Ejemplo n.º 1
0
        /* @SuppressWarnings("unchecked")*/
        public static T CloneChunk <T> (T chunk, ImageInfo info) where T : PngChunk
        {
            PngChunk cn = FactoryFromId(chunk.Id, info);

            if (cn.GetType() != chunk.GetType())
            {
                throw new System.Exception($"bad class cloning chunk: {cn.GetType()} {chunk.GetType()}");
            }
            cn.CloneDataFromRead(chunk);
            return((T)cn);
        }
Ejemplo n.º 2
0
        /* @SuppressWarnings("unchecked")*/
        public static T CloneChunk <T>(T chunk, ImageInfo info) where T : PngChunk
        {
            PngChunk cn = FactoryFromId(chunk.Id, info);

            if ((Object)cn.GetType() != (Object)chunk.GetType())
            {
                throw new PngjException("bad class cloning chunk: " + cn.GetType() + " "
                                        + chunk.GetType());
            }
            cn.CloneDataFromRead(chunk);
            return((T)cn);
        }