コード例 #1
0
        public static bool IsEnable(string featureName)
        {
            if (featureName == null || featureName.Length == 0)
            {
                return(true);
            }
            if (featureName.IndexOf("||") >= 0)
            {
                string[] separator = new string[]
                {
                    "||"
                };
                string[] array = featureName.Split(separator, StringSplitOptions.RemoveEmptyEntries);
                if (array.Length >= 2)
                {
                    for (int i = 0; i < array.Length; i++)
                    {
                        if (FeatureMatrix.IsEnable(array[i]))
                        {
                            return(true);
                        }
                    }
                    return(false);
                }
            }
            if (featureName.IndexOf("&&") >= 0)
            {
                string[] separator2 = new string[]
                {
                    "&&"
                };
                string[] array2 = featureName.Split(separator2, StringSplitOptions.RemoveEmptyEntries);
                if (array2.Length >= 2)
                {
                    for (int j = 0; j < array2.Length; j++)
                    {
                        if (!FeatureMatrix.IsEnable(array2[j]))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            featureName = featureName.Trim();
            if (featureName[0] == '!')
            {
                return(!FeatureMatrix.IsEnable(featureName.Substring(1)));
            }
            string @string = FeatureMatrix.GetString(featureName);

            return(@string != null && @string.Length > 0 && FeatureMatrix.CurrentVer.CompareTo(@string) >= 0);
        }
コード例 #2
0
        public static float GetFloat(string featureName)
        {
            string @string = FeatureMatrix.GetString(featureName);
            float  result;

            try
            {
                result = float.Parse(@string);
            }
            catch (FormatException)
            {
                Log <FeatureMatrix> .Logger.ErrorFormat("Not a Float value - Feature {0}='{1}'", featureName, @string);

                result = 0f;
            }
            return(result);
        }
コード例 #3
0
        public static int GetInteger(string featureName)
        {
            string @string = FeatureMatrix.GetString(featureName);
            int    result;

            try
            {
                result = int.Parse(@string);
            }
            catch (FormatException)
            {
                Log <FeatureMatrix> .Logger.ErrorFormat("Not an Integer value - Feature {0}='{1}'", featureName, @string);

                result = 0;
            }
            return(result);
        }
コード例 #4
0
        public static int?GetNullableInt(string featureName)
        {
            string @string = FeatureMatrix.GetString(featureName);

            if (@string == null || @string == "")
            {
                return(null);
            }
            int?result;

            try
            {
                result = new int?(int.Parse(@string));
            }
            catch (FormatException)
            {
                Log <FeatureMatrix> .Logger.ErrorFormat("Not an Integer value - Feature {0}='{1}'", featureName, @string);

                result = null;
            }
            return(result);
        }
コード例 #5
0
        private static bool LoadFeatureMatrix()
        {
            bool result;

            lock (FeatureMatrix.featureLock)
            {
                if (FeatureMatrix.featureMatrixLoaded)
                {
                    result = false;
                }
                else
                {
                    FeatureMatrix.gameCodeMap         = HeroesContentsLoader.GetGameCode();
                    FeatureMatrix.featureMap          = HeroesContentsLoader.GetFeatureMatrix(FeatureMatrix.LangTag);
                    FeatureMatrix.featureMatrixLoaded = true;
                    if (FeatureMatrix.GetString("OverrideSetting").Length > 0)
                    {
                        Dictionary <string, string> featureMatrix = HeroesContentsLoader.GetFeatureMatrix(FeatureMatrix.GetString("OverrideSetting"));
                        foreach (KeyValuePair <string, string> keyValuePair in featureMatrix)
                        {
                            string key = keyValuePair.Key;
                            if (key != "GameCode" && key != "CurrentVer" && key != "OverrideSetting")
                            {
                                FeatureMatrix.featureMap[key] = keyValuePair.Value;
                            }
                        }
                    }
                    if (ServiceCoreSettings.Default.NGM_Disable != "-1")
                    {
                        FeatureMatrix.overrideMap["NGM_disable"] = ServiceCoreSettings.Default.NGM_Disable;
                    }
                    result = true;
                }
            }
            return(result);
        }