Example #1
0
        /// <summary>
        /// Resolve inheritances in DllProject, use referenced projects to search
        /// </summary>
        public static void Inheritances( UmlProject proj, Hashtable dllprojs, ArrayList errors )
        {
            foreach( DictionaryEntry ent in proj.classes ) {
                Type t = (Type)ent.Key;
                UmlType tp = (UmlType)ent.Value;

                if( tp is UmlClass )
                    if( t.BaseType != null && !t.BaseType.Equals( typeof( object ) ) ) {
                        UmlClass cl = (UmlClass)tp;
                        Type base_type = t.BaseType;

                        cl.BaseList = new ArrayList();
                        UmlProject base_proj = (UmlProject)dllprojs[base_type.Assembly.FullName];

                        if( base_proj == null ) {
                            errors.Add( "unknown assembly: " + base_type.Assembly.FullName );
                            continue;
                        }

                        UmlClass base_class = (UmlClass)base_proj.name_to_class[ base_type.FullName ];

                        if( base_class == null ) {
                            errors.Add( "unknown class in assembly: " + base_type.FullName );
                            continue;
                        }

                        cl.BaseList.Add( base_class );
                    } else
                        ((UmlClass)tp).BaseList = null;
            }
        }
Example #2
0
        public static bool UpdateProject(UmlProject proj)
        {
            string dllname = proj.filename;

            if (!File.Exists(dllname))
            {
                return(false);
            }
            if (proj.write_time.Equals(File.GetLastWriteTime(dllname)))
            {
                proj.Visit(new UmlObject.Visitor(ClearDeleted), null);
                return(true);
            }
            System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFile(dllname);
            if (assem == null)
            {
                return(false);
            }

            proj.name       = assem.FullName;
            proj.write_time = File.GetLastWriteTime(dllname);
            proj.refs       = new ArrayList();
            foreach (AssemblyName refasm in assem.GetReferencedAssemblies())
            {
                proj.refs.Add(refasm.FullName);
            }

            ModelBuilder mb = new ModelBuilder();

            mb.assem           = assem;
            mb.root            = proj.root;
            proj.classes       = mb.classes = new Hashtable();
            proj.name_to_class = mb.name_to_class = new Hashtable();
            return(mb.Update());
        }
Example #3
0
 public static UmlProject CreateProjectFromName( string name )
 {
     System.Reflection.Assembly assem = System.Reflection.Assembly.LoadWithPartialName( name );
     if( assem == null )
         return null;
     UmlProject proj = new UmlProject();
     proj.filename = assem.GetModules()[0].FullyQualifiedName;
     proj.name = assem.FullName;
     proj.guid = "{" + System.Guid.NewGuid().ToString().ToLower() + "}";
     proj.root = new UmlNamespace();
     proj.root.name = String.Empty;
     return proj;
 }
Example #4
0
 public static UmlProject CreateProject( string dllname )
 {
     if( !File.Exists( dllname ) )
         return null;
     System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFile( dllname );
     if( assem == null )
         return null;
     UmlProject proj = new UmlProject();
     proj.filename = dllname;
     proj.name = assem.FullName;
     proj.guid = "{" + System.Guid.NewGuid().ToString().ToLower() + "}";
     proj.root = new UmlNamespace();
     proj.root.name = String.Empty;
     return proj;
 }
Example #5
0
        public static UmlProject CreateProjectFromName(string name)
        {
            System.Reflection.Assembly assem = System.Reflection.Assembly.LoadWithPartialName(name);
            if (assem == null)
            {
                return(null);
            }
            UmlProject proj = new UmlProject();

            proj.filename  = assem.GetModules()[0].FullyQualifiedName;
            proj.name      = assem.FullName;
            proj.guid      = "{" + System.Guid.NewGuid().ToString().ToLower() + "}";
            proj.root      = new UmlNamespace();
            proj.root.name = String.Empty;
            return(proj);
        }
Example #6
0
        public static UmlProject CreateProject(string dllname)
        {
            if (!File.Exists(dllname))
            {
                return(null);
            }
            System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFile(dllname);
            if (assem == null)
            {
                return(null);
            }
            UmlProject proj = new UmlProject();

            proj.filename  = dllname;
            proj.name      = assem.FullName;
            proj.guid      = "{" + System.Guid.NewGuid().ToString().ToLower() + "}";
            proj.root      = new UmlNamespace();
            proj.root.name = String.Empty;
            return(proj);
        }
Example #7
0
        /// <summary>
        /// Resolve inheritances in DllProject, use referenced projects to search
        /// </summary>
        public static void Inheritances(UmlProject proj, Hashtable dllprojs, ArrayList errors)
        {
            foreach (DictionaryEntry ent in proj.classes)
            {
                Type    t  = (Type)ent.Key;
                UmlType tp = (UmlType)ent.Value;

                if (tp is UmlClass)
                {
                    if (t.BaseType != null && !t.BaseType.Equals(typeof(object)))
                    {
                        UmlClass cl        = (UmlClass)tp;
                        Type     base_type = t.BaseType;

                        cl.BaseList = new ArrayList();
                        UmlProject base_proj = (UmlProject)dllprojs[base_type.Assembly.FullName];

                        if (base_proj == null)
                        {
                            errors.Add("unknown assembly: " + base_type.Assembly.FullName);
                            continue;
                        }

                        UmlClass base_class = (UmlClass)base_proj.name_to_class[base_type.FullName];

                        if (base_class == null)
                        {
                            errors.Add("unknown class in assembly: " + base_type.FullName);
                            continue;
                        }

                        cl.BaseList.Add(base_class);
                    }
                    else
                    {
                        ((UmlClass)tp).BaseList = null;
                    }
                }
            }
        }
Example #8
0
        public static bool UpdateProject( UmlProject proj )
        {
            string dllname = proj.filename;

            if( !File.Exists( dllname ) )
                return false;
            if( proj.write_time.Equals( File.GetLastWriteTime( dllname ) ) ) {
                proj.Visit( new UmlObject.Visitor( ClearDeleted ), null );
                return true;
            }
            System.Reflection.Assembly assem = System.Reflection.Assembly.LoadFile( dllname );
            if( assem == null )
                return false;

            proj.name = assem.FullName;
            proj.write_time = File.GetLastWriteTime( dllname );
            proj.refs = new ArrayList();
            foreach( AssemblyName refasm in assem.GetReferencedAssemblies() )
                proj.refs.Add( refasm.FullName );

            ModelBuilder mb = new ModelBuilder();
            mb.assem = assem;
            mb.root = proj.root;
            proj.classes = mb.classes = new Hashtable();
            proj.name_to_class = mb.name_to_class = new Hashtable();
            return mb.Update();
        }