private void importToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { try { Bitmap chunk = (Bitmap)Image.FromFile(dialog.FileName); if (treeView1.SelectedNode != null) { if (treeView1.SelectedNode.Tag != null) { ShapeChunk data = (ShapeChunk)treeView1.SelectedNode.Tag; data.Replace(chunk); m_vStorageObject.AddChange(m_vStorageObject.GetTextures()[data.GetTextureId()]); Render(); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
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; }
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; }