private void ReflectOutEvents() { //do events foreach (EventInfo ei in TypeInAssembly.GetEvents(RequiredBindings)) { if (TypeInAssembly == ei.DeclaringType) { //add all the event types to the associations List, so that //the association lines for this class can be obtained, and //possibly drawn on the container string eName = GetGenericsForType(ei.EventHandlerType); eName = LowerAndTrim(eName); string association = ei.EventHandlerType.IsGenericType ? ei.EventHandlerType.GetGenericTypeDefinition().FullName : ei.EventHandlerType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } //do we want long or short event description displayed if (ShowEvents) { Events.Add(eName + " " + ei.Name); } else { Events.Add(ei.Name); } } } HasEvents = Events.Any(); }
static internal void InitFunctions() { Functions.Add(Function.GetUsers, new AsanaFunction("/users", "GET")); Functions.Add(Function.GetMe, new AsanaFunction("/users/me", "GET")); Functions.Add(Function.GetUserById, new AsanaFunction("/users/{0}", "GET")); Functions.Add(Function.GetWorkspaces, new AsanaFunction("/workspaces", "GET")); Functions.Add(Function.GetUsersInWorkspace, new AsanaFunction("/workspaces/{0:ID}/users", "GET")); Functions.Add(Function.GetTasksInWorkspace, new AsanaFunction("/workspaces/{0:ID}/tasks?assignee={1:ID}", "GET")); Functions.Add(Function.GetProjectsInWorkspace, new AsanaFunction("/workspaces/{0:ID}/projects", "GET")); Functions.Add(Function.GetTagsInWorkspace, new AsanaFunction("/workspaces/{0:ID}/tags", "GET")); Functions.Add(Function.GetTaskById, new AsanaFunction("/tasks/{0}", "GET")); Functions.Add(Function.GetStoriesInTask, new AsanaFunction("/tasks/{0:ID}/stories", "GET")); Functions.Add(Function.GetProjectsOnATask, new AsanaFunction("/tasks/{0:ID}/projects", "GET")); Functions.Add(Function.GetTasksByTag, new AsanaFunction("/tags/{0:ID}/tasks", "GET")); Functions.Add(Function.GetStoryById, new AsanaFunction("/stories/{0}", "GET")); Functions.Add(Function.GetProjectById, new AsanaFunction("/projects/{0}", "GET")); Functions.Add(Function.GetTasksInAProject, new AsanaFunction("/projects/{0:ID}/tasks", "GET")); Functions.Add(Function.GetTagById, new AsanaFunction("/tags/{0}", "GET")); Functions.Add(Function.CreateWorkspaceTask, new AsanaFunction("/tasks", "POST")); Functions.Add(Function.AddProjectToTask, new AsanaFunction("/tasks/{0:ID}/addProject", "POST")); Functions.Add(Function.RemoveProjectFromTask, new AsanaFunction("/tasks/{0:ID}/removeProject", "POST")); Functions.Add(Function.AddStoryToTask, new AsanaFunction("/tasks/{0:Target}/stories", "POST")); Functions.Add(Function.UpdateTask, new AsanaFunction("/tasks/{0:ID}", "PUT")); Functions.Add(Function.UpdateTag, new AsanaFunction("/tags/{0:ID}", "PUT")); Functions.Add(Function.GetTeamsInWorkspace, new AsanaFunction("/organizations/{0:ID}/teams", "GET")); Associations.Add(typeof(AsanaTask), new AsanaFunctionAssociation(GetFunction(Function.CreateWorkspaceTask), GetFunction(Function.UpdateTask))); Associations.Add(typeof(AsanaStory), new AsanaFunctionAssociation(GetFunction(Function.AddStoryToTask), null)); }
public override void Initialize(Schema schema) { base.Initialize(schema); artistEntity = schema.GetEntity <IArtist>(); Associations.Add(new Association(ASSOCIATION_CREATORS, this, artistEntity, Relationship.ManyToMany, false)); }
public GDMAssociation AddAssociation(string relation, GDMIndividualRecord relPerson) { GDMAssociation result = new GDMAssociation(); result.Relation = relation; result.XRef = (relPerson == null) ? string.Empty : relPerson.XRef; Associations.Add(result); return(result); }
public GDMAssociation AddAssociation(string relation, GDMIndividualRecord relPerson) { GDMAssociation result = new GDMAssociation(this); result.Relation = relation; result.Individual = relPerson; Associations.Add(result); return(result); }
public GEDCOMAssociation AddAssociation(string relation, GEDCOMIndividualRecord relPerson) { GEDCOMAssociation result = new GEDCOMAssociation(Owner, this, "", ""); result.Relation = relation; result.Individual = relPerson; Associations.Add(result); return(result); }
public void AddAssociation(SaveFileAssociation association) { if (association is null) { throw new ArgumentNullException(nameof(association)); } Associations.Add(association.Extension, association); }
/// <summary> /// Returs a string which is the name of the type in its full /// format. If its not a generic type, then the name of the /// t input parameter is simply returned, if however it is /// a generic method say a List of ints then the appropraite string /// will be retrurned /// </summary> /// <param name="t">The Type to check for generics</param> /// <returns>a string representing the type</returns> private string GetGenericsForType(Type t) { string name = ""; if (!t.GetType().IsGenericType) { //see if there is a ' char, which there is for //generic types int idx = t.Name.IndexOfAny(new char[] { '`', '\'' }); if (idx >= 0) { name = t.Name.Substring(0, idx); //get the generic arguments Type[] genTypes = t.GetGenericArguments(); foreach (var genType in genTypes) { var type = genType.IsGenericType ? genType.GetGenericTypeDefinition() : genType; if (type.FullName != null) { Associations.Add(type.FullName); } } //and build the list of types for the result string if (genTypes.Length == 1) { name += "<" + GetGenericsForType(genTypes[0]) + ">"; } else { name += "<"; foreach (Type gt in genTypes) { name += GetGenericsForType(gt) + ", "; } if (name.LastIndexOf(",") > 0) { name = name.Substring(0, name.LastIndexOf(",")); } name += ">"; } } else { name = t.Name; } return(name); } else { return(t.Name); } }
private void ReflectOutConstructors() { //do constructors foreach (ConstructorInfo ci in TypeInAssembly.GetConstructors(RequiredBindings)) { if (TypeInAssembly == ci.DeclaringType) { string cDetail = TypeInAssembly.Name + "("; string pDetail = ""; //add all the constructor param types to the associations List, so that //the association lines for this class can be obtained, and //possibly drawn on the container ParameterInfo[] pif = ci.GetParameters(); foreach (ParameterInfo p in pif) { string pName = GetGenericsForType(p.ParameterType); pName = LowerAndTrim(pName); if (IncludeConstructorParametersAsAssociations) { string association = p.ParameterType.IsGenericType ? p.ParameterType.GetGenericTypeDefinition().FullName : p.ParameterType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } } pDetail = pName + " " + p.Name + ", "; cDetail += pDetail; } if (cDetail.LastIndexOf(",") > 0) { cDetail = cDetail.Substring(0, cDetail.LastIndexOf(",")); } cDetail += ")"; //do we want long or short field constructor displayed if (ShowConstructorParameters) { Constructors.Add(cDetail); } else { Constructors.Add(TypeInAssembly.Name + "( )"); } } } HasConstructors = Constructors.Any(); }
static internal void InitFunctions() { Functions.Add(Function.GetUsers, new AsanaFunction("/users", "GET")); Functions.Add(Function.GetMe, new AsanaFunction("/users/me", "GET")); Functions.Add(Function.GetUserById, new AsanaFunction("/users/{0}", "GET")); Functions.Add(Function.GetWorkspaces, new AsanaFunction("/workspaces", "GET")); Functions.Add(Function.GetWorkspaceById, new AsanaFunction("/workspaces/{0}", "GET")); Functions.Add(Function.GetUsersInWorkspace, new AsanaFunction("/workspaces/{0:ID}/users", "GET")); Functions.Add(Function.GetTasksInWorkspace, new AsanaFunction("/workspaces/{0:ID}/tasks?assignee={1:ID}", "GET")); Functions.Add(Function.GetProjectsInWorkspace, new AsanaFunction("/workspaces/{0:ID}/projects", "GET")); Functions.Add(Function.GetTagsInWorkspace, new AsanaFunction("/workspaces/{0:ID}/tags", "GET")); Functions.Add(Function.GetTaskById, new AsanaFunction("/tasks/{0}", "GET")); Functions.Add(Function.GetStoriesInTask, new AsanaFunction("/tasks/{0:ID}/stories", "GET")); Functions.Add(Function.GetProjectsOnATask, new AsanaFunction("/tasks/{0:ID}/projects", "GET")); Functions.Add(Function.GetTasksByTag, new AsanaFunction("/tags/{0:ID}/tasks", "GET")); Functions.Add(Function.GetStoryById, new AsanaFunction("/stories/{0}", "GET")); Functions.Add(Function.GetProjectById, new AsanaFunction("/projects/{0}", "GET")); Functions.Add(Function.GetJobById, new AsanaFunction("/jobs/{0}", "GET")); Functions.Add(Function.GetTeamById, new AsanaFunction("/teams/{0}", "GET")); Functions.Add(Function.GetTasksInAProject, new AsanaFunction("/projects/{0:ID}/tasks", "GET")); Functions.Add(Function.GetTagById, new AsanaFunction("/tags/{0}", "GET")); Functions.Add(Function.GetTeamsInWorkspace, new AsanaFunction("/organizations/{0:ID}/teams", "GET")); Functions.Add(Function.GetProjectsInTeam, new AsanaFunction("/teams/{0:ID}/projects", "GET")); Functions.Add(Function.GetEventsInAProject, new AsanaFunction("/projects/{0:ID}/events?sync={1}", "GET")); Functions.Add(Function.GetEventsInTask, new AsanaFunction("/tasks/{0:ID}/events?sync={1}", "GET")); Functions.Add(Function.CreateWorkspaceTask, new AsanaFunction("/tasks", "POST")); Functions.Add(Function.AddProjectToTask, new AsanaFunction("/tasks/{0:ID}/addProject", "POST")); Functions.Add(Function.RemoveProjectFromTask, new AsanaFunction("/tasks/{0:ID}/removeProject", "POST")); Functions.Add(Function.AddStoryToTask, new AsanaFunction("/tasks/{0:Target}/stories", "POST")); Functions.Add(Function.AddTagToTask, new AsanaFunction("/tasks/{0:ID}/addTag", "POST")); Functions.Add(Function.RemoveTagFromTask, new AsanaFunction("/tasks/{0:ID}/removeTag", "POST")); Functions.Add(Function.CreateWorkspaceProject, new AsanaFunction("/projects", "POST")); Functions.Add(Function.CreateWorkspaceTag, new AsanaFunction("/tags", "POST")); Functions.Add(Function.UpdateTask, new AsanaFunction("/tasks/{0:ID}", "PUT")); Functions.Add(Function.UpdateTag, new AsanaFunction("/tags/{0:ID}", "PUT")); Functions.Add(Function.UpdateProject, new AsanaFunction("/projects/{0:ID}", "PUT")); Functions.Add(Function.UpdateWorkspace, new AsanaFunction("/workspaces/{0:ID}", "PUT")); Functions.Add(Function.DeleteTask, new AsanaFunction("/tasks/{0:ID}", "DELETE")); Functions.Add(Function.DeleteProject, new AsanaFunction("/projects/{0:ID}", "DELETE")); Functions.Add(Function.DuplicateProject, new AsanaFunction("/projects/{0}/duplicate", "POST")); Associations.Add(typeof(AsanaWorkspace), new AsanaFunctionAssociation(null, GetFunction(Function.UpdateWorkspace), null)); Associations.Add(typeof(AsanaTask), new AsanaFunctionAssociation(GetFunction(Function.CreateWorkspaceTask), GetFunction(Function.UpdateTask), GetFunction(Function.DeleteTask))); Associations.Add(typeof(AsanaProject), new AsanaFunctionAssociation(GetFunction(Function.CreateWorkspaceProject), GetFunction(Function.UpdateProject), GetFunction(Function.DeleteProject))); Associations.Add(typeof(AsanaTag), new AsanaFunctionAssociation(GetFunction(Function.CreateWorkspaceTag), GetFunction(Function.UpdateTag), null)); Associations.Add(typeof(AsanaStory), new AsanaFunctionAssociation(GetFunction(Function.AddStoryToTask), null, null)); }
private void ReflectOutProperties() { //do properties foreach (PropertyInfo pi in TypeInAssembly.GetProperties(RequiredBindings)) { if (TypeInAssembly == pi.DeclaringType) { // add read method if exists if (pi.CanRead) { propGetters.Add(pi.GetGetMethod(true)); } // add write method if exists if (pi.CanWrite) { propSetters.Add(pi.GetSetMethod(true)); } string pName = GetGenericsForType(pi.PropertyType); //add all the property types to the associations List, so that //the association lines for this class can be obtained, and //possibly drawn on the container pName = LowerAndTrim(pName); if (IncludePropertyTypesAsAssociations) { string association = pi.PropertyType.IsGenericType ? pi.PropertyType.GetGenericTypeDefinition().FullName : pi.PropertyType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } } //do we want long or short property description displayed if (ShowPropertyTypes) { Properties.Add(pName + " " + pi.Name); } else { Properties.Add(pi.Name); } } } HasProperties = Properties.Any(); }
/// <summary> /// Ассоциация расширений с редактором /// </summary> /// <param name="exts">Массив расширений</param> /// <param name="editor">Тип редактора, которым эти файлы открывать</param> public static void Register(string[] exts, Type editor) { if (exts != null) { if (Associations == null) { Associations = new Dictionary <string, Type>(); } foreach (string ext in exts) { if (!Associations.ContainsKey(ext)) { Associations.Add(ext, editor); } } } }
public void Set(PSMClass groupedClass) { if (groupedClass == null) { return; } List <GroupBySelectorData> List = new List <GroupBySelectorData>(); foreach (PSMSubordinateComponent comp in groupedClass.Components) { if (comp is PSMAssociation) { PSMAssociation A = comp as PSMAssociation; if (A.Child is PSMClass) { List.Add(new GroupBySelectorData() { IsSelected = true, PSMAssociation = A, PSMClass = A.Child as PSMClass }); } } } if (List.Count == 0) { return; } GroupByDialog D = new GroupByDialog(); D.List.ItemsSource = List; if (D.ShowDialog() == true) { foreach (GroupBySelectorData Data in List) { if (Data.IsSelected) { Associations.Add(Data.PSMAssociation); } } GroupedClass = groupedClass; } }
private async Task FillAssociations() { HttpMessage associationMesssage = await Login.Instance.DoGet("api/associations"); if (associationMesssage.Success) { string json = await associationMesssage.Response.Content.ReadAsStringAsync(); AssociationModel[] associations = JsonConvert.DeserializeObject <AssociationModel[]>(json); foreach (AssociationModel associationObj in associations) { Associations.Add(associationObj); } } else { await Application.Current.MainPage.DisplayAlert("Failed", "Could not load associations. Are you sure you are connected?", "OK"); } }
private void _RegisterType(Type root, params Type[] related) { //+ Validate types. if (root.IsInterface || related.Count(a => a.IsInterface) > 0) { throw new NotSupportedException("Interfaces can not be serialized"); } // Add missing associations lock (Associations) { // root types IEnumerable <Type> r = new List <Type>(related); // related children foreach (Type t in related) { r = r.Union(from z in t.GetTypes( (c, d) => d.IsSubclassOf(c) && !d.IsAbstract && !d.IsGenericTypeDefinition , Assemblies.Values.ToArray()) select z); } var x = from i in r.Distinct() join j in Associations.Where(a => a.Key.Item1 == root.FullName) on i.FullName equals j.Key.Item2 into outer from k in outer.DefaultIfEmpty() where k.Key == null select new { k = new Tuple <string, string>(root.FullName, i.FullName), v = i }; foreach (var i in x) { Associations.Add(i.k, i.v); } } }
/// <summary> /// Code in this method does the following /// 1. Read the methodbodyIL string /// 2. Look at all ILInstructions and look for new objects being /// created inside the method, and add as Association /// 3. Finally return the method body IL for the diagram to use /// </summary> private String ReadMethodBodyAndAddAssociations(MethodInfo mi) { String ilBody = ""; try { if (mi == null) { return(""); } if (mi.GetMethodBody() == null) { return(""); } MethodBodyReader mr = new MethodBodyReader(mi); foreach (ILInstruction instruction in mr.Instructions) { if (instruction.Code.Name.ToLower().Equals("newobj")) { dynamic operandType = instruction.Operand; String association = operandType.DeclaringType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } } } ilBody = mr.GetBodyCode(); return(ilBody); } catch (Exception ex) { return(""); } }
private void ReflectOutFields() { //do fields foreach (FieldInfo fi in TypeInAssembly.GetFields(RequiredBindings)) { if (TypeInAssembly == fi.DeclaringType) { //add all the field types to the associations List, so that //the association lines for this class can be obtained, and //possibly drawn on the container string fName = GetGenericsForType(fi.FieldType); fName = LowerAndTrim(fName); if (IncludeFieldTypesAsAssociations) { string association = fi.FieldType.IsGenericType ? fi.FieldType.GetGenericTypeDefinition().FullName : fi.FieldType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } } //do we want long or short field description displayed if (ShowFieldTypes) { Fields.Add(fName + " " + fi.Name); } else { Fields.Add(fi.Name); } } } HasFields = Fields.Any(); }
void Init(MappingSchema mappingSchema) { var ta = mappingSchema.GetAttribute <TableAttribute>(TypeAccessor.Type, a => a.Configuration); if (ta != null) { TableName = ta.Name; SchemaName = ta.Schema; DatabaseName = ta.Database; IsColumnAttributeRequired = ta.IsColumnAttributeRequired; } if (TableName == null) { TableName = TypeAccessor.Type.Name; if (TypeAccessor.Type.IsInterfaceEx() && TableName.Length > 1 && TableName[0] == 'I') { TableName = TableName.Substring(1); } } var attrs = new List <ColumnAttribute>(); foreach (var member in TypeAccessor.Members) { var aa = mappingSchema.GetAttribute <AssociationAttribute>(TypeAccessor.Type, member.MemberInfo, attr => attr.Configuration); if (aa != null) { Associations.Add(new AssociationDescriptor( TypeAccessor.Type, member.MemberInfo, aa.GetThisKeys(), aa.GetOtherKeys(), aa.ExpressionPredicate, aa.Storage, aa.CanBeNull)); continue; } var ca = mappingSchema.GetAttribute <ColumnAttribute>(TypeAccessor.Type, member.MemberInfo, attr => attr.Configuration); if (ca != null) { if (ca.IsColumn) { if (ca.MemberName != null) { attrs.Add(new ColumnAttribute(member.Name, ca)); } else { var cd = new ColumnDescriptor(mappingSchema, ca, member); Columns.Add(cd); _columnNames.Add(member.Name, cd); } } } else if ( !IsColumnAttributeRequired && mappingSchema.IsScalarType(member.Type) || mappingSchema.GetAttribute <IdentityAttribute>(TypeAccessor.Type, member.MemberInfo, attr => attr.Configuration) != null || mappingSchema.GetAttribute <PrimaryKeyAttribute>(TypeAccessor.Type, member.MemberInfo, attr => attr.Configuration) != null) { var cd = new ColumnDescriptor(mappingSchema, new ColumnAttribute(), member); Columns.Add(cd); _columnNames.Add(member.Name, cd); } else { var caa = mappingSchema.GetAttribute <ColumnAliasAttribute>(TypeAccessor.Type, member.MemberInfo, attr => attr.Configuration); if (caa != null) { if (Aliases == null) { Aliases = new Dictionary <string, string>(); } Aliases.Add(member.Name, caa.MemberName); } } } var typeColumnAttrs = mappingSchema.GetAttributes <ColumnAttribute>(TypeAccessor.Type, a => a.Configuration); foreach (var attr in typeColumnAttrs.Concat(attrs)) { if (attr.IsColumn) { SetColumn(attr, mappingSchema); } } }
public TypeTable(Type type) { ViewSource = type.Name; UpdateSource = type.Name; TypeName = type.FullName; m_assemblyName = type.Assembly.FullName; var tattr = type.GetCustomAttributes(true); foreach (var attr in tattr.Where(a => a.GetType() == typeof(Source))) { var sourceAttribute = attr as Source; if (sourceAttribute == null) { continue; } var view = sourceAttribute.View; var update = sourceAttribute.Update; ViewSource = view == string.Empty ? type.Name : view; UpdateSource = update == string.Empty ? type.Name : update; } var minfoArray = type.GetMembers(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); foreach (var info in minfoArray.Where(i => i.GetCustomAttributes(typeof(DataField), true).Length > 0)) { //Get DataFields var mattr = info.GetCustomAttributes(typeof(DataField), true); var dataField = mattr[0] as DataField; if (dataField == null) { continue; } var columnName = dataField.FieldName; var memberName = dataField.MemberName ?? info.Name; var isPrimaryKey = dataField.PrimaryKey; var isIdentity = dataField.Identity; var size = dataField.Size; var memberInfo = GetMemberInfo(type, memberName); var viewOnly = dataField.ViewOnly; switch (memberInfo.MemberType) { case MemberTypes.Property: Add(new TypeColumn(columnName, info.Name, (memberInfo as PropertyInfo), viewOnly, isPrimaryKey, isIdentity, size)); break; case MemberTypes.Field: Add(new TypeColumn(columnName, info.Name, (memberInfo as FieldInfo), viewOnly, isPrimaryKey, isIdentity, size)); break; } } //Get Relations foreach (var info in minfoArray.Where(i => i.GetCustomAttributes(typeof(Association), true).Length > 0)) { var rattr = info.GetCustomAttributes(typeof(Association), true); var association = rattr[0] as Association; if (association == null) { continue; } var memberInfo = GetMemberInfo(type, association.SourceMember); TypeRelation relation = null; var sourceKeyColumn = this.First(col => col.Name == association.SourceKey); switch (memberInfo.MemberType) { case MemberTypes.Property: var pInfo = memberInfo as PropertyInfo; if (pInfo == null) { break; } relation = new TypeRelation(association.Relationship, pInfo.PropertyType, association.SourceMember, association.SourceKey, association.ReferenceKey, memberInfo, sourceKeyColumn); break; case MemberTypes.Field: var fInfo = memberInfo as FieldInfo; if (fInfo == null) { break; } relation = new TypeRelation(association.Relationship, fInfo.FieldType, association.SourceMember, association.SourceKey, association.ReferenceKey, memberInfo, sourceKeyColumn); break; } Associations.Add(relation); } MappedObjectType = type; }
void IXmlSerializable.ReadXml(XmlReader reader) { if (reader.NodeType == XmlNodeType.Element) { //Get table attributes TypeName = reader.GetAttribute("Type"); ViewSource = reader.GetAttribute("View"); UpdateSource = reader.GetAttribute("Update"); string assembly = reader.GetAttribute("Assembly"); //TODO find another way not to include assembly if ((ViewSource == null && UpdateSource == null) || assembly == null) { //TODO throw exception here } if (ViewSource == null && UpdateSource != null) { ViewSource = UpdateSource; } if (UpdateSource == null && ViewSource != null) { UpdateSource = ViewSource; } //TODO Add try catch here var type = Type.GetType(string.Format("{0}, {1}", TypeName, assembly), true); if (type == null) { throw new Exception(string.Format("Unknown Type {0}.{1}", assembly, TypeName)); } MappedObjectType = type; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "Fields") { if (reader.IsEmptyElement) { continue; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "DataField") { var column = new TypeColumn(); column.ReadXml(reader, type); Add(column); } else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "Fields") { break; } } } else if (reader.NodeType == XmlNodeType.Element && reader.Name == "Associations") { if (reader.IsEmptyElement) { continue; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == "Association") { var relation = new TypeRelation(); relation.ReadXml(reader, type, this); Associations.Add(relation); } else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "Associations") { break; } } } else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "DataObject") { break; } } } }
private void ReflectOutMethods() { //do methods foreach (MethodInfo mi in TypeInAssembly.GetMethods(RequiredBindings)) { if (TypeInAssembly == mi.DeclaringType) { string mDetail = mi.Name + "( "; string pDetail = ""; //do we want to display method arguments, if we do create the //appopraiate string if (ShowMethodArguments) { ParameterInfo[] pif = mi.GetParameters(); foreach (ParameterInfo p in pif) { //add all the parameter types to the associations List, so that //the association lines for this class can be obtained, and //possibly drawn on the container string pName = GetGenericsForType(p.ParameterType); pName = LowerAndTrim(pName); if (IncludeMethodArgumentAsAssociations) { string association = p.ParameterType.IsGenericType ? p.ParameterType.GetGenericTypeDefinition().FullName : p.ParameterType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } } pDetail = pName + " " + p.Name + ", "; mDetail += pDetail; } if (mDetail.LastIndexOf(",") > 0) { mDetail = mDetail.Substring(0, mDetail.LastIndexOf(",")); } } mDetail += " )"; //add the return type to the associations List, so that //the association lines for this class can be obtained, and //possibly drawn on the container string rName = GetGenericsForType(mi.ReturnType); //dont want to include void as an association type if (!string.IsNullOrEmpty(rName)) { rName = GetGenericsForType(mi.ReturnType); rName = LowerAndTrim(rName); string association = mi.ReturnType.IsGenericType ? mi.ReturnType.GetGenericTypeDefinition().FullName : mi.ReturnType.FullName; if (!Associations.Contains(association)) { Associations.Add(association); } //do we want to display method return types if (ShowMethodReturnValues) { mDetail += " : " + rName; } } else { //do we want to display method return types if (ShowMethodReturnValues) { mDetail += " : void"; } } //work out whether this is a normal method, in which case add it //or if its a property get/set method, should it be added if (!ShowGetMethodForProperty && propGetters.Contains(mi)) { /* hidden get method */ } else if (!ShowSetMethodForProperty && propSetters.Contains(mi)) { /* hidden set method */ } else { if (ParseMethodBodyIL) { Methods.Add(new SerializableMethodData(mDetail, ReadMethodBodyAndAddAssociations(mi))); } else { Methods.Add(new SerializableMethodData(mDetail, "")); } } } } HasMethods = Methods.Any(); }
public override GEDCOMTag AddTag(string tagName, string tagValue, TagConstructor tagConstructor) { GEDCOMTag result; if (tagName == "NAME") { result = AddPersonalName(new GEDCOMPersonalName(Owner, this, tagName, tagValue)); } else if (tagName == "SUBM") { result = Submittors.Add(new GEDCOMPointer(Owner, this, tagName, tagValue)); } else if (tagName == "ANCI") { result = AncestorsInterest.Add(new GEDCOMPointer(Owner, this, tagName, tagValue)); } else if (tagName == "DESI") { result = DescendantsInterest.Add(new GEDCOMPointer(Owner, this, tagName, tagValue)); } else if (tagName == "_GROUP") { result = fGroups.Add(new GEDCOMPointer(Owner, this, tagName, tagValue)); } else { result = fTagsFactory.CreateTag(Owner, this, tagName, tagValue); if (result != null) { if (result is GEDCOMChildToFamilyLink) { result = ChildToFamilyLinks.Add(result as GEDCOMChildToFamilyLink); } else if (result is GEDCOMSpouseToFamilyLink) { result = SpouseToFamilyLinks.Add(result as GEDCOMSpouseToFamilyLink); } else if (result is GEDCOMIndividualOrdinance) { result = IndividualOrdinances.Add(result as GEDCOMIndividualOrdinance); } else if (result is GEDCOMAssociation) { result = Associations.Add(result as GEDCOMAssociation); } else if (result is GEDCOMIndividualEvent) { result = AddEvent(result as GEDCOMCustomEvent); } else if (result is GEDCOMIndividualAttribute) { result = AddEvent(result as GEDCOMCustomEvent); } else if (result is GEDCOMAlias) { result = Aliases.Add(result as GEDCOMAlias); } } else { result = base.AddTag(tagName, tagValue, tagConstructor); } } return(result); }
public void AddAssociation(XElement association, string associationKey) { Associations.Add(association); _addedAssociations.Add(associationKey); }
public void ConnectWith(IEnumerable <NodeNFA> nodes, string symbol) { Associations.Add(symbol, nodes); }
public void AddAssociation(NewFileIconAssociation association) { Associations.Add(association); Rows.Add(association.FileIcon, association.FileType); }