Exemplo n.º 1
0
        public MovieClip(MovieClip mv)
        {
            m_vStorageObject = mv.GetStorageObject();
            m_vDataType      = mv.GetMovieClipDataType();
            m_vShapes        = new List <ScObject>();

            this.SetOffset(-Math.Abs(mv.GetOffset()));

            //Duplicate MovieClip
            using (FileStream input = new FileStream(m_vStorageObject.GetFileName(), FileMode.Open))
            {
                input.Seek(Math.Abs(mv.GetOffset()) + 5, SeekOrigin.Begin);
                using (var br = new BinaryReader(input))
                {
                    this.ParseData(br);
                }
            }

            //Set new clip id
            short maxMovieClipId = this.GetId();

            foreach (MovieClip clip in m_vStorageObject.GetMovieClips())
            {
                if (clip.GetId() > maxMovieClipId)
                {
                    maxMovieClipId = clip.GetId();
                }
            }
            maxMovieClipId++;
            this.SetId(maxMovieClipId);

            //Get max shape id
            short maxShapeId = 20000;//avoid collision with other objects in MovieClips

            foreach (Shape shape in m_vStorageObject.GetShapes())
            {
                if (shape.GetId() > maxShapeId)
                {
                    maxShapeId = shape.GetId();
                }
            }
            maxShapeId++;

            //Duplicate shapes associated to clip
            List <ScObject> newShapes = new List <ScObject>();

            foreach (Shape s in m_vShapes)
            {
                Shape newShape = new Shape(s);
                newShape.SetId(maxShapeId);
                maxShapeId++;
                newShapes.Add(newShape);
                m_vStorageObject.AddShape(newShape);//Add to global shapelist
                m_vStorageObject.AddChange(newShape);
            }
            this.m_vShapes = newShapes;
        }
Exemplo n.º 2
0
        public MovieClip(MovieClip mv)
        {
            m_vStorageObject = mv.GetStorageObject();
            m_vDataType = mv.GetMovieClipDataType();
            m_vShapes = new List<ScObject>();

            this.SetOffset(-Math.Abs(mv.GetOffset()));
            
            //Duplicate MovieClip
            using (FileStream input = new FileStream(m_vStorageObject.GetFileName(), FileMode.Open))
            {
                input.Seek(Math.Abs(mv.GetOffset()) + 5, SeekOrigin.Begin);
                using (var br = new BinaryReader(input))
                {
                    this.ParseData(br);
                }
            }

            //Set new clip id
            short maxMovieClipId = this.GetId();
            foreach(MovieClip clip in m_vStorageObject.GetMovieClips())
            {
                if (clip.GetId() > maxMovieClipId)
                    maxMovieClipId = clip.GetId();
            }
            maxMovieClipId++;
            this.SetId(maxMovieClipId);

            //Get max shape id
            short maxShapeId = 20000;//avoid collision with other objects in MovieClips
            foreach(Shape shape in m_vStorageObject.GetShapes())
            {
                if (shape.GetId() > maxShapeId)
                    maxShapeId = shape.GetId();
            }
            maxShapeId++;

            //Duplicate shapes associated to clip
            List<ScObject> newShapes = new List<ScObject>();
            foreach(Shape s in m_vShapes)
            {
                Shape newShape = new Shape(s);
                newShape.SetId(maxShapeId);
                maxShapeId++;
                newShapes.Add(newShape);
                m_vStorageObject.AddShape(newShape);//Add to global shapelist
                m_vStorageObject.AddChange(newShape);
            }
            this.m_vShapes = newShapes;
        }