Ejemplo n.º 1
0
        public override void CloneDataFromRead(PngChunk other)
        {
            // THIS SHOULD NOT BE CALLED IF ALREADY CLONED WITH COPY CONSTRUCTOR
            PngChunkUNKNOWN c = (PngChunkUNKNOWN)other;

            data = c.data; // not deep copy
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known)
        /// </summary>
        /// <param name="cid">Chunk Id</param>
        /// <param name="info"></param>
        /// <returns></returns>
        internal static PngChunk FactoryFromId(String cid, ImageInfo info)
        {
            PngChunk chunk = null;

            if (factoryMap == null)
            {
                initFactory();
            }
            if (isKnown(cid))
            {
                Type t = factoryMap[cid];
                if (t == null)
                {
                    Console.Error.WriteLine("What?? " + cid);
                }
                System.Reflection.ConstructorInfo cons = t.GetConstructor(new Type[] { typeof(ImageInfo) });
                object o = cons.Invoke(new object[] { info });
                chunk = (PngChunk)o;
            }
            if (chunk == null)
            {
                chunk = new PngChunkUNKNOWN(cid, info);
            }

            return(chunk);
        }
Ejemplo n.º 3
0
        /// <summary> Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known) </summary>
        /// <param name="cid">Chunk Id</param>
        internal static PngChunk FactoryFromId(string cid, ImageInfo info)
        {
            PngChunk chunk = null;

            if (IsKnown(cid))
            {
                System.Type t = factoryMap[cid];
                if (t == null)
                {
                    UnityEngine.Debug.Log($"What?? {cid}");
                }
                System.Reflection.ConstructorInfo cons = t.GetConstructor(new System.Type[] { typeof(ImageInfo) });
                object o = cons.Invoke(new object[] { info });
                chunk = (PngChunk)o;
            }
            if (chunk == null)
            {
                chunk = new PngChunkUNKNOWN(cid, info);
            }

            return(chunk);
        }
Ejemplo n.º 4
0
 private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info)
     : base(c.Id, info)
 {
     System.Array.Copy(c.data, 0, data, 0, c.data.Length);
 }