public void CopyTo(MemoryMap dest)
 {
     CopyHelper.CopyTo(this, dest);
 }
        public List<MemoryMap> LoadFromFile(string filePath)
        {

            List<MemoryMap> maps = new List<MemoryMap>();
            m_execRegionOrderMap.Clear();

            using (XmlReader reader = XmlReader.Create(filePath))
            {
                try
                {
                    XPathDocument doc = new XPathDocument(reader);
                    XPathNavigator nav = doc.CreateNavigator();

                    XPathNodeIterator lrs = nav.SelectDescendants("LoadRegion", ScatterfileNamespace, false);
                    while (lrs.MoveNext())
                    {
                        int order = 0;

                        string lrName = lrs.Current.GetAttribute("Name", "");

                        XPathNodeIterator ers = nav.SelectDescendants("ExecRegion", ScatterfileNamespace, false);

                        while (ers.MoveNext())
                        {
                            string erName = ers.Current.GetAttribute("Name", "");

                            m_execRegionOrderMap[lrName + ":" + erName] = order++;
                        }
                    }
                }
                catch
                {
                    System.Diagnostics.Debug.WriteLine("Invalid scatterfile format");
                }
            }

            using (XmlReader reader = XmlReader.Create(filePath))
            {
                try
                {
                    XmlSerializer xmlSer = new XmlSerializer(typeof(ScatterFile));
                    ScatterFile scatter = xmlSer.Deserialize(reader) as ScatterFile;

                    MemoryMap map = new MemoryMap();
                    map.Name = "MAP";
                    maps.Add(map);

                    LoadScatterElements(map, scatter, maps, new ArrayList());
                }
                catch
                {
                    System.Diagnostics.Debug.WriteLine("Invalid scatterfile format");
                }
            }
            return maps;
        }
        private void addMemoryMapToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode tn = treeViewInventory.SelectedNode;
            TreeNodeData tnd = treeViewInventory.SelectedNode.Tag as TreeNodeData;

            if (tnd != null)
            {
                MemoryMap ms = new MemoryMap();
                ms.Name = "<New Memory Map>";
                (tnd.Data as List<MemoryMap>).Add(ms);
                TreeNode child = AddTreeElement(tn, ms.Name, ms, true, tnd.Data, tnd.FilePath);
                child.EnsureVisible();
                treeViewInventory.SelectedNode = child;
                child.BeginEdit();
            }
        }