Example #1
0
 public void HandlePart(PartEvent partEvent)
 {
     foreach (var handler in internalHandlers)
     {
         handler.HandlePart(partEvent);
     }
 }
Example #2
0
 private static void OnPart(Message msg)
 {
     PartEvent?.Invoke(new SystemMsgEventArgs()
     {
         msg = msg
     });
 }
 public void On( PartEvent     e )
 {
     if ( e.Who.Nick == CurrentNickname ) foreach ( var channel in e.AffectedChannels ) {
         var info = GetChannelInfo(channel);
         info.Joined = false;
         info.People.Clear();
     } else foreach ( var channel in e.AffectedChannels ) {
         GetChannelInfo(channel).People.RemoveAll(p=>p.NUH.Nick == e.Who.Nick);
     }
 }
Example #4
0
        void onEditorPartEvent(ConstructionEventType evt, Part part)
        {
#if DEBUG
            switch (evt)
            {
            case ConstructionEventType.PartDragging:
            case ConstructionEventType.PartOffsetting:
            case ConstructionEventType.PartRotating:
                /* these events are too noisy for logging */
                break;

            default:
                Debug.Log($"[RCSBA]: Editor Part Event {evt} {part.partInfo.name}");
                break;
            }
#endif
            PartEvent?.Invoke();
            switch (evt)
            {
            case ConstructionEventType.PartCopied:
            case ConstructionEventType.PartCreated:
                OnSelectionChanged();
                break;

            case ConstructionEventType.PartPicked:
                if (part != EditorLogic.RootPart)
                {
                    OnSelectionChanged();
                }
                break;

            case ConstructionEventType.PartDropped:
                if (part != EditorLogic.RootPart)
                {
                    OnSelectionChanged();
                }
                break;

            case ConstructionEventType.PartDeleted:
                OnSelectionChanged();
                break;

            case ConstructionEventType.PartAttached:
            case ConstructionEventType.PartDetached:
                OnVesselPartChanged();
                OnSelectionChanged();
                break;

            case ConstructionEventType.PartDragging:
                PartDrag?.Invoke();
                break;
            }
        }
Example #5
0
        protected virtual async void OnPart(string source, string target, string message)
        {
            string sourceNick = source.GetNickFromSource();
            bool   me         = _currentNick.EqualsIgnoreCase(sourceNick);

            if (me)
            {
                RemoveChannel(target);
            }
            else
            {
                var c = GetChannel(target);
                c.RemoveUser(sourceNick);
            }

            if (StrictNames && !me)
            {
                await Send("NAMES {0}", target);
            }

            PartEvent.Raise(this, new JoinPartEventArgs(sourceNick, target, message, me));
        }
        private async Task Reader()
        {
            using (HttpClient client = new HttpClient {
                Timeout = Timeout.InfiniteTimeSpan
            })
            {
                for (int i = 1; AutoReconnect && (RetryLimit == -1 || i <= RetryLimit); i++)
                {
                    try
                    {
                        using (var response = await client.GetAsync($"https://stream.lobi.co/2/group/{GroupID}?token={AccessToken}", HttpCompletionOption.ResponseHeadersRead))
                            using (var reader = new System.IO.StreamReader(await response.Content.ReadAsStreamAsync()))
                            {
                                i         = 0;    //カウンタ初期化
                                Connected = true; //Connected!!
                                ConnectedEvent?.Invoke(GroupID);
                                while (!reader.EndOfStream)
                                {
                                    token = new CancellationTokenSource();       //トークン初期化
                                    var jobj = await _Read(reader, token.Token); //Jsonデータ読み取り

                                    var ev = jobj["event"]?.ToString();
                                    if (ev == "chat")
                                    {
                                        ChatEvent?.Invoke(GroupID, JsonConvert.DeserializeObject <Chat>(jobj["chat"].ToString()));
                                    }
                                    else if (ev == "chat_deleted")
                                    {
                                        ChatDeletedEvent?.Invoke(GroupID, jobj["id"].ToString());
                                    }
                                    else if (ev == "part")
                                    {
                                        PartEvent?.Invoke(GroupID, JsonConvert.DeserializeObject <UserMinimal>(jobj["user"].ToString()));
                                    }
                                    else if (ev == "archive")
                                    {
                                        ArchiveEvent?.Invoke(GroupID);
                                    }
                                }
                            }
                        token     = null;
                        Connected = false;
                        DisconnectedEvent?.Invoke(GroupID);
                    }
                    catch (OperationCanceledException)
                    {
                        token     = null;
                        Connected = false;
                        DisconnectedEvent?.Invoke(GroupID);
                        return;
                    }
                    catch (Exception ex)
                    {
                        if (Connected)
                        {
                            token     = null;
                            Connected = false;
                            DisconnectedEvent?.Invoke(GroupID);//必要かな??
                        }
                        else
                        {
                            token     = null;
                            Connected = false;//一応ね
                        }
                        FailConnectEvent?.Invoke(GroupID, ex);
                    }
                    await Task.Delay(RetryCoolTimeMilliseconds);//クールタイム
                }
            }
        }
Example #7
0
 public override void HandlePart(PartEvent ev)
 {
     Bind(ev.User);
 }
Example #8
0
 public void On( PartEvent     e )
 {
 }
Example #9
0
        public override void HandlePart(PartEvent ev)
        {
            var message = $"{ev.User} has left {ev.Channel}";

            DisplayEvent(message, ev.User, ev.Channel);
        }
Example #10
0
 protected virtual void RaisePartEvent(TokenEventArgs e)
 {
     PartEvent?.Invoke(this, e);
 }
Example #11
0
 private IrcEvent ParsePart(UserData sender, EntityData target, string[] param, string text)
 {
     // Export before deleting data
     var ev = new PartEvent((User)sender, (Channel)target, text);
     if (sender.isclient)
         Entities.DropChannel((ChannelData)target);
     else
         Entities.Unjoin((ChannelData)target, sender);
     return ev;
 }
 public virtual void HandlePart(PartEvent ev)
 {
 }
Example #13
0
        public static ResponseData InFunction(string comMessage)
        {
            var messageArg = new MessageArgs(comMessage);

            return(PartEvent?.Invoke(null, messageArg));         // 触发事件,执行所有注册过的函数
        }