Пример #1
0
        public ImmagineFissa Retrieve(BinaryReader br)
        {
            // Immagine
            string nome = br.ReadString();

            // Modello
            Modello modello = Documento.getInstance().ModelloRiferimento;
            int     width   = br.ReadInt32();
            int     height  = br.ReadInt32();

            if (width != modello.Size.Width || height != modello.Size.Height)
            {
                return(null);
            }

            // Frame
            int nCol = br.ReadInt32();
            int len  = br.ReadInt32();

            byte[] frameAsArray = new byte[len];
            br.Read(frameAsArray, 0, len);

            // Informazione
            IPersister    infoPersister = PersisterFactory.GetPersister(br.ReadString());
            TypeAttribute attr          = (TypeAttribute)infoPersister.GetType().GetCustomAttribute(typeof(TypeAttribute));
            IInformazione infoAssociata = (IInformazione)infoPersister.Retrieve(br);

            // Out
            ImmagineFissa result = new ImmagineFissa(new Frame(frameAsArray, nCol, width * height), infoAssociata, nome);

            return(result);
        }
Пример #2
0
        public Animazione Retrieve(BinaryReader br)
        {
            // Animazione
            string     nome      = br.ReadString();
            uint       frameRate = br.ReadUInt32();
            Animazione result    = new Animazione(frameRate);

            result.Nome = nome;

            // Modello
            Modello modello = Documento.getInstance().ModelloRiferimento;
            int     width   = br.ReadInt32();
            int     height  = br.ReadInt32();

            if (width != modello.Size.Width || height != modello.Size.Height)
            {
                return(null);
            }

            // Frames
            byte[] frameAsArray;
            int    nFrames = br.ReadInt32();

            for (int i = 0; i < nFrames; i++)
            {
                int nCol = br.ReadInt32();
                int len  = br.ReadInt32();
                frameAsArray = new byte[len];
                br.Read(frameAsArray, 0, len);
                result.Frames.Add(new Frame(frameAsArray, nCol, width * height));
            }


            // Informazione
            IPersister    infoPersister = PersisterFactory.GetPersister(br.ReadString());
            IInformazione infoAssociata = (IInformazione)infoPersister.Retrieve(br);

            // Out
            result.InformazioneAssociata = infoAssociata;
            return(result);
        }
Пример #3
0
 public ImmagineFissa(Frame frame, IInformazione informazione) : this(frame, informazione, "")
 {
 }
Пример #4
0
 public ImmagineFissa(Frame frame, IInformazione informazione, string nome)
 {
     _frame = frame;
     InformazioneAssociata = informazione;
     Nome = nome;
 }