Beispiel #1
0
        public static void AddDiverter(MarshalOption marshalOption, object marshallerInstance, string marshalMethod, List <KeyValuePair <Type, object> > inputs, SynchronizationContext syncContext = null, bool makeDefault = false)
        {
            if (marshalOption == MarshalOption.UserDefined)
            {
                throw new InvalidOperationException($"User defined marshal options must call {nameof(AddDiverter)} passing a string argument into the first parameter.");
            }

            AddDiverter(marshalOption.ToString(), marshallerInstance, marshalMethod, inputs, syncContext, makeDefault);
        }
        public DiversionAttribute(MarshalOption option, string optionKey = null)
        {
            SelectedDiverter = option;

            if (option == MarshalOption.UserDefined)
            {
                SelectionKey = optionKey;
                MarshalInfo  = Diversion.GetInfo(optionKey);
            }
            else
            {
                MarshalInfo = Diversion.GetInfo(SelectedDiverter);
            }
        }
Beispiel #3
0
        public void AddEventHandlerRecord(MarshalOption option, int notificationId)
        {
            lock (Records)
            {
                var r = new HandlerRecord()
                {
                    HandlerThreadId = Thread.CurrentThread.ManagedThreadId,
                    MarshalOption   = option,
                    MarshalKey      = option.ToString(),
                    NotificationId  = notificationId
                };

                Records.Add(r);
            }
        }
Beispiel #4
0
 internal static MarshalInfo GetInfo(MarshalOption option)
 {
     return(GetInfo(option.ToString()));
 }