Beispiel #1
0
        /// <summary>
        ///     Loads resources file.
        /// </summary>
        private static void LoadResources()
        {
            ResourceManager.ContentUrlList        = new LogicArrayList <string>();
            ResourceManager.ChronosContentUrlList = new LogicArrayList <string>();
            ResourceManager.AppStoreUrlList       = new LogicArrayList <string>();

            string resourceFile = WebManager.DownloadConfigString("/res/resources.json");

            if (resourceFile != null)
            {
                LogicJSONObject jsonObject          = (LogicJSONObject)LogicJSONParser.Parse(resourceFile);
                LogicJSONArray  contentArray        = jsonObject.GetJSONArray("content");
                LogicJSONArray  chronosContentArray = jsonObject.GetJSONArray("chronosContent");
                LogicJSONArray  appStoreArray       = jsonObject.GetJSONArray("appstore");

                for (int i = 0; i < contentArray.Size(); i++)
                {
                    ResourceManager.ContentUrlList.Add(contentArray.GetJSONString(i).GetStringValue());
                }

                for (int i = 0; i < chronosContentArray.Size(); i++)
                {
                    ResourceManager.ChronosContentUrlList.Add(chronosContentArray.GetJSONString(i).GetStringValue());
                }

                for (int i = 0; i < appStoreArray.Size(); i++)
                {
                    ResourceManager.AppStoreUrlList.Add(appStoreArray.GetJSONString(i).GetStringValue());
                }
            }
            else
            {
                Debugger.Error("ResourceManager::loadResources resources.json not exist");
            }
        }
        public void Load(LogicJSONObject jsonObject)
        {
            Debugger.DoAssert(this.m_errorHandler != null, "LogicCalendarErrorHandler must not be NULL!");

            if (jsonObject == null)
            {
                this.m_errorHandler.ErrorFunction(this.m_calendarEvent, this, "Event function malformed.");
                return;
            }

            string name = LogicJSONHelper.GetString(jsonObject, "name");

            this.m_functionData = LogicDataTables.GetCalendarEventFunctionByName(name, null);

            if (this.m_functionData == null)
            {
                this.m_errorHandler.ErrorFunction(this.m_calendarEvent, this, string.Format("event function '{0}' not found.", name));
                return;
            }

            LogicJSONArray parameterArray = jsonObject.GetJSONArray("parameters");

            if (parameterArray != null)
            {
                for (int i = 0; i < parameterArray.Size(); i++)
                {
                    this.m_parameters.Add(parameterArray.GetJSONString(i).GetStringValue());
                }
            }

            this.LoadingFinished();
        }
            public CouchbaseSettings(LogicJSONObject jsonObject)
            {
                LogicJSONArray serverArray = jsonObject.GetJSONArray("servers");
                LogicJSONArray bucketArray = jsonObject.GetJSONArray("buckets");

                this.Servers = new LogicArrayList <CouchbaseServerEntry>(serverArray.Size());
                this.Buckets = new LogicArrayList <CouchbaseBucketEntry>(bucketArray.Size());

                for (int i = 0; i < serverArray.Size(); i++)
                {
                    this.Servers.Add(new CouchbaseServerEntry(serverArray.GetJSONObject(i)));
                }

                for (int i = 0; i < bucketArray.Size(); i++)
                {
                    CouchbaseBucketEntry entry = new CouchbaseBucketEntry(bucketArray.GetJSONString(i));

                    if (this.GetBucketIdx(entry.Name) != -1)
                    {
                        Logging.Warning("EnvironmentSettings::CouchbaseSettings.ctr: bucket with the same name already exists.");
                        continue;
                    }

                    if ((uint)entry.ServerIndex >= this.Servers.Size())
                    {
                        Logging.Warning(string.Format("EnvironmentSettings::CouchbaseSettings.ctr: server index is out of bounds (bucket name: {0})", entry.ServerIndex));
                        continue;
                    }

                    this.Buckets.Add(entry);
                }
            }
Beispiel #4
0
        private static LogicArrayList <string> LoadStringArray(LogicJSONArray jsonArray)
        {
            LogicArrayList <string> arrayList = new LogicArrayList <string>();

            if (jsonArray != null)
            {
                for (int i = 0; i < jsonArray.Size(); i++)
                {
                    arrayList.Add(jsonArray.GetJSONString(i).GetStringValue());
                }
            }

            return(arrayList);
        }
            public CouchbaseServerEntry(LogicJSONObject jsonObject)
            {
                LogicJSONArray hostArray = jsonObject.GetJSONArray("hosts");

                this.Hosts = new Uri[hostArray.Size()];

                for (int i = 0; i < hostArray.Size(); i++)
                {
                    this.Hosts[i] = new Uri("http://" + hostArray.GetJSONString(i).GetStringValue());
                }

                this.Username = jsonObject.GetJSONString("username").GetStringValue();
                this.Password = jsonObject.GetJSONString("password").GetStringValue();
            }
                public AdminSettings(LogicJSONObject jsonObject)
                {
                    LogicJSONArray presetLevelFileArray = jsonObject.GetJSONArray("presetLevelFiles");

                    if (presetLevelFileArray != null)
                    {
                        this.PresetLevelFiles = new LogicArrayList <string>(presetLevelFileArray.Size());

                        for (int i = 0; i < presetLevelFileArray.Size(); i++)
                        {
                            this.PresetLevelFiles.Add(presetLevelFileArray.GetJSONString(i).GetStringValue());
                        }
                    }
                    else
                    {
                        this.PresetLevelFiles = null;
                    }
                }
        private static string[] LoadStringArray(LogicJSONArray jsonArray)
        {
            string[] stringArray;

            if (jsonArray != null)
            {
                stringArray = new string[jsonArray.Size()];

                for (int i = 0; i < jsonArray.Size(); i++)
                {
                    stringArray[i] = jsonArray.GetJSONString(i).GetStringValue();
                }
            }
            else
            {
                stringArray = new string[0];
            }

            return(stringArray);
        }
        private static void LoadServerArray(LogicJSONArray jsonArray, int type)
        {
            ServerConnectionEntry[] entries;

            if (jsonArray != null)
            {
                entries = new ServerConnectionEntry[jsonArray.Size()];

                for (int i = 0; i < jsonArray.Size(); i++)
                {
                    entries[i] = new ServerConnectionEntry(jsonArray.GetJSONString(i));
                }
            }
            else
            {
                entries = new ServerConnectionEntry[0];
            }

            EnvironmentSettings.Servers[type] = entries;
        }
Beispiel #9
0
        /// <summary>
        ///     Loads the service config.
        /// </summary>
        private static void LoadConfig()
        {
            string json = WebManager.DownloadConfigString("/core/services.json");

            if (json != null)
            {
                LogicJSONObject jsonObject = (LogicJSONObject)LogicJSONParser.Parse(json);

                LogicJSONString versionObject = jsonObject.GetJSONString("version");

                if (versionObject != null)
                {
                    ServiceSettings._serviceVersion = versionObject.GetStringValue();
                }

                LogicJSONObject nodeObject = jsonObject.GetJSONObject("node");

                if (nodeObject != null)
                {
                    LogicJSONArray proxyArray = nodeObject.GetJSONArray("proxy");

                    if (proxyArray != null)
                    {
                        ServiceSettings._serviceIPs[1] = new string[proxyArray.Size()];

                        for (int i = 0; i < proxyArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[1][i] = proxyArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray accountArray = nodeObject.GetJSONArray("account");

                    if (accountArray != null)
                    {
                        ServiceSettings._serviceIPs[2] = new string[accountArray.Size()];

                        for (int i = 0; i < accountArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[2][i] = accountArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray globalArray = nodeObject.GetJSONArray("global_chat");

                    if (globalArray != null)
                    {
                        ServiceSettings._serviceIPs[6] = new string[globalArray.Size()];

                        for (int i = 0; i < globalArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[6][i] = globalArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray avatarArray = nodeObject.GetJSONArray("avatar");

                    if (avatarArray != null)
                    {
                        ServiceSettings._serviceIPs[9] = new string[avatarArray.Size()];

                        for (int i = 0; i < avatarArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[9][i] = avatarArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray homeArray = nodeObject.GetJSONArray("zone");

                    if (homeArray != null)
                    {
                        ServiceSettings._serviceIPs[10] = new string[homeArray.Size()];

                        for (int i = 0; i < homeArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[10][i] = homeArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray allianceArray = nodeObject.GetJSONArray("party");

                    if (allianceArray != null)
                    {
                        ServiceSettings._serviceIPs[11] = new string[allianceArray.Size()];

                        for (int i = 0; i < allianceArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[11][i] = allianceArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray leagueArray = nodeObject.GetJSONArray("ranking");

                    if (leagueArray != null)
                    {
                        ServiceSettings._serviceIPs[13] = new string[leagueArray.Size()];

                        for (int i = 0; i < leagueArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[13][i] = leagueArray.GetJSONString(i).GetStringValue();
                        }
                    }

                    LogicJSONArray battleArray = nodeObject.GetJSONArray("battle");

                    if (battleArray != null)
                    {
                        ServiceSettings._serviceIPs[27] = new string[battleArray.Size()];

                        for (int i = 0; i < battleArray.Size(); i++)
                        {
                            ServiceSettings._serviceIPs[27][i] = battleArray.GetJSONString(i).GetStringValue();
                        }
                    }
                }

                LogicJSONObject databaseObject = jsonObject.GetJSONObject("database");

                if (databaseObject != null)
                {
                    LogicJSONArray urls = databaseObject.GetJSONArray("urls");

                    if (urls != null)
                    {
                        ServiceSettings._databaseUrls = new string[urls.Size()];

                        for (int i = 0; i < urls.Size(); i++)
                        {
                            ServiceSettings._databaseUrls[i] = urls.GetJSONString(i).GetStringValue();
                        }
                    }

                    ServiceSettings._databaseUser     = LogicJSONHelper.GetJSONString(databaseObject, "user");
                    ServiceSettings._databasePassword = LogicJSONHelper.GetJSONString(databaseObject, "pass");
                }
            }
        }