public DownloadWebSocketService(
            IWebSocketHandler webSocketHandler,
            IDirectoryHandler directoryHandler,
            IDownloadHandler downloadHandler,
            IFileHandler fileHandler,
            IFileHistoryHandler fileHistoryHandler,
            ISettingsHandler settingsHandler,
            IDebugHandler debugHandler)
        {
            debugHandler.TraceMessage("Constructor called.", DebugSource.CONSTRUCTOR, DebugType.ENTRY_EXIT);

            DebugHandler       = debugHandler;
            WebSocketHandler   = webSocketHandler;
            DirectoryHandler   = directoryHandler;
            DownloadHandler    = downloadHandler;
            FileHandler        = fileHandler;
            FileHistoryHandler = fileHistoryHandler;
            SettingsHandler    = settingsHandler;
            LastDownloadedInfo = new JsonDownloadInfo();

            LittleWeebSettings = SettingsHandler.GetLittleWeebSettings();
            IrcSettings        = SettingsHandler.GetIrcSettings();


            downloadHandler.OnDownloadUpdateEvent += OnDownloadUpdateEvent;
        }
示例#2
0
        public static string GetImageLocation(this IBeatmap beatmap, ISettingsHandler settings)
        {
            var    songsDirectory  = BeatmapHelpers.GetFullSongsLocation(settings);
            var    osuFileLocation = beatmap.FullOsuFileLocation(songsDirectory);
            string ImageLocation   = string.Empty;

            using (StreamReader file = new StreamReader(osuFileLocation))
            {
                string line;
                while ((line = file.ReadLine()) != null)
                {
                    if (line.ToLower().Contains(".jpg") || line.ToLower().Contains(".png"))
                    {
                        var splited = line.Split(',');
                        ImageLocation = Path.Combine(beatmap.BeatmapDirectory(songsDirectory), splited[2].Trim('"'));
                        if (!File.Exists(ImageLocation))
                        {
                            return(string.Empty);
                        }
                        break;
                    }
                }
            }
            return(ImageLocation);
        }
        public Task SetSettingsClasses(
            ISettingsHandler settingsHandler,
            IIrcClientHandler ircClientHandler,
            IFileHandler fileHandler,
            IDownloadHandler downloadHandler,
            IDirectoryWebSocketService directoryWebSocketService,
            IIrcWebSocketService ircWebSocketService
            )
        {
            DebugHandler.TraceMessage("SetSettingsClasses Called.", DebugSource.TASK, DebugType.ENTRY_EXIT);

            SettingsHandler           = settingsHandler;
            IrcClientHandler          = ircClientHandler;
            DownloadHandler           = downloadHandler;
            DirectoryWebSocketService = directoryWebSocketService;
            IrcWebSocketService       = ircWebSocketService;


            WebSocketHandlerSettings          = WebSocketHandler as ISettingsInterface;
            IrcClientHandlerSettings          = ircClientHandler as ISettingsInterface;
            DebugHandlerSettings              = DebugHandler as ISettingsInterface;
            FileHandlerSettings               = fileHandler as ISettingsInterface;
            DownloadHandlerSettings           = downloadHandler as ISettingsInterface;
            DirectoryWebSocketServiceSettings = directoryWebSocketService as ISettingsInterface;
            IrcWebSocketServiceSettings       = ircWebSocketService as ISettingsInterface;

            LittleWeebSettings = settingsHandler.GetLittleWeebSettings();
            IrcSettings        = settingsHandler.GetIrcSettings();

            SetAllIrcSettings(IrcSettings);
            SetAllLittleWeebSettings(LittleWeebSettings);

            return(Task.CompletedTask);
        }
示例#4
0
        public MemoryDataFinderSettings(ISettingsHandler settings)
        {
            InitializeComponent();

            _settings = settings;

            checkBox_enableSmoothPp.Checked = _settings.Get <bool>(Helpers.EnablePpSmoothing);

            bool isFallback = _settings.Get <bool>(_names.OsuFallback);

            if (isFallback)
            {
                checkBox_EnableMemoryFinder.Enabled = false;
            }
            else
            {
                checkBox_EnableMemoryFinder.Checked = _settings.Get <bool>(_names.EnableMemoryScanner);

                checkBox_EnableMemoryPooling.Checked = _settings.Get <bool>(_names.EnableMemoryPooling);

                checkBox_clearTokensAfterPlay.Checked = _settings.Get <bool>(Helpers.ClearLiveTokensAfterResultScreenExit);
            }

            init = false;
        }
 public ApiClientsQualitiesViewModel(
     ISettingsHandler settingsHandler,
     IApiClientFactory apiClientFactory)
 {
     this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory));
     this.settingsHandler  = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
 }
 /// <summary>Initializes a new instance of the <see cref="MainViewModel"/> class.</summary>
 /// <param name="jiraHandler">The service for querying Jira.</param>
 /// <param name="settingsHandler"></param>
 /// <param name="settingsViewModel"></param>
 /// <exception cref="System.ArgumentNullException">messenger</exception>
 public MainViewModel(IIssueTrackerService jiraHandler, ISettingsHandler settingsHandler, SettingsViewModel settingsViewModel)
 {
     _jiraService       = jiraHandler ?? throw new ArgumentNullException(nameof(jiraHandler));
     _settingsHandler   = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
     _settingsViewModel = settingsViewModel ?? throw new ArgumentNullException(nameof(settingsViewModel));
     ((ISupportParentViewModel)_settingsViewModel).ParentViewModel = this;
 }
        public ThemeSelectorViewModel(ISettingsHandler settingsHandler)
        {
            this.settingsHandler = settingsHandler;
            if (settingsHandler == null)
            {
                throw new ArgumentNullException(nameof(settingsHandler));
            }

            foreach (MetroThemeBaseColour themeBaseColour in Enum.GetValues(typeof(MetroThemeBaseColour)))
            {
                var menuItem = new MenuItem(() => settingsHandler.Settings.MetroThemeBaseColour = themeBaseColour)
                {
                    Name = themeBaseColour.ToString().ToFriendlyString()
                };

                var savedBaseColour = settingsHandler.Settings.MetroThemeBaseColour.ToString();
                menuItem.IsChecked = savedBaseColour.IsEqualTo(menuItem.Name.Replace(" ", string.Empty));
                BaseThemes.Add(menuItem);
            }

            foreach (MetroThemeAccentColour themeAccentColour in Enum.GetValues(typeof(MetroThemeAccentColour)))
            {
                var menuItem = new MenuItem(() => settingsHandler.Settings.MetroThemeAccentColour = themeAccentColour)
                {
                    Name = themeAccentColour.ToString().ToFriendlyString(),
                };

                var savedAccecentColour = settingsHandler.Settings.MetroThemeAccentColour.ToString();
                menuItem.IsChecked = savedAccecentColour.IsEqualTo(menuItem.Name);
                AccentColours.Add(menuItem);
            }
        }
示例#8
0
 public void SetSettingsHandle(ISettingsHandler settings)
 {
     _settings = settings;
     _settings.SettingUpdated += SettingUpdated;
     _memoryDataProcessor.ToggleSmoothing(_settings.Get <bool>(Helpers.EnablePpSmoothing));
     _memoryDataProcessor.SetSettingsHandle(_settings);
 }
 public SqliteDataFinder(ILogger logger, ISettingsHandler settings, IMainWindowModel mainWindowHandle, ISqliteControler sqLiteControler)
 {
     _mainWindowHandle = mainWindowHandle;
     _settingsHandle   = settings;
     _sqliteControler  = sqLiteControler;
     Start(logger);
 }
示例#10
0
        public LoginViewModel(ISettingsHandler settingsHandler,
                              IGoBot goBot)
        {
            _settingsHandler = settingsHandler;

            _goBot       = goBot;
            LoginCommand = DelegateCommand.FromAsyncHandler(Login, CanLogin);
            LoginTypes   = new ObservableCollection <LoginType>(new List <LoginType>()
            {
                new LoginType()
                {
                    LoginAuth = LoginAuth.Google
                },
                new LoginType()
                {
                    LoginAuth = LoginAuth.PCT
                }
            });

            SelectedLoginType = LoginTypes.FirstOrDefault(t => t.LoginAuth == _settingsHandler.Settings.LoginAuth);

            UserName = _settingsHandler.Settings.Username;
            Password = _settingsHandler.Settings.Password;

            LoginCommand.RaiseCanExecuteChanged();

            _dispatcher          = new DispatcherTimer();
            _dispatcher.Tick    += LoginDispatcher;
            _dispatcher.Interval = new TimeSpan(0, 0, 1);
        }
示例#11
0
        public TextSaver(ISettingsHandler settings)
        {
            var saveDirectory = settings.Get <string>(SaveDirectoryConfigEntry);

            if (saveDirectory != SaveDirectoryConfigEntry.Default <string>() &&
                !string.IsNullOrWhiteSpace(saveDirectory))
            {
                _saveDirectory = saveDirectory;
                var driveList         = DriveInfo.GetDrives().ToList();
                var saveDirectoryInfo = new DirectoryInfo(_saveDirectory);
                foreach (var drive in driveList)
                {
                    if ((drive.DriveType == DriveType.Network || drive.DriveType == DriveType.Removable) &&
                        saveDirectoryInfo.Root.FullName == drive.RootDirectory.FullName)
                    {
                        MessageBox.Show("Please note that saving patterns on network shares might cause unexpected behaviours(like SC updating with 30s+ delay) - especially if connection is slow, and is not really supported.",
                                        "osu!StreamCompanion - network or removable media information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }

            try
            {
                if (!Directory.Exists(SaveDirectory))
                {
                    Directory.CreateDirectory(SaveDirectory);
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                throw new NonLoggableException(ex, "Could not create folder due to insuffisient premissions" +
                                               Environment.NewLine + "Please move this exectuable into a non-system folder");
            }
        }
示例#12
0
        public override CommandResultCode Execute(IExecutionContext context, CommandArguments args)
        {
            ISettingsHandler handler = Application as ISettingsHandler;

            if (handler == null)
            {
                Error.WriteLine("The application doesn't support settings.");
                return(CommandResultCode.ExecutionFailed);
            }

            if (!args.MoveNext())
            {
                return(CommandResultCode.SyntaxError);
            }

            string varName = args.Current;
            bool   success = UnsetVariable(varName, handler.Settings);

            while (args.MoveNext())
            {
                success |= UnsetVariable(args.Current, handler.Settings);
            }

            return(success ? CommandResultCode.Success : CommandResultCode.ExecutionFailed);
        }
示例#13
0
        public IngameOverlay(ILogger logger, ISettingsHandler settings, Delegates.Exit exiter)
        {
            _logger   = logger;
            _settings = settings;

            try
            {
                SetNewMap(new MapSearchResult(new MapSearchArgs("dummy")));
            }
            catch (Exception)
            {
                MessageBox.Show(
                    $"IngameOverlay plugin version is not valid for this version of StreamCompanion. {Environment.NewLine} Either update or remove it from plugins folder",
                    "osu!StreamCompanion Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                exiter("plugin version is invalid for current StreamCompanion version.");
            }

            if (_settings.Get <bool>(PluginSettings.EnableIngameOverlay))
            {
                CopyFreeType();

                Task.Run(() => WatchForProcessStart(cancellationToken.Token), cancellationToken.Token);
            }
        }
        public ShellViewModel(
            SettingsViewModel settingsViewModel,
            MainViewModel mainViewModel,
            IEventAggregator eventAggregator,
            INavigationService navigationService,
            IMonitorStreamsModel monitorStreamsModel,
            ISettingsHandler settingsHandler,
            PopularLivestreamWatcher popularLivestreamWatcher)
        {
            Settings                      = settingsViewModel ?? throw new ArgumentNullException(nameof(settingsViewModel));
            this.mainViewModel            = mainViewModel ?? throw new ArgumentNullException(nameof(mainViewModel));
            this.navigationService        = navigationService ?? throw new ArgumentNullException(nameof(navigationService));
            this.monitorStreamsModel      = monitorStreamsModel ?? throw new ArgumentNullException(nameof(monitorStreamsModel));
            this.settingsHandler          = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
            this.popularLivestreamWatcher = popularLivestreamWatcher ?? throw new ArgumentNullException(nameof(popularLivestreamWatcher));

            ActiveItem = mainViewModel;

            eventAggregator.Subscribe(this);
            Settings.ActivateWith(this);

            currentAppVersion = GetType().Assembly.GetName().Version;
            DisplayName       = $"LIVESTREAM MONITOR V{currentAppVersion.Major}.{currentAppVersion.Minor}.{currentAppVersion.Build}";
#if DEBUG
            // helps to know that we're running the debug rather than release version of the exe
            DisplayName += " (DEBUG)";
#endif
        }
示例#15
0
 public CacheInitalizer(IMainWindowModel mainWindowHandle, ISqliteControler sqliteControler, ISettingsHandler settings, ILogger logger)
 {
     _mainWindowHandle = mainWindowHandle;
     _sqliteControler  = sqliteControler;
     _settings         = settings;
     _logger           = logger;
 }
 public MetroWindowManager(ISettingsHandler settingsHandler)
 {
     if (settingsHandler == null)
     {
         throw new ArgumentNullException(nameof(settingsHandler));
     }
     this.settingsHandler = settingsHandler;
 }
示例#17
0
 public FirstRun(ILogger logger, ISettingsHandler settings, IEnumerable <IFirstRunControlProvider> firstRunControlProviders)
 {
     _logger   = logger;
     _settings = settings;
     _firstRunControlProviders = firstRunControlProviders.ToList();
     _logger.Log(">loaded {0} plugins for firstRun setup", LogLevel.Advanced, _firstRunControlProviders.Count.ToString());
     Start(_logger);
 }
示例#18
0
 public EvolvePokemonHandler(IPokemonHelper pokemonHelper,
                             ILogger logger,
                             ISettingsHandler settingsHandler)
 {
     _pokemonHelper   = pokemonHelper;
     _logger          = logger;
     _settingsHandler = settingsHandler;
 }
示例#19
0
        public static void SaveColor(ISettingsHandler settings, ConfigEntry entry, Color color)
        {
            var colors = BitConverter.GetBytes(color.ToArgb())
                         .Reverse()
                         .ToList();

            settings.Add(entry.Name, string.Join(";", colors.Select(v => v.ToString())), true);
        }
示例#20
0
        public WebSocketSettings(ISettingsHandler settings)
        {
            _settings = settings;
            InitializeComponent();

            checkBox_EnableWebSocketOutput.Checked         = settings.Get <bool>(WebSocketDataGetter.Enabled);
            checkBox_EnableWebSocketOutput.CheckedChanged += CheckBoxEnableWebSocketOutputOnCheckedChanged;
        }
示例#21
0
 public TransferPokemonHandler(IPokemonHelper pokemonHelper,
                               ISettingsHandler settings,
                               ILogger logger)
 {
     _pokemonHelper = pokemonHelper;
     _settings      = settings;
     _logger        = logger;
 }
示例#22
0
 public ClickCounterSettings(ISettingsHandler settings)
 {
     _settings = settings;
     InitializeComponent();
     RefreshDataGrid();
     groupBox_Mouse.Visible = checkBox_enableMouseHook.Checked;
     checkBox_enableMouseHook.CheckedChanged += CheckBox_enableMouseHook_CheckedChanged;
 }
示例#23
0
 public BackgroundImageProviderPlugin(ISaver saver, ISettingsHandler settings)
 {
     _saver        = saver;
     _settings     = settings;
     _saveLocation = Path.Combine(_saver.SaveDirectory, "BG.png");
     _tokenSetter  = Tokens.CreateTokenSetter(Name);
     _imageToken   = _tokenSetter("backgroundImage", null);
 }
示例#24
0
        public IngameOverlaySettings(ISettingsHandler settings)
        {
            _settings = settings;
            InitializeComponent();

            checkBox_ingameOverlay.Checked         = _settings.Get <bool>(PluginSettings.EnableIngameOverlay);
            checkBox_ingameOverlay.CheckedChanged += CheckBoxIngameOverlayOnCheckedChanged;
        }
 public ActionHandler(ISettingsHandler settingsHandler)
 {
     if (settingsHandler == null)
     {
         throw new ArgumentException("Parameter cannot be null", "settingsHandler");
     }
     _settingsHandler = settingsHandler;
 }
 public TwitchApiClient(
     ITwitchTvV5ReadonlyClient twitchTvV5Client,
     ITwitchTvHelixReadonlyClient twitchTvHelixClient,
     ISettingsHandler settingsHandler)
 {
     twitchTvV5ReadonlyClient = twitchTvV5Client ?? throw new ArgumentNullException(nameof(twitchTvV5Client));
     this.twitchTvHelixClient = twitchTvHelixClient ?? throw new ArgumentNullException(nameof(twitchTvHelixClient));
     this.settingsHandler     = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
 }
示例#27
0
 public MonitorStreamsModel(
     IMonitoredStreamsFileHandler fileHandler,
     ISettingsHandler settingsHandler,
     IApiClientFactory apiClientFactory)
 {
     this.fileHandler      = fileHandler ?? throw new ArgumentNullException(nameof(fileHandler));
     this.settingsHandler  = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
     this.apiClientFactory = apiClientFactory ?? throw new ArgumentNullException(nameof(apiClientFactory));
 }
        public TcpSocketSettings(ISettingsHandler settings)
        {
            _settings = settings;
            InitializeComponent();
            checkBox_EnableTcpOutput.Checked = _settings.Get <bool>(_names.tcpSocketEnabled);


            checkBox_EnableTcpOutput.CheckedChanged += checkBox_EnableTcpOutput_CheckedChanged;
        }
示例#29
0
        public SettingsViewModel(
            ISettingsHandler settingsHandler,
            ThemeSelectorViewModel themeSelectorViewModel)
        {
            this.settingsHandler = settingsHandler ?? throw new ArgumentNullException(nameof(settingsHandler));
            ThemeSelector        = themeSelectorViewModel ?? throw new ArgumentNullException(nameof(themeSelectorViewModel));

            ThemeSelector.ActivateWith(this);
        }
示例#30
0
        public OsuPost(ILogger logger, ISettingsHandler settings)
        {
            _settings = settings;

            api             = new OsuPostApi(logger);
            api.EndpointUrl = _settings.Get <string>(_names.osuPostEndpoint);
            SwitchApiStatus(_settings.Get <bool>(_names.osuPostEnabled));
            _settings.SettingUpdated += SettingUpdated;
        }