Example #1
0
        /// <param name="bookRoot">Root of the project.</param>
        /// <param name="dumpLocation">It's location. Where the file will be stored.</param>
        public void EnsureAllIsSaved(IEnumerable <EntryBase> allData, string bookRoot, string dumpLocation)
        {
            // Files. We store them in a local path.
            Uri[] urls = _eph.GetFiles(allData);
            using (IFileStorage fstorage = _fsf.CreateOn(dumpLocation))
            {
                foreach (Uri u in urls)
                {
                    DownloadAndStoreIfNotAvailable(fstorage, u);
                }
            }

            // Userpics. We store them in the book's root subfolder.
            Tuple <string, Userpic>[] userpics = _eph.GetUserpics(allData);
            using (IUserpicStorage ustorage = _ups.CreateOn(bookRoot))
            {
                foreach (var tuple in userpics)
                {
                    Userpic userpic = tuple.Item2;
                    Uri     u       = userpic.GetUri();

                    DownloadAndStoreIfNotAvailable(ustorage, u);
                }
            }
        }