Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

100% Reflective Class Diagram Creation Tool

, 14 Jun 2011 CPOL
100% Reflective Class Diagram Creation Tool
autodiagramer.zip
AutoDiagramer
AutoDiagramer
AutoDiagramer.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.application
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.pdb
AutoDiagramer.publish
AutoDiagramer.application
AutoDiagramer_1_7_0_0
AutoDiagramer.exe.deploy
AutoDiagramer.exe.manifest
np.ico.deploy
setup.exe
AutoDiagramer.vshost.application
AutoDiagramer.vshost.exe
AutoDiagramer.vshost.exe.manifest
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
obj
Debug
AutoDiagramer.application
AutoDiagramer.csproj.GenerateResource.Cache
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.frmAbout.resources
AutoDiagramer.frmMain.resources
AutoDiagramer.frmSave.resources
AutoDiagramer.frmSettings.resources
AutoDiagramer.frmZoom.resources
AutoDiagramer.InputBoxDialog.resources
AutoDiagramer.pdb
AutoDiagramer.Properties.Resources.resources
AutoDiagramer.Resource1.resources
AutoDiagramer.ucExpander.resources
ClassDiagFromAssembly.csproj.GenerateResource.Cache
Refactor
TempPE
Properties.Resources.Designer.cs.dll
Resource1.Designer.cs.dll
Printing
Properties
Settings.settings
Thumbs.db
autodiagramerdll.zip
AutoDiagramer.dll
autodiagrammer.zip
AutoDiagrammer
AutoDiagramerReflectorAddin
AutoDiagramerReflectorAddin.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.dll
AutoDiagramer.pdb
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
Printing
Properties
Settings.settings
Thumbs.db
AutoDiagramerStandAlone
AutoDiagramerStandAlone.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.application
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.pdb
AutoDiagramer.publish
AutoDiagramer.application
AutoDiagramer_1_12_0_0
AutoDiagramer.exe.deploy
AutoDiagramer.exe.manifest
np.ico.deploy
setup.exe
AutoDiagramer.vshost.application
AutoDiagramer.vshost.exe
AutoDiagramer.vshost.exe.manifest
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
Printing
Properties
Settings.settings
Thumbs.db
autodiagrammer2.zip
AutoDiagramer
AutoDiagramer.csproj.user
AutoDiagramer_TemporaryKey.pfx
bin
Debug
AutoDiagramer.application
AutoDiagramer.exe
AutoDiagramer.exe.manifest
AutoDiagramer.pdb
AutoDiagramer.publish
AutoDiagramer.application
AutoDiagramer_1_9_0_0
AutoDiagramer.exe.deploy
AutoDiagramer.exe.manifest
np.ico.deploy
Reflector.exe.deploy
setup.exe
AutoDiagramer.vshost.exe
Reflector.cfg
Reflector.exe
Controls
Forms
Helpers
images
about16.png
AboutImg.png
BannerImg.png
Collapse9.png
Constructors16.png
Draw16.png
edging.png
Events16.png
Exit16.png
Expand9.png
Fields16.png
help16.gif
HideTree.png
HideTree16.png
Interfaces16.png
MainCollapse13.png
MainExpand13.png
Method16.png
open16.png
print16.png
Prop16.png
Prop33.png
save16.png
SaveImg.png
Setting16.png
SettingImg.png
ShowTree.png
ShowTree16.png
Thumbs.db
TreeCode.png
TreeLeaf.png
TreeRoot.png
View16.png
np.ico
obj
Printing
Properties
Settings.settings
Thumbs.db
Reflector AddIn DLL
AutoDiagramer.dll
using System;
using System.Collections.Generic;
using System.Text;

namespace AutoDiagramer
{
    #region NameSpaces CLASS
    /// <summary>
    /// Provides methods for dealing with the allocation of individual
    /// <see cref="DrawableClass">DrawableClass</see> objects to 
    /// namespaces. And also the retrieval of only those 
    /// <see cref="DrawableClass">DrawableClass</see> objects
    /// This class implements a thread safe singleton pattern
    /// </summary>
    public sealed class NameSpaces
    {
        #region Instance Fields
        //instance fields
        private Dictionary<string, List<DrawableClass>> _assObjects = new Dictionary<string, List<DrawableClass>>();
        private static volatile AutoDiagramer.NameSpaces instance = null;
        private static object syncRoot = new object();
        #endregion
        #region Contrsuctor
        /// <summary>
        /// Creates a new NameSpaces object
        /// </summary>
        private NameSpaces()
        {

        }
        #endregion
        #region Public Methods

        /// <summary>
        /// Clear the collection of <see cref="DrawableClass">DrawableClass</see> objects
        /// </summary>
        public void Clear()
        {
            _assObjects.Clear();
        }


        /// <summary>
        /// public property that can get the single instance of the
        /// AutoDiagramer.NameSpaces object. This method uses an object lock
        /// to provide synchorinzation between threads, such that it will provide
        /// a thread safe AutoDiagramer.NameSpaces singleton object
        /// </summary>
        /// <returns>AutoDiagramer.NameSpaces which is the single instance of the
        /// AutoDiagramer.NameSpaces  object</returns>
        public static AutoDiagramer.NameSpaces Instance
        {
            //get the instance
            get
            {
                // only create a new instance if one doesn't already exist.
                if (instance == null)
                {
                    // use this lock to ensure that only one thread is accessing
                    // this block of code at once.
                    lock (syncRoot)
                    {
                        //check to see if instance exists, if not create a new one
                        if (instance == null)
                            instance = new AutoDiagramer.NameSpaces();
                    }
                }
                // return instance where it was just created or already existed.
                return instance;
            }
        }

        /// <summary>
        /// Returns a list of <see cref="DrawableClass">DrawableClass</see>
        /// objects which represents the list of <see cref="DrawableClass">
        /// DrawableClasses</see> requested within the specified namspace
        /// </summary>
        /// <param name="nspace">the specified namspace</param>
        /// <param name="requiredClasses">list of <see cref="DrawableClass">
        /// DrawableClasses</see>  requested</param>
        /// <returns>A list of <see cref="DrawableClass">DrawableClass</see>
        /// objects which represents the list of <see cref="DrawableClass">
        /// DrawableClasses</see> requested within the specified namspace</returns>
        public List<DrawableClass> getDrawableClassesForDiagram(string nspace, List<string> requiredClasses)
        {
            //create a new lists
            List<DrawableClass> outputDrawClasses = new List<DrawableClass>();
            //holding list for output list returned by TryGetValue of Dictionary
            List<DrawableClass> currentDrawClasses = null;
            _assObjects.TryGetValue(nspace, out currentDrawClasses);
            if (currentDrawClasses != null)
            {
                //loop through required DrawableClass list
                foreach (string s in requiredClasses)
                {
                    //if its in the list that belongs to the requested namespace
                    //include it in the outputDrawClasses list
                    foreach (DrawableClass dc in currentDrawClasses)
                    {
                        if (dc != null)
                        {
                            if (dc.Name.ToLower().Equals(s.ToLower()))
                            {
                                outputDrawClasses.Add(dc);
                            }
                        }
                    }                    
                }
                return outputDrawClasses;
            }
            return null;

        }

        /// <summary>
        /// Takes a nspace string and a <see cref="DrawableClass">DrawableClass
        /// </see>class to add to the
        /// namspace. The namespace and all its associated <see cref="DrawableClass">
        /// DrawableClass </see>class objects are stored as a generic Dictionary
        /// </summary>
        /// <param name="nspace">the new namespace to add</param>
        /// <param name="drawClass">The <see cref="DrawableClass">DrawableClass
        /// </see>class to add to the namspace</param>
        public void addNameSpace(string nspace, DrawableClass drawClass)
        {

            //check to see if the namaspace already exists
            if (_assObjects.ContainsKey(nspace))
            {
                //if it does get the list of DrawableClass for it, and add the new DrawableClass
                //and then add the whole lot back into the Dictionary (should overwrite the current entry)
                List<DrawableClass> currentDrawClasses = null;
                _assObjects.TryGetValue(nspace, out currentDrawClasses);
                if (currentDrawClasses != null)
                {
                    currentDrawClasses.Add(drawClass);
                }
            }
            //no namspace like this exists yet, must be 1st one
            else
            {
                _assObjects.Add(nspace, new List<DrawableClass>());
            }
        }
        #endregion
    }
    #endregion
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sacha Barber
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)
 
- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence
 
Both of these at Sussex University UK.
 
Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411023.1 | Last Updated 14 Jun 2011
Article Copyright 2007 by Sacha Barber
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid