コード例 #1
0
 private void btnAbrir_Click(object sender, EventArgs e)
 {
     try
     {
         openFile.ShowDialog();
         string RutaCompleta = openFile.FileName;
         if (RutaCompleta.Length > 0)
         {
             string[]   NombreFile = RutaCompleta.Split('\\');
             Ensamblado Ass        = new Ensamblado(RutaCompleta);
             lblAssembly.Text += " " + Ass.NombreArchivo.Trim();
             cEnsamblados.Add(Ass);
             LlenoTree(Ass);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
コード例 #2
0
        private void LlenoTree(Ensamblado Ensamb)
        {
            //Nodo principal
            TreeNode tnPadre;

            tnPadre = treeElementos.Nodes.Add(Ensamb.NombreArchivo);
            foreach (Type t in Ensamb.Tipos)
            {
                try
                {
                    //Nodo derivado, uno por cada clase

                    TreeNode tn;
                    tn = tnPadre.Nodes.Add(t.FullName);
                    //obtengo los constructores
                    ConstructorInfo[] ctrInfo = t.GetConstructors();
                    TreeNode          tn2;
                    tn2 = tn.Nodes.Add("Constructores");
                    //foreach (ConstructorInfo c in ctrInfo)
                    {
                        string[] NombreConstructor = t.FullName.Split('.');
                        tn2.Nodes.Add(NombreConstructor[NombreConstructor.Length - 1]);
                    }
                    //obtengo las propiedades
                    try
                    {
                        PropertyInfo[] pInfo = t.GetProperties();
                        tn2 = tn.Nodes.Add("Propiedades");

                        foreach (PropertyInfo p in pInfo)
                        {
                            tn2.Nodes.Add(p.ToString());
                        }
                    }
                    catch (Exception e)
                    {
                        tn2 = tn.Nodes.Add("Propiedades");
                        tn2.Nodes.Add(e.ToString());
                    }
                    //Obtengo los Metodos
                    try
                    {
                        MethodInfo[] mInfo = t.GetMethods();
                        tn2 = tn.Nodes.Add("Metodos");
                        foreach (MethodInfo m in mInfo)
                        {
                            tn2.Nodes.Add(m.ToString());
                        }
                    }
                    catch (Exception e)
                    {
                        tn2 = tn.Nodes.Add("Metodos");
                        tn2.Nodes.Add(e.ToString());
                    }

                    /*/Obtengo Eventos
                     * try
                     * {
                     *  EventInfo[] eInfo = t.GetEvents();
                     *  tn2 = tn.Nodes.Add("Eventos");
                     *
                     *  foreach (EventInfo e in eInfo)
                     *  {
                     *      tn2.Nodes.Add(e.Name);
                     *  }
                     *
                     * }
                     * catch (Exception e)
                     * {
                     *  tn2 = tn.Nodes.Add("Eventos");
                     *  tn2.Nodes.Add(e.ToString());
                     * }*/
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                }
            }
        }
コード例 #3
0
 public virtual void Add(Ensamblado Ensam)
 {
     this.List.Add(Ensam);
 }