Пример #1
0
        protected virtual DiffInfo LoadFromPackage(string path)
        {
            IProcessingContext context = new SimpleProcessingContext();

            CommandInstallerContext.Setup(context, Path.GetFileNameWithoutExtension(path), UpgradeAction.Preview, Sitecore.Update.Utils.InstallMode.Install, null, new List <ContingencyEntry>());
            ISource <PackageEntry> source    = new PackageReader(path);
            ISink <PackageEntry>   installer = DoCreateInstallerSink(context);
            var sorter = new PackageDumper(source);

            sorter.Initialize(context);
            sorter.Populate(installer);
            installer.Flush();
            var commands = new List <ICommand>(sorter.Commands);
            var engine   = new DataEngine {
                FilterCommands = false, OptimizeCommands = false
            };

            engine.ProcessCommands(ref commands);

            var          info = new DiffInfo(commands, string.Empty, string.Empty, "Generated by ConvertFromPackage command.");
            MetadataView view = UpdateHelper.LoadMetadata(path);

            if (view != null)
            {
                info.Readme      = view.Readme;
                info.InstallMode = view.Comment;
                info.Title       = view.PackageName;
            }
            ;

            return(info);
        }