示例#1
0
        public SCBlockMetadata(SCBlockAccessor accessor)
        {
            var aType = accessor.GetType();

            BlockList = aType.GetAllPropertiesOfType <SaveBlock>(accessor);
            ValueList = aType.GetAllConstantsOfType <uint>();
            Accessor  = accessor;
        }
示例#2
0
        /// <summary>
        /// Creates a new instance of <see cref="SCBlockMetadata"/> by loading properties and constants declared via reflection.
        /// </summary>
        public SCBlockMetadata(SCBlockAccessor accessor, IEnumerable <string> extraKeyNames)
        {
            var aType = accessor.GetType();

            BlockList = aType.GetAllPropertiesOfType <SaveBlock>(accessor);
            ValueList = aType.GetAllConstantsOfType <uint>();
            AddExtraKeyNames(ValueList, extraKeyNames);
            Accessor = accessor;
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of <see cref="SCBlockMetadata"/> by loading properties and constants declared via reflection.
        /// </summary>
        public SCBlockMetadata(SCBlockAccessor accessor, IEnumerable <string> extraKeyNames, params string[] exclusions)
        {
            var aType = accessor.GetType();

            BlockList = aType.GetAllPropertiesOfType <IDataIndirect>(accessor);
            ValueList = aType.GetAllConstantsOfType <uint>();
            AddExtraKeyNames(ValueList, extraKeyNames);
            if (exclusions.Length > 0)
            {
                ValueList = ValueList.Where(z => !exclusions.Any(z.Value.Contains)).ToDictionary(z => z.Key, z => z.Value);
            }
            Accessor = accessor;
        }