Exemplo n.º 1
0
        /// <summary>
        /// Creates a new package from a server folder
        /// </summary>
        /// <param name="owner">The owner form</param>
        /// <param name="connection">The connection used to retrieve the resources</param>
        /// <param name="folderResourceId">The folder to create the package from</param>
        /// <param name="zipfilename">The name of the output package file</param>
        /// <param name="allowedExtensions">A list of allowed extensions, set to null for all types. The special value &quot;*&quot; matches all unknown extensions.</param>
        /// <param name="removeExistingFiles">A flag indicating if the package should contain a delete instruction to delete the target area before restore</param>
        /// <param name="alternateTargetResourceId">The folder path where the package should be restore, set to null or empty string to use the source path</param>
        /// <returns></returns>
        public static DialogResult CreatePackage(Form owner, IServerConnection connection, string folderResourceId, string zipfilename, IEnumerable<ResourceTypes> allowedExtensions, bool removeExistingFiles, string alternateTargetResourceId)
        {
            PackageProgress pkgp = new PackageProgress();

            var builder = new PackageBuilder(connection);
            pkgp.m_invokeObj = builder;
            pkgp.m_method = () => { builder.CreatePackage(folderResourceId, zipfilename, allowedExtensions, removeExistingFiles, alternateTargetResourceId); return true; };

            return pkgp.ShowDialog(owner);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Rebuilds a package
        /// </summary>
        /// <param name="owner">The owner form</param>
        /// <param name="connection">The connection used to serialize the items</param>
        /// <param name="sourcePackageFile">The package file that the new file is based on</param>
        /// <param name="items">The items that describes the layout of the new package</param>
        /// <param name="targetfile">The output package file</param>
        /// <param name="insertEraseCommands">True if each resource should have a delete operation inserted before the actual operation, false otherwise</param>
        /// <returns>A DialogResult object that indicates the result of the operation</returns>
        public static DialogResult RebuildPackage(Form owner, IServerConnection connection, string sourcePackageFile, List<ResourceItem> items, string targetfile, bool insertEraseCommands)
        {
            PackageProgress pkgp = new PackageProgress();

            var builder = new PackageBuilder(connection);
            pkgp.m_invokeObj = builder;
            pkgp.m_method = () => { builder.RebuildPackage(sourcePackageFile, items, targetfile, insertEraseCommands); return true; };

            return pkgp.ShowDialog(owner);
        }
Exemplo n.º 3
0
        /// <summary>
        ///  Uploads a package file to the server in a non-transactional fashion
        /// </summary>
        /// <param name="owner">The owner form</param>
        /// <param name="connection">The connection used to upload the package</param>
        /// <param name="packageFile">The package file to upload</param>
        /// <param name="result">An <see cref="T:Maestro.Packaging.UploadPackageResult"/> object containing an optional list of operations to skip. It will be populated with the list of operations that passed and failed as the process executes</param>
        /// <returns>A DialogResult object that indicates the result of the operation</returns>
        public static DialogResult UploadPackageNonTransactional(Form owner, IServerConnection connection, string packageFile, UploadPackageResult result)
        {
            PackageProgress pkgp = new PackageProgress();
            pkgp.Text = Strings.TitleUploading;

            var builder = new PackageBuilder(connection);
            pkgp.m_invokeObj = builder;
            pkgp.m_method = () => { builder.UploadPackageNonTransactional(packageFile, result); return true; };

            return pkgp.ShowDialog(owner);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Lists the contents of a package
        /// </summary>
        /// <param name="owner">The owner form</param>
        /// <param name="connection">The connection used to deserialize the items</param>
        /// <param name="packageFile">The package file to read</param>
        /// <returns>A list of resources in the package</returns>
        public static Dictionary<string, ResourceItem> ListPackageContents(Form owner, IServerConnection connection, string packageFile)
        {
            PackageProgress pkgp = new PackageProgress();
            var builder = new PackageBuilder(connection);
            pkgp.m_invokeObj = builder;
            pkgp.m_method = () => { return builder.ListPackageContents(packageFile); };

            if (pkgp.ShowDialog(owner) == DialogResult.OK)
                return (Dictionary<string, ResourceItem>)pkgp.m_invokeResult;
            else
                return null;
        }