private Settings()
        {
            FirstTime = false;

            if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                System.Deployment.Application.ApplicationDeployment cd =
                    System.Deployment.Application.ApplicationDeployment.CurrentDeployment;
                Version = cd.CurrentVersion.ToString();
            }
            else
            {
                Version = DevelopmentVersion;
            }
            _appVersionFolder = KnownFolders.GetAppVersionFolder(Version);
            //DbCache = new DbCache(AppVersionFolder + "\\ms.video.downloader.settings.sqlite");
            _configuration = GetApplicationConfiguration();

            if (_configuration != null)
            {
                _fileSystem = new S3FileSystem(_configuration.S3AccessKey, _configuration.S3SecretAccessKey, _configuration.S3RegionHost, _configuration.S3BucketName);
                return;
            }
            FirstTime      = true;
            _configuration = new ApplicationConfiguration {
                Guid = Guid.NewGuid(), S3IsActive = false
            };
            SetApplicationConfiguration(_configuration);
            _fileSystem = new S3FileSystem(_configuration.S3AccessKey, _configuration.S3SecretAccessKey, _configuration.S3RegionHost, _configuration.S3BucketName);
        }
Ejemplo n.º 2
0
 private CacheManager(Settings settings)
 {
     _settings         = settings;
     _appVersionFolder = KnownFolders.GetAppVersionFolder(_settings.Version);
     _urlCaches        = GetUrls() ?? new List <UrlCache>();
     _videoCaches      = GetVideos() ?? new List <VideoCache>();
     VideoCaches       = new Dictionary <string, VideoCache>();
     UrlCaches         = new Dictionary <string, UrlCache>();
     foreach (var item in _urlCaches.Where(item => !UrlCaches.ContainsKey(item.VideoId)))
     {
         UrlCaches.Add(item.VideoId, item);
     }
     foreach (var item in _videoCaches.Where(item => !VideoCaches.ContainsKey(item.FileName) && UrlCaches.ContainsKey(item.VideoId)))
     {
         VideoCaches.Add(item.FileName, item);
     }
 }