ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/CCSFinger/Login.cs
Revision: 725
Committed: 2006-03-31T04:13:36-08:00 (19 years, 3 months ago) by douglas
File size: 1476 byte(s)
Log Message:
Service Worky!

File Contents

# Content
1 // Douglas Thrift
2 //
3 // CCS Computer Science
4 //
5 // Login
6
7 using System;
8
9 public class Login
10 {
11 private Net.USER_INFO_11 info;
12 private uint id;
13 private string session;
14 private string client;
15 private Wts.WTS_PROTOCOL_TYPE protocol;
16 private Wts.WTS_CONNECTSTATE_CLASS status;
17 private DateTime logon = DateTime.MinValue;
18
19 public Login(string login)
20 {
21 Net.UserGetInfo(null, login, 11, out info);
22
23 this.id = uint.MaxValue;
24 }
25
26 public Login(string login, uint id, string session, string client, Wts.WTS_PROTOCOL_TYPE protocol, Wts.WTS_CONNECTSTATE_CLASS status)
27 {
28 Net.UserGetInfo(null, login, 11, out info);
29
30 this.id = id;
31 this.session = session;
32 this.client = client;
33 this.protocol = protocol;
34 this.status = status;
35 }
36
37 public string Client
38 {
39 get { return protocol == Wts.WTS_PROTOCOL_TYPE.WTS_PROTOCOL_TYPE_CONSOLE ? "the Console" : client; }
40 }
41
42 public string Directory
43 {
44 get { return @"\\Zweihander\" + info.usri11_name; }
45 }
46
47 public uint Id
48 {
49 get { return id; }
50 }
51
52 public DateTime LastLogon
53 {
54 get
55 {
56 if (logon == DateTime.MinValue)
57 logon = new DateTime(1970, 1, 1) + new TimeSpan((long)info.usri11_last_logon * 10000000);
58
59 return logon;
60 }
61 }
62
63 public string Name
64 {
65 get { return info.usri11_full_name; }
66 }
67
68 public string Session
69 {
70 get { return session; }
71 }
72
73 public string Status
74 {
75 get { return status.ToString().Substring(3); }
76 }
77 }