コード例 #1
0
        public static float GetWeight(StructOption structOption, Dictionary <string, int> structCount)
        {
            bool containKey = structCount.ContainsKey(structOption.structureLayoutTag);

            if (containKey)
            {
                int count = structCount.TryGetValue(structOption.structureLayoutTag);
                if (count < structOption.minCount)
                {
                    return(2f);
                }
                else if (structOption.maxCount != -1 && count == structOption.maxCount)
                {
                    return(0f);
                }
                else
                {
                    return(1f);
                }
            }
            else
            {
                return(3f);
            }
        }
コード例 #2
0
        public override IEnumerable <string> ConfigErrors()
        {
            foreach (string str in allowedStructures)
            {
                allowedStructuresConverted.Add(StructOption.FromString(str));
            }

            return(base.ConfigErrors());
        }