Пример #1
0
    private void AddFunctionFunctionality()
    {
        GUILayout.BeginHorizontal();
        {
            GUILayout.Space(_defaultSpacing);
            if (GUILayout.Button("Add function", GUILayout.Width(150)))
            {
                if (_functionConfig == null)
                {
                    _self.AddFunction();
                }
                else
                {
                    _self.AddFunction(_functionConfig);
                    _functionConfig = null;
                }

                _showFunctions = true;

                if (FunctionAdded != null)
                {
                    FunctionAdded();
                }
            }
            _functionConfig = (FunctionConfig)EditorGUILayout.ObjectField(_functionConfig, typeof(FunctionConfig), true);
            GUILayout.Space(_defaultSpacing);
        }
        GUILayout.EndHorizontal();
    }
Пример #2
0
        private static FetchMatchesRequest GetFetchMatchesRequest()
        {
            var guid = Guid.NewGuid().ToString();
            var pool = new Pool();

            pool.Name = $"pool-{guid}";
            // フロントエンドリクエスト時の文字列を指定
            pool.TagPresentFilters.Add(new TagPresentFilter()
            {
                Tag = GameMode.Multi.ToString()
            });

            var config = new FunctionConfig
            {
                Host = MatchFunctionUrl,
                Port = MatchFunctionPort,
                Type = FunctionConfig.Types.Type.Grpc
            };

            var profile = new MatchProfile();

            profile.Name = "multi-100";
            profile.Pools.Add(pool);

            return(new FetchMatchesRequest
            {
                Config = config,
                Profile = profile
            });
        }
Пример #3
0
        public async Task <Stream> FunctionHandler(Stream input, ILambdaContext context)
        {
            var ssm = new AmazonSimpleSystemsManagementClient();

            const string googleComputeParameter      = "/estranged/google/compute";
            const string communityWebhookParameter   = "/estranged/discord/webhooks/community";
            const string reviewsWebhookParameter     = "/estranged/discord/webhooks/reviews";
            const string gamingWebhookParameter      = "/estranged/discord/webhooks/gaming";
            const string syndicationWebhookParameter = "/estranged/discord/webhooks/syndication";

            var parameters = (await ssm.GetParametersAsync(new GetParametersRequest
            {
                Names = new List <string>
                {
                    googleComputeParameter,
                    communityWebhookParameter,
                    reviewsWebhookParameter,
                    gamingWebhookParameter,
                    syndicationWebhookParameter
                }
            })).Parameters.ToDictionary(x => x.Name, x => x.Value);

            var config = new FunctionConfig
            {
                EstrangedDiscordCommunityWebhook   = parameters[communityWebhookParameter],
                EstrangedDiscordReviewsWebhook     = parameters[reviewsWebhookParameter],
                EstrangedDiscordGamingWebhook      = parameters[gamingWebhookParameter],
                EstrangedDiscordSyndicationWebhook = parameters[syndicationWebhookParameter]
            };

            var httpClient = new HttpClient();

            var services = new ServiceCollection()
                           .AddLogging(options =>
            {
                options.AddConsole();
                options.SetMinimumLevel(LogLevel.Warning);
            })
                           .AddSingleton <IRunnable, CommunityRunnable>()
                           .AddSingleton <IRunnable, ReviewsRunnable>()
                           .AddSingleton <IRunnable, SyndicationRunnable>()
                           .AddSingleton(TranslationClient.Create(GoogleCredential.FromJson(parameters[googleComputeParameter])))
                           .AddSteam(new SteamConfig {
                HttpClient = httpClient
            })
                           .AddSingleton <ISeenItemRepository, SeenItemRepository>()
                           .AddSingleton <IAmazonDynamoDB, AmazonDynamoDBClient>()
                           .AddSingleton <Scraper>()
                           .AddSingleton(httpClient)
                           .AddSingleton(config);

            var provider = services.BuildServiceProvider();

            await Task.WhenAll(provider.GetServices <IRunnable>().SelectMany(x => x.RunAsync(CancellationToken.None)));

            return(input);
        }
Пример #4
0
        public void TestFunctionConfig()
        {
            FunctionConfig config = new FunctionConfig();

            try
            {
                config.Init();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("Test only");
        }
Пример #5
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var section = Configuration.GetSection("AzureFunctions");
            Dictionary <string, FunctionOptions> mapFunctionUrl = section.GetChildren()
                                                                  .ToDictionary(x => x.Key, x => new FunctionOptions()
            {
                Url = x.GetSection("Url").Value
            });
            var functionConfig = new FunctionConfig()
            {
                MapOption = mapFunctionUrl
            };

            services.AddSingleton(functionConfig);
            services.AddHttpClient <IHashFuncClient, HashFuncClient>();
            services.AddControllers();
        }
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequest req,
            ILogger log, ExecutionContext context)
        {
            FunctionConfig funcConfig = null;
            BlogLogger     blobLogger = null;

            try{
                funcConfig = new FunctionConfig(context);
                blobLogger = new BlogLogger(funcConfig.StorageConnectionString);

                string requestBody = await new StreamReader(req.Body).ReadToEndAsync();

                var item = new KeyValuePair <string, StringValues>("x-api-key", new StringValues(funcConfig.FuncApiKey));
                if (!req.Headers.Contains(item))
                {
                    return(new NotFoundObjectResult(new { Id = -1, error = "Unknown error." }));
                }

                if (!_httpClient.DefaultRequestHeaders.Contains("x-api-key"))
                {
                    _httpClient.DefaultRequestHeaders.Add("x-api-key", funcConfig.ApiKeyForEmailSenderService);
                }

                var payload  = new StringContent(requestBody, Encoding.UTF8, "application/json");
                var response = await _httpClient.PostAsync(funcConfig.EmailSenderServiceUri, payload);

                var result = await response.Content.ReadAsStringAsync();

                await blobLogger.Log($"requestBody: {requestBody}");

                await blobLogger.Log($"inboundIP: {_utility.GetInboundIp(req)}");

                return(new OkObjectResult(result));
            }
            catch (Exception exc)
            {
                await blobLogger?.Log($"error: {exc.Message}");

                return(new NoContentResult());
            }
        }
Пример #7
0
 public HashFuncClient(HttpClient client, FunctionConfig functionConfig, ILogger <HashFuncClient> logger)
 {
     this.client         = client;
     this.functionConfig = functionConfig;
     this.logger         = logger;
 }
Пример #8
0
 /// <summary>
 /// 检测某条件的功能开启
 /// </summary>
 public void checkAllFunctions()
 {
     toCheckDic(FunctionConfig.getDic());
 }
Пример #9
0
        public void TestFunctionConfig()
        {
            FunctionConfig conf = new FunctionConfig();

            conf.Init();
        }
Пример #10
0
    //private (string[], int[]) LoadConfig(string configName)
    //{
    //    var data = AssetDatabase.LoadAssetAtPath<IdNameTableObject>($"Assets/{configName}.asset");
    //    var kArr = new string[data.Names.Length + 1];
    //    kArr[0] = "(空)";
    //    var vArr = new int[data.Names.Length + 1];
    //    for (int i = 0; i < data.Names.Length; i++)
    //    {
    //        kArr[i + 1] = data.Names[i];
    //    }
    //    for (int i = 0; i < vArr.Length; i++)
    //    {
    //        vArr[i] = i;
    //    }
    //    return (kArr, vArr);
    //}

    private void OnGUI()
    {
        BuffHelper.Init();
        //textColor = GUI.skin.textField.normal.textColor;
        //BuffHelper.buffTypeKArr =  BuffHelper.buffTypes.Values.ToArray();
        //BuffHelper.buffTypeVArr =  BuffHelper.buffTypes.Keys.ToArray();
        //BuffHelper.logicTypeKArr = BuffHelper.logicTypes.Values.ToArray();
        //BuffHelper.logicTypeVArr = BuffHelper.logicTypes.Keys.ToArray();

        //(BuffHelper.stateTypeKArr, BuffHelper.stateTypeVArr) = LoadConfig("状态配置");
        //BuffHelper.stateTypeKArr[0] = "(请选择状态)";
        //(BuffHelper.numericTypeKArr, BuffHelper.numericTypeVArr) = LoadConfig("属性配置");
        //BuffHelper.numericTypeKArr[0] = "(请选择属性)";
        //(BuffHelper.actionTypeKArr, BuffHelper.actionTypeVArr) = LoadConfig("动作配置");
        //BuffHelper.actionTypeKArr[0] = "(请选择动作)";
        //(BuffHelper.conditionTypeKArr, BuffHelper.conditionTypeVArr) = LoadConfig("条件配置");
        //BuffHelper.conditionTypeKArr[0] = "(请选择条件)";

        textColor = GUI.skin.textField.normal.textColor;
        scrollPos = EditorGUILayout.BeginScrollView(scrollPos); // 组开始

        BuffConfig removeBuff = null;

        foreach (var item in buffConfigs)
        {
            EditorGUILayout.BeginHorizontal(/*GUILayout.Height(16)*/);
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                GUILayout.Label("ID:");
                item.Id = EditorGUILayout.IntField(item.Id, GUILayout.Width(60));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                GUILayout.Label("名称:");
                item.Name = EditorGUILayout.TextField(item.Name, GUILayout.Width(60));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                GUILayout.Label("时间:");
                item.Duration = EditorGUILayout.FloatField(item.Duration, GUILayout.Width(60));
                GUILayout.Label(":");
                EditorGUILayout.EndHorizontal();

                if (item.Functions == null)
                {
                    item.Functions = new List <FunctionConfig>()
                    {
                        new FunctionConfig()
                        {
                            Type = 1
                        }
                    };
                }
                FunctionConfig removeFunc = null;
                EditorGUILayout.BeginVertical();
                foreach (var func in item.Functions)
                {
                    EditorGUILayout.BeginHorizontal();
                    OnFuncDraw(func);
                    {
                        EditorGUILayout.BeginHorizontal(GUILayout.Width(30));
                        if (GUILayout.Button("-"))
                        {
                            removeFunc = (func);
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                    EditorGUILayout.EndHorizontal();
                }
                if (removeFunc != null)
                {
                    item.Functions.Remove(removeFunc);
                }
                if (item.Functions.Count == 0)
                {
                    removeBuff = item;
                }
                GUI.color = Color.white;
                {
                    EditorGUILayout.BeginHorizontal(GUILayout.Width(30));
                    if (GUILayout.Button("+"))
                    {
                        item.Functions.Add(new FunctionConfig());
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
        if (removeBuff != null)
        {
            buffConfigs.Remove(removeBuff);
        }
        if (GUILayout.Button("+", GUILayout.Height(30)))
        {
            buffConfigs.Add(new BuffConfig()
            {
                Id = buffConfigs.Count
            });
        }

        EditorGUILayout.EndScrollView(); // 组结束
    }
Пример #11
0
    private void OnFuncDraw(FunctionConfig func)
    {
        EditorGUILayout.BeginHorizontal(GUILayout.Width(120));
        if (func.Type == 1)
        {
            GUILayout.Label("执行");
        }
        else
        {
            GUILayout.Label("附加");
        }
        func.Type = IntPopupDecorate(func.Type, BuffHelper.buffTypeKArr, BuffHelper.buffTypeVArr, 120);
        EditorGUILayout.EndHorizontal();

        if (func.Type == 1)
        {
            if (func.ExecuteLogic == null)
            {
                func.ExecuteLogic = new ExecuteLogic();
            }
            var executeLogic = func.ExecuteLogic;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
            executeLogic.Type = IntPopupDecorate(executeLogic.Type, BuffHelper.logicTypeKArr, BuffHelper.logicTypeVArr);
            EditorGUILayout.EndHorizontal();

            if (executeLogic.Type == 1)
            {
                if (executeLogic.ChangeState == null)
                {
                    executeLogic.ChangeState = new ChangeState();
                }
                var changeState = executeLogic.ChangeState;
                EditorGUILayout.BeginHorizontal(GUILayout.Width(130));
                changeState.State = IntPopupDecorate(changeState.State, BuffHelper.stateTypeKArr, BuffHelper.stateTypeVArr);
                MiddleCenterLabel("->");
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                changeState.Value = DefaultTextField("(数值表达式)", changeState.Value);
                EditorGUILayout.EndHorizontal();
            }
            if (executeLogic.Type == 2)
            {
                if (executeLogic.ChangeNumeric == null)
                {
                    executeLogic.ChangeNumeric = new ChangeNumeric();
                }
                var changeNumeric = executeLogic.ChangeNumeric;
                EditorGUILayout.BeginHorizontal(GUILayout.Width(130));
                changeNumeric.Numeric = IntPopupDecorate(changeNumeric.Numeric, BuffHelper.numericTypeKArr, BuffHelper.numericTypeVArr);
                MiddleCenterLabel("+");
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                changeNumeric.Value = DefaultTextField("(数值表达式)", changeNumeric.Value);
                EditorGUILayout.EndHorizontal();
            }
            if (executeLogic.Type == 3)
            {
                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                executeLogic.Value = DefaultTextField("(逻辑类型)", executeLogic.Value);
                EditorGUILayout.EndHorizontal();
            }
        }
        if (func.Type == 2)
        {
            if (func.ActionTrigger == null)
            {
                func.ActionTrigger = new ActionTrigger();
            }
            var actionTrigger = func.ActionTrigger;
            EditorGUILayout.BeginHorizontal(GUILayout.Width(130));
            actionTrigger.Action = IntPopupDecorate(actionTrigger.Action, BuffHelper.actionTypeKArr, BuffHelper.actionTypeVArr);
            MiddleCenterLabel(">");
            EditorGUILayout.EndHorizontal();

            OnFuncDraw(actionTrigger.LogicFunc);
        }
        if (func.Type == 3)
        {
            if (func.IntervalTrigger == null)
            {
                func.IntervalTrigger = new IntervalTrigger();
            }
            var intervalTrigger = func.IntervalTrigger;
            EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
            intervalTrigger.Interval = EditorGUILayout.IntField(intervalTrigger.Interval, GUILayout.Width(60));
            GUILayout.Label("(秒)");
            MiddleCenterLabel(">");
            EditorGUILayout.EndHorizontal();

            OnFuncDraw(intervalTrigger.LogicFunc);
        }
        if (func.Type == 4)
        {
            if (func.ConditionTrigger == null)
            {
                func.ConditionTrigger = new ConditionTrigger();
            }
            var conditionTrigger = func.ConditionTrigger;

            EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
            conditionTrigger.Condition = IntPopupDecorate(conditionTrigger.Condition, BuffHelper.conditionTypeKArr, BuffHelper.conditionTypeVArr);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
            conditionTrigger.Value = DefaultTextField("(判定表达式)", conditionTrigger.Value);
            MiddleCenterLabel(">");
            EditorGUILayout.EndHorizontal();

            OnFuncDraw(conditionTrigger.LogicFunc);
        }
    }
Пример #12
0
    /// <summary>
    /// 检查单个角色条件
    /// </summary>
    public virtual bool checkOneRoleCondition(int[] args, bool needNotice)
    {
        switch (args[0])
        {
        case RoleConditionType.Level:
        {
            if (me.role.getLevel() < args[1])
            {
                if (needNotice)
                {
                    me.showInfoCode(InfoCodeType.Condition_needLevel);
                }

                return(false);
            }
        }
        break;

        case RoleConditionType.FunctionOpen:
        {
            if (!me.func.isFunctionOpen(args[1]))
            {
                if (needNotice)
                {
                    me.showInfoCode(InfoCodeType.Condition_functionNotOpen, FunctionConfig.get(args[1]).showName);
                }

                return(false);
            }
        }
        break;

        case RoleConditionType.NeedUnion:
        {
            if (!me.union.hasUnion())
            {
                if (needNotice)
                {
                    me.showInfoCode(InfoCodeType.Condition_needUnion);
                }

                return(false);
            }
        }
        break;

        case RoleConditionType.QuestComplete:
        {
            if (!me.quest.isQuestComplete(args[1]))
            {
                if (needNotice)
                {
                    me.showInfoCode(InfoCodeType.Condition_needCompleteQuest, QuestConfig.get(args[1]).name);
                }

                return(false);
            }
        }
        break;

        case RoleConditionType.OnStatus:
        {
            if (!me.character.getCurrentCharacterUseLogic().getFightLogic().status.getStatus(args[1]))
            {
                if (needNotice)
                {
                    me.showInfoCode(InfoCodeType.Condition_needOnStatus, StatusConfig.getShowName(args[1]));
                }

                return(false);
            }
        }
        break;

        case RoleConditionType.OffStatus:
        {
            if (me.character.getCurrentCharacterUseLogic().getFightLogic().status.getStatus(args[1]))
            {
                if (needNotice)
                {
                    me.showInfoCode(InfoCodeType.Condition_needOffStatus, StatusConfig.getShowName(args[1]));
                }

                return(false);
            }
        }
        break;
        }

        return(true);
    }
Пример #13
0
        static void Process()
        {
            var skipFunctions = new HashSet <string>
            {
                "stbtt__find_table"
            };

            var parameters = new ConversionParameters
            {
                InputPath = @"stb_truetype.h",
                Defines   = new[]
                {
                    "STB_TRUETYPE_IMPLEMENTATION"
                },
                Namespace = "StbSharp",
            };

            parameters.StructSource = n =>
            {
                var result = new StructConfig
                {
                    Name   = n,
                    Source = new SourceInfo
                    {
                        Class      = "StbTrueType",
                        StructType = StructType.StaticClass,
                        Source     = SourceFile
                    }
                };

                return(result);
            };

            parameters.GlobalVariableSource = n => new BaseConfig
            {
                Name   = n,
                Source = new SourceInfo
                {
                    Class      = "StbTrueType",
                    Source     = SourceFile,
                    StructType = StructType.StaticClass
                }
            };

            parameters.EnumSource = n => new BaseConfig
            {
                Name   = string.Empty,
                Source = new SourceInfo
                {
                    Class      = "StbTrueType",
                    Source     = SourceFile,
                    StructType = StructType.StaticClass
                }
            };


            parameters.FunctionSource = n =>
            {
                var fc = new FunctionConfig
                {
                    Name   = n.Name,
                    Static = true,
                    Source = new SourceInfo
                    {
                        Source     = SourceFile,
                        Class      = "StbTrueType",
                        StructType = StructType.StaticClass,
                    }
                };

                if (skipFunctions.Contains(n.Name))
                {
                    fc.Source.Source = null;
                }

                return(fc);
            };

            var cp = new ClangParser();

            var outputs = cp.Process(parameters);

            // Post processing
            Logger.Info("Post processing...");

            foreach (var output in outputs)
            {
                var data = output.Value;
                data = Utility.ReplaceNativeCalls(data);

                data = data.Replace("(void *)(0)", "null");
                data = data.Replace("stbtt_vertex* vertices = 0;", "stbtt_vertex* vertices = null;");
                data = data.Replace("(flags & 16)?dx:-dx", "(flags & 16) != 0?dx:-dx");
                data = data.Replace("(flags & 32)?dy:-dy", "(flags & 32) != 0?dy:-dy");
                data = data.Replace("(vertices) == (0)", "vertices == null");
                data = data.Replace("sizeof((vertices[0]))", "sizeof(stbtt_vertex)");
                data = data.Replace("(int)(!(flags & 1))", "((flags & 1) != 0?0:1)");
                data = data.Replace("vertices = 0;", "vertices = null;");
                data = data.Replace("stbtt_vertex* comp_verts = 0;", "stbtt_vertex* comp_verts = null;");
                data = data.Replace("stbtt_vertex* tmp = 0;", "stbtt_vertex* tmp = null;");
                data = data.Replace(",)", ")");
                data = data.Replace("+ +", "+");
                data = data.Replace("(sizeof(stbtt__hheap_chunk) + size * count)",
                                    "((ulong)sizeof(stbtt__hheap_chunk)+ size * (ulong)(count))");
                data = data.Replace("size * hh->num_remaining_in_head_chunk",
                                    "size * (ulong)hh->num_remaining_in_head_chunk");
                data = data.Replace("sizeof((*z))", "sizeof(stbtt__active_edge)");
                data = data.Replace("_next_ = 0;", "_next_ = null;");
                data = data.Replace("sizeof((scanline[0]))", "sizeof(float)");
                data = data.Replace("int c = (int)(((a)->y0) < ((b)->y0));", "int c = (int)(a->y0 < b->y0?1:0);");
                data = data.Replace("sizeof((*e))", "sizeof(stbtt__edge)");
                data = data.Replace("sizeof((**contour_lengths))", "sizeof(int)");
                data = data.Replace("sizeof((points[0]))", "sizeof(stbtt__point)");
                data = data.Replace("sizeof((*context))", "sizeof(stbrp_context)");
                data = data.Replace("sizeof((*nodes))", "sizeof(stbrp_node)");
                data = data.Replace("sizeof((*rects))", "sizeof(stbrp_rect)");
                data = data.Replace("(int)(((a[0]) == (b[0])) && ((a[1]) == (b[1])));",
                                    "(int)(((a[0] == b[0]) && (a[1] == b[1]))?1:0);");

                File.WriteAllText(output.Key, data);
            }
        }
Пример #14
0
        static void Convert()
        {
            var cp = new ClangParser();

            var skipStructs = new HashSet <string>
            {
                "nk_handle",
                "nk_user_font",
                "nk_font",
                "nk_allocator",
                "nk_clipboard",
                "nk_style_item_data",
                "nk_style_item",
                "nk_font_atlas",
                "nk_page_data",
                "nk_page_element",
                "nk_buffer",
                "nk_text_undo_state",
                "nk_property",
                "nk_property_variant",
                "nk_keyboard",
                "nk_mouse",
                "nk_draw_list",
                "nk_style",
                "nk_chart",
                "nk_command_custom",
                "nk_rp_context",
                "nk_context",
                "nk_page",
                "nk_pool",
                "nk_window",
                "nk_panel",
                "nk_config_stack_button_behavior_element",
                "nk_convert_config",
                "nk_user_font_glyph",
                "nk_popup_buffer",
            };

            var treatAsClasses = new HashSet <string>
            {
                "nk_str",
                "nk_clipboard",
                "nk_context",
                "nk_font_atlas",
                "nk_buffer",
                "nk_text_undo_state",
                "nk_page_element",
                "nk_keyboard",
                "nk_mouse",
                "nk_input",
                "nk_draw_list",
                "nk_command_buffer",
                "nk_style",
                "nk_chart",
                "nk_panel",
                "nk_window",
                "nk_popup_state",
                "nk_page",
                "nk_text_edit",
                "nk_pool",
                "nk_table",
                "nk_list_view",
                "nk_convert_config",
                "nk_style_item",
                "nk_config_stack_style_item_element",
                "nk_style_text",
                "nk_popup_buffer",
                "nk_image",
                "nk_cursor",
                "nk_user_font",
                "nk_font",
                "nk_config_stack_user_font_element",
                "nk_font_config",
                "nk_baked_font",
                "nk_chart_slot",
                "nk_row_layout",
                "nk_edit_state",
                "nk_property_state",
                "nk_configuration_stacks",
                "nk_scroll",
                "nk_memory_status",
                "nk_menu_state",
            };

            var skipGlobalVariables = new HashSet <string>
            {
                "nk_null_rect",
                "nk_red",
                "nk_green",
                "nk_blue",
                "nk_white",
                "nk_black",
                "nk_yellow",
                "nk_default_color_style",
                "nk_color_names",
                "nk_cursor_data",
                "hue_colors",
            };

            var skipFunctions = new HashSet <string>
            {
                "nk_inv_sqrt",
                "nk_strmatch_fuzzy_text",
                "nk_strmatch_fuzzy_string",
                "nk_str_append_text_runes",
                "nk_str_append_str_runes",
                "nk_stricmp",
                "nk_strfilter",
                "nk_utf_validate",
                "nk_utf_decode_byte",
                "nk_utf_decode",
                "nk_utf_encode_byte",
                "nk_utf_encode",
                "nk_utf_len",
                "nk_utf_at",
                "nk_style_get_color_by_name",
                "nk_pool_init_fixed",
                "nk_init_custom",
                "nk_pool_init",
                "nk_pool_free",
                "nk_pool_alloc",
                "nk_create_page_element",
                "nk_link_page_element_into_freelist",
                "nk_free_page_element",
                "nk_create_panel",
                "nk_free_panel",
                "nk_create_table",
                "nk_free_table",
                "nk_init_fixed",
                "nk_init",
                "nk_free",
                "nk_create_window",
                "nk_free_window",
                "nk_buffer_init_default",
                "nk_str_init_default",
                "nk_str_init",
                "nk_font_atlas_init_default",
                "nk_font_atlas_init",
                "nk_font_atlas_init_custom",
                "nk_init_default",
                "nk_command_buffer_push",
                "nk__begin",
                "nk_command_buffer_init",
                "nk_command_buffer_reset",
                "nk__next",
                "nk_build",
                "nk_property_",
                "nk_font_atlas_add_default",
                "nk_stroke_polygon",
                "nk_fill_polygon",
                "nk_stroke_polyline",
                "nk_font_default_glyph_ranges",
                "nk_font_chinese_glyph_ranges",
                "nk_font_cyrillic_glyph_ranges",
                "nk_font_korean_glyph_ranges",
            };

            var globalArrays = new HashSet <string>
            {
                "nk_utfbyte",
                "nk_utfmask",
                "nk_utfmin",
                "nk_utfmax",
                "nk_proggy_clean_ttf_compressed_data_base85",
                "nk_custom_cursor_data",
                "nk_cursor_data",
            };

            var parameters = new ConversionParameters
            {
                InputPath = @"nuklear.h",
                Defines   = new[]
                {
                    "NK_IMPLEMENTATION",
                    "NK_INCLUDE_DEFAULT_ALLOCATOR",
                    "NK_INCLUDE_VERTEX_BUFFER_OUTPUT",
                    "NK_INCLUDE_FONT_BAKING",
                    "NK_INCLUDE_DEFAULT_FONT"
                },
                Namespace = "NuklearSharp",
            };

            parameters.StructSource = n =>
            {
                var result = new StructConfig
                {
                    Name   = n,
                    Source = new SourceInfo
                    {
                        Class      = "Nuklear",
                        StructType = StructType.StaticClass
                    }
                };

                if (!skipStructs.Contains(n) && !n.StartsWith("nk_command_"))
                {
                    var sourceName = GetSourceName(n);

                    result.Source.Source = @"..\..\..\..\..\NuklearSharp\Nuklear." + sourceName + ".Generated.cs";
                }

                if (treatAsClasses.Contains(n) || n.StartsWith("nk_command_") || n.StartsWith("nk_style_") ||
                    n.StartsWith("nk_config_"))
                {
                    result.StructType = StructType.Class;
                }
                else
                {
                    result.StructType = StructType.Struct;
                }

                return(result);
            };

            parameters.GlobalVariableSource = n => new BaseConfig
            {
                Name   = n,
                Source = new SourceInfo
                {
                    Class      = "Nuklear",
                    Source     = @"..\..\..\..\..\NuklearSharp\Nuklear.GlobalVariables.Generated.cs",
                    StructType = StructType.StaticClass
                }
            };

            parameters.EnumSource = n => new BaseConfig
            {
                Name   = string.Empty,
                Source = new SourceInfo
                {
                    Class      = "Nuklear",
                    Source     = @"..\..\..\..\..\NuklearSharp\Nuklear.Enums.Generated.cs",
                    StructType = StructType.StaticClass
                }
            };

            parameters.FunctionSource = n =>
            {
                var fc = new FunctionConfig
                {
                    Name   = n.Name,
                    Static = true,
                    Source = new SourceInfo
                    {
                        Source     = @"..\..\..\..\..\NuklearSharp\Nuklear.Utility.Generated.cs",
                        Class      = "Nuklear",
                        StructType = StructType.StaticClass,
                    }
                };

                var parts = n.Signature.Split(',');

                var s = string.Empty;
                if (parts.Length > 0)
                {
                    for (var i = 0; i < parts.Length; ++i)
                    {
                        var parts2 = parts[i].Trim().Split(' ');

                        var typeName = parts2[0];

                        if (typeName.EndsWith("*"))
                        {
                            typeName = typeName.Substring(0, typeName.Length - 1);
                        }

                        var recordType = cp.Processor.GetRecordType(typeName);
                        if (recordType != RecordType.None)
                        {
                            s = typeName;
                        }

                        break;
                    }
                }

                if (!string.IsNullOrEmpty(s))
                {
                    var sourceName = GetSourceName(s);
                    fc.Source.Source = @"..\..\..\..\..\NuklearSharp\Nuklear." + sourceName + ".Generated.cs";
                }

                if (skipFunctions.Contains(n.Name))
                {
                    fc.Source.Source = null;
                }

                return(fc);
            };

            parameters.TreatGlobalPointerAsArray = n => globalArrays.Contains(n);

            parameters.UseRefInsteadOfPointer = (f, t, n) => n == "custom" ||
                                                f == "nk_unify" ||
                                                n == "state" ||
                                                n == "ws" ||
                                                n == "size" ||
                                                n == "glyph_count" ||
                                                n == "width" ||
                                                n == "height" ||
                                                n == "value" ||
                                                n == "val" ||
                                                n == "cursor" ||
                                                n == "len" ||
                                                n == "select_begin" ||
                                                n == "select_end";

            parameters.CustomGlobalVariableProcessor += cpr =>
            {
                if (cpr.Info.Spelling == "nk_proggy_clean_ttf_compressed_data_base85" ||
                    cpr.Info.Spelling == "nk_custom_cursor_data")
                {
                    var sb = new StringBuilder();

                    sb.Append("{");

                    var start = cpr.Expression.IndexOf('\"') + 1;
                    for (var i = start; i < cpr.Expression.Length; ++i)
                    {
                        var c = cpr.Expression[i];

                        if (c == '\"')
                        {
                            break;
                        }

                        if (i > start)
                        {
                            sb.Append(", ");
                        }

                        sb.AppendFormat("0x{0:X}", (int)c);
                    }

                    sb.Append("}");

                    cpr.Expression = "byte[] " + cpr.Info.Spelling + " = " + sb.ToString();
                }
            };

            parameters.FunctionHeaderProcessed = (fn, args) =>
            {
                if (fn.Contains("nk_stricmpn") ||
                    fn.Contains("nk_tree_state_base") ||
                    fn.Contains("nk_tree_state_push") ||
                    fn.Contains("nk_tree_state_image_push") ||
                    fn.Contains("nk_group_scrolled_offset_begin") ||
                    fn.Contains("nk_parse_hex") ||
                    fn.Contains("nk_itoa") |
                    fn.Contains("nk_string_float_limit") ||
                    fn.Contains("nk_text_clamp") ||
                    fn.Contains("nk_text_calculate_text_bounds") ||
                    fn.Contains("nk_str_") ||
                    fn.Contains("nk_draw_") ||
                    fn.Contains("nk_font_"))
                {
                    return;
                }

                if (args.Length == 0 || !args[0].StartsWith("nk_context"))
                {
                    return;
                }
                var sb = new StringFunctionBinding
                {
                    Header = fn,
                    Args   = args,
                };

                _bindings[fn] = sb;
            };

            var outputs = cp.Process(parameters);

            // Post processing
            Logger.Info("Post processing...");

            foreach (var output in outputs)
            {
                if (output.Key.Contains("GlobalVariables") ||
                    output.Key.Contains("Enums") /* ||
                                                  * output.Key.Contains("Commands\\") ||
                                                  * output.Key.Contains("Config\\") ||
                                                  * output.Key.Contains("Core\\") ||
                                                  * output.Key.Contains("Drawing\\") ||
                                                  * output.Key.Contains("Fonts\\") ||
                                                  * output.Key.Contains("InputSystem\\") ||
                                                  * output.Key.Contains("MemoryManagement\\") ||
                                                  * output.Key.Contains("RectPacts\\") ||
                                                  * output.Key.Contains("Styling\\") ||
                                                  * output.Key.Contains("TextEditing\\")*/)
                {
                    continue;
                }

                var data = output.Value;

                // Post processing
                Logger.Info("Post processing '{0}'...", output.Key);


                data = PostProcess(data);

                File.WriteAllText(output.Key, data);
            }
        }