Beispiel #1
0
        public DropboxMediaSource(DropboxMediaSourceSettings settings)
        {
            _media = new List<Media>();
            Settings = settings;

            Client = new DropNetClient(Settings.ApplicationKey, Settings.ApplicationSecret, Settings.UserToken,
                            Settings.UserSecret) { UseSandbox = Settings.Sandbox };
        }
        public DropboxLocalMediaSource(DropboxMediaSourceSettings dropboxMediaSourceSettings, String folder)
            : base(dropboxMediaSourceSettings)
        {
            // store our files inside user-specific folder
            _folder = Path.Combine(folder, Settings.UserToken);
            Directory.CreateDirectory(_folder);

            // load images we already have downloaded
            ((List<Media>)Media).AddRange(Directory.EnumerateFiles(_folder, "*.*",
                                                      Settings.Recursive
                                                          ? SearchOption.AllDirectories
                                                          : SearchOption.TopDirectoryOnly)
                                 .Where(MediaFactory.IsPathMedia)
                                 .Select(p => new LocalMedia(p, Settings.Id)));
        }