コード例 #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
        }
コード例 #2
0
ファイル: PngChunk.cs プロジェクト: ondrejmyska/pngcs
        /// <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);
        }
コード例 #3
0
ファイル: PngChunk.cs プロジェクト: evi1m3/BarCode.Xnet
        /// <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)
                {
                    System.Diagnostics.Debug.WriteLine("What?? " + cid);
                }
                System.Reflection.ConstructorInfo cons = t.GetTypeInfo().DeclaredConstructors.Single(
                    c =>
                {
                    var p = c.GetParameters();
                    return(p.Length == 1 && p[0].ParameterType == typeof(ImageInfo));
                });
                object o = cons.Invoke(new object[] { info });
                chunk = (PngChunk)o;
            }
            if (chunk == null)
            {
                chunk = new PngChunkUNKNOWN(cid, info);
            }

            return(chunk);
        }
コード例 #4
0
ファイル: AbstractPngChunk.cs プロジェクト: Chapmania/Juniper
        /// <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 AbstractPngChunk FactoryFromId(string cid, ImageInfo info)
        {
            AbstractPngChunk chunk = null;

            if (factoryMap is null)
            {
                _ = InitFactory();
            }

            if (IsKnown(cid))
            {
                var t = factoryMap[cid];
                if (t is null)
                {
                    Console.Error.WriteLine("What?? " + cid);
                }

                var cons = t.GetConstructor(new Type[] { typeof(ImageInfo) });
                var o    = cons.Invoke(new object[] { info });
                chunk = (AbstractPngChunk)o;
            }

            if (chunk is null)
            {
                chunk = new PngChunkUNKNOWN(cid, info);
            }

            return(chunk);
        }
コード例 #5
0
ファイル: PngChunkUNKNOWN.cs プロジェクト: Chapmania/Juniper
        private static byte[] CloneData(PngChunkUNKNOWN other)
        {
            if (other is null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            return(other.data);
        }
コード例 #6
0
ファイル: PngChunk.cs プロジェクト: NASA-AMMOS/pngcs
        /// <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))
            {
                chunk = factoryMap[cid](info);
            }
            if (chunk == null)
            {
                Console.WriteLine("unknown chunk " + cid);
                chunk = new PngChunkUNKNOWN(cid, info);
            }

            return(chunk);
        }
コード例 #7
0
ファイル: PngChunk.cs プロジェクト: 1144822034/sc2.2mobile
        internal static PngChunk FactoryFromId(string cid, ImageInfo info)
        {
            PngChunk pngChunk = null;

            if (factoryMap == null)
            {
                initFactory();
            }
            if (isKnown(cid))
            {
                pngChunk = (PngChunk)factoryMap[cid].GetTypeInfo().DeclaredConstructors.First().Invoke(new object[1]
                {
                    info
                });
            }
            if (pngChunk == null)
            {
                pngChunk = new PngChunkUNKNOWN(cid, info);
            }
            return(pngChunk);
        }
コード例 #8
0
 private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info)
     : base(c.Id, info)
 {
     System.Array.Copy(c.data, 0, data, 0, c.data.Length);
 }
コード例 #9
0
ファイル: PngChunkUNKNOWN.cs プロジェクト: git-thinh/limada
 private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info)
     : base(c.Id, info)
 {
     System.Array.Copy(c.data, 0, data, 0, c.data.Length);
 }
コード例 #10
0
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkUNKNOWN pngChunkUNKNOWN = (PngChunkUNKNOWN)other;

            data = pngChunkUNKNOWN.data;
        }
コード例 #11
0
 public PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info)
     : base(c.Id, info)
 {
     Array.Copy(c.data, 0, data, 0, c.data.Length);
 }