private void ValidateCommandLineArguments() { var args = Environment.GetCommandLineArgs(); var hasFive = args?.Length >= 5; if (hasFive) { var hasLogfilePath = Uri.TryCreate(args[1], UriKind.Absolute, out Uri filePath) && filePath.IsFile; var hasLogLevel = Enum.TryParse(args[2], out LogLevel level); var hasHostUri = Uri.TryCreate(args[3], UriKind.Absolute, out Uri hostUri) && hostUri.IsWellFormedOriginalString(); var hasAuthenticationToken = Guid.TryParse(args[4], out Guid token); if (hasLogfilePath && hasLogLevel && hasHostUri && hasAuthenticationToken) { logFilePath = args[1]; logLevel = level; runtimeHostUri = args[3]; authenticationToken = token; uiMode = args.Length == 6 && Enum.TryParse(args[5], out uiMode) ? uiMode : UserInterfaceMode.Desktop; return; } } throw new ArgumentException("Invalid arguments! Required: SafeExamBrowser.Client.exe <logfile path> <log level> <host URI> <token>"); }
/// <summary> /// Sets the user interface mode. /// None will keep the ui from loading. /// Mini will display a compact version of the ui. /// Invisible will hide the ui. /// Full will display all elements of the ui (default). /// </summary> public void SetUIMode(UserInterfaceMode mode) { _mediaPlayer.uiMode = mode.ToString().ToLower(); }