public override void Startup()
        {
            Logger.Debug("Startup...");

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(FilePath))
            {
                var infoResult = _entityLoader.ReadFromFile <SoundCloudClientInfo>(stream);
                if (!infoResult.IsSuccess)
                {
                    Logger.Fatal("ClientInfo missing");
                    return;
                }

                _clientInfoRepository.Save(infoResult.Data);
            }

            var result = _settingsService.Get();

            if (!result.IsSuccess)
            {
                Logger.Error("Settings not available");
                return;
            }

            _soundCloudService.Initialize(result.Data.SoundCloudSettings.AccessToken);
        }
Пример #2
0
        public override void Startup()
        {
            Logger.Debug("Startup...");

            var result = _entityLoader.ReadFromFile <Settings>(SettingsFile);

            if (result.IsSuccess)
            {
                _settingsRepository.Save(result.Data);
            }
            else
            {
                _settingsRepository.Save(new Settings());
            }
        }
Пример #3
0
        public override void Startup()
        {
            Logger.Debug("Startup...");

            var result = _entityLoader.ReadFromFile <List <LocalPlaylist> >(PlaylistFile);

            if (!result.IsSuccess)
            {
                return;
            }

            foreach (var playlist in result.Data)
            {
                _localPlaylistRepository.Save(playlist);

                foreach (var track in playlist.Tracks.Cast <LocalTrack>())
                {
                    _localTrackRepository.Save(track);
                }
            }
        }