Пример #1
0
        public override string json()
        {
            string outstring = "{ "
                               + "\"sessionId\": " + id + ", "
                               + "\"username\": \"" + username + "\", "
                               + "\"domain\": \"" + domainname + "\", "
                               + "\"stationname\": \"" + stationname + "\", "
                               + "\"connecttime\": \"" + ConnectTime + "\", "
                               + "\"disconnecttime\": \"" + DisconnectTime + "\", "
                               + "\"lastinputtime\": \"" + LastInputTime + "\", "
                               + "\"logontime\": \"" + LogonTime.ToString("s") + "Z" + "\", "
                               + "\"currenttime\": \"" + CurrentTime + "\", "
                               + "\"idletime\": \"" + IdleTime + "\", "
                               + "\"sessiontime\": \"" + SessionTime + "\", "
                               + "\"state\": \"" + connectstate.ToString().Substring(3) + "\", ";

            if (ld != null)
            {
                outstring += "\"logindata\": " + ld.json() + ", ";
            }
            outstring += "\"ticks\": " + ticks
                         + " }";
            return(outstring);
        }
Пример #2
0
 public string StateStr()
 {
     if (State == WTS_CONNECTSTATE_CLASS.WTSActive)
     {
         return("Active");
     }
     else if (State == WTS_CONNECTSTATE_CLASS.WTSDisconnected)
     {
         return("Disconnected (" + Cameyo.RdpMon.Utils.DurationStr(DateTime.UtcNow.Subtract(DisconnectTime)) + ")");
     }
     else if (State == WTS_CONNECTSTATE_CLASS.WTSDown)
     {
         return("Down (" + Cameyo.RdpMon.Utils.DurationStr(DateTime.UtcNow.Subtract(DisconnectTime)) + ")");
     }
     else
     {
         var str = State.ToString();
         if (str.StartsWith("WTS"))
         {
             str = str.Remove(0, 3);
         }
         return(str);
     }
 }