Ejemplo n.º 1
0
            public IDisposable Subscribe <T>(ActionIn <T> action)
            {
                Action = action;
                ++SubscribeCount;

                return(null);
            }
Ejemplo n.º 2
0
        public static void InitFromProcessParameters<T>(T obj, System.Collections.Generic.IEnumerator<string> enumerator) where T : ArchiveProcessParameters
        {
            ThrowIfNull(obj, nameof(obj));
            ThrowIfNull(enumerator, nameof(enumerator));

            System.Reflection.PropertyInfo[] enumerable = obj.GetType().GetProperties();

            try
            {
                ActionIn<System.Reflection.PropertyInfo> action = _action;

                void _action(in System.Reflection.PropertyInfo _p)
                {
                    void __action(in System.Reflection.PropertyInfo __p)
                    {
                        if (enumerator.MoveNext())

                            __p.SetValue(obj, typeof(Enum).IsAssignableFrom(__p.PropertyType) ? Enum.Parse(__p.PropertyType, enumerator.Current) : Convert.ChangeType(enumerator.Current, __p.PropertyType));

                        else

                            throw new InvalidOperationException(ProcessParametersCouldNotBeParsedCorrectly);
                    }

                    if (_p.Name == nameof(Guid))
                    {
                        action = __action;

                        _ = enumerator.MoveNext();

                        return;
                    }

                    __action(_p);
                }

                foreach (System.Reflection.PropertyInfo p in enumerable)

                    action(p);
            }

            catch (Exception ex) when (ex.Is(false, typeof(InvalidCastException), typeof(FormatException), typeof(OverflowException), typeof(ArgumentNullException)))
            {
                throw new InvalidOperationException(ProcessParametersCouldNotBeParsedCorrectly, ex);
            }
        }
Ejemplo n.º 3
0
 public Subscription(int worldId, ActionIn <T> action)
 {
     _worldId = worldId;
     _action  = action;
 }
Ejemplo n.º 4
0
 public IDisposable Subscribe <T>(ActionIn <T> action)
 {
     return(globalEcsContext.Subscribe <T>(action));
 }
Ejemplo n.º 5
0
 public CommandHandler(ActionIn <T> handler)
 {
     _handler = handler;
 }
Ejemplo n.º 6
0
                public StateDefinitionBuilder Do(ActionIn <TCommand> handle)
                {
                    _stateDefinitionBuilder.AddHandler(handle);

                    return(_stateDefinitionBuilder);
                }
Ejemplo n.º 7
0
 private void AddHandler <TCommand>(ActionIn <TCommand> handler) =>
 _configuration.CommandHandlers.Add(
     CommandTypeId <TCommand> .Value,
     new CommandHandler <TCommand>(handler)
     );