Ejemplo n.º 1
0
    private void Serialize(Parser.CefApiNode apiNode)
    {
        var formatter = new BinaryFormatter();
        var stream    = new FileStream(serializedApi, FileMode.Create, FileAccess.Write, FileShare.None);

        formatter.Serialize(stream, apiNode);
        stream.Close();
    }
Ejemplo n.º 2
0
 protected override void Parse(CefApiNode api)
 {
     while (!Done)
     {
         Ensure(
             ParseCefCallbackStruct(api.CefCallbackStructs) ||
             ParseCefExportFunction(api.CefFunctions) ||
             SkipCHeaderCode()
             );
     }
 }
Ejemplo n.º 3
0
 protected override void Parse(CefApiNode api)
 {
     while (!Done)
     {
         Ensure(
             ParseClass(api.CefClasses) ||
             ParseFunction(api.CefCppFunctions) ||
             SkipCHeaderCode() ||
             SkipCppHeaderCode()
             );
     }
 }
Ejemplo n.º 4
0
    public CefApiDeclarations GetDeclarations()
    {
        apiNode = Deserialize();
        string hash = Parser.Parser.ParseApiHash();

        if (apiNode == null || !hash.Equals(apiNode.ApiHashUniversal))
        {
            apiNode = Parser.Parser.Parse();
            apiNode.ApiHashUniversal = hash;
            Serialize(apiNode);
        }
        return(BuildTypes());
    }
Ejemplo n.º 5
0
        internal static CefApiNode Parse()
        {
            var apiNode = new CefApiNode();

            Parser p = new CefCApiParser();

            p.SetFile(Path.Combine("cef", "include", "cef_version.h"));
            p.Parse(apiNode);
            var files = Directory.GetFiles(Path.Combine("cef", "include", "capi"));

            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base_capi.h")
                {
                    continue;
                }
                p.SetFile(f);
                p.Parse(apiNode);
            }



            p = new CefInternalsParser();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types.h"));
            p.Parse(apiNode);

            CefApiNode tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_time.h"));
            p.Parse(tmpApi);
            apiNode.CefValueStructs.AddRange(tmpApi.CefValueStructs);

            tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_list.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_map.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_multimap.h"));
            p.Parse(tmpApi);
            apiNode.CefStringCollectionFunctions = tmpApi.CefFunctions.ToArray();

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_win.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsWindows = tmpApi.CefFunctions;
            apiNode.CefStructsWindows   = tmpApi.CefValueStructs;

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_linux.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsLinux = tmpApi.CefFunctions;
            apiNode.CefStructsLinux   = tmpApi.CefValueStructs;

            p = new CefClassesParser();

            files = Directory.GetFiles(System.IO.Path.Combine("cef", "include"));
            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_resources.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_strings.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_sandbox_win.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_version.h")
                {
                    continue;
                }

                p.SetFile(f);
                p.Parse(apiNode);
            }

            return(apiNode);
        }
Ejemplo n.º 6
0
 protected abstract void Parse(CefApiNode data);
Ejemplo n.º 7
0
        internal static CefApiNode Parse()
        {
            var apiNode = new CefApiNode();

            Parser p = new CefCApiParser();

            p.SetFile(Path.Combine("cef", "include", "cef_version.h"));
            p.Parse(apiNode);
            p.SetFile(Path.Combine("cef", "include", "cef_api_hash.h"));
            p.Parse(apiNode);
            var files = Directory.GetFiles(Path.Combine("cef", "include", "capi"));

            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base_capi.h")
                {
                    continue;
                }
                p.SetFile(f);
                p.Parse(apiNode);
            }



            p = new CefInternalsParser();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types.h"));
            p.Parse(apiNode);

            var errorCodeEnum = apiNode.CefEnums.Find(e => e.Name == "cef_errorcode");

            if (errorCodeEnum != null)
            {
                // CEF now uses preprocessor directives to pull enum values from include/base/internal/cef_net_error_list.h
                // This is a hack to pull the values manually
                if (errorCodeEnum.Members.Count == 1)
                {
                    var fn = Path.Combine("cef", "include", "base", "internal", "cef_net_error_list.h");
                    if (!File.Exists(fn))
                    {
                        Debug.Print("error list file not found - please check.");
                        Debugger.Break();
                    }
                    p.SetFile(fn);
                    (p as CefInternalsParser).ParseNetErrorValues(errorCodeEnum.Members);
                }
                else
                {
                    Debug.Print("enum cef_errorcode_t unexpected member count - please check.");
                    Debugger.Break();
                }
            }
            else
            {
                Debug.Print("enum cef_errorcode_t is missing - please check.");
                Debugger.Break();
            }

            CefApiNode tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_time.h"));
            p.Parse(tmpApi);
            apiNode.CefValueStructs.AddRange(tmpApi.CefValueStructs);

            tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_list.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_map.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_multimap.h"));
            p.Parse(tmpApi);
            apiNode.CefStringCollectionFunctions = tmpApi.CefFunctions.ToArray();

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_win.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsWindows = tmpApi.CefFunctions;
            apiNode.CefStructsWindows   = tmpApi.CefValueStructs;

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_linux.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsLinux = tmpApi.CefFunctions;
            apiNode.CefStructsLinux   = tmpApi.CefValueStructs;

            p = new CefClassesParser();

            files = Directory.GetFiles(System.IO.Path.Combine("cef", "include"));
            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_resources.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_strings.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_sandbox_win.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_version.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_api_hash.h")
                {
                    continue;
                }

                p.SetFile(f);
                p.Parse(apiNode);
            }

            return(apiNode);
        }