private void btnGetReflection_Click(object sender, EventArgs e) { // NameSpace if (this.cmbNameSpace.SelectedItem == null) { return; } NameSpaceItem sel = this.cmbNameSpace.SelectedItem as NameSpaceItem; if (sel == null) { return; } Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum ns = sel.nameSpace; // GetType ReflectOtherAssembly reflect = new ReflectOtherAssemblyVersionDotNet4(); Type type = reflect.GetTypeOfWindowsObject(cmbReflectTarget.Text, ns); if (type == null) { MessageBox.Show("型情報が存在しません。"); return; } // get reflection this.SetFullSignatureIntoReflectionList(type); /* * this.listReflectionList.Items.Clear(); * BindingFlags flag = BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.NonPublic; * BindingList<string> dataSource = new BindingList<string>(); * foreach (var item in ReflectionHelper.GetMethodsInfoByBindingFlags(type, flag)) * { * string publicprotected = ReflectionHelper.GetPublicProtected(item); * string isVirtual = ReflectionHelper.GetVirtualIfOverrided(item); * string fullsignature = publicprotected + isVirtual + item.ToString(); * * //this.listReflectionList.Items.Add(publicprotected + isVirtual + item.ToString()); * dataSource.Add(fullsignature); * } */ /* * this.bindingSource4ReflectionList.DataSource = dataSource; * //this.bindingSource4ReflectionList.DataMember = "item"; * this.listReflectionList.DataSource = this.bindingSource4ReflectionList; * this.listReflectionList.DisplayMember = "item"; * var a = this.listReflectionList.DataBindings; * this.bindingSource4ReflectionList.Filter = " like 'O'"; */ }
protected string NameSpaceEnumToObjectTreeString(Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum ns) { switch (ns) { case Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum.WindowsForms: return(this.SystemWindowsForms); break; case Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum.System: return(this.System); break; } return(string.Empty); }
public virtual Type GetTypeOfWindowsObject(string objectName, Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum ns = Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum.WindowsForms) { Type type = null; //Type tForm = null; //Type tTextBox = null; if (objectName == null) { return(null); } if (ns == NameSpaceEnum.Generic) { Type genericType = this.GetGenericTyupe(objectName); return(genericType); } string fullTypeString = this.NameSpaceEnumToObjectTreeString(ns) + objectName + ", " + this.NameSpaceEnumToNameSpaceString(ns) + this.GetPublicToken(); try { //type = Type.GetType(objectFullName + ReflectOtherAssembly.FullyAssemblyPublicTokenVer4Forms); type = Type.GetType(fullTypeString); // http://stackoverflow.com/questions/13048171/c-net-type-gettypesystem-windows-forms-form-returns-null //tTextBox = Type.GetType("System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); //tTextBox = Type.GetType("System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); } catch (Exception excp) { return(null); } return(type); }
public NameSpaceItem(Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum e, string nameSpaceString_) { this.nameSpace = e; this.nameSpaceString = nameSpaceString_; }
public virtual Type GetTypeOfWindowsObject(string objectName, Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum ns = Cシャープ日本語化リフレクション.ReflectOtherAssembly.NameSpaceEnum.WindowsForms) { return(null); }