예제 #1
0
파일: Program.cs 프로젝트: afrog33k/mcocoa
    private static void DoGenerateFromXML(ObjectModel objects, XmlNode framework)
    {
        string name = framework.Attributes["name"].Value;
        Blacklist[] blacklist = DoGetBlacklist(framework);
        Threading[] threading = DoGetThreading(framework);

        string outPath = ms_outDir;
        outPath = Path.Combine(outPath, name);
        outPath = Path.Combine(outPath, "generated");

        string[] files;
        if (Directory.Exists(outPath))
        {
            files = Directory.GetFiles(outPath, "*.cs", SearchOption.AllDirectories);
            foreach (string file in files)
                File.SetAttributes(file, FileAttributes.Normal);	// need to unlock generated .cs files so we can delete the directory
            Directory.Delete(outPath, true);
        }
        Directory.CreateDirectory(outPath);

        string dir;
        var analyze = new AnalyzeHeader(objects);
        foreach (XmlNode child in framework.ChildNodes)
        {
            if (child.Name == "Include")
            {
                dir = child.Attributes["path"].Value;
                DoParseHeaders(analyze, dir, false);
            }
        }

        objects.Reset();			// need to clear out any files from previous frameworks
        dir = framework.Attributes["path"].Value;
        DoParseHeaders(analyze, dir, true);

        analyze.PostParse();
        Generate generate = new Generate(objects);
        generate.Code(outPath, blacklist, threading);
    }