Exemple #1
0
 private void ModernButton1_Click(object sender, EventArgs e)
 {
     hasSaved = true;
     ApplicationSettingsManager.ReplaceAppSettings(OldSettings);
     ColorSchemeCentral.OnThemeChanged(this);
     Close();
 }
 public ApplicationSettingsServices(string pTestDb)
 {
     _dataParamManager        = new ApplicationSettingsManager(pTestDb);
     _nonWorkingDateManager   = new NonWorkingDateManagement(pTestDb);
     _provisioningRuleManager = new ProvisioningRuleManager(pTestDb);
     _loanScaleManager        = new LoanScaleManager(pTestDb);
 }
Exemple #3
0
        public override void SaveProgress()
        {
            Texts.initilizeLang();
            ApplicationSettingsManager.Settings.Language = comboBox1.Text;

            ApplicationSettingsManager.SaveSettings();
        }
Exemple #4
0
        /// <summary>
        /// Method called when the page is displayed.
        /// Searches for a matching contact using the current call address or number and display information if found.
        /// </summary>
        protected override void OnNavigatedTo(NavigationEventArgs nee)
        {
            base.OnNavigatedTo(nee);
            this.ViewModel.MuteListener  = this;
            this.ViewModel.PauseListener = this;
            this.ViewModel.CallUpdatedByRemoteListener = this;
            LinphoneManager.Instance.CallStateChanged += CallStateChanged;
            AudioRoutingManager.GetDefault().AudioEndpointChanged += AudioEndpointChanged;

            if (NavigationContext.QueryString.ContainsKey("sip"))
            {
                String          calledNumber = NavigationContext.QueryString["sip"];
                LinphoneAddress address      = LinphoneManager.Instance.LinphoneCore.InterpretURL(calledNumber);
                calledNumber = String.Format("{0}@{1}", address.UserName, address.Domain);
                // While we dunno if the number matches a contact one, we consider it won't and we display the phone number as username
                Contact.Text = calledNumber;

                if (calledNumber != null && calledNumber.Length > 0)
                {
                    ContactManager cm = ContactManager.Instance;
                    cm.ContactFound += cm_ContactFound;
                    cm.FindContact(calledNumber);
                }
            }

            ApplicationSettingsManager settings = new ApplicationSettingsManager();

            settings.Load();

            // Callback CallStateChanged set too late when call is incoming, so trigger it manually
            if (LinphoneManager.Instance.LinphoneCore.CallsNb > 0)
            {
                LinphoneCall call = (LinphoneCall)LinphoneManager.Instance.LinphoneCore.Calls[0];
                if (call.State == LinphoneCallState.StreamsRunning)
                {
                    CallStateChanged(call, LinphoneCallState.StreamsRunning);
                    if (settings.VideoActiveWhenGoingToBackground)
                    {
                        LinphoneManager.Instance.LinphoneCore.VideoPolicy.AutomaticallyAccept = settings.VideoAutoAcceptWhenGoingToBackground;
                        LinphoneCallParams callParams = call.GetCurrentParamsCopy();
                        callParams.VideoEnabled = true;
                        LinphoneManager.Instance.LinphoneCore.UpdateCall(call, callParams);
                    }
                }
                else if (call.State == LinphoneCallState.UpdatedByRemote)
                {
                    // The call was updated by the remote party while we were in background
                    LinphoneManager.Instance.CallState(call, call.State, "call updated while in background");
                }
            }

            settings.VideoActiveWhenGoingToBackground = false;
            settings.Save();

            oneSecondTimer          = new DispatcherTimer();
            oneSecondTimer.Interval = TimeSpan.FromSeconds(1);
            oneSecondTimer.Tick    += timerTick;
            oneSecondTimer.Start();
        }
 public ApplicationSettingsServices(User pUser)
 {
     _user                    = pUser;
     _dataParamManager        = new ApplicationSettingsManager(pUser);
     _nonWorkingDateManager   = new NonWorkingDateManagement(pUser);
     _provisioningRuleManager = new ProvisioningRuleManager(pUser);
     _loanScaleManager        = new LoanScaleManager(_user);
 }
Exemple #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="_config"></param>
 /// <param name="_cache"></param>
 /// <param name="_httpContextAccessor"></param>
 public AdministratorController(IConfiguration _config, IMemoryCache _cache, IHttpContextAccessor _httpContextAccessor)
     : base(_config, _cache, _httpContextAccessor)
 {
     this.config = _config;
     this.cache  = _cache;
     this.httpContextAccessor = _httpContextAccessor;
     uMgr  = new UserManager(config, cache);
     asMgr = new ApplicationSettingsManager(config, cache);
 }
Exemple #7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            StartupStopwatch.Start();
            AppArguments = e.Args;
            SystemInfo.Init();
            ApplicationReset.Reset();
            CreateDirectories();
            ApplicationSettingsManager.LoadSettings();
            GetApplicationSettingsAvailability.Get();

            if (e.Args.Contains("-runGame"))
            {
                Logger.Init(e.Args.Contains("-disableLogging"));

                ExceptionCatching.Init();

                GetRequiredApplicationFiles.Get();

                ApplicationRunSacredGameWithArgs.Run(e.Args);

                Current.StartupUri = new Uri("resources/pgs/InvisibilityWindowForGame.xaml",
                                             UriKind.Relative);

                Task.Run(GetApplicationDownloadStatistic.Get);
            }
            else
            {
                Logger.Init(e.Args.Contains("-disableLogging"));

                ExceptionCatching.Init();

                PrintBaseInfo.Print();

                NetworkUtils.LogStatus();

                GetApplicationGlobalizerLibrary.Get();

                LanguageFileManager.CreateLanguageFiles();

                ThemeFileManager.CreateThemeFiles();

                CheckAvailabilityGameSettings.Get();

                CreateBackupApplicationSettings.Create();

                CreateBackupSacredGameSettings.Create();

                GetRequiredApplicationFiles.Get();

                CheckAvailabilityUpdateTemp.Get();

                Task.Run(GetApplicationDownloadStatistic.Get);

                base.OnStartup(e);
            }
        }
 public override void Load()
 {
     if (_configurationOptions.Enabled)
     {
         _logger.LogDebug($"Loading remote configuration... {DateTime.Now}");
         _applicationSettings = new ApplicationSettingsManager(_logger, _configurationOptions, new FirestoreConnectionManager(_logger, _configurationOptions), new FileManager(), new SecretsConnectionManager(_logger));
         _applicationSettings.Setup().Wait();
         _applicationSettings.CreateListeners(JsonSettingsToDictionary, ReloadSettings);
     }
     else
     {
         _logger.LogWarning("Remote configuration is disabled!");
     }
 }
 public override void SaveProgress()
 {
     ApplicationSettingsManager.Settings.DeviceName = textBox1.Text.Trim();
     ApplicationSettingsManager.Settings.FirstRun   = false;
     if (checkBox1.Checked)
     {
         AddApplicationToStartup();
     }
     else
     {
         RemoveApplicationFromStartup();
     }
     ApplicationSettingsManager.SaveSettings();
 }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                manager = new ApplicationSettingsManager(ApplicationContext.Server, ApplicationContext.ConnectionString);

                GetApplicationSettings();

                if (!IsPostBack)
                {
                    SetPageContext();
                }
            }
            catch (Exception ex)
            {
                Log.WriteTraceOutput(ex);
            }
        }
        private void SaveChanges()
        {
            this.unitOfWork.SettingRepository.Update(this.Model.Language);
            this.unitOfWork.SettingRepository.Update(this.Model.BackupDatabaseName);
            this.unitOfWork.SettingRepository.Update(this.Model.BackupLocation);
            this.unitOfWork.SettingRepository.Update(this.Model.BackupFileName);
            this.unitOfWork.SettingRepository.Update(this.Model.BackupHour);
            this.unitOfWork.SettingRepository.Update(this.Model.BackupMinute);
            this.unitOfWork.SettingRepository.Update(this.Model.ReminderCheckDelay);
            this.unitOfWork.SettingRepository.Update(this.Model.SmtpEnableSsl);
            this.unitOfWork.SettingRepository.Update(this.Model.SmtpFromAddress);
            this.unitOfWork.SettingRepository.Update(this.Model.SmtpHost);
            this.unitOfWork.SettingRepository.Update(this.Model.SmtpPassword);
            this.unitOfWork.SettingRepository.Update(this.Model.SmtpPort);
            this.unitOfWork.SettingRepository.Update(this.Model.SmtpUserName);

            this.unitOfWork.Save();

            ApplicationSettingsManager.TryWriteValue("VideoDevice", this.SelectedVideoDevice);
        }
Exemple #12
0
        /// <summary>
        /// Method called when the page is leaved.
        /// </summary>
        protected override void OnNavigatedFrom(NavigationEventArgs nee)
        {
            if (((InCallModel)ViewModel).IsVideoActive)
            {
                LinphoneCall call = null;
                try
                {
                    call = (LinphoneCall)LinphoneManager.Instance.LinphoneCore.Calls[0];
                }
                catch (System.ArgumentOutOfRangeException) { }
                if (call != null)
                {
                    ApplicationSettingsManager settings = new ApplicationSettingsManager();
                    settings.Load();
                    settings.VideoActiveWhenGoingToBackground     = true;
                    settings.VideoAutoAcceptWhenGoingToBackground = LinphoneManager.Instance.LinphoneCore.VideoPolicy.AutomaticallyAccept;
                    settings.Save();
                    LinphoneManager.Instance.LinphoneCore.VideoPolicy.AutomaticallyAccept = false;
                    LinphoneCallParams callParams = call.GetCurrentParamsCopy();
                    callParams.VideoEnabled = false;
                    LinphoneManager.Instance.LinphoneCore.UpdateCall(call, callParams);
                }
            }

            oneSecondTimer.Stop();
            if (fadeTimer != null)
            {
                fadeTimer.Dispose();
                fadeTimer = null;
            }

            base.OnNavigatedFrom(nee);
            this.ViewModel.MuteListener  = null;
            this.ViewModel.PauseListener = null;
            LinphoneManager.Instance.CallStateChanged -= CallStateChanged;
            AudioRoutingManager.GetDefault().AudioEndpointChanged -= AudioEndpointChanged;
        }
 public ApplicationSettingsServices(string pTestDb)
 {
     _dataParamManager      = new ApplicationSettingsManager(pTestDb);
     _nonWorkingDateManager = new NonWorkingDateManagement(pTestDb);
 }
 public ApplicationSettingsServices(User pUser)
 {
     _user                  = pUser;
     _dataParamManager      = new ApplicationSettingsManager(pUser);
     _nonWorkingDateManager = new NonWorkingDateManagement(pUser);
 }
 public void TextFixtureSetUp()
 {
     TechnicalSettings.UseOnlineMode = false;
     _generalSettingsManager         = new ApplicationSettingsManager(DataUtil.TESTDB);
 }
Exemple #16
0
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new TextWriterTraceListener(errorFileName));
            Trace.AutoFlush = true;

            if (args.Any(c => c.ToLower() == "/armobs"))
            {
                if (args.Length == 1)
                {
                    var obs32List = Process.GetProcessesByName("obs32");
                    var obs64List = Process.GetProcessesByName("obs64");
                    if (obs32List.Length == 0 && obs64List.Length == 0)
                    {
                        //No OBS found. Cancel operation.
                        File.Delete(OBSUtils.obswszip);
                        return;
                    }
                    List <Process> obsProcesses = new List <Process>();
                    obsProcesses.AddRange(obs32List);
                    obsProcesses.AddRange(obs64List);

                    if (obsProcesses.Count != 1)
                    {
                        //Multiple OBS instances found. Cancel operation.
                        File.Delete(OBSUtils.obswszip);
                        return;
                    }
                    var obsProcess = obsProcesses.First();

                    string path        = OBSUtils.GetProcessPath(obsProcess.Id);
                    string zipTempPath = Path.GetFileNameWithoutExtension(OBSUtils.obswszip);
                    OBSUtils.ExtractZip(OBSUtils.obswszip, zipTempPath);

                    OBSUtils.DirectoryCopy(zipTempPath, OBSUtils.GetPathFromOBSExecutable(path), true);
                    File.Delete(OBSUtils.obswszip);
                    Directory.Delete(zipTempPath, true);

                    var obsGlobalFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "obs-studio", "global.ini");
                    if (File.Exists(obsGlobalFilePath) && !File.ReadAllText(obsGlobalFilePath).Contains("[WebsocketAPI]"))
                    {
                        while (!obsProcess.HasExited)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine("OBS plugin install completed!");
                            sb.AppendLine("");
                            sb.AppendLine("Please close OBS and click OK to apply the final touches.");
                            MessageBox.Show(sb.ToString());
                        }

                        using (StreamWriter outputFile = new StreamWriter(obsGlobalFilePath)) {
                            outputFile.WriteLine("");
                            outputFile.WriteLine("[WebsocketAPI]");
                            outputFile.WriteLine("ServerPort=4444");
                            outputFile.WriteLine("DebugEnabled=false");
                            outputFile.WriteLine("AlertsEnabled=false");
                            outputFile.WriteLine("AuthRequired=false");
                        }

                        bool shouldRepeat = true;
                        while (shouldRepeat)
                        {
                            var obs32List2 = Process.GetProcessesByName("obs32");
                            var obs64List2 = Process.GetProcessesByName("obs64");

                            shouldRepeat = obs32List2.Length == 0 && obs64List2.Length == 0;
                            if (!shouldRepeat)
                            {
                                break;
                            }

                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine("OBS plugin install successfully!");
                            sb.AppendLine("");
                            sb.AppendLine("Please open OBS and click OK to continue to the app.");
                            MessageBox.Show(sb.ToString());
                        }
                    }

                    return;
                }
            }

#if FORCE_SILENCE
            Silent = true;
#else
            Silent = args.Any(c => c.ToLower() == "/s");
#endif
            errorText = $"An error occured! And it was saved to a file called {errorFileName}." + Environment.NewLine + "Please send this to the developer of the application.";

            Application.ThreadException += Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            ApplicationSettingsManager.LoadSettings();
            DevicePersistManager.LoadDevices();


            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (ApplicationSettingsManager.Settings.FirstRun)
            {
                FirstSetupForm firstRunForm = new FirstSetupForm();
                Application.Run(firstRunForm);
                if (!firstRunForm.FinishedSetup)
                {
                    return;
                }
            }

            OBSUtils.PrepareOBSIntegration();


            NetworkChange.NetworkAddressChanged      += NetworkChange_NetworkAddressChanged;
            NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAddressChanged;

            ServerThread = new ServerThread();
            ServerThread.Start();

            Application.Run(new MainForm());

            OBSUtils.Disconnect();

            ServerThread.Stop();
            NetworkChange.NetworkAddressChanged      -= NetworkChange_NetworkAddressChanged;
            NetworkChange.NetworkAvailabilityChanged -= NetworkChange_NetworkAddressChanged;
            ApplicationSettingsManager.SaveSettings();
            DevicePersistManager.SaveDevices();
            Trace.Flush();
        }
Exemple #17
0
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new TextWriterTraceListener(errorFileName));
            Trace.AutoFlush = true;

            if (args.Any(c => c.ToLower() == "/armobs"))
            {
                if (args.Length == 1)
                {
                    var obs32List = Process.GetProcessesByName("obs32");
                    var obs64List = Process.GetProcessesByName("obs64");
                    if (obs32List.Length == 0 && obs64List.Length == 0)
                    {
                        //No OBS found. Cancel operation.
                        File.Delete(OBSUtils.obswszip);

                        return;
                    }
                    List <Process> obsProcesses = new List <Process>();
                    obsProcesses.AddRange(obs32List);
                    obsProcesses.AddRange(obs64List);

                    if (obsProcesses.Count != 1)
                    {
                        //Multiple OBS instances found. Cancel operation.
                        File.Delete(OBSUtils.obswszip);

                        return;
                    }
                    var obsProcess = obsProcesses.First();

                    string path = OBSUtils.GetProcessPath(obsProcess.Id);


                    string zipTempPath = Path.GetFileNameWithoutExtension(OBSUtils.obswszip);

                    OBSUtils.ExtractZip(OBSUtils.obswszip, zipTempPath);


                    OBSUtils.DirectoryCopy(zipTempPath, OBSUtils.GetPathFromOBSExecutable(path), true);

                    File.Delete(OBSUtils.obswszip);
                    Directory.Delete(zipTempPath, true);

                    var obsGlobalFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "obs-studio", "global.ini");

                    if (File.Exists(obsGlobalFilePath) && !File.ReadAllText(obsGlobalFilePath).Contains("[WebsocketAPI]"))
                    {
                        Trace.WriteLine("File exist and not contain web socket.");
                        while (!obsProcess.HasExited)
                        {
                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine(Texts.rm.GetString("OBSINTEGRATIONINSTALL", Texts.cultereinfo));
                            sb.AppendLine("");
                            sb.AppendLine(Texts.rm.GetString("OBSINTEGRATIONAPPLY", Texts.cultereinfo));
                            MessageBox.Show(sb.ToString());
                        }

                        using (StreamWriter outputFile = new StreamWriter(obsGlobalFilePath))
                        {
                            outputFile.WriteLine("");
                            outputFile.WriteLine("[WebsocketAPI]");
                            outputFile.WriteLine("ServerPort=4444");
                            outputFile.WriteLine("DebugEnabled=false");
                            outputFile.WriteLine("AlertsEnabled=false");
                            outputFile.WriteLine("AuthRequired=false");
                        }

                        bool shouldRepeat = true;
                        while (shouldRepeat)
                        {
                            var obs32List2 = Process.GetProcessesByName("obs32");
                            var obs64List2 = Process.GetProcessesByName("obs64");

                            shouldRepeat = obs32List2.Length == 0 && obs64List2.Length == 0;
                            if (!shouldRepeat)
                            {
                                break;
                            }

                            StringBuilder sb = new StringBuilder();
                            sb.AppendLine(Texts.rm.GetString("OBSINTEGRATIONINSTALLSUCESSFULL", Texts.cultereinfo));
                            sb.AppendLine("");
                            sb.AppendLine(Texts.rm.GetString("OBSINTEGRATIONCONFIRMOBS", Texts.cultereinfo));
                            MessageBox.Show(sb.ToString());
                        }
                    }

                    return;
                }
            }

#if FORCE_SILENCE
            Silent = true;
#else
            Silent = args.Any(c => c.ToLower() == "/s");
#endif
            const string appName = "DisplayButtons";
            bool         createdNew;

            mutex = new Mutex(true, appName, out createdNew);

            if (!createdNew)
            {
                //app is already running! Exiting the application
                if (MessageBox.Show(Texts.rm.GetString("ALREADYDISPLAYBUTTONISOPEN", Texts.cultereinfo), Texts.rm.GetString("ALREADYDISPLAYBUTTONISOPENTITLE", Texts.cultereinfo), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    var myapp = Process.GetProcessesByName(Assembly.GetCallingAssembly().GetName().Name);

                    List <Process> obsProcesses = new List <Process>();
                    obsProcesses.AddRange(myapp);


                    if (obsProcesses.Count > 1)
                    {
                        var last = obsProcesses.First();
                        last.Kill();
                    }
                }
                //return;
            }


            Application.ThreadException += Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;


            EventXml.LoadSettings();

            ApplicationSettingsManager.LoadSettings();
            Texts.initilizeLang();
            errorText = String.Format(Texts.rm.GetString("INTEGRATIONERROROCURRED", Texts.cultereinfo), errorFileName);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            OBSUtils.PrepareOBSIntegration();
            if (ApplicationSettingsManager.Settings.FirstRun)
            {
                FirstSetupForm firstRunForm = new FirstSetupForm();
                Application.Run(firstRunForm);
                if (!firstRunForm.FinishedSetup)
                {
                    return;
                }
            }
            //  EnsureBrowserEmulationEnabled("DisplayButtons.exe");

            new WebBrowserInstanceHelper().SetBrowserFeatureControl();

            dynamic form = Activator.CreateInstance(FindType("DisplayButtons.Forms.ActionHelperForms.MainFormMenuOption")) as Form;

            if (form.ShowDialog() == DialogResult.OK)
            {
                Initilizator.mode         = 0;
                Initilizator.ServerThread = new ServerThread();
                Initilizator.ServerThread.Start();


                Debug.WriteLine("MODO SOCKET CLIENT");
            }
            else
            {
                // Silent = true;
                Debug.WriteLine("MODO USB");
                Initilizator.mode = 1;

                Adbserver = new AdbServer();

                Adbserver.StartServer(Path.Combine(Application.StartupPath, @"Data\adb\adb.exe"), restartServerIfNewer: true);

                monitor = new DeviceMonitor(new AdbSocket(new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort)));
                client  = new AdbClient(new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort), Factories.AdbSocketFactory);

                monitor.DeviceConnected    += MainForm.DeviceAdbConnected;
                monitor.DeviceDisconnected += MainForm.DeviceAdbDisconnected;
                monitor.Start();



                if (client.GetDevices().Count == 1)
                {
                    Debug.WriteLine("ONE DEVICE");



                    //   client.ExecuteRemoteCommand("am start -a android.intent.action.VIEW -e mode 1 net.nickac.DisplayButtons/.MainActivity", client.GetDevices().First(), null);

                    DevicePersistManager.PersistUsbMode(client.GetDevices().First());
                    //      client.CreateForward(client.GetDevices().First(), "tcp:5095", "tcp:5095", true);

                    Initilizator.ClientThread = new ClientThread();
                    Initilizator.ClientThread.Start();
                }
                else
                {
                    Initilizator.ClientThread = new ClientThread();
                }
            }
            Application.Run(new MainForm());


            //Application.Run(new MainFormMenuOption());
            OBSUtils.Disconnect();
            if (Initilizator.mode == 1)
            {
                foreach (var device in client.GetDevices().ToList())
                {
                    //   client.ExecuteRemoteCommand("am force-stop net.nickac.DisplayButtons", device, null);
                    // client.ExecuteRemoteCommand("kill-server", device, null);

                    //   client.KillAdb();
                }
            }

            //   client.KillAdb();
            EventXml.SaveSettings();
            ApplicationSettingsManager.SaveSettings();
            DevicePersistManager.SaveDevices();

            NetworkChange.NetworkAddressChanged      -= NetworkChange_NetworkAddressChanged;
            NetworkChange.NetworkAvailabilityChanged -= NetworkChange_NetworkAddressChanged;
            Trace.Flush();
        }
Exemple #18
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ApplicationSettingsManager <ApplicationSettings> .BindToObject(Configuration);

            JwtSettings jwtSettings = new JwtSettings();

            Configuration.Bind(nameof(JwtSettings), jwtSettings);

            services.AddMemoryCache();
            services.AddDbContext <ApplicationDbContext>();
            services.AddSingleton <DapperDbContext>();
            services.ConfigureBLLServices();
            services.AddAutoMapper();

            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options =>
            {
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    // will the lifetime be validated
                    ValidateLifetime = jwtSettings.ValidateLifetime,

                    // specifies whether the publisher will validate when validating the token
                    ValidateIssuer = jwtSettings.ValidateIssuer,

                    // a string representing the publisher
                    ValidIssuer = jwtSettings.ValidIssuer,

                    // setting the token consumer
                    ValidAudience = jwtSettings.ValidAudience,

                    // Will the token consumer be validated
                    ValidateAudience = jwtSettings.ValidateAudience,

                    // validate the security key
                    ValidateIssuerSigningKey = jwtSettings.ValidateIssuerSigningKey,

                    // set the security key
                    IssuerSigningKey =
                        new SymmetricSecurityKey(Convert.FromBase64String(jwtSettings.IssuerSigningKey))
                };
            });

            services.AddAuthorization();

            services.AddCors();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info
                {
                    Title       = "ArTour API",
                    Description = "Swagger Core API documentation",
                    Version     = "v1"
                });
                var xmlPath = AppDomain.CurrentDomain.BaseDirectory + @"Artour.WebAPI.xml";
                c.IncludeXmlComments(xmlPath);
                c.OperationFilter <FileOperationFilter>();
            });

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }