Exemple #1
0
 public ResourceHistory(string workflowOutput, IList <IDebugState> debugOutput, IEventInfo taskHistoryOutput, string userName)
 {
     TaskHistoryOutput = taskHistoryOutput;
     DebugOutput       = debugOutput;
     WorkflowOutput    = workflowOutput;
     UserName          = userName;
 }
Exemple #2
0
 protected virtual void ProcessSection(ISyntaxInfo Info)
 {
     if (Info is IRangeInfo)
     {
         IRangeInfo info1 = (IRangeInfo)Info;
         if (info1.StartPoint.Y >= 0)
         {
             this.sections.Add(info1);
         }
         this.ProcessSections(info1.Regions);
         this.ProcessSections(info1.Comments);
     }
     if (Info is IInterfaceInfo)
     {
         IInterfaceInfo info2 = (InterfaceInfo)Info;
         this.ProcessSections(info2.Methods);
         this.ProcessSections(info2.Properties);
         this.ProcessSections(info2.Events);
     }
     if (Info is IClassInfo)
     {
         IClassInfo info3 = (IClassInfo)Info;
         this.ProcessSections(info3.Classes);
         this.ProcessSections(info3.Interfaces);
         this.ProcessSections(info3.Structures);
         this.ProcessSections(info3.Enums);
     }
     if (Info is IMethodInfo)
     {
         this.ProcessSections(((IMethodInfo)Info).Statements);
     }
     else if (Info is IPropInfo)
     {
         IPropInfo info4 = (ICsPropInfo)Info;
         if (info4.PropertyGet != null)
         {
             this.ProcessSection(info4.PropertyGet);
         }
         if (info4.PropertySet != null)
         {
             this.ProcessSection(info4.PropertySet);
         }
     }
     else if (Info is IEventInfo)
     {
         IEventInfo info5 = (ICsEventInfo)Info;
         if (info5.EventAdd != null)
         {
             this.ProcessSection(info5.EventAdd);
         }
         if (info5.EventRemove != null)
         {
             this.ProcessSection(info5.EventRemove);
         }
     }
     else if (Info is IAccessorInfo)
     {
         this.ProcessSections(((IAccessorInfo)Info).Statements);
     }
 }
Exemple #3
0
        public void SendNotificationEmail(int[] userIds, IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));
            Require.NotNull(userIds, nameof(userIds));

            var mail = new MailMessage
            {
                From = new MailAddress(_mailerSettings.From)
            };
            var client = _mailerSettings.GetSmtpClient();

            mail.Subject = MailingResources.NotificationMailCaption;
            mail.Body    = string.Format(MailingResources.NotificationMessageTemplate,
                                         _notificationEmailDescriber.Describe((dynamic)eventInfo));

            foreach (var emailAdress in userIds.Select(userId => _usersRepository.GetAccount(userId).Email))
            {
                mail.To.Add(emailAdress);

                client.Send(mail);

                mail.To.Clear();
            }

            mail.Dispose();
        }
        /// <summary>
        /// event TDelegate IInterface.EventName <br/>
        /// {                                    <br/>
        ///   add{...}                           <br/>
        ///   remove{...}                        <br/>
        /// }                                    <br/>
        /// </summary>
        protected internal virtual EventDeclarationSyntax DeclareEvent(IEventInfo @event, CSharpSyntaxNode?addBody = null, CSharpSyntaxNode?removeBody = null, bool forceInlining = false)
        {
            Debug.Assert(@event.DeclaringType.IsInterface);

            EventDeclarationSyntax result = EventDeclaration
                                            (
                type: CreateType(@event.Type),
                identifier: Identifier(@event.Name)
                                            )
                                            .WithExplicitInterfaceSpecifier
                                            (
                explicitInterfaceSpecifier: ExplicitInterfaceSpecifier((NameSyntax)CreateType(@event.DeclaringType))
                                            );

            List <AccessorDeclarationSyntax> accessors = new List <AccessorDeclarationSyntax>();

            if (@event.AddMethod != null && addBody != null)
            {
                accessors.Add(DeclareAccessor(SyntaxKind.AddAccessorDeclaration, addBody, forceInlining));
            }

            if (@event.RemoveMethod != null && removeBody != null)
            {
                accessors.Add(DeclareAccessor(SyntaxKind.RemoveAccessorDeclaration, removeBody, forceInlining));
            }

            return(!accessors.Any() ? result : result.WithAccessorList
                   (
                       accessorList: AccessorList
                       (
                           accessors: List(accessors)
                       )
                   ));
        }
 public ResourceHistory(string workflowOutput, IList<IDebugState> debugOutput, IEventInfo taskHistoryOutput, string userName)
 {
     TaskHistoryOutput = taskHistoryOutput;
     DebugOutput = debugOutput;
     WorkflowOutput = workflowOutput;
     UserName = userName;
 }
Exemple #6
0
 public Event(IEventInfo eventInfo, int id = 0)
 {
     Id         = id;
     OccurredOn = DateTimeOffset.Now;
     EventInfo  = JsonConvert.SerializeObject(eventInfo);
     EventType  = eventInfo.GetEventType();
 }
        void OnSelectEnemy(IEventInfo a_info)
        {
            EnemyInfo enemyInfo = a_info as EnemyInfo;

            if (enemyInfo != null && enemyInfo.enemy == this)
            {
                // Update selected name
                ReferenceManager.Instance.enemySelectPanelText.text = "To " + battleProfile.EntityName + " " + enemySlot.ToString();

                // Update selected slot
                BattleManager.Instance.CurrEnemySelect = enemyInfo.enemy.enemySlot;

                // Update current command target (if there is one)
                if (BattleManager.Instance.CurrentCommand != null)
                {
                    BattleManager.Instance.CurrentCommand.target = this;
                }

                // Ensure button is selected
                anim.SetBool("Selected", true);
            }
            // Ensure all other buttons are unselected
            else if (enemyInfo != null && enemyInfo.enemy.enemySlot != enemySlot)
            {
                anim.SetBool("Selected", false);
            }
        }
Exemple #8
0
        void OnPartyReady(IEventInfo a_info)
        {
            PartyInfo partyInfo = a_info as PartyInfo;

            if (partyInfo != null && partyInfo.partySlot == partySlot)
            {
                //Debug.Log("ON PARTY READY FOR " + partyInfo.partySlot);

                // There can only be one party ready at a time, so unready all others
                for (int i = 0; i < BattleManager.Instance.PartyMembers.Length; ++i)
                {
                    ePartySlot currSlot = (ePartySlot)i;

                    if (partyInfo.partySlot != currSlot)
                    {
                        EventManager.TriggerEvent("PartyUnready", new PartyInfo {
                            partySlot = currSlot
                        });
                    }
                }

                // Update action panel data
                ReferenceManager.Instance.actionPanelName.text = battleProfile.EntityName;

                // Visually move into ready position
                gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x, readyOffset, gameObject.transform.localPosition.z);
            }
        }
Exemple #9
0
        public void SendNotificationEmail(int[] userIds, IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));
            Require.NotNull(userIds, nameof(userIds));

            var mail = new MailMessage
            {
                From = new MailAddress(_mailerSettings.From)
            };
            var client = _mailerSettings.GetSmtpClient();

            mail.Subject = MailingResources.NotificationMailCaption;
            mail.Body = string.Format(MailingResources.NotificationMessageTemplate,
                _notificationEmailDescriber.Describe((dynamic) eventInfo));

            foreach (var emailAdress in userIds.Select(userId => _usersRepository.GetAccount(userId).Email))
            {
                mail.To.Add(emailAdress);

                client.Send(mail);

                mail.To.Clear();
            }

            mail.Dispose();
        }
        protected IEventInfo GetEvent(EventInfo member)
        {
            IEventInfo wrapper = FindByName(GetType(member.DeclaringType).GetEvents(All), member.Name);

            Assert.IsNotNull(wrapper, "Could not find event '{0}'.", member);
            return(wrapper);
        }
        public void EventWrapper(Type type, string eventName)
        {
            EventInfo  target = type.GetEvent(eventName, All);
            IEventInfo info   = GetEvent(target);

            WrapperAssert.AreEquivalent(target, info, false);
        }
        internal UnresolvedEventInfo(IEventInfo adapter)
        {
            if (adapter == null)
                throw new ArgumentNullException("adapter");

            this.adapter = adapter;
        }
Exemple #13
0
        /// <summary>
        /// Save event info to the buffer
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static string StoreEventInfo(IEventInfo info)
        {
            var guid = Guid.NewGuid();

            EventInfoStore.TryAdd(guid.ToString(), info);
            return(guid.ToString());
        }
Exemple #14
0
        public Event(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            OccuredOn = DateTime.UtcNow;
            EventType = eventInfo.GetEventType();
            EventInfo = SerializeEventInfo(eventInfo);
        }
        void OnConfirmEnemySelect(IEventInfo a_info)
        {
            // Add action against enemy to the command list
            _commandList.Add(CurrentCommand);

            // Selection done, go to next party member
            EventManager.TriggerEvent("NextPartyMember");
        }
Exemple #16
0
        public Event(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            OccuredOn = DateTime.UtcNow;
            EventType = eventInfo.GetEventType();
            EventInfo = SerializeEventInfo(eventInfo);
        }
 /// <summary>
 /// Fill the dto
 /// </summary>
 /// <param name="ev"></param>
 public virtual void Fill(IEventInfo ev)
 {
     Type      = ev.Type;
     Title     = ev.Title;
     Message   = ev.Message;
     Data      = ev.Data;
     Progress  = ev.Progress;
     TimeStamp = ev.TimeStamp;
 }
Exemple #18
0
        internal UnresolvedEventInfo(IEventInfo adapter)
        {
            if (adapter == null)
            {
                throw new ArgumentNullException("adapter");
            }

            this.adapter = adapter;
        }
        public void SendNotificationEmail(int[] userIds, IEventInfo eventInfo)
        {
            Require.NotEmpty(userIds, nameof(userIds));
            Require.NotNull(eventInfo, nameof(eventInfo));

            var description = _notificationEmailDescriber.Describe(eventInfo);
            var notificationMail = new NotificationEmail(userIds, description);
            _notificationMailRepository.SaveNotificationEmail(notificationMail);
        }
Exemple #20
0
        protected void SendOutEmailsAboutEvent(int[] userIds, IEventInfo eventInfo)
        {
            var ids =
                userIds.Where(
                    id =>
                    _userPresentationProvider.GetUserEventSettings(id, eventInfo.GetEventType()) ==
                    NotificationSettingValue.SendNotificationAndMail).ToArray();

            Mailer.SendNotificationEmail(ids, eventInfo);
        }
Exemple #21
0
        public void SendNotificationEmail(int[] userIds, IEventInfo eventInfo)
        {
            Require.NotEmpty(userIds, nameof(userIds));
            Require.NotNull(eventInfo, nameof(eventInfo));

            var description      = _notificationEmailDescriber.Describe(eventInfo);
            var notificationMail = new NotificationEmail(userIds, description);

            _notificationMailRepository.SaveNotificationEmail(notificationMail);
        }
Exemple #22
0
    /**
     * @brief Invoke a specified event.
     * @param a_eventName is the name of the event.
     * @param a_eventInfo is the information to pass into the event.
     * */
    public static void TriggerEvent(string a_eventName, IEventInfo a_eventInfo = null)
    {
        GameplayEvent foundEvent = null;

        // Event exists
        if (instance.eventDict.TryGetValue(a_eventName, out foundEvent))
        {
            foundEvent.Invoke(a_eventInfo);
        }
    }
        protected void SendOutEmailsAboutEvent(int[] userIds, IEventInfo eventInfo)
        {
            var ids =
                userIds.Where(
                    id =>
                        _userPresentationProvider.GetUserEventSettings(id, eventInfo.GetEventType()) ==
                        NotificationSettingValue.SendNotificationAndMail).ToArray();

            Mailer.SendNotificationEmail(ids, eventInfo);
        }
Exemple #24
0
        void OnPartyUnready(IEventInfo a_info)
        {
            PartyInfo partyInfo = a_info as PartyInfo;

            if (partyInfo != null && partyInfo.partySlot == partySlot || partyInfo.partySlot == ePartySlot.NONE)
            {
                // Reset position to default
                gameObject.transform.localPosition = Vector3.zero;
            }
        }
        public Task <IReadOnlyList <string> > GetHandlersAsync(IEventInfo ev)
        {
            string handler;

            if (this.events.TryGetValue(ev, out handler))
            {
                return(Task.FromResult <IReadOnlyList <string> > (new[] { handler }));
            }

            return(Task.FromResult <IReadOnlyList <string> > (new string[0]));
        }
 void OnTameEnemy(IEventInfo a_info)
 {
     // Enemy was the last, freeze hp countdown on party members
     if (EnemyEntities.Count == 1)
     {
         foreach (var party in PartyEntities)
         {
             party.StopAllCoroutines();
         }
     }
 }
 /// <summary>
 /// target.Event [+|-]= ...;
 /// </summary>
 protected internal AssignmentExpressionSyntax RegisterEvent(IEventInfo @event, ExpressionSyntax?target, bool add, ExpressionSyntax right, ITypeInfo?castTargetTo = null) => AssignmentExpression
 (
     kind: add ? SyntaxKind.AddAssignmentExpression : SyntaxKind.SubtractAssignmentExpression,
     left: MemberAccess
     (
         target,
         @event,
         castTargetTo
     ),
     right: right
 );
        // TODO: Break error handling out into reusable interface implementer
        public EventViewModel(TargetPlatform platform, IEventInfo ev, IEnumerable <IObjectEditor> editors)
            : base(platform, editors)
        {
            if (ev == null)
            {
                throw new ArgumentNullException(nameof(ev));
            }

            Event = ev;
            RequestCurrentValueUpdate();
        }
Exemple #29
0
 /// <summary>
 /// Get the event from the buffer
 /// </summary>
 /// <param name="evinfo"></param>
 /// <returns></returns>
 private static IEventInfo DequeueEventInfo(IEventInfo evinfo)
 {
     if (infoEventInfoBuffer.TryDequeue(out var ev))
     {
         return(ev);
     }
     else
     {
         return(null);
     }
 }
        public override void ConsumeEvent(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            var @event = new Event(eventInfo);

            var distributionPolicy = DistributionPolicyFactory.GetAdminRelatedPolicy();

            EventRepository.DistrubuteEvent(@event, distributionPolicy);

            SendOutEmailsAboutEvent(distributionPolicy.ReceiverIds, eventInfo);
        }
        public override void ConsumeEvent(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            var @event = new Event(eventInfo);

            var distributionPolicy = GetDistributionPolicyForEvent((dynamic) eventInfo);

            EventRepository.DistrubuteEvent(@event, distributionPolicy);

            SendOutEmailsAboutEvent(distributionPolicy.ReceiverIds, eventInfo);
        }
        public override void ConsumeEvent(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            var @event = new Event(eventInfo);

            var distributionPolicy = GetDistributionPolicyForEvent((dynamic)eventInfo);

            EventRepository.DistrubuteEvent(@event, distributionPolicy);

            SendOutEmailsAboutEvent(distributionPolicy.ReceiverIds, eventInfo);
        }
        public override void ConsumeEvent(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            var @event = new Event(eventInfo);

            var distributionPolicy = DistributionPolicyFactory.GetAdminRelatedPolicy();

            EventRepository.DistrubuteEvent(@event, distributionPolicy);

            SendOutEmailsAboutEvent(distributionPolicy.ReceiverIds, eventInfo);
        }
Exemple #34
0
        public virtual void ConsumeEvent(IEventInfo eventInfo)
        {
            Require.NotNull(eventInfo, nameof(eventInfo));

            var @event = new Event(eventInfo);

            var distributionPolicy = DistributionPolicyFactory.GetAdminRelatedPolicy();

            EventRepository.DistrubuteEvent(@event, distributionPolicy);

            Mailer.SendNotificationEmail(distributionPolicy.ReceiverIds, eventInfo);
        }
        public Task <IReadOnlyList <string> > GetHandlersAsync(IEventInfo ev)
        {
            if (ev == null)
            {
                throw new ArgumentNullException(nameof(ev));
            }

            if (!(ev is Xamarin.PropertyEditing.Reflection.ReflectionEventInfo info))
            {
                throw new ArgumentException();
            }

            return(Task.FromResult(info.GetHandlers(this.target)));
        }
Exemple #36
0
    /// <summary>
    /// When the socket message event is invoked.
    /// </summary>
    /// <remarks>
    /// <para>Receives and handles received <see cref="GuildedSocketMessage" /> messages.</para>
    /// </remarks>
    /// <param name="message">A message received from a WebSocket</param>
    protected void OnSocketMessage(GuildedSocketMessage message)
    {
        object eventName = message.EventName ?? (object)message.Opcode;

        // Checks if this event is supported by Guilded.NET
        if (GuildedEvents.ContainsKey(eventName))
        {
            IEventInfo <object> ev = GuildedEvents[eventName];

            object data = ev.Transform(ev.ArgumentType, GuildedSerializer, message);

            ev.OnNext(data);
        }
    }
        void CallRunDialog(IEventInfo a_info)
        {
            DialogRunInfo dialogRunInfo = a_info as DialogRunInfo;

            StopAllCoroutines();

            if (dialogRunInfo != null)
            {
                StartCoroutine("RunThroughDialog", dialogRunInfo.onDialogCompleteFunc);
            }
            else
            {
                StartCoroutine(RunThroughDialog());
            }
        }
        public Task <IReadOnlyList <string> > GetHandlersAsync(IEventInfo ev)
        {
            if (ev == null)
            {
                throw new ArgumentNullException(nameof(ev));
            }

            ReflectionEventInfo info = ev as ReflectionEventInfo;

            if (info == null)
            {
                throw new ArgumentException();
            }

            return(Task.FromResult(info.GetHandlers(this.target)));
        }
 public abstract void ConsumeEvent(IEventInfo eventInfo);
Exemple #40
0
 private static string SerializeEventInfo(IEventInfo eventInfo)
 {
     return JsonConvert.SerializeObject((dynamic) eventInfo);
 }
 public override EventInfo Wrap(IEventInfo adapter)
 {
     return new UnresolvedEventInfo(adapter);
 }
        public string Describe(IEventInfo @eventInfo)
        {
            Require.NotNull(@eventInfo, nameof(@eventInfo));

            return Describe((dynamic) @eventInfo);
        }
 /// <inheritdoc />
 public bool Equals(IEventInfo other)
 {
     return Equals((object)other);
 }
 /// <summary>
 /// Creates a <see cref="EventInfo" /> wrapper for <see cref="IEventInfo" />.
 /// </summary>
 /// <param name="adapter">The adapter.</param>
 /// <returns>The unresolved event.</returns>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="adapter"/> is null.</exception>
 public abstract EventInfo Wrap(IEventInfo adapter);
        /// <summary>
        /// Resolves a reflected event to its native <see cref="EventInfo" /> object.
        /// </summary>
        /// <param name="event">The reflected event.</param>
        /// <param name="throwOnError">If true, throws an exception if resolution fails,
        /// otherwise returns an unresolved <see cref="EventInfo" />.</param>
        /// <returns>The resolved <see cref="EventInfo" />.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="event"/>
        /// is null.</exception>
        /// <exception cref="ReflectionResolveException">Thrown if <paramref name="event"/>
        /// could not be resolved.</exception>
        public static EventInfo ResolveEvent(IEventInfo @event, bool throwOnError)
        {
            if (@event == null)
                throw new ArgumentNullException("event");

            try
            {
                Type resolvedType = @event.DeclaringType.Resolve(throwOnError);
                if (!Reflector.IsUnresolved(resolvedType))
                {
                    EventInfo resolvedEvent =
                        resolvedType.GetEvent(@event.Name, BindingFlags.Public | BindingFlags.NonPublic
                            | BindingFlags.Instance | BindingFlags.Static);

                    if (resolvedEvent != null)
                        return resolvedEvent;
                }
            }
            catch (Exception ex)
            {
                if (throwOnError)
                    throw new ReflectionResolveException(@event, ex);
            }

            if (throwOnError)
                throw new ReflectionResolveException(@event);

            return UnresolvedCodeElementFactory.Instance.Wrap(@event);
        }