public void RunTests(IEnumerable <TestCase> allTestCases, IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher)
        {
            DebugUtils.AssertIsNotNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNotNull(workingDir, nameof(workingDir));

            IDictionary <string, List <TestCase> > groupedTestCases = testCasesToRun.GroupByExecutable();

            TestCase[] allTestCasesAsArray = allTestCases as TestCase[] ?? allTestCases.ToArray();
            foreach (string executable in groupedTestCases.Keys)
            {
                string finalParameters = SettingsWrapper.ReplacePlaceholders(userParameters, executable);
                string finalWorkingDir = SettingsWrapper.ReplacePlaceholders(workingDir, executable);

                if (_canceled)
                {
                    break;
                }

                RunTestsFromExecutable(
                    executable,
                    finalWorkingDir,
                    allTestCasesAsArray.Where(tc => tc.Source == executable),
                    groupedTestCases[executable],
                    baseDir,
                    finalParameters,
                    isBeingDebugged,
                    debuggedLauncher);
            }
        }
 public Erc20DepositTransactionService(IQueueFactory queueFactory,
                                       ILog logger,
                                       IExchangeContractService coinContractService,
                                       IBaseSettings baseSettings,
                                       IErc20DepositContractService erc20DepositContractService,
                                       TransferContractService transferContractService,
                                       IUserTransferWalletRepository userTransferWalletRepository,
                                       IUserPaymentHistoryRepository userPaymentHistoryRepository,
                                       ICoinTransactionService cointTransactionService,
                                       ICoinTransactionRepository coinTransactionRepository,
                                       ICoinEventService coinEventService,
                                       IEventTraceRepository eventTraceRepository,
                                       IErcInterfaceService ercInterfaceService,
                                       SettingsWrapper settingsWrapper,
                                       IHotWalletService hotWalletService)
 {
     _eventTraceRepository = eventTraceRepository;
     _logger       = logger;
     _baseSettings = baseSettings;
     _queue        = queueFactory.Build(Constants.Erc20DepositCashinTransferQueue);
     _erc20DepositContractService  = erc20DepositContractService;
     _transferContractService      = transferContractService;
     _userTransferWalletRepository = userTransferWalletRepository;
     _userPaymentHistoryRepository = userPaymentHistoryRepository;
     _cointTransactionService      = cointTransactionService;
     _coinTransactionRepository    = coinTransactionRepository;
     _coinEventService             = coinEventService;
     _ercInterfaceService          = ercInterfaceService;
     _hotWalletAddress             = settingsWrapper.Ethereum.HotwalletAddress;
     _hotWalletService             = hotWalletService;
 }
 public GoogleTestExecutor(ILogger logger, SettingsWrapper settings, IDebuggedProcessExecutorFactory processExecutorFactory)
 {
     _logger   = logger;
     _settings = settings;
     _processExecutorFactory = processExecutorFactory;
     _schedulingAnalyzer     = new SchedulingAnalyzer(logger);
 }
        public void RunTests(IEnumerable <TestCase> testCasesToRun, string baseDir,
                             string workingDir, string userParameters, bool isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
        {
            DebugUtils.AssertIsNotNull(userParameters, nameof(userParameters));
            DebugUtils.AssertIsNotNull(workingDir, nameof(workingDir));

            IDictionary <string, List <TestCase> > groupedTestCases = testCasesToRun.GroupByExecutable();

            foreach (string executable in groupedTestCases.Keys)
            {
                string finalParameters = SettingsWrapper.ReplacePlaceholders(userParameters, executable);
                string finalWorkingDir = SettingsWrapper.ReplacePlaceholders(workingDir, executable);

                if (_canceled)
                {
                    break;
                }

                _settings.ExecuteWithSettingsForExecutable(executable, () =>
                {
                    RunTestsFromExecutable(
                        executable,
                        finalWorkingDir,
                        groupedTestCases[executable],
                        finalParameters,
                        isBeingDebugged,
                        debuggedLauncher,
                        executor);
                }, _logger);
            }
        }
Exemple #5
0
        public void InsertForm(IFormData form)
        {
            ISettings settings = new SettingsWrapper();

            var autoStoreValues = settings.GetSetting(_providerSettingsPrefix + "AutoStoreValues");
            var autoStoreDisabledReplacementValue = settings.GetSetting(_providerSettingsPrefix + "AutoStoreDisabledReplacementValue");

            bool storeValuesInSitecore = false;

            if (bool.TryParse(autoStoreValues, out storeValuesInSitecore) && !storeValuesInSitecore)
            {
                if (form != null && form.Fields != null && form.Fields.Any())
                {
                    form.Fields.ToList().ForEach(field =>
                    {
                        if (!string.IsNullOrEmpty(field.Data))
                        {
                            field.Data = autoStoreDisabledReplacementValue;
                        }
                        field.Value = autoStoreDisabledReplacementValue;
                    });
                }
            }

            _defaultAnalyticsDataProvider.InsertForm(form);
        }
Exemple #6
0
        public HeaderViewModel(ILogger logger, SocketIoService socketIoService, StatsService statsService,
                               SettingsWrapper settingsWrapper)
        {
            _logger          = logger;
            _settingsWrapper = settingsWrapper;

            OpenWebsiteCommand  = new RelayCommand(LogoClick);
            SettingsCommand     = new RelayCommand(SettingsClick);
            QrCodeClickCommand  = new RelayCommand(QrCodeClick);
            ExportStatsCommand  = new RelayCommand(async _ => await ExportStatsAsync());
            EnableReplayCommand = new RelayCommand(EnableReplays);
            SwitchThemeCommand  = new RelayCommand(SwitchTheme);

            socketIoService.StateChanged.Subscribe(state => { ConnectionState = state.ToString(); });
            statsService.StatsStatusChanged.Subscribe(status => { CanExport = status == StatsStatus.Fetched; });

            _settingsWrapper.SettingChanged(nameof(SettingsJson.InstallDirectory)).Subscribe(s =>
            {
                var path         = Path.Combine(_settingsWrapper.CurrentSettings.InstallDirectory, "preferences.xml");
                CanEnableReplays = File.Exists(path);
            });

            if (_settingsWrapper.CurrentSettings.DarkMode)
            {
                SwitchTheme();
            }
        }
Exemple #7
0
        public SubHeaderViewModel(SettingsWrapper settingsWrapper, StatsService statsService)
        {
            _settingsWrapper = settingsWrapper;

            PathClickCommand = new RelayCommand(PathClicked);

            _region = _settingsWrapper.CurrentSettings.Region;

            _settingsWrapper.SettingChanged(nameof(SettingsJson.InstallDirectory)).Subscribe(s => { InitPath(); });
            statsService.StatsStatusChanged.Skip(1).Subscribe(status =>
            {
                SetStatusChip(status);
                if (status == StatsStatus.Fetching)
                {
                    EnableUi     = false;
                    ShowProgress = Visibility.Visible;
                    ShowIcon     = Visibility.Collapsed;
                }
                else
                {
                    EnableUi     = true;
                    ShowProgress = Visibility.Collapsed;
                    ShowIcon     = Visibility.Visible;
                }
            });

            // TODO: Should be called in line 43 initially. It's not. rip.
            InitPath();
        }
Exemple #8
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings, string solutionDir = null)
        {
            if (string.IsNullOrWhiteSpace(solutionDir))
            {
                solutionDir = null;
            }

            var settingsProvider = SafeGetRunSettingsProvider(runSettings, messageLogger);

            var ourRunSettings = GetRunSettingsContainer(settingsProvider, messageLogger);

            foreach (RunSettings projectSettings in ourRunSettings.ProjectSettings)
            {
                projectSettings.GetUnsetValuesFrom(ourRunSettings.SolutionSettings);
            }

            var settingsWrapper = new SettingsWrapper(ourRunSettings, solutionDir);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
Exemple #9
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings, string solutionDir = null)
        {
            if (string.IsNullOrWhiteSpace(solutionDir))
            {
                solutionDir = null;
            }

            var settingsProvider = SafeGetRunSettingsProvider(runSettings, messageLogger);

            var ourRunSettings = GetRunSettingsContainer(settingsProvider, messageLogger);

            foreach (RunSettings projectSettings in ourRunSettings.ProjectSettings)
            {
                projectSettings.GetUnsetValuesFrom(ourRunSettings.SolutionSettings);
            }

            var testSettings    = runSettings.GetSettings(GoogleTestConstants.TestPropertySettingsName) as TestPropertySettingsProvider;
            var settingsWrapper = new SettingsWrapper(ourRunSettings, testSettings?.TestPropertySettings, solutionDir);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.OutputMode,
                                                          () => settingsWrapper.TimestampMode, () => settingsWrapper.SeverityMode, () => settingsWrapper.PrefixOutputWithGta);

            settingsWrapper.RegexTraitParser = new RegexTraitParser(loggerAdapter);
            settingsWrapper.HelperFilesCache = new HelperFilesCache(loggerAdapter);

            LogWarningsForDeprecatedSettings(ourRunSettings, loggerAdapter);

            settings = settingsWrapper;
            logger   = loggerAdapter;

            SpeedupThreadPoolHack(logger);
        }
Exemple #10
0
 public HotWalletService(IBaseSettings baseSettings,
                         IQueueFactory queueFactory,
                         IHotWalletOperationRepository hotWalletCashoutRepository,
                         IPrivateWalletService privateWalletService,
                         IErc20PrivateWalletService erc20PrivateWalletService,
                         ISignatureService signatureService,
                         ILog log,
                         Web3 web3,
                         IHotWalletTransactionRepository hotWalletCashoutTransactionRepository,
                         IErc20DepositContractService erc20DepositContractService,
                         SettingsWrapper settingsWrapper,
                         IUserTransferWalletRepository userTransferWalletRepository,
                         IGasPriceRepository gasPriceRepository)
 {
     _hotWalletTransactionMonitoringQueue = queueFactory.Build(Constants.HotWalletTransactionMonitoringQueue);
     _hotWalletCashoutQueue      = queueFactory.Build(Constants.HotWalletCashoutQueue);
     _baseSettings               = baseSettings;//.HotWalletAddress
     _hotWalletCashoutRepository = hotWalletCashoutRepository;
     _privateWalletService       = privateWalletService;
     _erc20PrivateWalletService  = erc20PrivateWalletService;
     _log  = log;
     _web3 = web3;
     _hotWalletCashoutTransactionRepository = hotWalletCashoutTransactionRepository;
     _signatureService             = signatureService;
     _erc20DepositContractService  = erc20DepositContractService;
     _settingsWrapper              = settingsWrapper;
     _userTransferWalletRepository = userTransferWalletRepository;
     _semaphores         = new ConcurrentDictionary <string, SemaphoreSlim>();
     _gasPriceRepository = gasPriceRepository;
 }
        public void InsertForm(IFormData form)
        {
            ISettings settings = new SettingsWrapper();

            var autoStoreValues = settings.GetSetting(_providerSettingsPrefix + "AutoStoreValues");
            var autoStoreDisabledReplacementValue = settings.GetSetting(_providerSettingsPrefix + "AutoStoreDisabledReplacementValue");

            bool storeValuesInSitecore = false;

            if (bool.TryParse(autoStoreValues, out storeValuesInSitecore) && !storeValuesInSitecore)
            {
                if (form != null && form.Fields != null && form.Fields.Any())
                {
                    form.Fields.ToList().ForEach(field =>
                    {
                        if (!string.IsNullOrEmpty(field.Data))
                        {
                            field.Data = autoStoreDisabledReplacementValue;
                        }
                        field.Value = autoStoreDisabledReplacementValue;
                    });
                }
            }

            _defaultAnalyticsDataProvider.InsertForm(form);
        }
        public void SendEwsEmail(ProcessMessageArgs args)
        {
            ISettings settings = new SettingsWrapper();

            var exchangeUrl = settings.GetSetting(EwsSettingsPrefix + "ExchangeUrl");
            var exchangeVersion = settings.GetSetting(EwsSettingsPrefix + "ExchangeVersion");
            var userName = settings.GetSetting(EwsSettingsPrefix + "UserName");
            var userDomain = settings.GetSetting(EwsSettingsPrefix + "UserDomain");
            var userPassword = settings.GetSetting(EwsSettingsPrefix + "UserPassword");
            var fromEmail = settings.GetSetting(EwsSettingsPrefix + "FromEmail");

            ExchangeVersion version;
            if (!Enum.TryParse(exchangeVersion, out version))
            {
                //Default to latest version
                version = ExchangeVersion.Exchange2013_SP1;
            }

            var service = new ExchangeService(version)
            {
                Url = new Uri(exchangeUrl),
                Credentials =
                    !string.IsNullOrEmpty(userDomain)
                        ? new WebCredentials(userName, userPassword, userDomain)
                        : new WebCredentials(userName, userPassword)
            };

            var mail = GetMail(args, service);

            mail.From = fromEmail;

            mail.Send();
        }
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings)
        {
            RunSettingsProvider settingsProvider;

            try
            {
                settingsProvider = runSettings.GetSettings(GoogleTestConstants.SettingsName) as RunSettingsProvider;
            }
            catch (Exception e)
            {
                settingsProvider = null;
                messageLogger.SendMessage(TestMessageLevel.Error, $"ERROR: Visual Studio test framework failed to provide settings; using default settings. Error message: {e.Message}");
            }

            RunSettingsContainer ourRunSettings = settingsProvider?.SettingsContainer ?? new RunSettingsContainer();

            foreach (RunSettings projectSettings in ourRunSettings.ProjectSettings)
            {
                projectSettings.GetUnsetValuesFrom(ourRunSettings.SolutionSettings);
            }

            var settingsWrapper = new SettingsWrapper(ourRunSettings);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
        public void SendEwsEmail(ProcessMessageArgs args)
        {
            ISettings settings = new SettingsWrapper();

            var exchangeUrl     = settings.GetSetting(EwsSettingsPrefix + "ExchangeUrl");
            var exchangeVersion = settings.GetSetting(EwsSettingsPrefix + "ExchangeVersion");
            var userName        = settings.GetSetting(EwsSettingsPrefix + "UserName");
            var userDomain      = settings.GetSetting(EwsSettingsPrefix + "UserDomain");
            var userPassword    = settings.GetSetting(EwsSettingsPrefix + "UserPassword");
            var fromEmail       = settings.GetSetting(EwsSettingsPrefix + "FromEmail");

            ExchangeVersion version;

            if (!Enum.TryParse(exchangeVersion, out version))
            {
                //Default to latest version
                version = ExchangeVersion.Exchange2013_SP1;
            }

            var service = new ExchangeService(version)
            {
                Url         = new Uri(exchangeUrl),
                Credentials =
                    !string.IsNullOrEmpty(userDomain)
                        ? new WebCredentials(userName, userPassword, userDomain)
                        : new WebCredentials(userName, userPassword)
            };

            var mail = GetMail(args, service);

            mail.From = fromEmail;

            mail.Send();
        }
 public ParallelTestRunner(ITestFrameworkReporter reporter, ILogger logger, SettingsWrapper settings, SchedulingAnalyzer schedulingAnalyzer)
 {
     _frameworkReporter  = reporter;
     _logger             = logger;
     _settings           = settings;
     _schedulingAnalyzer = schedulingAnalyzer;
 }
Exemple #16
0
 public GoogleTestDiscoverer(ILogger logger, SettingsWrapper settings, IProcessExecutorFactory processExecutorFactory = null, IDiaResolverFactory diaResolverFactory = null)
 {
     _logger   = logger;
     _settings = settings;
     _processExecutorFactory = processExecutorFactory ?? new ProcessExecutorFactory();
     _diaResolverFactory     = diaResolverFactory ?? DefaultDiaResolverFactory.Instance;
 }
 public ExitCodeTestsReporter(ITestFrameworkReporter reporter, IExitCodeTestsAggregator exitCodeTestsAggregator,
                              SettingsWrapper settings, ILogger logger)
 {
     _reporter = reporter;
     _exitCodeTestsAggregator = exitCodeTestsAggregator;
     _settings = settings;
     _logger   = logger;
 }
 public SequentialTestRunner(string threadName, ITestFrameworkReporter reporter, ILogger logger, SettingsWrapper settings, SchedulingAnalyzer schedulingAnalyzer)
 {
     _threadName         = threadName;
     _frameworkReporter  = reporter;
     _logger             = logger;
     _settings           = settings;
     _schedulingAnalyzer = schedulingAnalyzer;
 }
        public static void SetSettings(SettingsWrapper settings)
        {
            Directory.CreateDirectory(SettingsDir);

            File.WriteAllText(SettingsFile, JsonConvert.SerializeObject(settings));

            MemoryCache.Default.Add(CacheKey, settings, DateTime.Now.AddDays(1));
        }
 public TestCaseFactory(string executable, ILogger logger, SettingsWrapper settings,
                        IDiaResolverFactory diaResolverFactory)
 {
     _logger             = logger;
     _settings           = settings;
     _executable         = executable;
     _diaResolverFactory = diaResolverFactory;
 }
Exemple #21
0
        public VideoLibrary(SettingsWrapper settings)
        {
            InitializeComponent();

            _dataContext = new VideoLibraryViewModel(settings);

            DataContext = _dataContext;
        }
        public static TestCase CreateExitCodeTestCase(SettingsWrapper settings, string executable, TestCaseLocation mainMethodLocation = null)
        {
            string filename     = Path.GetFileName(executable) ?? throw new InvalidOperationException($"Can't get filename from executable '{executable}'");
            string testCaseName = $"{settings.ExitCodeTestCase}.{filename.Replace(".", "_")}";
            string sourceFile   = mainMethodLocation?.Sourcefile ?? "";
            int    line         = (int)(mainMethodLocation?.Line ?? 0);

            return(new TestCase(testCaseName, executable, testCaseName, sourceFile, line));
        }
 public void LoadActiveFoundryTarget()
 {
     var wrapper = new SettingsWrapper();
     var target = wrapper.GetActiveFoundryTarget();
     PasswordTextBox.Password = target.Password;
     TargetNameTextBox.Text = target.Name;
     TargetUriTextBox.Text = target.Path.ToString();
     UsernameTextBox.Text = target.Username;
 }
Exemple #24
0
        public SettingsWindowViewModel(SettingsWrapper settingsWrapper)
        {
            _settingsWrapper = settingsWrapper;

            ExportCommand = new RelayCommand(Export);
            ImportCommand = new RelayCommand(Import);
            ResetCommand  = new RelayCommand(Reset);

            _fontSize            = _settingsWrapper.CurrentSettings.FontSize;
            _hideLowBattles      = _settingsWrapper.CurrentSettings.HideLowBattles;
            _automaticLimitsSync = _settingsWrapper.CurrentSettings.AutomaticLimitsSync;
            _automaticAppUpdate  = _settingsWrapper.CurrentSettings.AutomaticAppUpdate;

            ColorsViewModel = new ColorsViewModel("Colors",
                                                  new ColorsEditor(_settingsWrapper.SettingChangedSubject, ref settingsWrapper.CurrentSettings.Colors));

            StaticViewModels = new ObservableCollection <LimitsViewModel>
            {
                new LimitsViewModel("Battle limits",
                                    new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject,
                                                           _settingsWrapper.CurrentSettings.BattleLimits)),
                new LimitsViewModel("Winrate limits",
                                    new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject,
                                                           _settingsWrapper.CurrentSettings.WinRateLimits)),
                new LimitsViewModel("Avg frags limits",
                                    new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject,
                                                           _settingsWrapper.CurrentSettings.AvgFragsLimits))
            };

            AvgXpViewModels = new ObservableCollection <LimitsViewModel>(_settingsWrapper.CurrentSettings.AvgXpLimits.Select(
                                                                             l => new LimitsViewModel($"Avg Xp (Tier {l.ShipTier.ToString()})",
                                                                                                      new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject, l.Values))));

            AvgDmgBattleshipViewModels = new ObservableCollection <LimitsViewModel>(
                _settingsWrapper.CurrentSettings.AvgDmgLimits.Battleship.Select(l => new LimitsViewModel(
                                                                                    $"Avg Dmg (Tier {l.ShipTier.ToString()})",
                                                                                    new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject, l.Values))));
            AvgDmgCruiserViewModels = new ObservableCollection <LimitsViewModel>(
                _settingsWrapper.CurrentSettings.AvgDmgLimits.Cruiser.Select(l => new LimitsViewModel(
                                                                                 $"Avg Dmg (Tier {l.ShipTier.ToString()})",
                                                                                 new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject, l.Values))));
            AvgDmgDestroyerViewModels = new ObservableCollection <LimitsViewModel>(
                _settingsWrapper.CurrentSettings.AvgDmgLimits.Destroyer.Select(l => new LimitsViewModel(
                                                                                   $"Avg Dmg (Tier {l.ShipTier.ToString()})",
                                                                                   new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject, l.Values))));
            AvgDmgAirCarrierViewModels = new ObservableCollection <LimitsViewModel>(
                _settingsWrapper.CurrentSettings.AvgDmgLimits.AirCarrier.Select(l => new LimitsViewModel(
                                                                                    $"Avg Dmg (Tier {l.ShipTier.ToString()})",
                                                                                    new DoubleLimitsEditor(_settingsWrapper.SettingChangedSubject, l.Values))));

            WeightsViewModel =
                new WeightsViewModel(
                    new WeightsEditor(_settingsWrapper.SettingChangedSubject, _settingsWrapper.CurrentSettings));

            SetTextboxState(!_automaticLimitsSync);
        }
 public CommandLineGenerator(IEnumerable <TestCase> testCasesToRun,
                             int lengthOfExecutableString, string userParameters, string resultXmlFile,
                             SettingsWrapper settings)
 {
     _lengthOfExecutableString = lengthOfExecutableString;
     _testCasesToRun           = testCasesToRun.ToList();
     _resultXmlFile            = resultXmlFile;
     _settings       = settings;
     _userParameters = userParameters ?? throw new ArgumentNullException(nameof(userParameters));
 }
        public PreparingTestRunner(int threadId, ITestFrameworkReporter reporter, ILogger logger, SettingsWrapper settings, SchedulingAnalyzer schedulingAnalyzer)
        {
            _logger   = logger;
            _settings = settings;
            string threadName = ComputeThreadName(threadId, _settings.MaxNrOfThreads);

            _threadName      = string.IsNullOrEmpty(threadName) ? "" : $"{threadName} ";
            _threadId        = Math.Max(0, threadId);
            _testDirectory   = Utils.GetTempDirectory();
            _innerTestRunner = new SequentialTestRunner(_threadName, _threadId, _testDirectory, reporter, _logger, _settings, schedulingAnalyzer);
        }
        public BarcodeCreatorParent(SettingsWrapper settings)
        {
            InitializeComponent();

            var tasks = new Tasks(settings);

            var barcodeCreator = new BarcodeCreator((TasksViewModel)tasks.DataContext, settings);

            BarcodeCreatorContent.Content = barcodeCreator;
            TasksContent.Content          = tasks;
        }
        public DisplayPlayerStats(SettingsWrapper settingsWrapper, PlayerShip player) : this()
        {
            Player           = player;
            _settingsWrapper = settingsWrapper;
            WinRate          = Math.Round(player.Wins / player.Battles * 100, 2);
            AvgFrags         = Math.Round(player.Frags / player.Battles, 2);
            AvgXp            = Math.Round(player.XpEarned / player.Battles, 0);
            AvgDamage        = Math.Round(player.DamageDealt / player.Battles, 0);

            ComputeUi();
        }
Exemple #29
0
        internal static TestEnvironment CreateTestEnvironment(IRunSettings runSettings, IMessageLogger messageLogger)
        {
            var             settingsProvider = runSettings.GetSettings(GoogleTestConstants.SettingsName) as RunSettingsProvider;
            RunSettings     ourRunSettings   = settingsProvider != null ? settingsProvider.Settings : new RunSettings();
            var             settingsWrapper  = new SettingsWrapper(ourRunSettings);
            var             loggerAdapter    = new VsTestFrameworkLogger(messageLogger, settingsWrapper);
            TestEnvironment testEnvironment  = new TestEnvironment(settingsWrapper, loggerAdapter);

            settingsWrapper.RegexTraitParser = new RegexTraitParser(testEnvironment);
            return(testEnvironment);
        }
        /// <summary>
        /// Delete (recursively) and recreate the image cache directory
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="logger"></param>
        public static void ClearMagickImageCache(SettingsWrapper settings, Logger logger)
        {
            try
            {
                Directory.Delete(settings.CoreSettings.MagickImageTempDir, true);

                Directory.CreateDirectory(settings.CoreSettings.MagickImageTempDir);
            }
            catch (Exception e)
            {
                logger?.Error(e, "Failed attempting to clear ImageMagick cache");
            }
        }
Exemple #31
0
        public QrCodeViewModel(SocketIoService socketIoService, SettingsWrapper settingsWrapper)
        {
            // uiScheduler = TaskScheduler.FromCurrentSynchronizationContext();
            GenerateCommand = new RelayCommand(() => Generate());

            _socketIoService = socketIoService;

            if (string.IsNullOrEmpty(settingsWrapper.CurrentSettings.Token))
            {
                settingsWrapper.CurrentSettings.Token = Guid.NewGuid().ToString();
            }
            Generate(settingsWrapper.CurrentSettings.Token);
        }
        public void LoadActiveFoundryTarget()
        {
            var wrapper = new SettingsWrapper();
            var target = wrapper.GetActiveFoundryTarget();
            PasswordTextBox.Password = target.Password;
            TargetNameTextBox.Text = target.Name;
            TargetUriTextBox.Text = target.Path.ToString();
            UsernameTextBox.Text = target.Username;

            // TODO: Make this an asynchronous call
            try
            {
                // temporary pre-error handling & validation.
                var paas = new PaasTarget(target.Username, target.Password, target.Path);
                new SettingsWrapper().SetActiveFoundryTarget(Mappers.Map.PaasTargetToFoundryTarget(paas, target));

                var applications = paas.CloudApplications;
                foreach (var application in applications)
                {
                    var appDetail =
                        new CloudsAppDetails
                            {
                                ApplicationTile =
                                    {
                                        Title = application.Name,
                                        Count = FoundryApplication.GetInstanceCount(application),
                                    },
                                ApplicationInformationTextBlock =
                                    {
                                        Text =
                                            Properties.Resources.ApplicationMemory + application.Resources.Memory + "\n" +
                                            Properties.Resources.ApplicationDisk + application.Resources.Disk + "\n" +
                                            Properties.Resources.ApplicationStack + application.State + "\n" +
                                            Properties.Resources.ApplicationModel + application.Staging.Model + "\n" +
                                            Properties.Resources.ApplicationStack + application.Staging.Stack + "\n" +
                                            Properties.Resources.ApplicationUris + GetUris(application.Uris)
                                    }
                            };


                    CloudTargetApplications.Children.Add(appDetail);
                }
            }
            catch (Exception ex)
            {
                // Logging here.
                // Temporarily ignoring exceptions until I can look at and determine the unique results from Cloud Foundry.
                MessageBox.Show("This cloud was not found: " + ex.Message);
            }
        }
Exemple #33
0
        public static void CreateEnvironment(IRunSettings runSettings, IMessageLogger messageLogger, out ILogger logger, out SettingsWrapper settings)
        {
            var settingsProvider = runSettings.GetSettings(GoogleTestConstants.SettingsName) as RunSettingsProvider;
            RunSettingsContainer ourRunSettings = settingsProvider != null ? settingsProvider.SettingsContainer : new RunSettingsContainer();
            var settingsWrapper = new SettingsWrapper(ourRunSettings);

            var loggerAdapter = new VsTestFrameworkLogger(messageLogger, () => settingsWrapper.DebugMode, () => settingsWrapper.TimestampOutput);
            var regexParser   = new RegexTraitParser(loggerAdapter);

            settingsWrapper.RegexTraitParser = regexParser;

            settings = settingsWrapper;
            logger   = loggerAdapter;
        }
Exemple #34
0
        public MainWindow()
        {
            InitializeComponent();

            _logger = LogManager.GetCurrentClassLogger();

            SettingsWrapper settings = Settings.GetSettings();

            LogManager.Configuration.Variables["logfile"] = Path.Combine(settings.CoreSettings.OutputDirectory, ".logs", $"{DateTime.Now:yyyy.MM.dd}.log");

            _barcodeCreatorParent = new BarcodeCreatorParent(settings);

            _videoLibrary = new VideoLibrary(settings);

            ContentArea.Content = _barcodeCreatorParent;
        }