void GenerateNewSessionId() { PreviousSession = CurrentSession; var virtualSessionId = Guid.NewGuid().ToString(); var sessionName = WorkstationHelper.GetSessionName(WorkstationHelper.GetSessionId()); CurrentSession = new SessionInfo(virtualSessionId, sessionName); WriteLine($"Generated new session id: (current: {CurrentSession?.SessionId}), (prev: {PreviousSession?.SessionId})"); }
void GenerateNewIdIfUnlocked() { var sid = WorkstationHelper.GetSessionId(); var state = WorkstationHelper.GetSessionLockState(sid); var name = WorkstationHelper.GetSessionName(sid); WriteLine($"Startup sid:{sid}, state:{state}, name:{name}"); if (state == WorkstationHelper.LockState.Unlocked && name != "SYSTEM") { GenerateNewSessionId(); } }