public static int Main(string [] args)
    {
        string dir      = null;
        string lib      = null;
        var    debug    = Environment.GetEnvironmentVariable("DOCFIXER");
        bool   debugDoc = false;

        DocGenerator.DebugDocs = false;

        for (int i = 0; i < args.Length; i++)
        {
            var arg = args [i];
            if (arg == "-h" || arg == "--help")
            {
                Help();
                return(0);
            }
            if (arg == "--appledocs")
            {
                mergeAppledocs = true;
                continue;
            }
            if (arg == "--debugdoc")
            {
                DocGenerator.DebugDocs = true;
                debugDoc = true;
                continue;
            }

            if (lib == null)
            {
                lib = arg;
            }
            else
            {
                dir = arg;
            }
        }

        if (dir == null)
        {
            Help();
            return(1);
        }

        if (File.Exists(Path.Combine(dir, "en")))
        {
            Console.WriteLine("The directory does not seem to be the root for documentation (missing `en' directory)");
            return(1);
        }
        assembly_dir = Path.Combine(dir, "en");
        assembly     = Assembly.LoadFrom(lib);

        foreach (Type t in assembly.GetTypes())
        {
            if (debugDoc)
            {
                string str = DocGenerator.GetAppleDocFor(t);
                if (str == null)
                {
                    Console.WriteLine("Could not find docs for {0}", t);
                }

                continue;
            }

            if (debug != null && t.FullName != debug)
            {
                continue;
            }

            var btas = t.GetCustomAttributes(typeof(BaseTypeAttribute), true);
            if (btas.Length > 0)
            {
                ProcessNSO(t, (BaseTypeAttribute)btas [0]);
            }
        }

        Console.WriteLine("saving");
        SaveDocs();

        return(0);
    }