Aurora.Services.WebAPIConnector.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString ) : void
GenericData IGenericData
source IConfigSource
simBase IRegistryCore
defaultConnectionString string
return void
        public void Initialize(IGenericData GenericData, IConfigSource source, IRegistryCore simBase, string defaultConnectionString)
        {
            if (handleConfig(source, defaultConnectionString))
            {
                if (!Enabled)
                {
                    Warn("not loaded, disabled in config.");
                }
                else
                {
                    GD = GenericData;
                    GD.ConnectToDatabase(m_connectionString, "WebAPI", true);

                    QueryFilter filter = new QueryFilter();
                    filter.andFilters["user"] = UUID.Zero;
                    List<string> query = GD.Query(new string[2]{
                        "method",
                        "rate"
                    }, c_table_access, filter, null, null, null);
                    if (query.Count % 2 == 0)
                    {
                        Dictionary<string, uint?> DAR = new Dictionary<string, uint?>();
                        for (int i = 0; i < query.Count; i += 2)
                        {
                            if (string.IsNullOrEmpty(query[i + 1]))
                            {
                                DAR[query[i]] = null;
                            }
                            else
                            {
                                DAR[query[i]] = uint.Parse(query[i + 1]);
                            }
                        }
                        DataManager.DataManager.RegisterPlugin(this);
                    }
                    else
                    {
                        MainConsole.Instance.Error("[" + Name + "]: Could not find default access rate limits");
                    }

                }
            }
        }