/// <summary> /// Erstellt eine neue Session, es darf nur eine Existieren und der Wert der Authorisierung darf nur einmal gesetzt werden. /// </summary> /// <param name="authorization">Authorisationsstufe 1 = Admin, 2 = User</param> public static void CreateSession(int authorization, int userId) { if (instance == null) if (authorization == 1 || authorization == 2) instance = new Session(authorization, userId); else throw new FormatException("Es sind nur die Berechtigungsstufen 1, oder 2 zulässig"); else throw new UnauthorizedAccessException("Es darf nur eine Session erstellt werden"); }