public override bool OnNext() { TypeItem selectedTypeItem = this.SelectedTypeItem; System.Type type = selectedTypeItem.Type; if (type == null) { ITypeResolutionService service = (ITypeResolutionService)base.ServiceProvider.GetService(typeof(ITypeResolutionService)); if (service == null) { return(false); } try { type = service.GetType(selectedTypeItem.TypeName, true, true); } catch (Exception exception) { UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("ObjectDataSourceDesigner_CannotGetType", new object[] { selectedTypeItem.TypeName })); return(false); } } if (type == null) { return(false); } if (type != this._previousSelectedType) { (base.NextPanel as ObjectDataSourceChooseMethodsPanel).SetType(type); this._previousSelectedType = type; } return(true); }
private bool app_Filter(object item) { TypeItem typeItem = this.headerListBox.SelectedItem as TypeItem; if (typeItem == null) { return(false); } if (item is AppItem) { AppItem gadgetItem = item as AppItem; if (typeItem.Type == gadgetItem.Type) { return(true); } } else { GadgetItemOnline onlineItem = item as GadgetItemOnline; if (typeItem.Type == onlineItem.AppSubType || typeItem.Type < 0) { return(true); } } return(false); }
private TypeItem[] GetIncludedTypes() { if (_attribute.IncludeTypes == null) { return(Array.Empty <TypeItem>()); } var typeItems = new TypeItem[_attribute.IncludeTypes.Length]; for (int i = 0; i < _attribute.IncludeTypes.Length; i++) { Type type = _attribute.IncludeTypes[i]; if (type != null) { typeItems[i] = new TypeItem(type, _attribute.Grouping); } else { throw new ArgumentException("IncludeTypes must not contain null."); } } return(typeItems); }
private void ManageDbTabs_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if ((ManageDbTabs.SelectedItem as TabItem).Header.ToString() == "Video360") { _selectedTab = SelectedTab.Video360; SelectionTabTitle.Text = "Видео 360"; } else if ((ManageDbTabs.SelectedItem as TabItem).Header.ToString() == "Video5D") { _selectedTab = SelectedTab.Video5D; SelectionTabTitle.Text = "Видео 5D"; } else if ((ManageDbTabs.SelectedItem as TabItem).Header.ToString() == "Game") { _selectedTab = SelectedTab.Game; SelectionTabTitle.Text = "Игры"; } _typeItem = getTypeItem(); EddingMode = false; } catch (Exception ex) { App.SendException(ex); } }
public JsonResult AddItem(TypeItem tipo, string YoutubeId) { var item = _youtubeService.BuscarNoYouTubePorIDAsync(tipo, YoutubeId).Result; _minhaPlaylist.AddItem(item); return(Json(true)); }
public void VisitType(TypeItem item) { if (InFile(item)) { _sequenceToDelete.Add(item); } }
/// <summary> /// 加载报表组件 /// </summary> /// <returns></returns> private static bool loadReportInterface() { foreach (string Item in System.IO.Directory.GetFiles(CLDC_DataCore.Function.File.GetPhyPath("Plugins"))) { if (CLDC_DataCore.Function.File.GetExtName(Item).ToLower() == ".dll") { System.Reflection.Assembly asb; try { asb = System.Reflection.Assembly.LoadFile(Item); } catch { continue; } Type[] types = asb.GetTypes(); foreach (Type TypeItem in types) { if (TypeItem.GetInterface("IReportInterface") != null) { report = (CLDC_DataCore.Interfaces.IReportInterface)Activator.CreateInstance(TypeItem); //创建实例 return(true); } } } } return(false); }
public ShowVideoListPage(IEnumerable <BaseContentEntity> items, TypeItem typeVideo) { try { InitializeComponent(); if (typeVideo == TypeItem.Video360) { Title = "Видео 360"; } if (typeVideo == TypeItem.Video5D) { Title = "Видео 5D"; } if (typeVideo == TypeItem.Game) { Title = "Игры"; } App.MainWnd.ChangeTitle(Title); VideoViewer.SetSourse(items); Paggination.SetViewer(VideoViewer); Paggination.GenerateListPagginationButtons(); Paggination.CurrentPage = 1; } catch (Exception ex) { App.SendException(ex); } }
public bool InsertType(int i) { if (i < 0 || i > mTypes.Count) { return(false); } string typeName = "NewTypeName"; int n = 1; while (FindCustomDataType(typeName) != null) { typeName = "NewTypeName" + n; n++; } TypeItem ti = new TypeItem(mOnDirty, typeName); if (i == mTypes.Count) { mTypes.Add(ti); } else { mTypes.Insert(i, ti); } return(true); }
public virtual void AppendMissing(TypeItem source) { AppendDifference(source, false); if (generateSource) { if (string.IsNullOrEmpty(source.PackageName)) { int length = source.Code.Length + source.CodeBody.Length + 100; StringBuilder sb = new StringBuilder(length); if (!source.Code.IsEmpty) { sb.AppendLine(CreateOrReplace + source.Code.GetSource()); sb.AppendLine(string.Empty); sb.AppendLine("/"); } if (!source.CodeBody.IsEmpty) { sb.AppendLine(CreateOrReplace + source.CodeBody.GetSource()); } string p = BuildPath(Path.Combine(this.folderForSource, source.Owner), "Types", source.Name); WriteFile(p, sb.ToString()); } } }
private void typeListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataMgr.Instance.MainTags.Clear(); TypeItem typeItem = this.typeListBox.SelectedItem as TypeItem; if (typeItem == null) { return; } if (typeItem.Type == TypeItem.Installing) // Show installing list { this.ShowControl(ControlMgr.Instance.AppInstallingListUserControl); } else { ControlMgr.Instance.AppManagementUserControl.TypeId = typeItem.Type; foreach (TypeItem subTypeItem in typeItem.SubTypeItems) { DataMgr.Instance.MainTags.Add(subTypeItem); } this.ShowControl(ControlMgr.Instance.AppManagementUserControl); ControlMgr.Instance.AppManagementUserControl.SelectSubType(); } }
/// <summary> /// Отсюда обрабатываются нажатия на кнопки с типами /// </summary> private void B_Lake_Click(object sender, EventArgs e) { _typeItem = new Lake(); _typeItemInner = _typeItem.GetCopy(); _typeItemOuter = _typeItem.GetCopy(); ChangeBackColors((Button)sender, Tool_hydrography, Tool_area); }
private void subTypeListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { TypeItem typeItem = getTypeItem(); if (typeItem == null) { return; } if (typeItem.ParentType == TypeItem.Root) { if (typeItem.SubTypeItems.Count > 0) { this.appListBox_All.ItemsSource = DataMgr.Instance.getAppCollectionByType(typeItem.Type); } if (typeItem.Type == TypeItem.MostRecentUsed) { this.appListBox_All.ItemsSource = DataMgr.Instance.MruItems; } } else { TypeItem mainTypeItem = this.mainTypeListBox.SelectedItem as TypeItem; mainTypeItem.SelectedSubTypeIndex = this.subTypeListBox.SelectedIndex; this.appListBox_All.ItemsSource = DataMgr.Instance[typeItem.Type]; } }
void IOracleModelVisitor.VisitType(TypeItem item) { if (this._filter(item)) { _items.Add(item); } }
private void AddLinkFromInherited(TypeItem fromTypeItem, string toTypeId) { string id = fromTypeItem.InheritsFrom; // We're looking for hits on one specific method. // Everything that inherits from the toType. if (id != toTypeId) return; string fromTypeId = fromTypeItem.GetShortID(); BaseItem baseItem = _projectBrowser.Lookup(id); // If the interface is not present in our project, then forget about it. if (baseItem == null) return; // Only add nodes once. //if (_addedNodes.ContainsKey(fromTypeId)) //{ // object baby = _addedNodes[fromTypeId]; // UpdateNodeColor(baby, _sharedOptions.TypeColor); //} //else //{ Color color = GetColorForNode(baseItem, ChangeBrightnessColor(_sharedOptions.TypeColor, 1)); AddNode(fromTypeId, GetNameForItem(baseItem), color, baseItem); //} AddEdge(fromTypeId, toTypeId, EdgeStyle.NormalArrow); }
public Item(string name, TypeItem typeItem, Vector3 pos) { this.name = name; this.typeItem = typeItem; this.pos = pos; this.typeAction = TypeAction.Create; }
public void Choose(TypeItem typeItem) { int choosingIndex = -1; for (int i = 0; i < _typeItems.Count; i++) { if (_typeItems[i].productType.IDType == typeItem.productType.IDType) { choosingIndex = i; _typeItems[i].isChosen = !_typeItems[i].isChosen; } else { _typeItems[i].isChosen = false; } } if (choosingIndex != currentType) { currentType = choosingIndex; LoadProducts(false); } if (_typeItems[choosingIndex].isChosen == false) { currentType = -1; LoadProducts(false); } TypeItems = new ObservableCollection <TypeItem>(_typeItems); }
private void Append(TypeItem source, DifferenceModel d) { string p = BuildPath(Path.Combine(this.folderForTarget, source.Owner), "Types", source.Name); StringBuilder sb = new StringBuilder(); if (!File.Exists(p)) { var file = source.Files.OfType <FileElement>().FirstOrDefault(); if (file != null && file.Exist(this.rootFolderSource)) { sb = new StringBuilder(Helpers.ContentHelper.LoadContentFromFile(this.rootFolderSource, file.Path)); } else { sb = new StringBuilder(Helpers.ContentHelper.LoadContentFromFile(this.rootFolderSource, file.Path)); sb.Append(CreateOrReplace); sb.Append(source.Code.GetSource()); sb.AppendLine("\r\n"); sb.Append(source.CodeBody.GetSource()); } if (sb.Length > 0) { WriteFile(p, sb.ToString()); d.Addfile(p); } } }
public ItemStack AddStack(ItemStack stack) { if (stack == this) { return(stack); } if (!TypeItem.Equals(stack.TypeItem)) { return(stack); } var nCount = count + stack.Count; if (nCount > maxCount) { Count = maxCount; stack.Count = nCount - maxCount; } else { Count = nCount; stack.Count = 0; } return(stack); }
private void B_ImpossibleRiver_Click(object sender, EventArgs e) { _typeItem = new ImpassableRiver(); _typeItemInner = _typeItem.GetCopy(); _typeItemOuter = _typeItem.GetCopy(); ChangeBackColors((Button)sender, Tool_hydrography, Tool_line); }
public Item(int iD, string name, TypeItem type, int effect) { ID = iD; Name = name; Type = type; Effect = effect; }
private void SpawnItem(Vector2Int point, TypeItem type) { GameObject item = null; switch (type) { case TypeItem.Money: item = Instantiate(MoneyPrefab, new Vector3(point.x, point.y, 0), Quaternion.identity); StatisticsManager.StatisticsInstance.Measurements.moneyTotal++; break; case TypeItem.Potion: item = Instantiate(PotionPrefabList[UnityEngine.Random.Range(0, PotionPrefabList.Count)], new Vector3(point.x, point.y, 0), Quaternion.identity); break; case TypeItem.Weapon: item = Instantiate(WeaponPrefab, new Vector3(point.x, point.y, 0), Quaternion.identity); break; } item.GetComponent <Item>().Init(type); if (type == TypeItem.Money) { StatisticsManager.StatisticsInstance.Measurements.moneyTotal += item.GetComponent <Item>().GetValue; } StatisticsManager.StatisticsInstance.Measurements.itemsTotal++; }
public void TreeViewItemChildrenNullOnNotExpanded() { TypeMetadata typeMeta = new TypeMetadata(typeof(Type)); TypeItem tvi = new TypeItem(typeMeta); Assert.IsNull(tvi.Children[0]); }
private void InitializeTypesComboBox() { if (this.TypeDiscoveryService != null) { Cursor cursor = Cursor.Current; try { Cursor.Current = Cursors.WaitCursor; ICollection types = FilterTypes(TypeDiscoveryService.GetTypes(typeof(object), true)); _typeNameComboBox.BeginUpdate(); _typeNameComboBox.Items.Clear(); foreach (Type type in types) { TypeItem typeItem = new TypeItem(type); _typeNameComboBox.Items.Add(typeItem); } } finally { _typeNameComboBox.EndUpdate(); Cursor.Current = cursor; } SelectTypeInComboBox(); } }
public void Init(TypeItem item = TypeItem.Money) { isInit = true; type = item; switch (type) { case TypeItem.Money: Value = UnityEngine.Random.Range(ValueMin, ValueMax); break; case TypeItem.Potion: int random = UnityEngine.Random.Range(0, 3); switch (random) { case 0: Heal = UnityEngine.Random.Range(HealMin, HealMax); break; case 1: DmgIncrease = UnityEngine.Random.Range(DmgIncreaseMin, DmgIncreaseMax); break; case 2: SpeedIncrease = UnityEngine.Random.Range(SpeedIncreeseMin, SpeecIncreaseMax); break; } break; case TypeItem.Weapon: break; } }
//------------------ public void anyPanel_Click(object sender, EventArgs e) { Panel tempPanel = (Panel)sender; label_Way.Text = tempPanel.Name + "--"; Item existItem = _allItems.Find(x => x.ID == int.Parse(tempPanel.Name)); foreach (var item in existItem.Types) { label_Way.Text += " " + item.Name + ","; } if (Btn_create_P) { // пока сделаю без связей на соседние до и после _tempItems.Add(existItem); _typeItem.Sequence.SetItems(_tempItems); existItem.Types.Add(_typeItem); if (_typeItem.Sequence is Items.Single) { _allSingles.Add(_typeItem.Sequence as Items.Single); _tempItems.Clear(); //_typeItem.Sequence = new Items.Single(this); _typeItem = _typeItem.GetCopy(); } } else { if (Btn_item_from) { if (item_from != null) { panel_list.Find(x => x.Name == item_to.ID.ToString()).BackgroundImage = Properties.Resources.Point; } item_from = _allItems.Find(x => x.ID == int.Parse(tempPanel.Name));//_allItems[int.Parse(tempPanel.Name)]; B_from.Text = item_from.ID.ToString(); toolB_start.Text = item_from.ID.ToString(); Btn_item_from = !Btn_item_from; tempPanel.BackgroundImage = Properties.Resources.EnabledPoint; } if (Btn_item_to) { if (item_to != null) { panel_list.Find(x => x.Name == item_to.ID.ToString()).BackgroundImage = Properties.Resources.Point; } item_to = _allItems.Find(x => x.ID == int.Parse(tempPanel.Name)); //_allItems[int.Parse(tempPanel.Name)]; B_to.Text = item_to.ID.ToString(); toolB_finish.Text = item_to.ID.ToString(); Btn_item_to = !Btn_item_to; tempPanel.BackgroundImage = Properties.Resources.EnabledPoint; } } }
/// <summary> /// 返回分组的形式,规格选择 /// </summary> /// <param name="skus"></param> /// <param name="styles"></param> /// <returns></returns> public List <TypeItem> GetStylesByGroup(List <SKUItem> skus, out List <StyleItem> styles) { //按规格种类列表 List <TypeItem> items = new List <TypeItem>(); styles = new List <StyleItem>(); TypeItem item; Dictionary <int, List <TypeValue> > all = new Dictionary <int, List <TypeValue> >(); foreach (SKUItem skuItem in skus) { string sku = skuItem.SKU; int innerStyleId = skuItem.StyleId; if (string.IsNullOrEmpty(sku)) { continue; } string[] arry = sku.Split('|'); foreach (string s in arry) { string[] a = s.Split(':'); int typeId = int.Parse(a[0]); int valueId = int.Parse(a[1]); if (!all.ContainsKey(typeId)) { all.Add(typeId, new List <TypeValue>()); } bool exists = false; foreach (TypeValue a1 in all[typeId]) { if (a1.Code == typeId + ":" + valueId) { exists = true; break; } } if (!exists) { TypeValue v = new TypeValue(typeId, valueId, valueCache[valueId].Name); all[typeId].Insert(0, v); } } int stock = skuItem.Num; styles.Insert(0, new StyleItem() { StyleId = innerStyleId, Code = sku, Num = stock }); } foreach (KeyValuePair <int, List <TypeValue> > entry in all) { item = new TypeItem(); item.Name = nameCache[entry.Key].Name; item.Id = entry.Key; item.Values = entry.Value; items.Add(item); } return(items); }
public DefaultItem(Guid newGuid, TypeItem type, ItemContext context, IItemReference parent) : base(context, new ItemEntity(), parent, true) { Guid = newGuid; Type = type; children.SetReadOnly(true); related.SetReadOnly(true); }
private TypeItem[] MergeArrays(TypeItem[] filteredTypes, TypeItem[] includedTypes) { var totalTypes = new TypeItem[filteredTypes.Length + includedTypes.Length]; filteredTypes.CopyTo(totalTypes, 0); includedTypes.CopyTo(totalTypes, filteredTypes.Length); return(totalTypes); }
private void SelectItem() { TypeItem item = (this.objectTypeView.SelectedNode != null ? this.objectTypeView.SelectedNode.Tag as TypeItem : null); this.selectedType = item.TypeInfo; this.DialogResult = DialogResult.OK; this.Close(); }
private void buttonOk_Click(object sender, EventArgs e) { TypeItem item = (this.objectTypeView.SelectedNode != null ? this.objectTypeView.SelectedNode.Tag as TypeItem : null); this.selectedType = item.TypeInfo; this.DialogResult = DialogResult.OK; this.Close(); }
private void AddLinksFromMethods(TypeItem fromTypeItem, string toMethodId) { string fromMethodId, id; foreach (MethodItem methodItem in fromTypeItem.Methods) { if (CheckWorker()) break; fromMethodId = methodItem.GetShortID(); SDILReader.MethodBodyReader mr = new MethodBodyReader(methodItem.MethodInfo); if (mr == null) continue; // Abstract..external, etc if (mr.instructions == null) continue; foreach (ILInstruction instruction in mr.instructions) { if (CheckWorker()) break; id = string.Empty; if (instruction.Code.OperandType != OperandType.InlineMethod) continue; if (instruction.Operand is MethodInfo) { id = string.Format("{0} {1}", (instruction.Operand as MethodInfo).DeclaringType.ToString(), RefHelp.GetNameWithParameterList(instruction.Operand as MethodInfo)); } else if (instruction.Operand is ConstructorInfo) { id = string.Format("{0} {1}", (instruction.Operand as ConstructorInfo).DeclaringType.ToString(), RefHelp.GetNameWithParameterList(instruction.Operand as ConstructorInfo)); } else if (instruction.Operand == null) { _logView.LogStr("Butterfly failed with null instruction.operand :" + instruction.ToString()); } else { _logView.LogStr("Butterfly failed to recognise call instruction (in) :" + instruction.Operand.GetType().ToString()); } // We're looking for hits on one specific method. if (id != toMethodId) continue; // Only add nodes once. //if (_addedNodes.ContainsKey(fromMethodId)) continue; string caption = fromTypeItem + "\n" + methodItem.Name; AddNode(fromMethodId, caption, _sharedOptions.MethodColor, methodItem); AddEdge(fromMethodId, toMethodId, EdgeStyle.NormalArrow); } } }
public Item(string _name,int _id,string desc,int _amount,int _price,TypeItem _type) { name = _name; id = _id; Description = desc; amount = _amount; icon = Resources.Load<Sprite>(""+name); price = _price; type = _type; }
private void AddLinksFromClasses(TypeItem fromTypeItem, string toTypeId) { if (fromTypeItem.Implements == null) return; string fromTypeId = fromTypeItem.GetShortID(); foreach (string id in fromTypeItem.Implements) { // We're looking for hits on one specific method. if (id != toTypeId) continue; BaseItem baseItem = _projectBrowser.Lookup(id); // If the interface is not present in our project, then forget about it. if (baseItem == null) continue; // Only add types once. if (_addedNodes.ContainsKey(fromTypeId)) continue; //AddNode(fromTypeId, GetNameForItem(fromTypeItem), _sharedOptions.TypeColor, fromTypeItem); Color color = GetColorForNode(fromTypeItem, ChangeBrightnessColor(_sharedOptions.TypeColor, 1)); AddNode(fromTypeId, GetNameForItem(fromTypeItem), color, fromTypeItem); AddEdge(fromTypeId, toTypeId, EdgeStyle.NormalArrow, Color.DarkSeaGreen); //todo } }
private MethodInfo[] GetMethods(TypeItem typeItem) { // better way to sort.. IComparable? todo Dictionary<string, MethodInfo> d = new Dictionary<string, MethodInfo>(); List<string> l = new List<string>(); string id; foreach (MethodInfo mi in typeItem.TypeRef.GetMethods( BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly )) { if (mi.IsSpecialName) continue; try { id = RefHelp.GetNameWithParameterList(mi); } catch (FileNotFoundException exc) { if (!_miWarnedAlready.Contains(typeItem.FullName)) { _logView.LogExcStr(exc, "Failed to get methods for " + typeItem.FullName); _miWarnedAlready.Add(typeItem.FullName); } continue; } d.Add(id, mi); l.Add(id); } l.Sort(); MethodInfo[] result = new MethodInfo[l.Count]; for (int i = 0; i < l.Count; i++) result[i] = d[l[i]]; return result; }
private void ReflectAssembly(AssemblyItem assemblyItem, Assembly asm, bool invert) { string ns; NamespaceItem nsItem; Dictionary<string, NamespaceItem> nsItems = new Dictionary<string, NamespaceItem>(); // Add the assembly item itself to the lookup. _projectBrowser.AddLookup(assemblyItem, assemblyItem.GetID(), invert); try { Type[] types = asm.GetTypes(); } catch (ReflectionTypeLoadException exc) { _logView.LogExcStr(exc, "Failed to call GetTypes on " + asm.FullName); return; } foreach (Type t in asm.GetTypes()) { ns = t.Namespace; if (string.IsNullOrEmpty(ns)) ns = "(none)"; if (!nsItems.ContainsKey(ns)) { nsItem = new NamespaceItem(ns, assemblyItem); nsItems.Add(ns, nsItem); assemblyItem.NameSpaces.Add(nsItem); _projectBrowser.AddLookup(nsItem, nsItem.GetID(), invert); } else { nsItem = nsItems[ns]; } // Flatten nested types. string name = t.Name; if (t.IsNested) { // Flat with .id'd name. Type parentType = t.DeclaringType; while (parentType != null) { name = parentType.Name + "." + name; parentType = parentType.DeclaringType; } } try { TypeItem typeItem = new TypeItem(name, t.FullName, t, nsItem); nsItem.Types.Add(typeItem); _projectBrowser.AddLookup(typeItem, typeItem.GetID(), invert); foreach (MethodInfo mi in GetMethods(typeItem)) { MethodItem methodItem = new MethodItem(mi.Name, mi, typeItem); typeItem.Methods.Add(methodItem); _projectBrowser.AddLookup(methodItem, methodItem.GetID(), invert); } // Get the list of implemented interfaces. typeItem.Implements = GetImplementedInterfaces(typeItem); if (typeItem.TypeRef.BaseType != null) { typeItem.InheritsFrom = typeItem.TypeRef.BaseType.ToString(); } else { typeItem.InheritsFrom = null; } } catch (Exception exc) { _logView.LogExcStr(exc, "Generic Types issue?"); } } }
private SortedList CreateTypeTable() { SortedList TypeTable = new SortedList(); TypeItem VariantType = null; VariantType = new TypeItem(); VariantType.Name = "Unknown"; VariantType.GXType = GXProperty.VARTYPE.None; VariantType.ReadSize = 0; VariantType.WriteSize = 0; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Signed Integer"; VariantType.GXType = GXProperty.VARTYPE.SignedInteger; VariantType.ReadSize = 4; VariantType.WriteSize = 4; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Signed Integer16"; VariantType.GXType = GXProperty.VARTYPE.SignedInteger; VariantType.ReadSize = 2; VariantType.WriteSize = 2; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Unsigned Integer"; VariantType.GXType = GXProperty.VARTYPE.UnsignedInteger; VariantType.ReadSize = 4; VariantType.WriteSize = 4; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Unsigned Integer16"; VariantType.GXType = GXProperty.VARTYPE.UnsignedInteger; VariantType.ReadSize = 2; VariantType.WriteSize = 2; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Hex String"; VariantType.GXType = GXProperty.VARTYPE.HexString; VariantType.ReadSize = 0; VariantType.WriteSize = 0; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Byte"; VariantType.GXType = GXProperty.VARTYPE.SignedInteger; VariantType.ReadSize = 1; VariantType.WriteSize = 1; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Byte Array"; VariantType.GXType = GXProperty.VARTYPE.ByteArray; VariantType.ReadSize = 0; VariantType.WriteSize = 0; TypeTable.Add(VariantType.Name, VariantType); VariantType = new TypeItem(); VariantType.Name = "Boolean"; VariantType.GXType = GXProperty.VARTYPE.Boolean; VariantType.ReadSize = 1; VariantType.WriteSize = 1; TypeTable.Add(VariantType.Name, VariantType); return TypeTable; }
// http://msdn2.microsoft.com/en-us/library/system.type.findinterfaces.aspx private static List<string> GetImplementedInterfaces(TypeItem typeItem) { List<string> result = new List<string>(); try { TypeFilter myFilter = new TypeFilter(MyInterfaceFilter); Type[] myInterfaces = typeItem.TypeRef.FindInterfaces(myFilter, null); for (int i = 0; i < myInterfaces.Length; i++) { result.Add(myInterfaces[i].ToString()); } } catch (ArgumentNullException) { //Console.WriteLine("ArgumentNullException: " + e.Message); } catch (TargetInvocationException) { //Console.WriteLine("TargetInvocationException: " + e.Message); } return result; }
private void AddLinksFromMethods(TypeItem fromTypeItem, string toTypeId) { foreach (MethodItem methodItem in fromTypeItem.Methods) { string fromTypeId = fromTypeItem.GetShortID(); MethodBodyReader mr = new MethodBodyReader(methodItem.MethodInfo); if (mr == null) continue; // Abstract..external, etc if (mr.instructions == null) continue; foreach (ILInstruction instruction in mr.instructions) { string id = string.Empty; if (instruction.Code.OperandType != OperandType.InlineMethod) continue; // TODO dup code if (instruction.Operand is MethodInfo) { id = (instruction.Operand as MethodInfo).DeclaringType.ToString(); } else if (instruction.Operand is ConstructorInfo) { id = (instruction.Operand as ConstructorInfo).DeclaringType.ToString(); } else if (instruction.Operand == null) { _logView.LogStr("Class Butterfly failed to recognise call instruction due to generics.(in)"); } else { _logView.LogStr("Class Butterfly failed to recognise call instruction (in) :" + instruction.Operand.GetType().ToString()); } // We're looking for hits on one specific method. if (id != toTypeId) continue; // Only add nodes once. //if (_addedNodes.ContainsKey(fromTypeId)) continue; //AddNode(fromTypeId, GetNameForItem(fromTypeItem), ChangeBrightnessColor(_sharedOptions.TypeColor,0.8), fromTypeItem); Color color = GetColorForNode(fromTypeItem, ChangeBrightnessColor(_sharedOptions.TypeColor, 1)); AddNode(fromTypeId, GetNameForItem(fromTypeItem), color, fromTypeItem); AddEdge(fromTypeId, toTypeId, EdgeStyle.NormalArrow); } } }
public MemberItem(TypeItem parent, Member metaData) : base(parent.Parent, metaData.Name) { Type = metaData.Type; }
public Item(TypeItem _type,int pos) { type = _type; position = pos; }
/// <summary> /// Group setup /// </summary> /// <param name="groupName">Name of the group</param> /// <param name="types">Types making up the group</param> public TypeGroup( string groupName, Type[] types ) { m_Name = groupName; m_TypeItems = new TypeItem[ types.Length ]; for ( int typeIndex = 0; typeIndex < types.Length; ++typeIndex ) { m_TypeItems[ typeIndex ] = new TypeItem( types[ typeIndex ] ); } }
protected static MemberItem CreateMember(TypeItem parent, Member member) { return new MemberItem(parent, member); }