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 }
/// <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); }
/// <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); }
private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info) : base(c.Id, info) { System.Array.Copy(c.data, 0, data, 0, c.data.Length); }