Пример #1
0
        public IList <LogEntry> Import(string location, bool includeContent, bool includeLibrary, bool includeModels,
                                       bool includeTemplates, int targetFolder, IEnumerable <CmsResource> resources, bool overwriteExisting,
                                       Dictionary <string, int> accessMaps, Dictionary <string, int> packageMaps, Dictionary <string, int> stateMaps,
                                       Dictionary <string, int> workflowFilterMaps, EventHandler <MigrationItemEventArgs> onItemProcessed = null)
        {
            var migrationSession = new MigrationSessionBuilder(_cms, false);

            migrationSession.ImportSession.FileLocation            = location;
            migrationSession.ImportSession.IncludeContent          = includeContent;
            migrationSession.ImportSession.IncludeLibrary          = includeLibrary;
            migrationSession.ImportSession.IncludeModels           = includeModels;
            migrationSession.ImportSession.IncludeTemplates        = includeTemplates;
            migrationSession.ImportSession.TargetFolder            = targetFolder;
            migrationSession.ImportSession.ResourceCollection      = resources;
            migrationSession.ImportSession.OverwriteExistingAssets = overwriteExisting;
            migrationSession.ImportSession.AccessMaps         = accessMaps;
            migrationSession.ImportSession.PackageMaps        = packageMaps;
            migrationSession.ImportSession.StateMaps          = stateMaps;
            migrationSession.ImportSession.WorkflowFilterMaps = workflowFilterMaps;

            if (onItemProcessed != null)
            {
                migrationSession.ImportSession.ItemProcessed += onItemProcessed;
            }

            migrationSession.Execute();

            migrationSession.EndSession();

            return(migrationSession.ImportSession.Log);
        }
Пример #2
0
        public IList <LogEntry> Export(string location, int topLevelId, bool includeContent, bool includeLibrary, bool includeModels,
                                       bool includeTemplates, IEnumerable <CmsResource> resources, EventHandler <MigrationItemEventArgs> onItemProcessed = null)
        {
            var migrationSession = new MigrationSessionBuilder(_cms);

            migrationSession.ExportSession.FileLocation       = location;
            migrationSession.ExportSession.TargetFolder       = topLevelId;
            migrationSession.ExportSession.IncludeContent     = includeContent;
            migrationSession.ExportSession.IncludeLibrary     = includeLibrary;
            migrationSession.ExportSession.IncludeModels      = includeModels;
            migrationSession.ExportSession.IncludeTemplates   = includeTemplates;
            migrationSession.ExportSession.ResourceCollection = resources;

            if (onItemProcessed != null)
            {
                migrationSession.ExportSession.ItemProcessed += onItemProcessed;
            }

            migrationSession.Execute();

            migrationSession.EndSession();

            return(migrationSession.ExportSession.Log);
        }