Exemple #1
0
        private void ConvertPropertyNamesToCamelCase(ValidatorRules validatorRules)
        {
            // Workaround as System.Text.Json in ASP.NET 3 cannot serialise property keys.
            // Although unnecessary for ASP.NET Core 2.2, it's too expensive to check!
            var newValidatorList = new SerialisableDictionary <string, SerialisableDictionary <string, object> >();

            foreach (var item in validatorRules.ValidatorList)
            {
                newValidatorList.Add(item.Key.ToCamelCase(), validatorRules.ValidatorList[item.Key]);
            }

            var newErrorList = new SerialisableDictionary <string, SerialisableDictionary <string, string> >();

            foreach (var item in validatorRules.ErrorList)
            {
                newErrorList.Add(item.Key.ToCamelCase(), validatorRules.ErrorList[item.Key]);
            }

            var newTypeList = new SerialisableDictionary <string, string>();

            foreach (var item in validatorRules.TypeList)
            {
                newTypeList.Add(item.Key.ToCamelCase(), validatorRules.TypeList[item.Key]);
            }

            validatorRules.ValidatorList = newValidatorList;
            validatorRules.ErrorList     = newErrorList;
            validatorRules.TypeList      = newTypeList;
        }
 private void AddAppearanceValue(string appearanceName, float value, bool isRegexMatch)
 {
     foreach (var appearanceValue in AppearanceValues.Where(x => x.Value.Value >= value))
     {
         appearanceValue.Value.Value++;
     }
     AppearanceValues.Add(appearanceName, new AppearanceOptions {
         Value = value, IsRegexMatch = isRegexMatch
     });
 }
Exemple #3
0
 private void SetDictionariesCaseInsensitive(List <ArmourChart> armourCharts)
 {
     foreach (var armourChart in armourCharts)
     {
         var dictionary = new SerialisableDictionary <string, string>(StringComparer.OrdinalIgnoreCase);
         foreach (var digivolution in armourChart.DigimentalDigivolution)
         {
             dictionary.Add(digivolution.Key, digivolution.Value);
         }
         armourChart.DigimentalDigivolution = dictionary;
     }
 }
Exemple #4
0
        public static SerialisableDictionary CreateConfigDictionary(object[,] ConfigMatrix)
        {
            SerialisableDictionary cd = new SerialisableDictionary();

            int r = ConfigMatrix.GetLength(0);
            int c = ConfigMatrix.GetLength(1);

            if (c == 2)
            {
                for (int x = 0; x < r; ++x)
                {
                    if (!ConfigMatrix[x, 0].Equals(ExcelDna.Integration.ExcelEmpty.Value))
                    {
                        if (XLOM.Contains(ConfigMatrix[x, 1].ToString(), true))
                        {
                            cd[ConfigMatrix[x, 0].ToString()] = XLOM.Get(ConfigMatrix[x, 1].ToString());
                        }
                        else
                        {
                            cd[ConfigMatrix[x, 0].ToString()] = ConfigMatrix[x, 1];
                        }
                    }
                }
            }
            else if (c > 2)
            {
                for (int cc = 1; cc < c; ++cc)
                {
                    string colName = ConfigMatrix[0, cc].ToString();
                    Dictionary <string, object> cdd = new Dictionary <string, object>();
                    for (int x = 1; x < r; ++x)
                    {
                        cdd[ConfigMatrix[x, 0].ToString()] = ConfigMatrix[x, cc];
                    }

                    cd.Add(colName, cdd);
                }
            }

            return(cd);
        }