コード例 #1
0
ファイル: Program.cs プロジェクト: afrog33k/mcocoa
    private static void DoParseHeaders(AnalyzeHeader analyze, string dir, bool emitting)
    {
        var parser = new NewParser();
        string[] files = Directory.GetFiles(dir, "*.h");
        foreach (string inFile in files)
        {
            if (!inFile.EndsWith("NSObjCRuntime.h"))
            {
                string text = File.ReadAllText(inFile);
                XmlNode node = parser.Parse(text, inFile);

                analyze.Header(node.ChildNodes[0], inFile, emitting);
            }
        }
    }
コード例 #2
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);
    }