public static void testWrite(string src, string target)
        {
            // for writing is not necesary to register
            DummyClass c = new DummyClass();

            c.name = "Hernán";
            c.age  = 45;

            PngReader pngr = FileHelper.CreatePngReader(src);
            PngWriter pngw = FileHelper.CreatePngWriter(target, pngr.ImgInfo, true);

            pngw.CopyChunksFirst(pngr, ChunkCopyBehaviour.COPY_ALL_SAFE);
            PngChunkSERI mychunk = new PngChunkSERI(pngw.ImgInfo);

            mychunk.SetObj(c);
            mychunk.Priority = true; // if we want it to be written as soon as possible
            pngw.GetChunksList().Queue(mychunk);
            for (int row = 0; row < pngr.ImgInfo.Rows; row++)
            {
                ImageLine l1 = pngr.ReadRow(row);
                pngw.WriteRow(l1, row);
            }
            pngw.CopyChunksLast(pngr, ChunkCopyBehaviour.COPY_ALL);
            pngr.End();
            pngw.End();
            Console.Out.WriteLine("Done. Writen : " + target);
        }
        public static void testRead(String file)
        {
            // register with factory chunk
            PngChunk.FactoryRegister(PngChunkSERI.ID, typeof(PngChunkSERI));
            // read all file
            PngReader pngr = FileHelper.CreatePngReader(file);

            pngr.ReadSkippingAllRows();
            pngr.End();
            // we assume there can be at most one chunk of this type...
            PngChunk chunk = pngr.GetChunksList().GetById1(PngChunkSERI.ID); // This would work even if not registered, but then PngChunk would be of type PngChunkUNKNOWN

            Console.Out.WriteLine(chunk);
            // the following would fail if we had not register the chunk
            PngChunkSERI chunkprop = (PngChunkSERI)chunk;
            string       name      = chunkprop.GetObj().name;
            int          age       = chunkprop.GetObj().age;

            Console.Out.WriteLine("Done. Name: " + name + " age=" + age);
        }
        public static void testWrite(string src, string target)
        {
            // for writing is not necesary to register
            DummyClass c = new DummyClass();
            c.name = "Hernán";
            c.age = 45;

            PngReader pngr = FileHelper.CreatePngReader(src);
            PngWriter pngw = FileHelper.CreatePngWriter(target, pngr.ImgInfo, true);
            pngw.CopyChunksFirst(pngr, ChunkCopyBehaviour.COPY_ALL_SAFE);
            PngChunkSERI mychunk = new PngChunkSERI(pngw.ImgInfo);
            mychunk.SetObj(c);
            mychunk.Priority = true; // if we want it to be written as soon as possible
            pngw.GetChunksList().Queue(mychunk);
            for (int row = 0; row < pngr.ImgInfo.Rows; row++) {
                ImageLine l1 = pngr.ReadRow(row);
                pngw.WriteRow(l1, row);
            }
            pngw.CopyChunksLast(pngr, ChunkCopyBehaviour.COPY_ALL);
            pngr.End();
            pngw.End();
            Console.Out.WriteLine("Done. Writen : " + target);
        }
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkSERI otherx = (PngChunkSERI)other;

            this.obj = otherx.obj; // shallow clone, we could implement other copying
        }