Esempio n. 1
0
        public PlayerData Convert(byte[] source)
        {
            var player = new PlayerData();

            ConverterReflection.SetConversionProperties(player, source);
            return(player);
        }
Esempio n. 2
0
            Tuple <int, object> ITupleConverter <Club> .Convert(byte[] sourceOfData)
            {
                bytes = sourceOfData;
                Club club = new Club();

                PropertyInfo[]          props   = club.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
                DataFileInfoAttribute[] attribs = new DataFileInfoAttribute[props.Length];

                if (props == null)
                {
                    props   = typeof(Club).GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
                    attribs = new DataFileInfoAttribute[props.Length];

                    for (int i = 0; i < attribs.Length; i++)
                    {
                        attribs[i] = (DataFileInfoAttribute)props[i].GetCustomAttributes(typeof(DataFileInfoAttribute), true).FirstOrDefault();
                    }
                }

                ConverterReflection.SetConversionProperties(club, /*props, attribs,*/ bytes);

                var result = new Tuple <int, object>(club.ClubId, club);

                return(result);
            }
Esempio n. 3
0
        Tuple <int, object> ITupleConverter <Nation> .Convert(byte[] source)
        {
            var nation = new Nation();

            ConverterReflection.SetConversionProperties(nation, source);

            nation.EUNation = EUNations.Contains(nation.Name, StringComparer.InvariantCultureIgnoreCase);

            return(new Tuple <int, object>(nation.Id, nation));
        }
Esempio n. 4
0
            Tuple <int, object> ITupleConverter <Staff> .Convert(byte[] source)
            {
                var staff = new Staff();

                PropertyInfo[]          props   = staff.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
                DataFileInfoAttribute[] attribs = new DataFileInfoAttribute[props.Length];

                for (int i = 0; i < attribs.Length; i++)
                {
                    attribs[i] = (DataFileInfoAttribute)props[i].GetCustomAttributes(typeof(DataFileInfoAttribute), true).FirstOrDefault();
                }

                ConverterReflection.SetConversionProperties(staff, source);
                //ConverterReflection.SetConversionProperties(staff, props, attribs, source);

                return(new Tuple <int, object>(staff.StaffPlayerId, staff));
            }