/// <summary>
        /// Click on the link label into a reference panel
        /// </summary>
        void MainForm_Reference(object sender, EventArgs e)
        {
            AMF0Reference element = (AMF0Reference)((panelAMF3Reference)sender).Element;
            IAMFBase      result  = null;

            try
            {
                result = element.Parser.FindObjectReference(element.Reference);
            }
            catch (ArgumentOutOfRangeException error)
            {
                MessageBox.Show(error.Message, "Invalid reference #" + element.Reference, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (result != null)
            {
                TreeNode treenode_result = FindForm(this.treeView.Nodes, result);
                if (treenode_result != null)
                {
                    this.treeView.SelectedNode = treenode_result;
                }
            }
            else
            {
                Debug.WriteLine("Cannot find reference " + element.Reference + ".");
            }
        }
 /// <summary>
 ///
 /// </summary>
 private void AssignImage(TreeNode node, IAMFBase element)
 {
     if (imageList.Images.ContainsKey(element.Name))
     {
         node.ImageKey         = element.Name;
         node.SelectedImageKey = element.Name;
     }
     else
     {
         node.ImageKey         = "None";
         node.SelectedImageKey = "None";
     }
 }
        /// <summary>
        ///
        /// </summary>
        private void PopulateTree(TreeNode node, object p)
        {
            IAMFBase realObj = (IAMFBase)p;

            if (realObj.AmfType == AMFType.AMF0_ARRAY)
            {
                PopulateNode(node, (Dictionary <string, object>)((AMF0Array)p).Source);
            }
            else if (realObj.AmfType == AMFType.AMF3_ARRAYLIST)
            {
                PopulateNode(node, (ArrayList)((AMF3ArrayList)p).Source);
            }
            else if (realObj.AmfType == AMFType.AMF0_OBJECT || realObj.AmfType == AMFType.AMF3_OBJECT)
            {
                PopulateNode(node, (Dictionary <string, object>)((IAMFBase)p).Source);
            }
        }
        /// <summary>
        ///
        /// </summary>
        private void tab_Select(string imagekey, string p, IAMFBase element)
        {
            tabPage.Text     = element.Name;
            tabPage.ImageKey = imagekey;
            tabPage.Controls.Clear();
            UserControl panel = AddPropertyPanel(element);

            if (panel != null)
            {
                panel.Dock = DockStyle.Fill;
                tabPage.Controls.Add(panel);
                ((IAMFDisplayPanel)panel).Populate(p, element);
                if (panel is panelAMF3Reference)
                {
                    ((panelAMF3Reference)panel).Reference += new EventHandler <EventArgs>(MainForm_Reference);
                }
            }
        }
 public void Populate(string name, SOReader.Sol.AMF.DataType.IAMFBase item)
 {
     prop_name.Text = name;
     if (item.AmfType == AMFType.AMF3_REFERENCE)
     {
         linkLabel1.Text = "Object reference #" + ((AMF3Reference)item).Reference;
         linkLabel1.Tag = ((AMF3Reference)item).Reference;
         objectReference = ((AMF3Reference)item).Reference;
     }
     else if (item.AmfType == AMFType.AMF0_REFERENCE)
     {
         linkLabel1.Tag = ((AMF0Reference)item).Reference;
         linkLabel1.Text = "Object reference #" + ((AMF0Reference)item).Reference;
         objectReference = ((AMF0Reference)item).Reference;
     }
     else if (item.AmfType == AMFType.AMF0_LOST_REFERENCE)
     {
         linkLabel1.Enabled = false;
         linkLabel1.Text = "Invalid reference";
         linkLabel1.Tag = -1;
         objectReference = -1; 
     }
     element = item;
 }
 public void Populate(string name, SOReader.Sol.AMF.DataType.IAMFBase item)
 {
     prop_name.Text = name;
     if (item.AmfType == AMFType.AMF3_REFERENCE)
     {
         linkLabel1.Text = "Object reference #" + ((AMF3Reference)item).Reference;
         linkLabel1.Tag  = ((AMF3Reference)item).Reference;
         objectReference = ((AMF3Reference)item).Reference;
     }
     else if (item.AmfType == AMFType.AMF0_REFERENCE)
     {
         linkLabel1.Tag  = ((AMF0Reference)item).Reference;
         linkLabel1.Text = "Object reference #" + ((AMF0Reference)item).Reference;
         objectReference = ((AMF0Reference)item).Reference;
     }
     else if (item.AmfType == AMFType.AMF0_LOST_REFERENCE)
     {
         linkLabel1.Enabled = false;
         linkLabel1.Text    = "Invalid reference";
         linkLabel1.Tag     = -1;
         objectReference    = -1;
     }
     element = item;
 }
        /// <summary>
        ///
        /// </summary>
        private UserControl AddPropertyPanel(IAMFBase element)
        {
            UserControl panel = null;

            switch (element.AmfType)
            {
            case AMFType.AMF0_STRING:
                panel = new panelAMF0String();
                break;

            case AMFType.AMF0_BOOLEAN:
                panel = new panelAMF0Boolean();
                break;

            case AMFType.AMF0_CLASS:
                break;

            case AMFType.AMF0_DATE:
                panel = new panelAMF0Date();
                break;

            case AMFType.AMF0_NULL:
            case AMFType.AMF0_UNDEFINED:
                panel = new panelAMF0Null();
                break;

            case AMFType.AMF0_NUMBER:
                panel = new panelAMF0Number();
                break;

            case AMFType.AMF0_XML_STRING:
            case AMFType.AMF3_XML:
                panel = new panelAMF0Xml();
                break;

            case AMFType.AMF3_BYTEARRAY:
                panel = new panelAMF3ByteArray();
                break;

            case AMFType.AMF3_INT:
                panel = new panelAMF3Int();
                break;

            case AMFType.AMF3_REFERENCE:
            case AMFType.AMF0_REFERENCE:
            case AMFType.AMF0_LOST_REFERENCE:
                panel = new panelAMF3Reference();
                break;

            case AMFType.AMF3_OBJECT:
            case AMFType.AMF0_OBJECT:
            case AMFType.AMF0_ARRAY:
            case AMFType.AMF0_LIST:
            case AMFType.AMF3_ARRAYLIST:
            default:
                panel = new panelAMFDefault();
                Debug.WriteLine("Unknown: " + element.AmfType);
                break;
            }
            return(panel);
        }
        /// <summary>
        /// 
        /// </summary>
        private UserControl AddPropertyPanel(IAMFBase element)
        {
            UserControl panel = null;
            switch (element.AmfType)
            {
                case AMFType.AMF0_STRING:
                    panel = new panelAMF0String();
                    break;

                case AMFType.AMF0_BOOLEAN:
                    panel = new panelAMF0Boolean();
                    break;

                case AMFType.AMF0_CLASS:
                    break;

                case AMFType.AMF0_DATE:
                    panel = new panelAMF0Date();
                    break;

                case AMFType.AMF0_NULL:
                case AMFType.AMF0_UNDEFINED:
                    panel = new panelAMF0Null();
                    break;

                case AMFType.AMF0_NUMBER:
                    panel = new panelAMF0Number();
                    break;

                case AMFType.AMF0_XML_STRING:
                case AMFType.AMF3_XML:
                    panel = new panelAMF0Xml();
                    break;

                case AMFType.AMF3_BYTEARRAY:
                    panel = new panelAMF3ByteArray();
                    break;

                case AMFType.AMF3_INT:
                    panel = new panelAMF3Int();
                    break;

                case AMFType.AMF3_REFERENCE:
                case AMFType.AMF0_REFERENCE:
                case AMFType.AMF0_LOST_REFERENCE:
                    panel = new panelAMF3Reference();
                    break;

                case AMFType.AMF3_OBJECT:
                case AMFType.AMF0_OBJECT:
                case AMFType.AMF0_ARRAY:
                case AMFType.AMF0_LIST:
                case AMFType.AMF3_ARRAYLIST:
                default:
                    panel = new panelAMFDefault();
                    Debug.WriteLine("Unknown: " + element.AmfType);
                    break;
            }
            return panel;
        }
 /// <summary>
 /// 
 /// </summary>
 private void tab_Select(string imagekey, string p, IAMFBase element)
 {
     tabPage.Text = element.Name;
     tabPage.ImageKey = imagekey;
     tabPage.Controls.Clear();
     UserControl panel = AddPropertyPanel(element);
     if (panel != null)
     {
         panel.Dock = DockStyle.Fill;
         tabPage.Controls.Add(panel);
         ((IAMFDisplayPanel)panel).Populate(p, element);
         if (panel is panelAMF3Reference)
         {
             ((panelAMF3Reference)panel).Reference += new EventHandler<EventArgs>(MainForm_Reference);
         }
     }
 }
 /// <summary>
 /// 
 /// </summary>
 private void AssignImage(TreeNode node, IAMFBase element)
 {
     if (imageList.Images.ContainsKey(element.Name))
     {
         node.ImageKey = element.Name;
         node.SelectedImageKey = element.Name;
     }
     else
     {
         node.ImageKey = "None";
         node.SelectedImageKey = "None";
     }
 }