Exemplo n.º 1
0
        public FieldData(string fieldName, string[] alternateFieldNames, DataSerializer serializationMethods, ushort offset)
        {
            SerializationMethods = serializationMethods;
            Offset        = offset;
            FieldNameHash = fieldName.GetInt32Hash();

            if (alternateFieldNames != null &&
                alternateFieldNames.Length != 0)
            {
                var length = alternateFieldNames.Length;

                AlternateHashes = new int[length];

                for (var index = 0; index < length; index++)
                {
                    AlternateHashes[index] = alternateFieldNames[index].GetInt32Hash();
                }
            }
            else
            {
                AlternateHashes = null;
            }
        }
Exemplo n.º 2
0
        public bool TryGetNonCachedSerializationMethods(Type type, out DataSerializer dataSerializer, Func <ISerializationProvider, bool> shouldUse = null)
        {
            foreach (var provider in _providers)
            {
                if (shouldUse != null &&
                    shouldUse(provider) == false)
                {
                    continue;
                }

                if (provider.TryGet(this, type, out dataSerializer) == false)
                {
                    continue;
                }

                dataSerializer.RootInitialize(this);

                return(true);
            }

            dataSerializer = default;
            return(false);
        }
Exemplo n.º 3
0
 public ByRefFieldWriter(DataSerializer dataSerializer, SetDelegate set, GetDelegate get)
 {
     _set            = set;
     _get            = get;
     _dataSerializer = dataSerializer;
 }
Exemplo n.º 4
0
 public PropertyWriter(DataSerializer dataSerializer, SetPropertyDelegate <T, TMember> set, GetPropertyDelegate <T, TMember> get)
 {
     _set            = set;
     _get            = get;
     _dataSerializer = dataSerializer;
 }
Exemplo n.º 5
0
 public StructFieldWriter(DataSerializer dataSerializer, FieldInfo fieldInfo)
 {
     _fieldOffset    = UnsafeUtils.GetFieldOffset(fieldInfo);
     _dataSerializer = dataSerializer;
 }
Exemplo n.º 6
0
 public TypedDataSerializer(DataSerializer methods)
 {
     _methods = methods;
 }
Exemplo n.º 7
0
 public static TypedDataSerializer <T> GetTyped <T>(this DataSerializer dataSerializer)
 {
     return(new TypedDataSerializer <T>(dataSerializer));
 }
Exemplo n.º 8
0
 public MemberSerializerStruct(int hash, DataSerializer dataSerializer)
 {
     Hash           = hash;
     DataSerializer = dataSerializer;
 }