static void Main(string[] args)
        {
            CLOptions options = new CLOptions();

            Parser.Default.ParseArguments(args, options);

            APIReflector reflector = new APIReflector(options);

            reflector.reflectClasses(options);
        }
 public APIReflector(CLOptions options)
 {
     if (options.outputFile == null)
     {
         classStore = new MongoClassStore(options);
     }
     else
     {
         classStore = new FileClassStore(options.outputFile);
     }
 }
        public MongoClassStore(CLOptions options)
        {
            IMongoClient client = null;

            if (options.password != null)
            {
                MongoCredential credential = MongoCredential.CreateMongoCRCredential("docuWiki", "docuWikiUser", options.password);
                var             settings   = new MongoClientSettings
                {
                    Credentials = new[] { credential }
                };
                settings.Server = new MongoServerAddress("localhost", 27018);
                client          = new MongoClient(settings);
            }
            else
            {
                client = new MongoClient();
            }
            database = client.GetDatabase("docuWiki");
            clearCollection();
        }
        public void reflectClasses(CLOptions options)
        {
            String   assemblyFile = options.assemblyFile;
            Assembly ksp          = null;

            if (assemblyFile == null)
            {
                ksp = typeof(GameEvents).Assembly;
            }
            else
            {
                ksp = Assembly.LoadFrom(assemblyFile);
            }

            foreach (Type type in ksp.GetExportedTypes())
            {
                Debug.WriteLine("reflecting " + type.FullName);
                TopLevelDocumentable rep = reflectTop(type);
                if (rep != null)
                {
                    classStore.storeClass(rep);
                }
            }

            ksp = typeof(ConfigNode).Assembly;

            foreach (Type type in ksp.GetExportedTypes())
            {
                Debug.WriteLine("reflecting " + type.FullName);
                TopLevelDocumentable rep = reflectTop(type);
                if (rep != null)
                {
                    classStore.storeClass(rep);
                }
            }

            ksp = typeof(PQSOrbit).Assembly;

            foreach (Type type in ksp.GetExportedTypes())
            {
                Debug.WriteLine("reflecting " + type.FullName);
                TopLevelDocumentable rep = reflectTop(type);
                if (rep != null)
                {
                    classStore.storeClass(rep);
                }
            }

            ksp = typeof(KSPAssets.AssetDefinition).Assembly;

            foreach (Type type in ksp.GetExportedTypes())
            {
                Debug.WriteLine("reflecting " + type.FullName);
                TopLevelDocumentable rep = reflectTop(type);
                if (rep != null)
                {
                    classStore.storeClass(rep);
                }
            }

            int count = classStore.await();

            Debug.WriteLine("inserted =" + count);
        }