Ejemplo n.º 1
0
        public IBindResult Bind(IBindContext context)
        {
            var extensionManager = context.ServiceProvider.GetService <IExtensionManager>();

            var backendExtensions = extensionManager.GetServices <IWindowsInstallerBackendBinderExtension>();

            foreach (var extension in backendExtensions)
            {
                extension.PreBackendBind(context);
            }

            IBindResult result  = null;
            var         dispose = true;

            try
            {
                var command = new BindDatabaseCommand(context, backendExtensions, "darice.cub");
                result = command.Execute();

                foreach (var extension in backendExtensions)
                {
                    extension.PostBackendBind(result);
                }

                dispose = false;
                return(result);
            }
            finally
            {
                if (dispose)
                {
                    result?.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        public IBindResult Bind(IBindContext context)
        {
            var extensionManager = context.ServiceProvider.GetService <IExtensionManager>();

            var backendExtensions = extensionManager.GetServices <IWindowsInstallerBackendBinderExtension>();

            foreach (var extension in backendExtensions)
            {
                extension.PreBackendBind(context);
            }

            var validator = Validator.CreateFromContext(context, "mergemod.cub");

            IBindResult result = null;

            try
            {
                var command = new BindDatabaseCommand(context, backendExtensions, validator);
                result = command.Execute();

                foreach (var extension in backendExtensions)
                {
                    extension.PostBackendBind(result);
                }

                return(result);
            }
            catch
            {
                result?.Dispose();
                throw;
            }
        }
Ejemplo n.º 3
0
        public IBindResult Bind(IBindContext context)
        {
            var messaging = context.ServiceProvider.GetService <IMessaging>();

            var backendHelper = context.ServiceProvider.GetService <IBackendHelper>();

            var extensionManager = context.ServiceProvider.GetService <IExtensionManager>();

            var backendExtensions = extensionManager.GetServices <IWindowsInstallerBackendBinderExtension>();

            foreach (var extension in backendExtensions)
            {
                extension.PreBackendBind(context);
            }

            // Create transforms named in patch transforms.
            IEnumerable <PatchTransform> patchTransforms;
            {
                var command = new CreatePatchTransformsCommand(messaging, backendHelper, context.IntermediateRepresentation, context.IntermediateFolder);
                patchTransforms = command.Execute();
            }

            // Enhance the intermediate by attaching the created patch transforms.
            IEnumerable <SubStorage> subStorages;
            {
                var command = new AttachPatchTransformsCommand(messaging, backendHelper, context.IntermediateRepresentation, patchTransforms);
                subStorages = command.Execute();
            }

            // Create WindowsInstallerData with patch metdata and transforms as sub-storages
            // Create MSP from WindowsInstallerData
            IBindResult result = null;

            try
            {
                var command = new BindDatabaseCommand(context, backendExtensions, subStorages, null);
                result = command.Execute();

                foreach (var extension in backendExtensions)
                {
                    extension.PostBackendBind(result);
                }

                return(result);
            }
            catch
            {
                result?.Dispose();
                throw;
            }
        }
 /// <summary>
 /// See <see cref="IWindowsInstallerBackendBinderExtension.PreBackendBind(IBindContext)"/>
 /// </summary>
 public virtual void PostBackendBind(IBindResult result)
 {
 }
Ejemplo n.º 5
0
        private void BindPhase(Intermediate output, IEnumerable <Localization> localizations, IEnumerable <string> filterCultures, string cabCachePath, IEnumerable <IBindPath> bindPaths, CancellationToken cancellationToken)
        {
            var intermediateFolder = this.IntermediateFolder;

            if (String.IsNullOrEmpty(intermediateFolder))
            {
                intermediateFolder = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
            }

            IResolveResult resolveResult;

            {
                var context = this.ServiceProvider.GetService <IResolveContext>();
                context.BindPaths                  = bindPaths;
                context.Extensions                 = this.ExtensionManager.GetServices <IResolverExtension>();
                context.ExtensionData              = this.ExtensionManager.GetServices <IExtensionData>();
                context.FilterCultures             = filterCultures;
                context.IntermediateFolder         = intermediateFolder;
                context.IntermediateRepresentation = output;
                context.Localizations              = localizations;
                context.CancellationToken          = cancellationToken;

                var resolver = this.ServiceProvider.GetService <IResolver>();
                resolveResult = resolver.Resolve(context);
            }

            if (this.Messaging.EncounteredError)
            {
                return;
            }

            IBindResult bindResult = null;

            try
            {
                {
                    var context = this.ServiceProvider.GetService <IBindContext>();
                    //context.CabbingThreadCount = this.CabbingThreadCount;
                    context.CabCachePath            = cabCachePath;
                    context.Codepage                = resolveResult.Codepage;
                    context.DefaultCompressionLevel = this.DefaultCompressionLevel;
                    context.DelayedFields           = resolveResult.DelayedFields;
                    context.ExpectedEmbeddedFiles   = resolveResult.ExpectedEmbeddedFiles;
                    context.Extensions              = this.ExtensionManager.GetServices <IBinderExtension>();
                    context.FileSystemExtensions    = this.ExtensionManager.GetServices <IFileSystemExtension>();
                    context.Ices = Array.Empty <string>(); // TODO: set this correctly
                    context.IntermediateFolder         = intermediateFolder;
                    context.IntermediateRepresentation = resolveResult.IntermediateRepresentation;
                    context.OutputPath         = this.OutputFile;
                    context.PdbType            = this.PdbType;
                    context.PdbPath            = this.PdbType == PdbType.None ? null : this.PdbFile ?? Path.ChangeExtension(this.OutputFile, ".wixpdb");
                    context.SuppressIces       = Array.Empty <string>(); // TODO: set this correctly
                    context.SuppressValidation = true;                   // TODO: set this correctly
                    context.CancellationToken  = cancellationToken;

                    var binder = this.ServiceProvider.GetService <IBinder>();
                    bindResult = binder.Bind(context);
                }

                if (this.Messaging.EncounteredError)
                {
                    return;
                }

                {
                    var context = this.ServiceProvider.GetService <ILayoutContext>();
                    context.Extensions         = this.ExtensionManager.GetServices <ILayoutExtension>();
                    context.TrackedFiles       = bindResult.TrackedFiles;
                    context.FileTransfers      = bindResult.FileTransfers;
                    context.IntermediateFolder = intermediateFolder;
                    context.ContentsFile       = this.ContentsFile;
                    context.OutputsFile        = this.OutputsFile;
                    context.BuiltOutputsFile   = this.BuiltOutputsFile;
                    context.SuppressAclReset   = false; // TODO: correctly set SuppressAclReset
                    context.CancellationToken  = cancellationToken;

                    var layout = this.ServiceProvider.GetService <ILayoutCreator>();
                    layout.Layout(context);
                }
            }
            finally
            {
                bindResult?.Dispose();
            }
        }
Ejemplo n.º 6
0
 void _activationTimer_Tick( object sender, EventArgs e )
 {
     try
     {
         if( _bindResult != null )
         {
             //Console.WriteLine( "Elapsed OnPointerButtonUp Seal !" );
             _bindResult.Seal();
         }
     }
     finally
     {
         _bindResult = null;
         _activationTimer.Stop();
         _activationTimer = null;
     }
 }
Ejemplo n.º 7
0
        void OnWindowMoved( object sender, WindowElementLocationEventArgs e )
        {
            Debug.Assert( Dispatcher.CurrentDispatcher == Application.Current.Dispatcher, "This method should only be called by the Application Thread." );

            //avoids bind during a resize
            if( !_resizeMoveLock && !_pointerDownLock )
            {
                if( _tester.CanTest )
                {
                    ISpatialBinding binding = WindowBinder.GetBinding( e.Window );
                    IDictionary<IWindowElement, Rect> rect = WindowManager.WindowElements.ToDictionary( x => x, y => WindowManager.GetClientArea( y ) );

                    IBinding result = _tester.Test( binding, rect, AttractionRadius );
                    if( result != null )
                    {
                        _bindResult = WindowBinder.PreviewBind( result.Target, result.Origin, result.Position );
                    }
                    else
                    {
                        if( _tester.LastResult != null )
                        {
                            WindowBinder.PreviewUnbind( _tester.LastResult.Target, _tester.LastResult.Origin );
                            _bindResult = null;
                        }
                    }
                }
            }
            _resizeMoveLock = false;
        }