Beispiel #1
0
        public UnregisterStatus Unregister(string Username)
        {
            GetUsersResponse resp = api.Helix.Users.GetUsersAsync(logins: new List <string>()
            {
                Username
            }).Result;
            List <UserResponse> user = resp.Users.Select(t => new UserResponse(t)).ToList();

            if (user.Count == 0)
            {
                return(UnregisterStatus.UserNotFound);
            }

            if (!Tracking.Contains(user[0].Id))
            {
                return(UnregisterStatus.NotTracking);
            }

            Tracking.Remove(user[0].Id);
            UserDatabase.Remove(user[0].Id);

            Offline.Remove(user[0].Id);
            Online.Remove(user[0].Id);

            return(UnregisterStatus.Success);
        }
    // Update is called once per frame
    void OnEnable()
    {
        currNav = GameController.instance.player.GetComponent <Player_Control>().equipment[(int)bodyPart.Hand];
        Nav     = ((Equipable_Nav)ItemController.instance.items[currNav.itemFileName]);
        if (Nav.isOnline)
        {
            GameController.instance.Map_RenderFull();
            Offline.SetActive(false);
        }
        else
        {
            GameController.instance.Map_RenderHalf();
            Offline.SetActive(true);
        }

        if (Nav.SpendBattery)
        {
            Battery.SetActive(true);
        }
        else
        {
            Battery.SetActive(false);
        }

        if (currNav.valFloat < 0 && Nav.SpendBattery)
        {
            Display.SetActive(false);
        }
        else
        {
            Display.SetActive(true);
        }
    }
Beispiel #3
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (Class != null)
                {
                    hashCode = hashCode * 59 + Class.GetHashCode();
                }
                if (DisplayName != null)
                {
                    hashCode = hashCode * 59 + DisplayName.GetHashCode();
                }
                if (Executors != null)
                {
                    hashCode = hashCode * 59 + Executors.GetHashCode();
                }
                if (Icon != null)
                {
                    hashCode = hashCode * 59 + Icon.GetHashCode();
                }
                if (IconClassName != null)
                {
                    hashCode = hashCode * 59 + IconClassName.GetHashCode();
                }

                hashCode = hashCode * 59 + Idle.GetHashCode();

                hashCode = hashCode * 59 + JnlpAgent.GetHashCode();

                hashCode = hashCode * 59 + LaunchSupported.GetHashCode();
                if (LoadStatistics != null)
                {
                    hashCode = hashCode * 59 + LoadStatistics.GetHashCode();
                }

                hashCode = hashCode * 59 + ManualLaunchAllowed.GetHashCode();
                if (MonitorData != null)
                {
                    hashCode = hashCode * 59 + MonitorData.GetHashCode();
                }

                hashCode = hashCode * 59 + NumExecutors.GetHashCode();

                hashCode = hashCode * 59 + Offline.GetHashCode();
                if (OfflineCause != null)
                {
                    hashCode = hashCode * 59 + OfflineCause.GetHashCode();
                }
                if (OfflineCauseReason != null)
                {
                    hashCode = hashCode * 59 + OfflineCauseReason.GetHashCode();
                }

                hashCode = hashCode * 59 + TemporarilyOffline.GetHashCode();
                return(hashCode);
            }
        }
Beispiel #4
0
 /*
  *  Function: GoOffline
  *
  *  Puts the Web Module in Offline Mode
  */
 public void GoOffline()
 {
     _online = false;
     if (offline == null)
     {
         offline = new Offline();
     }
 }
Beispiel #5
0
 protected virtual void OnOffline(object sender, EventArgs args)
 {
     if (IsOnline)
     {
         Offline?.Invoke(sender, args);
     }
     Request       = null;
     this.IsOnline = false;
 }
Beispiel #6
0
 private void Session_StateChanged(object sender, AudioSessionStateChangedEventArgs e)
 {
     if (e.NewState == AudioSessionState.AudioSessionStateActive)
     {
         Online?.Invoke(this, new EventArgs());
     }
     else
     {
         Offline?.Invoke(this, new EventArgs());
     }
 }
Beispiel #7
0
 public void Remove(T key, string connectionId)
 {
     lock (_connections)
     {
         if (_connections.TryGetValue(key, out HashSet <string> connections))
         {
             connections.Remove(connectionId);
             if (connections.Count == 0)
             {
                 _connections.Remove(key);
                 Offline?.Invoke(this, key);
             }
         }
     }
 }
        public static bool CheckForPi()
        {
            Finding?.Invoke(null, EventArgs.Empty);
            var found = PingHost(piIP.ToString(), Port);

            if (PiFound && !found)
            {
                Offline?.Invoke(null, EventArgs.Empty);
            }
            if (!PiFound && found)
            {
                Online?.Invoke(null, EventArgs.Empty);
            }

            PiFound = found;

            return(PiFound);
        }
Beispiel #9
0
        /// <summary>
        /// Opens this PortBridgeServerProxy instance and listens for new connections coming through Service Bus.
        /// </summary>
        /// <exception cref="System.Security.SecurityException">Throws a SecurityException if Group Policy prohibits Resource Publishing.</exception>
        public async Task Open()
        {
            if (this.IsOpen)
            {
                throw new InvalidOperationException();
            }

            this.listener             = new HybridConnectionListener(connectionString.ToString());
            this.listener.Online     += (s, e) => { Online?.Invoke(this, e); };
            this.listener.Offline    += (s, e) => { Offline?.Invoke(this, e); };
            this.listener.Connecting += (s, e) => { Connecting?.Invoke(this, e); };

            await listener.OpenAsync(shuttingDown.Token);

            this.IsOpen = true;

            AcceptLoopAsync().Fork(this);
        }
Beispiel #10
0
 private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
 {
     if (e.IsAvailable)
     {
         Login().Wait();
         Online?.Invoke(this, new CDOEventArgs()
         {
             Session = this
         });
     }
     else
     {
         LoginHttpStatus = HttpStatusCode.ServiceUnavailable;
         Offline?.Invoke(this, new CDOOfflineEventArgs()
         {
             Session = this
         });
     }
 }
Beispiel #11
0
        /// <summary>
        /// 向用户列表中的在线用户推送信息
        /// </summary>
        /// <param name="p_userIDs">用户列表</param>
        /// <param name="p_msg">待推送信息</param>
        /// <returns>在线推送列表</returns>
        public static async Task <List <long> > Push(List <long> p_userIDs, MsgInfo p_msg)
        {
            if (p_userIDs == null || p_userIDs.Count == 0 || p_msg == null)
            {
                throw new Exception("待推送的用户或信息不可为空!");
            }

            var    onlines   = new List <long>();
            var    offlines  = new List <long>();
            string onlineMsg = p_msg.GetOnlineMsg();
            int    cnt       = await Kit.GetSvcReplicaCount();

            if (cnt > 1)
            {
                // Msg服务多副本推送
                await PushMultipleReplicas(p_userIDs, onlineMsg, onlines, offlines, cnt);
            }
            else
            {
                // 本地单副本推送
                PushLocal(p_userIDs, onlineMsg, onlines, offlines);
            }

            // 离线
            if (offlines.Count > 0)
            {
                // 将消息保存到用户的未推送列表
                var lc = new ListCache <string>(MsgQueueKey);
                foreach (long id in offlines)
                {
                    await lc.RightPush(id, onlineMsg);
                }

                // 推送离线提醒
                if (!string.IsNullOrEmpty(p_msg.Title))
                {
                    Offline.Add(offlines, p_msg);
                }
            }
            return(onlines);
        }
Beispiel #12
0
    /*
     *  Function: postOfflineAction
     *
     *  Handles actions if module is offline.
     *
     *  Parameters:
     *
     *  action - The desired action
     *  form - The WWWForm to submit to the server
     *  returnType - The type of data that needs to be returned
     *  callback - A function pointer to the method that will manage the returned data
     *
     *  See Also:
     *
     *  - <GoOffline>
     *  - <PostAction(WebActions, WWWForm, ReturnTypes, function)>
     */
    private void postOfflineAction(WebActions action, WWWForm form, ReturnTypes returnType, Action <Hashtable> callback)
    {
        if (offline == null)
        {
            offline = new Offline();
        }

        switch (action)
        {
        case WebActions.GetQuestions:
            TextAsset questionsXML = (TextAsset)Resources.Load(Assets.Resources.Data.Questions);
            Hashtable data         = GetQuestionDataFromXML(questionsXML.text);
            callback(data);
            break;

        default:
            Hashtable temp = new Hashtable();
            temp["data"] = true;
            callback(temp);
            break;
        }
    }
    public void SetData(FriendData data)
    {
        foreach (UnityEngine.UI.Button b in unfriend)
        {
            b.onClick.RemoveAllListeners();
            b.onClick.AddListener(() => { FriendManager.callRemoveFriend(data); SmallWindow.singleton.close(gameObject); });
        }
        Tname.text      = data.Name;
        level.text      = "Level " + data.Level.ToString();
        statistics.text = data.Staticsics;
        status.text     = data.status.ToString();
        if (data.icon != new Sprite())
        {
            Icon.sprite = data.icon;
        }
        else
        {
            Icon.sprite = defaultIcon;
        }

        switch (data.status)
        {
        case friendStatus.Online:
            Offline.SetActive(false);
            Online.SetActive(true);
            break;

        case friendStatus.Offline:
            Offline.SetActive(true);
            Online.SetActive(false);
            break;

        case friendStatus.Playing:
            Offline.SetActive(false);
            Online.SetActive(true);
            break;
        }
    }
Beispiel #14
0
    public override string ToString()
    {
        StringBuilder __sb = new StringBuilder("TimMBean(");

        __sb.Append(", ThreadId: ");
        __sb.Append(ThreadId);
        if (Mid != null && __isset.mid)
        {
            __sb.Append(", Mid: ");
            __sb.Append(Mid);
        }
        if (FromTid != null && __isset.fromTid)
        {
            __sb.Append(", FromTid: ");
            __sb.Append(FromTid == null ? "<null>" : FromTid.ToString());
        }
        if (ToTid != null && __isset.toTid)
        {
            __sb.Append(", ToTid: ");
            __sb.Append(ToTid == null ? "<null>" : ToTid.ToString());
        }
        if (Body != null && __isset.body)
        {
            __sb.Append(", Body: ");
            __sb.Append(Body);
        }
        if (Type != null && __isset.type)
        {
            __sb.Append(", Type: ");
            __sb.Append(Type);
        }
        if (__isset.msgType)
        {
            __sb.Append(", MsgType: ");
            __sb.Append(MsgType);
        }
        if (Offline != null && __isset.offline)
        {
            __sb.Append(", Offline: ");
            __sb.Append(Offline == null ? "<null>" : Offline.ToString());
        }
        if (LeaguerTid != null && __isset.leaguerTid)
        {
            __sb.Append(", LeaguerTid: ");
            __sb.Append(LeaguerTid == null ? "<null>" : LeaguerTid.ToString());
        }
        if (ExtraList != null && __isset.extraList)
        {
            __sb.Append(", ExtraList: ");
            __sb.Append(ExtraList);
        }
        if (Timestamp != null && __isset.timestamp)
        {
            __sb.Append(", Timestamp: ");
            __sb.Append(Timestamp);
        }
        if (Error != null && __isset.error)
        {
            __sb.Append(", Error: ");
            __sb.Append(Error == null ? "<null>" : Error.ToString());
        }
        if (ExtraMap != null && __isset.extraMap)
        {
            __sb.Append(", ExtraMap: ");
            __sb.Append(ExtraMap);
        }
        if (__isset.readstatus)
        {
            __sb.Append(", Readstatus: ");
            __sb.Append(Readstatus);
        }
        __sb.Append(")");
        return(__sb.ToString());
    }
Beispiel #15
0
 public void Write(TProtocol oprot)
 {
     oprot.IncrementRecursionDepth();
     try
     {
         TStruct struc = new TStruct("TimMBean");
         oprot.WriteStructBegin(struc);
         TField field = new TField();
         field.Name = "threadId";
         field.Type = TType.String;
         field.ID   = 1;
         oprot.WriteFieldBegin(field);
         oprot.WriteString(ThreadId);
         oprot.WriteFieldEnd();
         if (Mid != null && __isset.mid)
         {
             field.Name = "mid";
             field.Type = TType.String;
             field.ID   = 2;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Mid);
             oprot.WriteFieldEnd();
         }
         if (FromTid != null && __isset.fromTid)
         {
             field.Name = "fromTid";
             field.Type = TType.Struct;
             field.ID   = 3;
             oprot.WriteFieldBegin(field);
             FromTid.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (ToTid != null && __isset.toTid)
         {
             field.Name = "toTid";
             field.Type = TType.Struct;
             field.ID   = 4;
             oprot.WriteFieldBegin(field);
             ToTid.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (Body != null && __isset.body)
         {
             field.Name = "body";
             field.Type = TType.String;
             field.ID   = 5;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Body);
             oprot.WriteFieldEnd();
         }
         if (Type != null && __isset.type)
         {
             field.Name = "type";
             field.Type = TType.String;
             field.ID   = 6;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Type);
             oprot.WriteFieldEnd();
         }
         if (__isset.msgType)
         {
             field.Name = "msgType";
             field.Type = TType.I16;
             field.ID   = 7;
             oprot.WriteFieldBegin(field);
             oprot.WriteI16(MsgType);
             oprot.WriteFieldEnd();
         }
         if (Offline != null && __isset.offline)
         {
             field.Name = "offline";
             field.Type = TType.Struct;
             field.ID   = 8;
             oprot.WriteFieldBegin(field);
             Offline.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (LeaguerTid != null && __isset.leaguerTid)
         {
             field.Name = "leaguerTid";
             field.Type = TType.Struct;
             field.ID   = 9;
             oprot.WriteFieldBegin(field);
             LeaguerTid.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (ExtraList != null && __isset.extraList)
         {
             field.Name = "extraList";
             field.Type = TType.List;
             field.ID   = 10;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteListBegin(new TList(TType.Struct, ExtraList.Count));
                 foreach (TimNode _iter82 in ExtraList)
                 {
                     _iter82.Write(oprot);
                 }
                 oprot.WriteListEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (Timestamp != null && __isset.timestamp)
         {
             field.Name = "timestamp";
             field.Type = TType.String;
             field.ID   = 11;
             oprot.WriteFieldBegin(field);
             oprot.WriteString(Timestamp);
             oprot.WriteFieldEnd();
         }
         if (Error != null && __isset.error)
         {
             field.Name = "error";
             field.Type = TType.Struct;
             field.ID   = 12;
             oprot.WriteFieldBegin(field);
             Error.Write(oprot);
             oprot.WriteFieldEnd();
         }
         if (ExtraMap != null && __isset.extraMap)
         {
             field.Name = "extraMap";
             field.Type = TType.Map;
             field.ID   = 13;
             oprot.WriteFieldBegin(field);
             {
                 oprot.WriteMapBegin(new TMap(TType.String, TType.String, ExtraMap.Count));
                 foreach (string _iter83 in ExtraMap.Keys)
                 {
                     oprot.WriteString(_iter83);
                     oprot.WriteString(ExtraMap[_iter83]);
                 }
                 oprot.WriteMapEnd();
             }
             oprot.WriteFieldEnd();
         }
         if (__isset.readstatus)
         {
             field.Name = "readstatus";
             field.Type = TType.I16;
             field.ID   = 14;
             oprot.WriteFieldBegin(field);
             oprot.WriteI16(Readstatus);
             oprot.WriteFieldEnd();
         }
         oprot.WriteFieldStop();
         oprot.WriteStructEnd();
     }
     finally
     {
         oprot.DecrementRecursionDepth();
     }
 }
Beispiel #16
0
        /// <summary>
        /// Returns true if HudsonMasterComputer instances are equal
        /// </summary>
        /// <param name="other">Instance of HudsonMasterComputer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(HudsonMasterComputer other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Class == other.Class ||
                     Class != null &&
                     Class.Equals(other.Class)
                     ) &&
                 (
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                 ) &&
                 (
                     Executors == other.Executors ||
                     Executors != null &&
                     Executors.SequenceEqual(other.Executors)
                 ) &&
                 (
                     Icon == other.Icon ||
                     Icon != null &&
                     Icon.Equals(other.Icon)
                 ) &&
                 (
                     IconClassName == other.IconClassName ||
                     IconClassName != null &&
                     IconClassName.Equals(other.IconClassName)
                 ) &&
                 (
                     Idle == other.Idle ||
                     Idle != null &&
                     Idle.Equals(other.Idle)
                 ) &&
                 (
                     JnlpAgent == other.JnlpAgent ||
                     JnlpAgent != null &&
                     JnlpAgent.Equals(other.JnlpAgent)
                 ) &&
                 (
                     LaunchSupported == other.LaunchSupported ||
                     LaunchSupported != null &&
                     LaunchSupported.Equals(other.LaunchSupported)
                 ) &&
                 (
                     LoadStatistics == other.LoadStatistics ||
                     LoadStatistics != null &&
                     LoadStatistics.Equals(other.LoadStatistics)
                 ) &&
                 (
                     ManualLaunchAllowed == other.ManualLaunchAllowed ||
                     ManualLaunchAllowed != null &&
                     ManualLaunchAllowed.Equals(other.ManualLaunchAllowed)
                 ) &&
                 (
                     MonitorData == other.MonitorData ||
                     MonitorData != null &&
                     MonitorData.Equals(other.MonitorData)
                 ) &&
                 (
                     NumExecutors == other.NumExecutors ||
                     NumExecutors != null &&
                     NumExecutors.Equals(other.NumExecutors)
                 ) &&
                 (
                     Offline == other.Offline ||
                     Offline != null &&
                     Offline.Equals(other.Offline)
                 ) &&
                 (
                     OfflineCause == other.OfflineCause ||
                     OfflineCause != null &&
                     OfflineCause.Equals(other.OfflineCause)
                 ) &&
                 (
                     OfflineCauseReason == other.OfflineCauseReason ||
                     OfflineCauseReason != null &&
                     OfflineCauseReason.Equals(other.OfflineCauseReason)
                 ) &&
                 (
                     TemporarilyOffline == other.TemporarilyOffline ||
                     TemporarilyOffline != null &&
                     TemporarilyOffline.Equals(other.TemporarilyOffline)
                 ));
        }
Beispiel #17
0
 public static void OnOffline()
 {
     Offline.Invoke();
 }
Beispiel #18
0
 public LoginForm()
 {
     InitializeComponent();
     Offline.Hide();
 }
Beispiel #19
0
 private void Session_SessionDisconnected(object sender, AudioSessionDisconnectedEventArgs e) => Offline?.Invoke(this, new EventArgs());