Esempio n. 1
0
        internal void ValidateVariableListCounts(IO.ICanThrowReadExceptionsWithExtraDetails readExceptionThrower)
        {
            var set = SetType.ToString();

            ProtoData.Traits[MegaloScriptVariableType.Numeric].ValidateListCount(Numerics, set + ".Numerics", readExceptionThrower);
            ProtoData.Traits[MegaloScriptVariableType.Timer].ValidateListCount(Timers, set + ".Timers", readExceptionThrower);
            ProtoData.Traits[MegaloScriptVariableType.Team].ValidateListCount(Teams, set + ".Teams", readExceptionThrower);
            ProtoData.Traits[MegaloScriptVariableType.Player].ValidateListCount(Players, set + ".Players", readExceptionThrower);
            ProtoData.Traits[MegaloScriptVariableType.Object].ValidateListCount(Objects, set + ".Objects", readExceptionThrower);
        }
Esempio n. 2
0
        internal void ValidateListCount(System.Collections.IList list, string listName
                                        , IO.ICanThrowReadExceptionsWithExtraDetails readExceptionThrower)
        {
            if (list.Count > MaxCount)
            {
                var ex = new System.IO.InvalidDataException(string.Format(Util.InvariantCultureInfo,
                                                                          "{0} exceeded its maximum number of elements; {1} > {2}", listName, list.Count, MaxCount));

                readExceptionThrower.ThrowReadExeception(ex);
            }
        }