private void CreateBundle(string target_directory)
        {
            string target_filename_bundle_manifest = Path.GetFullPath(Path.Combine(target_directory, manifest.Id + Common.EXT_BUNDLE_MANIFEST));
            string target_filename_bundle          = Path.GetFullPath(Path.Combine(target_directory, manifest.Id + Common.EXT_BUNDLE));

            // Check that the details of the manifest are reasonable
            try
            {
                new Uri(manifest.BaseUrl);
            }
            catch (Exception)
            {
                MessageBoxes.Warn("Your base URL of '{0}' is invalid.  Please correct it and try again.", manifest.BaseUrl);
                return;
            }

            // Smash out the manifest
            string json = manifest.ToJSON();

            File.WriteAllText(target_filename_bundle_manifest, json);

            // Smash out the bundle
            string source_directory = Path.GetFullPath(Path.Combine(library.LIBRARY_BASE_PATH, @"*"));
            string directory_exclusion_parameter = (manifest.IncludesPDFs ? "" : "-xr!documents");
            string parameters = String.Format("a -tzip -mm=Deflate -mmt=on -mx9 \"{0}\" \"{1}\" {2}", target_filename_bundle, source_directory, directory_exclusion_parameter);

            // Watch the zipper
            SafeThreadPool.QueueUserWorkItem(o => TailZIPProcess(manifest, parameters));
        }
        public WebLibraryDetail UpdateKnownWebLibraryFromBundleLibraryManifest(BundleLibraryManifest manifest)
        {
            Logging.Info("+Updating known Bundle Library {0} ({1})", manifest.Title, manifest.Id);

            WebLibraryDetail new_web_library_detail = new WebLibraryDetail();

            new_web_library_detail.BundleManifestJSON = manifest.ToJSON();
            new_web_library_detail.Id          = manifest.Id;
            new_web_library_detail.Title       = manifest.Title;
            new_web_library_detail.Description = manifest.Description;
            new_web_library_detail.IsReadOnly  = true;
            new_web_library_detail.Deleted     = false;

            UpdateKnownWebLibrary(new_web_library_detail);

            Logging.Info("-Updating known Bundle Library {0} ({1})", manifest.Title, manifest.Id);

            return(new_web_library_detail);
        }
        public WebLibraryDetail UpdateKnownWebLibraryFromBundleLibraryManifest(BundleLibraryManifest manifest, bool suppress_flush_to_disk = true)
        {
            WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread();

            Logging.Info("+Updating known Bundle Library {0} ({1})", manifest.Title, manifest.Id);

            WebLibraryDetail new_web_library_detail = new WebLibraryDetail();

            new_web_library_detail.BundleManifestJSON = manifest.ToJSON();
            //new_web_library_detail.IsBundleLibrary = true;
            new_web_library_detail.Id          = manifest.Id;
            new_web_library_detail.Title       = manifest.Title;
            new_web_library_detail.Description = manifest.Description;
            new_web_library_detail.Deleted     = false;

            UpdateKnownWebLibrary(new_web_library_detail, suppress_flush_to_disk);

            Logging.Info("-Updating known Bundle Library {0} ({1})", manifest.Title, manifest.Id);

            return(new_web_library_detail);
        }