示例#1
0
            MakeSerializer_Delegate()
            {
                var Type = typeof(t);
                Action <SerializeData, object> Serializer = (Data, obj) =>
                {
                    var MD        = (MulticastDelegate)obj;
                    var Delegates = MD.GetInvocationList();
                    Data.Data.Write(BitConverter.GetBytes(Delegates.Length), 0, 4);
                    for (int i = 0; i < Delegates.Length; i++)
                    {
                        LoadedFunc LoadedFunc;
                        var        Delegate       = Delegates[i];
                        var        DelegateMethod = Delegate.Method;
                        Data.TrustToMethod?.Invoke(DelegateMethod);
                        LoadedFunc = Serializere.VisitedInfoSerialize(Data, DelegateMethod,
                                                                      () =>
                        {
                            var Key = new LoadedFunc(DelegateMethod);
                            if (Serializere.LoadedFuncs_Ser.TryGetValue(Key, out LoadedFunc) == false)
                            {
                                var TargetType = DelegateMethod.DeclaringType;

                                LoadedFunc            = Key;
                                LoadedFunc.NameAsByte =
                                    Serializere.Write(
                                        DelegateMethod.Name,
                                        DelegateMethod.ReflectedType.MidName());
                                LoadedFunc.SerializerTarget = GetSerialize(TargetType);
                                Serializere.LoadedFuncs_Ser.Add(LoadedFunc);
                            }
                            return(LoadedFunc.NameAsByte, LoadedFunc);
                        });
示例#2
0
文件: Debug.cs 项目: monsajem/Incs
            private static void Check_SR(SerializeData Data)
            {
                var Type = typeof(t);

                Data.Data.Write(BitConverter.GetBytes(Data.Data.Length), 0, 8);
                var TypeBytes = Serializere.Write(Type.MidName());

                Data.Data.Write(TypeBytes, 0, TypeBytes.Length);
            }