Пример #1
0
 public override void ParseFromRaw(ChunkRaw c)
 {
     XmlSerializer serializerObj = new XmlSerializer(typeof(DummyClass));
     obj = (DummyClass)serializerObj.Deserialize(new MemoryStream(c.Data));
 }
Пример #2
0
 public void SetObj(DummyClass o)
 {
     this.obj = o;
 }
Пример #3
0
 public PngChunkSERI(ImageInfo info)
     : base(ID, info)
 {
     obj = new DummyClass();
 }
Пример #4
0
 public override void CloneDataFromRead(PngChunk other)
 {
     PngChunkSERI otherx = (PngChunkSERI)other;
     this.obj = otherx.obj; // shallow clone, we could implement other copying
 }
Пример #5
0
        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);
        }
Пример #6
0
 public PngChunkSERI(ImageInfo info)
     : base(ID, info)
 {
     obj = new DummyClass();
 }
Пример #7
0
 public void SetObj(DummyClass o)
 {
     this.obj = o;
 }
Пример #8
0
        public override void CloneDataFromRead(PngChunk other)
        {
            PngChunkSERI otherx = (PngChunkSERI)other;

            this.obj = otherx.obj; // shallow clone, we could implement other copying
        }
Пример #9
0
        public override void ParseFromRaw(ChunkRaw c)
        {
            XmlSerializer serializerObj = new XmlSerializer(typeof(DummyClass));

            obj = (DummyClass)serializerObj.Deserialize(new MemoryStream(c.Data));
        }