public void DrawAllRelation(DllReader dll)
        {
            foreach (DescriptionClass dc in DescriptionClass.PutTypeInList(dll))
            {
                if (dc._mainType.IsInterface)
                    foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                    {
                        DrawRelationInterface(type.Name, dc.GetName(), shapeDict);
                    }
            }
            foreach (DescriptionClass dc in PutClassInList(dll))
            {
                    foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                    {
                        if (type.IsInterface)
                            DrawRelationInterface(type.Name, dc.GetName(), shapeDict);
                        else
                            DrawRelation(type.Name, dc.GetName(), shapeDict);
                    }

                    foreach (Type type in dc._nestedClass)
                    {
                        DrawRelationNested(type.Name, dc.GetName(), shapeDict);
                    }
            }
        }
Beispiel #2
0
        public void DrawAllRelation(DllReader dll)
        {
            foreach (DescriptionClass dc in DescriptionClass.PutTypeInList(dll))
            {
                if (dc._mainType.IsInterface)
                {
                    foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                    {
                        DrawRelationInterface(type.Name, dc.GetName(), shapeDict);
                    }
                }
            }
            foreach (DescriptionClass dc in PutClassInList(dll))
            {
                foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                {
                    if (type.IsInterface)
                    {
                        DrawRelationInterface(type.Name, dc.GetName(), shapeDict);
                    }
                    else
                    {
                        DrawRelation(type.Name, dc.GetName(), shapeDict);
                    }
                }

                foreach (Type type in dc._nestedClass)
                {
                    DrawRelationNested(type.Name, dc.GetName(), shapeDict);
                }
            }
        }
Beispiel #3
0
 public DescriptionClass(DllReader test, Type type)
 {
     _mainType    = type;
     _subClasses  = SortListSubClass(test.GetParentsAndInterfaces(_mainType), test);
     _nestedClass = type.GetNestedTypes().ToList();
     _property    = type.GetProperties().ToList();
     _field       = SortListFi(type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).ToList());
     _method      = SortListMi(type.GetMethods().ToList());
 }
 public DescriptionClass(DllReader test, Type type)
 {
     _mainType = type;
     _subClasses = SortListSubClass(test.GetParentsAndInterfaces(_mainType), test);
     _nestedClass = type.GetNestedTypes().ToList();
     _property = type.GetProperties().ToList();
     _field = SortListFi(type.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).ToList());
     _method = SortListMi(type.GetMethods().ToList());
 }
 public static List<DescriptionClass> PutTypeInList(DllReader dllReader)
 {
     List<DescriptionClass> allClasses = new List<DescriptionClass>();
     DescriptionClass dClass;
     foreach (Type type in dllReader.GetAllTypes())
     {
         dClass = new DescriptionClass(dllReader, type);
         allClasses.Add(dClass);
     }
     return allClasses;
 }
Beispiel #6
0
        public static List <DescriptionClass> PutTypeInList(DllReader dllReader)
        {
            List <DescriptionClass> allClasses = new List <DescriptionClass>();
            DescriptionClass        dClass;

            foreach (Type type in dllReader.GetAllTypes())
            {
                dClass = new DescriptionClass(dllReader, type);
                allClasses.Add(dClass);
            }
            return(allClasses);
        }
Beispiel #7
0
        public List <DescriptionClass> PutClassInList(DllReader dll)
        {
            List <DescriptionClass> lDc = new List <DescriptionClass>();

            foreach (DescriptionClass dc in DescriptionClass.PutTypeInList(dll))
            {
                if (!dc._mainType.IsInterface && !dc._mainType.IsNested)
                {
                    lDc.Add(dc);
                }
            }
            return(lDc);
        }
 public int CountNbTimeCall(Type type, DllReader test)
 {
     int counter = 0;
     foreach (DescriptionClass dc in DescriptionClass.PutTypeInList(test))
     {
         if (!dc._mainType.IsInterface)
         {
             foreach (Type t in dc._subClasses)
                 if (t == type)
                     counter++;
         }
     }
     return counter;
 }
Beispiel #9
0
        public int CountNbTimeCall(Type type, DllReader test)
        {
            int counter = 0;

            foreach (DescriptionClass dc in DescriptionClass.PutTypeInList(test))
            {
                if (!dc._mainType.IsInterface)
                {
                    foreach (Type t in dc._subClasses)
                    {
                        if (t == type)
                        {
                            counter++;
                        }
                    }
                }
            }
            return(counter);
        }
Beispiel #10
0
        //triage de liste subClasse pour enlever les classes déjà utilisé par les classes mères.
        public List <Type> SortListSubClass(List <Type> sClass, DllReader test)
        {
            List <Type> lIndex = new List <Type>();

            foreach (Type type in sClass)
            {
                foreach (Type t in test.GetParentsAndInterfaces(type))
                {
                    if (sClass.Contains(t))
                    {
                        lIndex.Add(t);
                    }
                }
            }
            foreach (Type t in lIndex)
            {
                sClass.Remove(t);
            }
            return(sClass);
        }
Beispiel #11
0
        public void loadAssembly(Assembly assembly)
        {
            /********************Algorithme de placement *********************************/
            DllReader test = new DllReader(assembly.Location);

            /**********Interfaces**************/
            int x = 100;
            int y = 100;
            int xCount;

            IEnumerable <DescriptionClass> requete = from dc in PutInterfaceInList(test)
                                                     orderby CountNbTimeCall(dc._mainType, test)
                                                     select dc;

            List <DescriptionClass> interfaceList = requete.ToList <DescriptionClass>();
            int index = 0;

            while (index != interfaceList.Count)
            {
                if (interfaceList.ElementAt(index)._subClasses.Count == 0)
                {
                    DrawInterfaceShape(interfaceList.ElementAt(index).GetName(), x, y, shapeDict);
                    interfaceList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y    += 400;
            x     = 100;
            index = 0;
            while (index != interfaceList.Count)
            {
                if (CountNbTimeCall(interfaceList.ElementAt(index)._mainType, test) == 0)
                {
                    DrawInterfaceShape(interfaceList.ElementAt(index).GetName(), x, y, shapeDict);
                    interfaceList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y -= 200;
            x  = 600;

            foreach (DescriptionClass dc in interfaceList)
            {
                DrawInterfaceShape(dc.GetName(), x, y, shapeDict);
                x += 200;
            }

            foreach (DescriptionClass dc in PutInterfaceInList(test))
            {
                foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                {
                    DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                }
            }

            /************Classes***********************/



            x       = 0;
            y       = 800;
            requete = from dc in PutClassInList(test)
                      orderby CountNbTimeCall(dc._mainType, test)
                      select dc;

            List <DescriptionClass> classList = requete.ToList <DescriptionClass>();

            index = 0;

            while (index != classList.Count)
            {
                if (classList.ElementAt(index)._subClasses.Count == 0)
                {
                    DrawClassShape(classList.ElementAt(index).GetName(), x, y, shapeDict);
                    xCount = 0;
                    foreach (Type type in classList.ElementAt(index)._nestedClass)
                    {
                        DrawNestedClassShape(type.Name, x + xCount, y - 200, shapeDict);
                        xCount += 100;
                    }
                    classList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y    += 400;
            x     = 100;
            index = 0;
            while (index != classList.Count)
            {
                if (CountNbTimeCall(classList.ElementAt(index)._mainType, test) == 0)
                {
                    DrawClassShape(classList.ElementAt(index).GetName(), x, y, shapeDict);
                    classList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y -= 200;
            x  = 600;

            foreach (DescriptionClass dc in classList)
            {
                DrawClassShape(dc.GetName(), x, y, shapeDict);
                x += 200;
            }

            foreach (DescriptionClass dc in PutClassInList(test))
            {
                foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                {
                    if (type.IsInterface)
                    {
                        DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                    }
                    else
                    {
                        DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                    }
                }
            }

            foreach (DescriptionClass dc in PutClassInList(test))
            {
                foreach (Type type in dc._nestedClass)
                {
                    DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                }
            }
        }
 public List<DescriptionClass> PutInterfaceInList(DllReader dll)
 {
     List<DescriptionClass> lDc = new List<DescriptionClass>();
     foreach (DescriptionClass dc in DescriptionClass.PutTypeInList(dll))
     {
         if(dc._mainType.IsInterface)
             lDc.Add(dc);
     }
     return lDc;
 }
        public void loadAssembly( Assembly assembly )
        {
            /********************Algorithme de placement *********************************/
            DllReader test = new DllReader(assembly.Location);

            /**********Interfaces**************/
            int x = 100;
            int y = 100;
            int xCount;

            IEnumerable<DescriptionClass> requete = from dc in PutInterfaceInList(test)
                                                    orderby CountNbTimeCall(dc._mainType, test)
                                                    select dc;
            List<DescriptionClass> interfaceList = requete.ToList<DescriptionClass>();
            int index = 0;

            while (index != interfaceList.Count)
            {
                if (interfaceList.ElementAt(index)._subClasses.Count == 0)
                {
                    DrawInterfaceShape(interfaceList.ElementAt(index).GetName(), x, y, shapeDict);
                    interfaceList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y += 400;
            x = 100;
            index = 0;
            while (index != interfaceList.Count)
            {
                if (CountNbTimeCall(interfaceList.ElementAt(index)._mainType, test) == 0)
                {
                    DrawInterfaceShape(interfaceList.ElementAt(index).GetName(), x, y, shapeDict);
                    interfaceList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y -= 200;
            x = 600;

            foreach (DescriptionClass dc in interfaceList)
            {
                DrawInterfaceShape(dc.GetName(), x, y, shapeDict);
                x += 200;
            }

            foreach (DescriptionClass dc in PutInterfaceInList(test))
                foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                {
                    DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                }

            /************Classes***********************/

            x = 0;
            y = 800;
            requete = from dc in PutClassInList(test)
                      orderby CountNbTimeCall(dc._mainType, test)
                      select dc;
            List<DescriptionClass> classList = requete.ToList<DescriptionClass>();
            index = 0;

            while (index != classList.Count)
            {
                if (classList.ElementAt(index)._subClasses.Count == 0)
                {
                    DrawClassShape(classList.ElementAt(index).GetName(), x, y, shapeDict);
                    xCount = 0;
                    foreach (Type type in classList.ElementAt(index)._nestedClass)
                    {
                        DrawNestedClassShape(type.Name, x + xCount, y - 200, shapeDict);
                        xCount += 100;
                    }
                    classList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y += 400;
            x = 100;
            index = 0;
            while (index != classList.Count)
            {
                if (CountNbTimeCall(classList.ElementAt(index)._mainType, test) == 0)
                {
                    DrawClassShape(classList.ElementAt(index).GetName(), x, y, shapeDict);
                    classList.RemoveAt(index);
                    index--;
                    x += 200;
                }

                index++;
            }
            y -= 200;
            x = 600;

            foreach (DescriptionClass dc in classList)
            {
                DrawClassShape(dc.GetName(), x, y, shapeDict);
                x += 200;
            }

            foreach (DescriptionClass dc in PutClassInList(test))
                foreach (Type type in dc.SortListType(dc._subClasses, dc._mainType))
                {
                    if (type.IsInterface)
                        DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                    else
                        DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                }

            foreach (DescriptionClass dc in PutClassInList(test))
                foreach (Type type in dc._nestedClass)
                {
                    DrawLineRelation(type.Name, dc.GetName(), shapeDict);
                }
        }
 //triage de liste subClasse pour enlever les classes déjà utilisé par les classes mères.
 public List<Type> SortListSubClass(List<Type> sClass, DllReader test)
 {
     List<Type> lIndex = new List<Type>();
     foreach (Type type in sClass)
     {
         foreach (Type t in test.GetParentsAndInterfaces(type))
         {
             if (sClass.Contains(t))
                 lIndex.Add(t);
         }
     }
     foreach (Type t in lIndex)
         sClass.Remove(t);
     return sClass;
 }
Beispiel #15
0
        private void drawToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DllReader test = new DllReader(_loadedAssembly.Location);

            _diagramDisplayControl.DrawAllRelation(test);
        }
Beispiel #16
0
 private void drawToolStripMenuItem_Click(object sender, EventArgs e)
 {
     DllReader test = new DllReader(_loadedAssembly.Location);
     _diagramDisplayControl.DrawAllRelation(test);
 }