aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.Mba.Core/EventArgs.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/WixToolset.Mba.Core/EventArgs.cs1903
1 files changed, 1903 insertions, 0 deletions
diff --git a/src/WixToolset.Mba.Core/EventArgs.cs b/src/WixToolset.Mba.Core/EventArgs.cs
new file mode 100644
index 00000000..9e8e6ecc
--- /dev/null
+++ b/src/WixToolset.Mba.Core/EventArgs.cs
@@ -0,0 +1,1903 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolset.BootstrapperCore
4{
5 using System;
6 using System.Collections.Generic;
7 using System.Collections.ObjectModel;
8
9 /// <summary>
10 /// Base class for BA <see cref="EventArgs"/> classes.
11 /// </summary>
12 [Serializable]
13 public abstract class HResultEventArgs : EventArgs
14 {
15 /// <summary>
16 /// Creates a new instance of the <see cref="HResultEventArgs"/> class.
17 /// </summary>
18 public HResultEventArgs()
19 {
20 }
21
22 /// <summary>
23 /// Gets or sets the <see cref="HResult"/> of the operation. This is passed back to the engine.
24 /// </summary>
25 public int HResult { get; set; }
26 }
27
28 /// <summary>
29 /// Base class for cancellable BA <see cref="EventArgs"/> classes.
30 /// </summary>
31 [Serializable]
32 public abstract class CancellableHResultEventArgs : HResultEventArgs
33 {
34 /// <summary>
35 /// Creates a new instance of the <see cref="CancellableHResultEventArgs"/> class.
36 /// </summary>
37 public CancellableHResultEventArgs(bool cancelRecommendation)
38 {
39 this.Cancel = cancelRecommendation;
40 }
41
42 /// <summary>
43 /// Gets or sets whether to cancel the operation. This is passed back to the engine.
44 /// </summary>
45 public bool Cancel { get; set; }
46 }
47
48 /// <summary>
49 /// Base class for <see cref="EventArgs"/> classes that must return a <see cref="Result"/>.
50 /// </summary>
51 [Serializable]
52 public abstract class ResultEventArgs : HResultEventArgs
53 {
54 /// <summary>
55 /// Creates a new instance of the <see cref="ResultEventArgs"/> class.
56 /// </summary>
57 /// <param name="recommendation">Recommended result from engine.</param>
58 /// <param name="result">The result to return to the engine.</param>
59 public ResultEventArgs(Result recommendation, Result result)
60 {
61 this.Recommendation = recommendation;
62 this.Result = result;
63 }
64
65 /// <summary>
66 /// Gets the recommended <see cref="Result"/> of the operation.
67 /// </summary>
68 public Result Recommendation { get; private set; }
69
70 /// <summary>
71 /// Gets or sets the <see cref="Result"/> of the operation. This is passed back to the engine.
72 /// </summary>
73 public Result Result { get; set; }
74 }
75
76 /// <summary>
77 /// Base class for <see cref="EventArgs"/> classes that receive status from the engine.
78 /// </summary>
79 [Serializable]
80 public abstract class StatusEventArgs : HResultEventArgs
81 {
82 /// <summary>
83 /// Creates a new instance of the <see cref="StatusEventArgs"/> class.
84 /// </summary>
85 /// <param name="hrStatus">The return code of the operation.</param>
86 public StatusEventArgs(int hrStatus)
87 {
88 this.Status = hrStatus;
89 }
90
91 /// <summary>
92 /// Gets the return code of the operation.
93 /// </summary>
94 public int Status { get; private set; }
95 }
96
97 /// <summary>
98 /// Base class for <see cref="EventArgs"/> classes that receive status from the engine and return an action.
99 /// </summary>
100 public abstract class ActionEventArgs<T> : StatusEventArgs
101 {
102 /// <summary>
103 /// </summary>
104 /// <param name="hrStatus">The return code of the operation.</param>
105 /// <param name="recommendation">Recommended action from engine.</param>
106 /// <param name="action">The action to perform.</param>
107 public ActionEventArgs(int hrStatus, T recommendation, T action)
108 : base(hrStatus)
109 {
110 this.Recommendation = recommendation;
111 this.Action = action;
112 }
113
114 /// <summary>
115 /// Gets the recommended action from the engine.
116 /// </summary>
117 public T Recommendation { get; private set; }
118
119 /// <summary>
120 /// Gets or sets the action to be performed. This is passed back to the engine.
121 /// </summary>
122 public T Action { get; set; }
123 }
124
125 /// <summary>
126 /// Additional arguments used when startup has begun.
127 /// </summary>
128 [Serializable]
129 public class StartupEventArgs : HResultEventArgs
130 {
131 /// <summary>
132 /// Creates a new instance of the <see cref="StartupEventArgs"/> class.
133 /// </summary>
134 public StartupEventArgs()
135 {
136 }
137 }
138
139 /// <summary>
140 /// Additional arguments used when shutdown has begun.
141 /// </summary>
142 [Serializable]
143 public class ShutdownEventArgs : HResultEventArgs
144 {
145 /// <summary>
146 /// Creates a new instance of the <see cref="ShutdownEventArgs"/> class.
147 /// </summary>
148 public ShutdownEventArgs(BOOTSTRAPPER_SHUTDOWN_ACTION action)
149 {
150 this.Action = action;
151 }
152
153 /// <summary>
154 /// The action for OnShutdown.
155 /// </summary>
156 public BOOTSTRAPPER_SHUTDOWN_ACTION Action { get; set; }
157 }
158
159 /// <summary>
160 /// Additional arguments used when the system is shutting down or the user is logging off.
161 /// </summary>
162 /// <remarks>
163 /// <para>To prevent shutting down or logging off, set <see cref="CancellableHResultEventArgs.Cancel"/> to
164 /// true; otherwise, set it to false.</para>
165 /// <para>By default setup will prevent shutting down or logging off between
166 /// <see cref="BootstrapperApplication.ApplyBegin"/> and <see cref="BootstrapperApplication.ApplyComplete"/>.</para>
167 /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/>
168 /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other
169 /// critical operations before being closed by the operating system.</para>
170 /// </remarks>
171 [Serializable]
172 public class SystemShutdownEventArgs : CancellableHResultEventArgs
173 {
174 /// <summary>
175 /// Creates a new instance of the <see cref="SystemShutdownEventArgs"/> class.
176 /// </summary>
177 /// <param name="reasons">The reason the application is requested to close or being closed.</param>
178 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
179 public SystemShutdownEventArgs(EndSessionReasons reasons, bool cancelRecommendation)
180 : base(cancelRecommendation)
181 {
182 this.Reasons = reasons;
183 }
184
185 /// <summary>
186 /// Gets the reason the application is requested to close or being closed.
187 /// </summary>
188 /// <remarks>
189 /// <para>To prevent shutting down or logging off, set <see cref="CancellableHResultEventArgs.Cancel"/> to
190 /// true; otherwise, set it to false.</para>
191 /// <para>If <see cref="SystemShutdownEventArgs.Reasons"/> contains <see cref="EndSessionReasons.Critical"/>
192 /// the bootstrapper cannot prevent the shutdown and only has a few seconds to save state or perform any other
193 /// critical operations before being closed by the operating system.</para>
194 /// </remarks>
195 public EndSessionReasons Reasons { get; private set; }
196 }
197
198 /// <summary>
199 /// Additional arguments used when the overall detection phase has begun.
200 /// </summary>
201 [Serializable]
202 public class DetectBeginEventArgs : CancellableHResultEventArgs
203 {
204 /// <summary>
205 /// Creates a new instance of the <see cref="DetectBeginEventArgs"/> class.
206 /// </summary>
207 /// <param name="installed">Specifies whether the bundle is installed.</param>
208 /// <param name="packageCount">The number of packages to detect.</param>
209 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
210 public DetectBeginEventArgs(bool installed, int packageCount, bool cancelRecommendation)
211 : base(cancelRecommendation)
212 {
213 this.Installed = installed;
214 this.PackageCount = packageCount;
215 }
216
217 /// <summary>
218 /// Gets whether the bundle is installed.
219 /// </summary>
220 public bool Installed { get; private set; }
221
222 /// <summary>
223 /// Gets the number of packages to detect.
224 /// </summary>
225 public int PackageCount { get; private set; }
226 }
227
228 /// <summary>
229 /// Additional arguments used when detected a forward compatible bundle.
230 /// </summary>
231 [Serializable]
232 public class DetectForwardCompatibleBundleEventArgs : CancellableHResultEventArgs
233 {
234 /// <summary>
235 /// Creates a new instance of the <see cref="DetectUpdateBeginEventArgs"/> class.
236 /// </summary>
237 /// <param name="bundleId">The identity of the forward compatible bundle.</param>
238 /// <param name="relationType">Relationship type for this forward compatible bundle.</param>
239 /// <param name="bundleTag">The tag of the forward compatible bundle.</param>
240 /// <param name="perMachine">Whether the detected forward compatible bundle is per machine.</param>
241 /// <param name="version">The version of the forward compatible bundle detected.</param>
242 /// <param name="cancelRecommendation">The cancel recommendation from the engine.</param>
243 /// <param name="ignoreBundleRecommendation">The ignore recommendation from the engine.</param>
244 public DetectForwardCompatibleBundleEventArgs(string bundleId, RelationType relationType, string bundleTag, bool perMachine, long version, bool cancelRecommendation, bool ignoreBundleRecommendation)
245 : base(cancelRecommendation)
246 {
247 this.BundleId = bundleId;
248 this.RelationType = relationType;
249 this.BundleTag = bundleTag;
250 this.PerMachine = perMachine;
251 this.Version = Engine.LongToVersion(version);
252 this.IgnoreBundle = ignoreBundleRecommendation;
253 }
254
255 /// <summary>
256 /// Gets the identity of the forward compatible bundle detected.
257 /// </summary>
258 public string BundleId { get; private set; }
259
260 /// <summary>
261 /// Gets the relationship type of the forward compatible bundle.
262 /// </summary>
263 public RelationType RelationType { get; private set; }
264
265 /// <summary>
266 /// Gets the tag of the forward compatible bundle.
267 /// </summary>
268 public string BundleTag { get; private set; }
269
270 /// <summary>
271 /// Gets whether the detected forward compatible bundle is per machine.
272 /// </summary>
273 public bool PerMachine { get; private set; }
274
275 /// <summary>
276 /// Gets the version of the forward compatible bundle detected.
277 /// </summary>
278 public Version Version { get; private set; }
279
280 /// <summary>
281 /// Instructs the engine whether to use the forward compatible bundle.
282 /// </summary>
283 public bool IgnoreBundle { get; set; }
284 }
285
286 /// <summary>
287 /// Additional arguments used when the detection for an update has begun.
288 /// </summary>
289 [Serializable]
290 public class DetectUpdateBeginEventArgs : CancellableHResultEventArgs
291 {
292 /// <summary>
293 /// Creates a new instance of the <see cref="DetectUpdateBeginEventArgs"/> class.
294 /// </summary>
295 /// <param name="updateLocation">The location to check for an updated bundle.</param>
296 /// <param name="cancelRecommendation">The cancel recommendation from the engine.</param>
297 /// <param name="skipRecommendation">The skip recommendation from the engine.</param>
298 public DetectUpdateBeginEventArgs(string updateLocation, bool cancelRecommendation, bool skipRecommendation)
299 : base(cancelRecommendation)
300 {
301 this.UpdateLocation = updateLocation;
302 }
303
304 /// <summary>
305 /// Gets the identity of the bundle to detect.
306 /// </summary>
307 public string UpdateLocation { get; private set; }
308
309 /// <summary>
310 /// Whether to skip checking for bundle updates.
311 /// </summary>
312 public bool Skip { get; set; }
313 }
314
315 /// <summary>
316 /// Additional arguments used when the detection for an update has begun.
317 /// </summary>
318 [Serializable]
319 public class DetectUpdateEventArgs : CancellableHResultEventArgs
320 {
321 /// <summary>
322 /// Creates a new instance of the <see cref="DetectUpdateBeginEventArgs"/> class.
323 /// </summary>
324 /// <param name="updateLocation">The location to check for an updated bundle.</param>
325 /// <param name="size">The expected size of the updated bundle.</param>
326 /// <param name="version">The expected version of the updated bundle.</param>
327 /// <param name="title">The title of the updated bundle.</param>
328 /// <param name="summary">The summary of the updated bundle.</param>
329 /// <param name="contentType">The content type of the content of the updated bundle.</param>
330 /// <param name="content">The content of the updated bundle.</param>
331 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
332 /// <param name="stopRecommendation">The recommendation from the engine.</param>
333 public DetectUpdateEventArgs(string updateLocation, long size, long version, string title, string summary, string contentType, string content, bool cancelRecommendation, bool stopRecommendation)
334 : base(cancelRecommendation)
335 {
336 this.UpdateLocation = updateLocation;
337 this.Size = size;
338 this.Version = Engine.LongToVersion(version);
339 this.Title = title;
340 this.Summary = summary;
341 this.ContentType = contentType;
342 this.Content = content;
343 this.StopProcessingUpdates = stopRecommendation;
344 }
345
346 /// <summary>
347 /// Gets the identity of the bundle to detect.
348 /// </summary>
349 public string UpdateLocation { get; private set; }
350
351 /// <summary>
352 /// Gets the size of the updated bundle.
353 /// </summary>
354 public long Size { get; private set; }
355
356 /// <summary>
357 /// Gets the version of the updated bundle.
358 /// </summary>
359 public Version Version { get; private set; }
360
361 /// <summary>
362 /// Gets the title of the the updated bundle.
363 /// </summary>
364 public string Title { get; private set; }
365
366 /// <summary>
367 /// Gets the summary of the updated bundle.
368 /// </summary>
369 public string Summary { get; private set; }
370
371 /// <summary>
372 /// Gets the content type of the content of the updated bundle.
373 /// </summary>
374 public string ContentType { get; private set; }
375
376 /// <summary>
377 /// Gets the content of the updated bundle.
378 /// </summary>
379 public string Content { get; private set; }
380
381 /// <summary>
382 /// Tells the engine to stop giving the rest of the updates found in the feed.
383 /// </summary>
384 public bool StopProcessingUpdates { get; set; }
385 }
386
387 /// <summary>
388 /// Additional arguments used when the detection for an update has completed.
389 /// </summary>
390 [Serializable]
391 public class DetectUpdateCompleteEventArgs : StatusEventArgs
392 {
393 /// <summary>
394 /// Creates a new instance of the <see cref="DetectUpdateCompleteEventArgs"/> class.
395 /// </summary>
396 /// <param name="hrStatus">The return code of the operation.</param>
397 /// <param name="ignoreRecommendation">The recommendation from the engine.</param>
398 public DetectUpdateCompleteEventArgs(int hrStatus, bool ignoreRecommendation)
399 : base(hrStatus)
400 {
401 this.IgnoreError = ignoreRecommendation;
402 }
403
404 /// <summary>
405 /// If Status is an error, then set this to true to ignore it and continue detecting.
406 /// </summary>
407 public bool IgnoreError { get; set; }
408 }
409
410 /// <summary>
411 /// Additional arguments used when a related bundle has been detected for a bundle.
412 /// </summary>
413 [Serializable]
414 public class DetectRelatedBundleEventArgs : CancellableHResultEventArgs
415 {
416 /// <summary>
417 /// Creates a new instance of the <see cref="DetectRelatedBundleEventArgs"/> class.
418 /// </summary>
419 /// <param name="productCode">The identity of the related package bundle.</param>
420 /// <param name="relationType">Relationship type for this related bundle.</param>
421 /// <param name="bundleTag">The tag of the related package bundle.</param>
422 /// <param name="perMachine">Whether the detected bundle is per machine.</param>
423 /// <param name="version">The version of the related bundle detected.</param>
424 /// <param name="operation">The operation that will be taken on the detected bundle.</param>
425 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
426 public DetectRelatedBundleEventArgs(string productCode, RelationType relationType, string bundleTag, bool perMachine, long version, RelatedOperation operation, bool cancelRecommendation)
427 : base(cancelRecommendation)
428 {
429 this.ProductCode = productCode;
430 this.RelationType = relationType;
431 this.BundleTag = bundleTag;
432 this.PerMachine = perMachine;
433 this.Version = Engine.LongToVersion(version);
434 this.Operation = operation;
435 }
436
437 /// <summary>
438 /// Gets the identity of the related bundle detected.
439 /// </summary>
440 public string ProductCode { get; private set; }
441
442 /// <summary>
443 /// Gets the relationship type of the related bundle.
444 /// </summary>
445 public RelationType RelationType { get; private set; }
446
447 /// <summary>
448 /// Gets the tag of the related package bundle.
449 /// </summary>
450 public string BundleTag { get; private set; }
451
452 /// <summary>
453 /// Gets whether the detected bundle is per machine.
454 /// </summary>
455 public bool PerMachine { get; private set; }
456
457 /// <summary>
458 /// Gets the version of the related bundle detected.
459 /// </summary>
460 public Version Version { get; private set; }
461
462 /// <summary>
463 /// Gets the operation that will be taken on the detected bundle.
464 /// </summary>
465 public RelatedOperation Operation { get; private set; }
466 }
467
468 /// <summary>
469 /// Additional arguments used when the detection for a specific package has begun.
470 /// </summary>
471 [Serializable]
472 public class DetectPackageBeginEventArgs : CancellableHResultEventArgs
473 {
474 /// <summary>
475 /// Creates a new instance of the <see cref="DetectPackageBeginEventArgs"/> class.
476 /// </summary>
477 /// <param name="packageId">The identity of the package to detect.</param>
478 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
479 public DetectPackageBeginEventArgs(string packageId, bool cancelRecommendation)
480 : base(cancelRecommendation)
481 {
482 this.PackageId = packageId;
483 }
484
485 /// <summary>
486 /// Gets the identity of the package to detect.
487 /// </summary>
488 public string PackageId { get; private set; }
489 }
490
491 /// <summary>
492 /// Additional arguments used when a package was not found but a newer package using the same provider key was.
493 /// </summary>
494 [Serializable]
495 public class DetectCompatibleMsiPackageEventArgs : CancellableHResultEventArgs
496 {
497 /// <summary>
498 /// Creates a new instance of the <see cref="DetectCompatibleMsiPackageEventArgs"/> class.
499 /// </summary>
500 /// <param name="packageId">The identity of the package that was not detected.</param>
501 /// <param name="compatiblePackageId">The identity of the compatible package that was detected.</param>
502 /// <param name="compatiblePackageVersion">The version of the compatible package that was detected.</param>
503 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
504 public DetectCompatibleMsiPackageEventArgs(string packageId, string compatiblePackageId, long compatiblePackageVersion, bool cancelRecommendation)
505 : base(cancelRecommendation)
506 {
507 this.PackageId = packageId;
508 this.CompatiblePackageId = compatiblePackageId;
509 this.CompatiblePackageVersion = Engine.LongToVersion(compatiblePackageVersion);
510 }
511
512 /// <summary>
513 /// Gets the identity of the package that was not detected.
514 /// </summary>
515 public string PackageId { get; private set; }
516
517 /// <summary>
518 /// Gets the identity of the compatible package that was detected.
519 /// </summary>
520 public string CompatiblePackageId { get; private set; }
521
522 /// <summary>
523 /// Gets the version of the compatible package that was detected.
524 /// </summary>
525 public Version CompatiblePackageVersion { get; private set; }
526 }
527
528 /// <summary>
529 /// Additional arguments used when a related MSI package has been detected for a package.
530 /// </summary>
531 [Serializable]
532 public class DetectRelatedMsiPackageEventArgs : CancellableHResultEventArgs
533 {
534 /// <summary>
535 /// Creates a new instance of the <see cref="DetectRelatedMsiPackageEventArgs"/> class.
536 /// </summary>
537 /// <param name="packageId">The identity of the package detecting.</param>
538 /// <param name="upgradeCode">The upgrade code of the related package detected.</param>
539 /// <param name="productCode">The identity of the related package detected.</param>
540 /// <param name="perMachine">Whether the detected package is per machine.</param>
541 /// <param name="version">The version of the related package detected.</param>
542 /// <param name="operation">The operation that will be taken on the detected package.</param>
543 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
544 public DetectRelatedMsiPackageEventArgs(string packageId, string upgradeCode, string productCode, bool perMachine, long version, RelatedOperation operation, bool cancelRecommendation)
545 : base(cancelRecommendation)
546 {
547 this.PackageId = packageId;
548 this.UpgradeCode = upgradeCode;
549 this.ProductCode = productCode;
550 this.PerMachine = perMachine;
551 this.Version = Engine.LongToVersion(version);
552 this.Operation = operation;
553 }
554
555 /// <summary>
556 /// Gets the identity of the product's package detected.
557 /// </summary>
558 public string PackageId { get; private set; }
559
560 /// <summary>
561 /// Gets the upgrade code of the related package detected.
562 /// </summary>
563 public string UpgradeCode { get; private set; }
564
565 /// <summary>
566 /// Gets the identity of the related package detected.
567 /// </summary>
568 public string ProductCode { get; private set; }
569
570 /// <summary>
571 /// Gets whether the detected package is per machine.
572 /// </summary>
573 public bool PerMachine { get; private set; }
574
575 /// <summary>
576 /// Gets the version of the related package detected.
577 /// </summary>
578 public Version Version { get; private set; }
579
580 /// <summary>
581 /// Gets the operation that will be taken on the detected package.
582 /// </summary>
583 public RelatedOperation Operation { get; private set; }
584 }
585
586 /// <summary>
587 /// Additional arguments used when a target MSI package has been detected.
588 /// </summary>
589 public class DetectTargetMsiPackageEventArgs : CancellableHResultEventArgs
590 {
591 /// <summary>
592 /// Creates a new instance of the <see cref="DetectMsiFeatureEventArgs"/> class.
593 /// </summary>
594 /// <param name="packageId">Detected package identifier.</param>
595 /// <param name="productCode">Detected product code.</param>
596 /// <param name="state">Package state detected.</param>
597 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
598 public DetectTargetMsiPackageEventArgs(string packageId, string productCode, PackageState state, bool cancelRecommendation)
599 : base(cancelRecommendation)
600 {
601 this.PackageId = packageId;
602 this.ProductCode = productCode;
603 this.State = state;
604 }
605
606 /// <summary>
607 /// Gets the identity of the target's package detected.
608 /// </summary>
609 public string PackageId { get; private set; }
610
611 /// <summary>
612 /// Gets the product code of the target MSI detected.
613 /// </summary>
614 public string ProductCode { get; private set; }
615
616 /// <summary>
617 /// Gets the detected patch package state.
618 /// </summary>
619 public PackageState State { get; private set; }
620 }
621
622 /// <summary>
623 /// Additional arguments used when a feature in an MSI package has been detected.
624 /// </summary>
625 public class DetectMsiFeatureEventArgs : CancellableHResultEventArgs
626 {
627 /// <summary>
628 /// Creates a new instance of the <see cref="DetectMsiFeatureEventArgs"/> class.
629 /// </summary>
630 /// <param name="packageId">Detected package identifier.</param>
631 /// <param name="featureId">Detected feature identifier.</param>
632 /// <param name="state">Feature state detected.</param>
633 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
634 public DetectMsiFeatureEventArgs(string packageId, string featureId, FeatureState state, bool cancelRecommendation)
635 : base(cancelRecommendation)
636 {
637 this.PackageId = packageId;
638 this.FeatureId = featureId;
639 this.State = state;
640 }
641
642 /// <summary>
643 /// Gets the identity of the feature's package detected.
644 /// </summary>
645 public string PackageId { get; private set; }
646
647 /// <summary>
648 /// Gets the identity of the feature detected.
649 /// </summary>
650 public string FeatureId { get; private set; }
651
652 /// <summary>
653 /// Gets the detected feature state.
654 /// </summary>
655 public FeatureState State { get; private set; }
656 }
657
658 /// <summary>
659 /// Additional arguments used when the detection for a specific package has completed.
660 /// </summary>
661 [Serializable]
662 public class DetectPackageCompleteEventArgs : StatusEventArgs
663 {
664 /// <summary>
665 /// Creates a new instance of the <see cref="DetectPackageCompleteEventArgs"/> class.
666 /// </summary>
667 /// <param name="packageId">The identity of the package detected.</param>
668 /// <param name="hrStatus">The return code of the operation.</param>
669 /// <param name="state">The state of the specified package.</param>
670 public DetectPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state)
671 : base(hrStatus)
672 {
673 this.PackageId = packageId;
674 this.State = state;
675 }
676
677 /// <summary>
678 /// Gets the identity of the package detected.
679 /// </summary>
680 public string PackageId { get; private set; }
681
682 /// <summary>
683 /// Gets the state of the specified package.
684 /// </summary>
685 public PackageState State { get; private set; }
686 }
687
688 /// <summary>
689 /// Additional arguments used when the detection phase has completed.
690 /// </summary>
691 [Serializable]
692 public class DetectCompleteEventArgs : StatusEventArgs
693 {
694 /// <summary>
695 /// Creates a new instance of the <see cref="DetectCompleteEventArgs"/> class.
696 /// </summary>
697 /// <param name="hrStatus">The return code of the operation.</param>
698 public DetectCompleteEventArgs(int hrStatus)
699 : base(hrStatus)
700 {
701 }
702 }
703
704 /// <summary>
705 /// Additional arguments used when the engine has begun planning the installation.
706 /// </summary>
707 [Serializable]
708 public class PlanBeginEventArgs : CancellableHResultEventArgs
709 {
710 /// <summary>
711 /// Creates a new instance of the <see cref="PlanBeginEventArgs"/> class.
712 /// </summary>
713 /// <param name="packageCount">The number of packages to plan for.</param>
714 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
715 public PlanBeginEventArgs(int packageCount, bool cancelRecommendation)
716 : base(cancelRecommendation)
717 {
718 this.PackageCount = packageCount;
719 }
720
721 /// <summary>
722 /// Gets the number of packages to plan for.
723 /// </summary>
724 public int PackageCount { get; private set; }
725 }
726
727 /// <summary>
728 /// Additional arguments used when the engine has begun planning for a related bundle.
729 /// </summary>
730 [Serializable]
731 public class PlanRelatedBundleEventArgs : CancellableHResultEventArgs
732 {
733 /// <summary>
734 /// Creates a new instance of the <see cref="PlanRelatedBundleEventArgs"/> class.
735 /// </summary>
736 /// <param name="bundleId">The identity of the bundle to plan for.</param>
737 /// <param name="recommendedState">The recommended requested state for the bundle.</param>
738 /// <param name="state">The requested state for the bundle.</param>
739 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
740 public PlanRelatedBundleEventArgs(string bundleId, RequestState recommendedState, RequestState state, bool cancelRecommendation)
741 : base(cancelRecommendation)
742 {
743 this.BundleId = bundleId;
744 this.RecommendedState = recommendedState;
745 this.State = state;
746 }
747
748 /// <summary>
749 /// Gets the identity of the bundle to plan for.
750 /// </summary>
751 public string BundleId { get; private set; }
752
753 /// <summary>
754 /// Gets the recommended requested state for the bundle.
755 /// </summary>
756 public RequestState RecommendedState { get; private set; }
757
758 /// <summary>
759 /// Gets or sets the requested state for the bundle.
760 /// </summary>
761 public RequestState State { get; set; }
762 }
763
764 /// <summary>
765 /// Additional arguments used when the engine has begun planning the installation of a specific package.
766 /// </summary>
767 [Serializable]
768 public class PlanPackageBeginEventArgs : CancellableHResultEventArgs
769 {
770 /// <summary>
771 /// Creates a new instance of the <see cref="PlanPackageBeginEventArgs"/> class.
772 /// </summary>
773 /// <param name="packageId">The identity of the package to plan for.</param>
774 /// <param name="recommendedState">The recommended requested state for the package.</param>
775 /// <param name="state">The requested state for the package.</param>
776 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
777 public PlanPackageBeginEventArgs(string packageId, RequestState recommendedState, RequestState state, bool cancelRecommendation)
778 : base(cancelRecommendation)
779 {
780 this.PackageId = packageId;
781 this.RecommendedState = recommendedState;
782 this.State = state;
783 }
784
785 /// <summary>
786 /// Gets the identity of the package to plan for.
787 /// </summary>
788 public string PackageId { get; private set; }
789
790 /// <summary>
791 /// Gets the recommended requested state for the package.
792 /// </summary>
793 public RequestState RecommendedState { get; private set; }
794
795 /// <summary>
796 /// Gets or sets the requested state for the package.
797 /// </summary>
798 public RequestState State { get; set; }
799 }
800
801 /// <summary>
802 /// Additional arguments used when the engine is about to plan a newer package using the same provider key.
803 /// </summary>
804 [Serializable]
805 public class PlanCompatibleMsiPackageBeginEventArgs : CancellableHResultEventArgs
806 {
807 /// <summary>
808 /// Creates a new instance of the <see cref="PlanCompatibleMsiPackageBeginEventArgs"/> class.
809 /// </summary>
810 /// <param name="packageId">The identity of the package that was not detected.</param>
811 /// <param name="compatiblePackageId">The identity of the compatible package that was detected.</param>
812 /// <param name="compatiblePackageVersion">The version of the compatible package that was detected.</param>
813 /// <param name="recommendedState">The recommended request state for the compatible package.</param>
814 /// <param name="state">The requested state for the compatible package.</param>
815 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
816 public PlanCompatibleMsiPackageBeginEventArgs(string packageId, string compatiblePackageId, long compatiblePackageVersion, RequestState recommendedState, RequestState state, bool cancelRecommendation)
817 : base(cancelRecommendation)
818 {
819 this.PackageId = packageId;
820 this.CompatiblePackageId = compatiblePackageId;
821 this.CompatiblePackageVersion = Engine.LongToVersion(compatiblePackageVersion);
822 this.RecommendedState = recommendedState;
823 this.State = state;
824 }
825
826 /// <summary>
827 /// Gets the identity of the package that was not detected.
828 /// </summary>
829 public string PackageId { get; private set; }
830
831 /// <summary>
832 /// Gets the identity of the compatible package detected.
833 /// </summary>
834 public string CompatiblePackageId { get; private set; }
835
836 /// <summary>
837 /// Gets the version of the compatible package detected.
838 /// </summary>
839 public Version CompatiblePackageVersion { get; private set; }
840
841 /// <summary>
842 /// Gets the recommended state to use for the compatible package for planning.
843 /// </summary>
844 public RequestState RecommendedState { get; private set; }
845
846 /// <summary>
847 /// Gets or sets the state to use for the compatible package for planning.
848 /// </summary>
849 public RequestState State { get; set; }
850 }
851
852 /// <summary>
853 /// Additional arguments used when the engine has completed planning the installation of a specific package.
854 /// </summary>
855 [Serializable]
856 public class PlanCompatibleMsiPackageCompleteEventArgs : StatusEventArgs
857 {
858 /// <summary>
859 /// Creates a new instance of the <see cref="PlanCompatibleMsiPackageCompleteEventArgs"/> class.
860 /// </summary>
861 /// <param name="packageId">The identity of the package planned for.</param>
862 /// <param name="compatiblePackageId">The identity of the compatible package that was detected.</param>
863 /// <param name="hrStatus">The return code of the operation.</param>
864 /// <param name="state">The current state of the package.</param>
865 /// <param name="requested">The requested state for the package</param>
866 /// <param name="execute">The execution action to take.</param>
867 /// <param name="rollback">The rollback action to take.</param>
868 public PlanCompatibleMsiPackageCompleteEventArgs(string packageId, string compatiblePackageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
869 : base(hrStatus)
870 {
871 this.PackageId = packageId;
872 this.CompatiblePackageId = compatiblePackageId;
873 this.State = state;
874 this.Requested = requested;
875 this.Execute = execute;
876 this.Rollback = rollback;
877 }
878
879 /// <summary>
880 /// Gets the identity of the package planned for.
881 /// </summary>
882 public string PackageId { get; private set; }
883
884 /// <summary>
885 /// Gets the identity of the compatible package detected.
886 /// </summary>
887 public string CompatiblePackageId { get; private set; }
888
889 /// <summary>
890 /// Gets the current state of the package.
891 /// </summary>
892 public PackageState State { get; private set; }
893
894 /// <summary>
895 /// Gets the requested state for the package.
896 /// </summary>
897 public RequestState Requested { get; private set; }
898
899 /// <summary>
900 /// Gets the execution action to take.
901 /// </summary>
902 public ActionState Execute { get; private set; }
903
904 /// <summary>
905 /// Gets the rollback action to take.
906 /// </summary>
907 public ActionState Rollback { get; private set; }
908 }
909
910 /// <summary>
911 /// Additional arguments used when engine is about to plan a MSP applied to a target MSI package.
912 /// </summary>
913 [Serializable]
914 public class PlanTargetMsiPackageEventArgs : CancellableHResultEventArgs
915 {
916 /// <summary>
917 /// Creates a new instance of the <see cref="PlanMsiFeatureEventArgs"/> class.
918 /// </summary>
919 /// <param name="packageId">Package identifier of the patch being planned.</param>
920 /// <param name="productCode">Product code identifier being planned.</param>
921 /// <param name="recommendedState">Recommended package state of the patch being planned.</param>
922 /// <param name="state">Package state of the patch being planned.</param>
923 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
924 public PlanTargetMsiPackageEventArgs(string packageId, string productCode, RequestState recommendedState, RequestState state, bool cancelRecommendation)
925 : base(cancelRecommendation)
926 {
927 this.PackageId = packageId;
928 this.ProductCode = productCode;
929 this.RecommendedState = recommendedState;
930 this.State = state;
931 }
932
933 /// <summary>
934 /// Gets the identity of the patch package to plan.
935 /// </summary>
936 public string PackageId { get; private set; }
937
938 /// <summary>
939 /// Gets the identity of the patch's target MSI to plan.
940 /// </summary>
941 public string ProductCode { get; private set; }
942
943 /// <summary>
944 /// Gets the recommended state of the patch to use by planning.
945 /// </summary>
946 public RequestState RecommendedState { get; private set; }
947
948 /// <summary>
949 /// Gets or sets the state of the patch to use by planning.
950 /// </summary>
951 public RequestState State { get; set; }
952 }
953
954 /// <summary>
955 /// Additional arguments used when engine is about to plan a feature in an MSI package.
956 /// </summary>
957 [Serializable]
958 public class PlanMsiFeatureEventArgs : CancellableHResultEventArgs
959 {
960 /// <summary>
961 /// Creates a new instance of the <see cref="PlanMsiFeatureEventArgs"/> class.
962 /// </summary>
963 /// <param name="packageId">Package identifier being planned.</param>
964 /// <param name="featureId">Feature identifier being planned.</param>
965 /// <param name="recommendedState">Recommended feature state being planned.</param>
966 /// <param name="state">Feature state being planned.</param>
967 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
968 public PlanMsiFeatureEventArgs(string packageId, string featureId, FeatureState recommendedState, FeatureState state, bool cancelRecommendation)
969 : base(cancelRecommendation)
970 {
971 this.PackageId = packageId;
972 this.FeatureId = featureId;
973 this.RecommendedState = recommendedState;
974 this.State = state;
975 }
976
977 /// <summary>
978 /// Gets the identity of the feature's package to plan.
979 /// </summary>
980 public string PackageId { get; private set; }
981
982 /// <summary>
983 /// Gets the identity of the feature to plan.
984 /// </summary>
985 public string FeatureId { get; private set; }
986
987 /// <summary>
988 /// Gets the recommended feature state to use by planning.
989 /// </summary>
990 public FeatureState RecommendedState { get; private set; }
991
992 /// <summary>
993 /// Gets or sets the feature state to use by planning.
994 /// </summary>
995 public FeatureState State { get; set; }
996 }
997
998 /// <summary>
999 /// Additional arguments used when then engine has completed planning the installation of a specific package.
1000 /// </summary>
1001 [Serializable]
1002 public class PlanPackageCompleteEventArgs : StatusEventArgs
1003 {
1004 /// <summary>
1005 /// Creates a new instance of the <see cref="PlanPackageCompleteEventArgs"/> class.
1006 /// </summary>
1007 /// <param name="packageId">The identity of the package planned for.</param>
1008 /// <param name="hrStatus">The return code of the operation.</param>
1009 /// <param name="state">The current state of the package.</param>
1010 /// <param name="requested">The requested state for the package</param>
1011 /// <param name="execute">The execution action to take.</param>
1012 /// <param name="rollback">The rollback action to take.</param>
1013 public PlanPackageCompleteEventArgs(string packageId, int hrStatus, PackageState state, RequestState requested, ActionState execute, ActionState rollback)
1014 : base(hrStatus)
1015 {
1016 this.PackageId = packageId;
1017 this.State = state;
1018 this.Requested = requested;
1019 this.Execute = execute;
1020 this.Rollback = rollback;
1021 }
1022
1023 /// <summary>
1024 /// Gets the identity of the package planned for.
1025 /// </summary>
1026 public string PackageId { get; private set; }
1027
1028 /// <summary>
1029 /// Gets the current state of the package.
1030 /// </summary>
1031 public PackageState State { get; private set; }
1032
1033 /// <summary>
1034 /// Gets the requested state for the package.
1035 /// </summary>
1036 public RequestState Requested { get; private set; }
1037
1038 /// <summary>
1039 /// Gets the execution action to take.
1040 /// </summary>
1041 public ActionState Execute { get; private set; }
1042
1043 /// <summary>
1044 /// Gets the rollback action to take.
1045 /// </summary>
1046 public ActionState Rollback { get; private set; }
1047 }
1048
1049 /// <summary>
1050 /// Additional arguments used when the engine has completed planning the installation.
1051 /// </summary>
1052 [Serializable]
1053 public class PlanCompleteEventArgs : StatusEventArgs
1054 {
1055 /// <summary>
1056 /// Creates a new instance of the <see cref="PlanCompleteEventArgs"/> class.
1057 /// </summary>
1058 /// <param name="hrStatus">The return code of the operation.</param>
1059 public PlanCompleteEventArgs(int hrStatus)
1060 : base(hrStatus)
1061 {
1062 }
1063 }
1064
1065 /// <summary>
1066 /// Additional arguments used when the engine has begun installing the bundle.
1067 /// </summary>
1068 [Serializable]
1069 public class ApplyBeginEventArgs : CancellableHResultEventArgs
1070 {
1071 /// <summary>
1072 /// Creates a new instance of the <see cref="ApplyBeginEventArgs"/> class.
1073 /// </summary>
1074 /// <param name="phaseCount">The number of phases during apply.</param>
1075 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1076 public ApplyBeginEventArgs(int phaseCount, bool cancelRecommendation)
1077 : base(cancelRecommendation)
1078 {
1079 this.PhaseCount = phaseCount;
1080 }
1081
1082 /// <summary>
1083 /// Gets the number of phases that the engine will go through in apply.
1084 /// There are currently two possible phases: cache and execute.
1085 /// </summary>
1086 public int PhaseCount { get; private set; }
1087 }
1088
1089 /// <summary>
1090 /// Additional arguments used when the engine is about to start the elevated process.
1091 /// </summary>
1092 [Serializable]
1093 public class ElevateBeginEventArgs : CancellableHResultEventArgs
1094 {
1095 /// <summary>
1096 /// Creates a new instance of the <see cref="ElevateBeginEventArgs"/> class.
1097 /// </summary>
1098 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1099 public ElevateBeginEventArgs(bool cancelRecommendation)
1100 : base(cancelRecommendation)
1101 {
1102 }
1103 }
1104
1105 /// <summary>
1106 /// Additional arguments used when the engine has completed starting the elevated process.
1107 /// </summary>
1108 [Serializable]
1109 public class ElevateCompleteEventArgs : StatusEventArgs
1110 {
1111 /// <summary>
1112 /// Creates a new instance of the <see cref="ElevateCompleteEventArgs"/> class.
1113 /// </summary>
1114 /// <param name="hrStatus">The return code of the operation.</param>
1115 public ElevateCompleteEventArgs(int hrStatus)
1116 : base(hrStatus)
1117 {
1118 }
1119 }
1120
1121 /// <summary>
1122 /// Additional arguments used when the engine has changed progress for the bundle installation.
1123 /// </summary>
1124 [Serializable]
1125 public class ProgressEventArgs : CancellableHResultEventArgs
1126 {
1127 /// <summary>
1128 /// Creates an new instance of the <see cref="ProgressEventArgs"/> class.
1129 /// </summary>
1130 /// <param name="progressPercentage">The percentage from 0 to 100 completed for a package.</param>
1131 /// <param name="overallPercentage">The percentage from 0 to 100 completed for the bundle.</param>
1132 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1133 public ProgressEventArgs(int progressPercentage, int overallPercentage, bool cancelRecommendation)
1134 : base(cancelRecommendation)
1135 {
1136 this.ProgressPercentage = progressPercentage;
1137 this.OverallPercentage = overallPercentage;
1138 }
1139
1140 /// <summary>
1141 /// Gets the percentage from 0 to 100 completed for a package.
1142 /// </summary>
1143 public int ProgressPercentage { get; private set; }
1144
1145 /// <summary>
1146 /// Gets the percentage from 0 to 100 completed for the bundle.
1147 /// </summary>
1148 public int OverallPercentage { get; private set; }
1149 }
1150
1151 /// <summary>
1152 /// Additional arguments used when the engine has encountered an error.
1153 /// </summary>
1154 [Serializable]
1155 public class ErrorEventArgs : ResultEventArgs
1156 {
1157 /// <summary>
1158 /// Creates a new instance of the <see cref="ErrorEventArgs"/> class.
1159 /// </summary>
1160 /// <param name="errorType">The error type.</param>
1161 /// <param name="packageId">The identity of the package that yielded the error.</param>
1162 /// <param name="errorCode">The error code.</param>
1163 /// <param name="errorMessage">The error message.</param>
1164 /// <param name="dwUIHint">Recommended display flags for an error dialog.</param>
1165 /// <param name="data">The exteded data for the error.</param>
1166 /// <param name="recommendation">Recommended result from engine.</param>
1167 /// <param name="result">The result to return to the engine.</param>
1168 public ErrorEventArgs(ErrorType errorType, string packageId, int errorCode, string errorMessage, int dwUIHint, string[] data, Result recommendation, Result result)
1169 : base(recommendation, result)
1170 {
1171 this.ErrorType = errorType;
1172 this.PackageId = packageId;
1173 this.ErrorCode = errorCode;
1174 this.ErrorMessage = errorMessage;
1175 this.UIHint = dwUIHint;
1176 this.Data = new ReadOnlyCollection<string>(data ?? new string[] { });
1177 }
1178
1179 /// <summary>
1180 /// Gets the type of error that occurred.
1181 /// </summary>
1182 public ErrorType ErrorType { get; private set; }
1183
1184 /// <summary>
1185 /// Gets the identity of the package that yielded the error.
1186 /// </summary>
1187 public string PackageId { get; private set; }
1188
1189 /// <summary>
1190 /// Gets the error code.
1191 /// </summary>
1192 public int ErrorCode { get; private set; }
1193
1194 /// <summary>
1195 /// Gets the error message.
1196 /// </summary>
1197 public string ErrorMessage { get; private set; }
1198
1199 /// <summary>
1200 /// Gets the recommended display flags for an error dialog.
1201 /// </summary>
1202 public int UIHint { get; private set; }
1203
1204 /// <summary>
1205 /// Gets the extended data for the error.
1206 /// </summary>
1207 public IList<string> Data { get; private set; }
1208 }
1209
1210 /// <summary>
1211 /// Additional arguments used when the engine has begun registering the location and visibility of the bundle.
1212 /// </summary>
1213 [Serializable]
1214 public class RegisterBeginEventArgs : CancellableHResultEventArgs
1215 {
1216 /// <summary>
1217 /// Creates a new instance of the <see cref="RegisterBeginEventArgs"/> class.
1218 /// </summary>
1219 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1220 public RegisterBeginEventArgs(bool cancelRecommendation)
1221 : base(cancelRecommendation)
1222 {
1223 }
1224 }
1225
1226 /// <summary>
1227 /// Additional arguments used when the engine has completed registering the location and visilibity of the bundle.
1228 /// </summary>
1229 [Serializable]
1230 public class RegisterCompleteEventArgs : StatusEventArgs
1231 {
1232 /// <summary>
1233 /// Creates a new instance of the <see cref="RegisterCompleteEventArgs"/> class.
1234 /// </summary>
1235 /// <param name="hrStatus">The return code of the operation.</param>
1236 public RegisterCompleteEventArgs(int hrStatus)
1237 : base(hrStatus)
1238 {
1239 }
1240 }
1241
1242 /// <summary>
1243 /// Additional arguments used when the engine has begun removing the registration for the location and visibility of the bundle.
1244 /// </summary>
1245 [Serializable]
1246 public class UnregisterBeginEventArgs : CancellableHResultEventArgs
1247 {
1248 /// <summary>
1249 /// Creates a new instance of the <see cref="UnregisterBeginEventArgs"/> class.
1250 /// </summary>
1251 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1252 public UnregisterBeginEventArgs(bool cancelRecommendation)
1253 : base(cancelRecommendation)
1254 {
1255 }
1256 }
1257
1258 /// <summary>
1259 /// Additional arguments used when the engine has completed removing the registration for the location and visibility of the bundle.
1260 /// </summary>
1261 [Serializable]
1262 public class UnregisterCompleteEventArgs : StatusEventArgs
1263 {
1264 /// <summary>
1265 /// Creates a new instance of the <see cref="UnregisterCompleteEventArgs"/> class.
1266 /// </summary>
1267 /// <param name="hrStatus">The return code of the operation.</param>
1268 public UnregisterCompleteEventArgs(int hrStatus)
1269 : base(hrStatus)
1270 {
1271 }
1272 }
1273
1274 /// <summary>
1275 /// Additional arguments used when the engine has begun caching the installation sources.
1276 /// </summary>
1277 [Serializable]
1278 public class CacheBeginEventArgs : CancellableHResultEventArgs
1279 {
1280 /// <summary>
1281 /// Creates a new instance of the <see cref="CacheBeginEventArgs"/> class.
1282 /// </summary>
1283 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1284 public CacheBeginEventArgs(bool cancelRecommendation)
1285 : base(cancelRecommendation)
1286 {
1287 }
1288 }
1289
1290 /// <summary>
1291 /// Additional arguments used when the engine begins to acquire containers or payloads.
1292 /// </summary>
1293 [Serializable]
1294 public class CacheAcquireBeginEventArgs : CancellableHResultEventArgs
1295 {
1296 /// <summary>
1297 /// Creates a new instance of the <see cref="CacheAcquireBeginEventArgs"/> class.
1298 /// </summary>
1299 public CacheAcquireBeginEventArgs(string packageOrContainerId, string payloadId, CacheOperation operation, string source, bool cancelRecommendation)
1300 : base(cancelRecommendation)
1301 {
1302 this.PackageOrContainerId = packageOrContainerId;
1303 this.PayloadId = payloadId;
1304 this.Operation = operation;
1305 this.Source = source;
1306 }
1307
1308 /// <summary>
1309 /// Gets the identifier of the container or package.
1310 /// </summary>
1311 public string PackageOrContainerId { get; private set; }
1312
1313 /// <summary>
1314 /// Gets the identifier of the payload (if acquiring a payload).
1315 /// </summary>
1316 public string PayloadId { get; private set; }
1317
1318 /// <summary>
1319 /// Gets the cache acquire operation.
1320 /// </summary>
1321 public CacheOperation Operation { get; private set; }
1322
1323 /// <summary>
1324 /// Gets the source of the container or payload.
1325 /// </summary>
1326 public string Source { get; private set; }
1327 }
1328
1329 /// <summary>
1330 /// Additional arguments used when the engine acquires some part of a container or payload.
1331 /// </summary>
1332 [Serializable]
1333 public class CacheAcquireProgressEventArgs : CancellableHResultEventArgs
1334 {
1335 /// <summary>
1336 /// Creates a new instance of the <see cref="CacheAcquireBeginEventArgs"/> class.
1337 /// </summary>
1338 public CacheAcquireProgressEventArgs(string packageOrContainerId, string payloadId, long progress, long total, int overallPercentage, bool cancelRecommendation)
1339 : base(cancelRecommendation)
1340 {
1341 this.PackageOrContainerId = packageOrContainerId;
1342 this.PayloadId = payloadId;
1343 this.Progress = progress;
1344 this.Total = total;
1345 this.OverallPercentage = overallPercentage;
1346 }
1347
1348 /// <summary>
1349 /// Gets the identifier of the container or package.
1350 /// </summary>
1351 public string PackageOrContainerId { get; private set; }
1352
1353 /// <summary>
1354 /// Gets the identifier of the payload (if acquiring a payload).
1355 /// </summary>
1356 public string PayloadId { get; private set; }
1357
1358 /// <summary>
1359 /// Gets the number of bytes cached thus far.
1360 /// </summary>
1361 public long Progress { get; private set; }
1362
1363 /// <summary>
1364 /// Gets the total bytes to cache.
1365 /// </summary>
1366 public long Total { get; private set; }
1367
1368 /// <summary>
1369 /// Gets the overall percentage of progress of caching.
1370 /// </summary>
1371 public int OverallPercentage { get; private set; }
1372 }
1373
1374 /// <summary>
1375 /// Additional arguments used when the engine completes the acquisition of a container or payload.
1376 /// </summary>
1377 [Serializable]
1378 public class CacheAcquireCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION>
1379 {
1380 /// <summary>
1381 /// Creates a new instance of the <see cref="CacheAcquireCompleteEventArgs"/> class.
1382 /// </summary>
1383 public CacheAcquireCompleteEventArgs(string packageOrContainerId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION action)
1384 : base(hrStatus, recommendation, action)
1385 {
1386 this.PackageOrContainerId = packageOrContainerId;
1387 this.PayloadId = payloadId;
1388 }
1389
1390 /// <summary>
1391 /// Gets the identifier of the container or package.
1392 /// </summary>
1393 public string PackageOrContainerId { get; private set; }
1394
1395 /// <summary>
1396 /// Gets the identifier of the payload (if acquiring a payload).
1397 /// </summary>
1398 public string PayloadId { get; private set; }
1399 }
1400
1401 /// <summary>
1402 /// Additional arguments used when the engine starts the verification of a payload.
1403 /// </summary>
1404 [Serializable]
1405 public class CacheVerifyBeginEventArgs : CancellableHResultEventArgs
1406 {
1407 /// <summary>
1408 /// Creates a new instance of the <see cref="CacheVerifyBeginEventArgs"/> class.
1409 /// </summary>
1410 public CacheVerifyBeginEventArgs(string packageId, string payloadId, bool cancelRecommendation)
1411 : base(cancelRecommendation)
1412 {
1413 this.PackageId = packageId;
1414 this.PayloadId = payloadId;
1415 }
1416
1417 /// <summary>
1418 /// Gets the identifier of the package.
1419 /// </summary>
1420 public string PackageId { get; private set; }
1421
1422 /// <summary>
1423 /// Gets the identifier of the payload.
1424 /// </summary>
1425 public string PayloadId { get; private set; }
1426 }
1427
1428 /// <summary>
1429 /// Additional arguments used when the engine completes the verification of a payload.
1430 /// </summary>
1431 [Serializable]
1432 public class CacheVerifyCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION>
1433 {
1434 /// <summary>
1435 /// Creates a new instance of the <see cref="CacheVerifyCompleteEventArgs"/> class.
1436 /// </summary>
1437 public CacheVerifyCompleteEventArgs(string packageId, string payloadId, int hrStatus, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEVERIFYCOMPLETE_ACTION action)
1438 : base(hrStatus, recommendation, action)
1439 {
1440 this.PackageId = packageId;
1441 this.PayloadId = payloadId;
1442 }
1443
1444 /// <summary>
1445 /// Gets the identifier of the package.
1446 /// </summary>
1447 public string PackageId { get; private set; }
1448
1449 /// <summary>
1450 /// Gets the identifier of the payload.
1451 /// </summary>
1452 public string PayloadId { get; private set; }
1453 }
1454
1455 /// <summary>
1456 /// Additional arguments used after the engine has cached the installation sources.
1457 /// </summary>
1458 [Serializable]
1459 public class CacheCompleteEventArgs : StatusEventArgs
1460 {
1461 /// <summary>
1462 /// Creates a new instance of the <see cref="CacheCompleteEventArgs"/> class.
1463 /// </summary>
1464 /// <param name="hrStatus">The return code of the operation.</param>
1465 public CacheCompleteEventArgs(int hrStatus)
1466 : base(hrStatus)
1467 {
1468 }
1469 }
1470
1471 /// <summary>
1472 /// Additional arguments used when the engine has begun installing packages.
1473 /// </summary>
1474 [Serializable]
1475 public class ExecuteBeginEventArgs : CancellableHResultEventArgs
1476 {
1477 /// <summary>
1478 /// Creates a new instance of the <see cref="ExecuteBeginEventArgs"/> class.
1479 /// </summary>
1480 /// <param name="packageCount">The number of packages to act on.</param>
1481 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1482 public ExecuteBeginEventArgs(int packageCount, bool cancelRecommendation)
1483 : base(cancelRecommendation)
1484 {
1485 this.PackageCount = packageCount;
1486 }
1487
1488 /// <summary>
1489 /// Gets the number of packages to act on.
1490 /// </summary>
1491 public int PackageCount { get; private set; }
1492 }
1493
1494 /// <summary>
1495 /// Additional arguments used when the engine has begun installing a specific package.
1496 /// </summary>
1497 [Serializable]
1498 public class ExecutePackageBeginEventArgs : CancellableHResultEventArgs
1499 {
1500 /// <summary>
1501 /// Creates a new instance of the <see cref="ExecutePackageBeginEventArgs"/> class.
1502 /// </summary>
1503 /// <param name="packageId">The identity of the package to act on.</param>
1504 /// <param name="shouldExecute">Whether the package should really be acted on.</param>
1505 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1506 public ExecutePackageBeginEventArgs(string packageId, bool shouldExecute, bool cancelRecommendation)
1507 : base(cancelRecommendation)
1508 {
1509 this.PackageId = packageId;
1510 this.ShouldExecute = shouldExecute;
1511 }
1512
1513 /// <summary>
1514 /// Gets the identity of the package to act on.
1515 /// </summary>
1516 public string PackageId { get; private set; }
1517
1518 /// <summary>
1519 /// Gets whether the package should really be acted on.
1520 /// </summary>
1521 public bool ShouldExecute { get; private set; }
1522 }
1523
1524 /// <summary>
1525 /// Additional arguments used when the engine executes one or more patches targeting a product.
1526 /// </summary>
1527 [Serializable]
1528 public class ExecutePatchTargetEventArgs : CancellableHResultEventArgs
1529 {
1530 /// <summary>
1531 /// Creates a new instance of the <see cref="ExecutePatchTargetEventArgs"/> class.
1532 /// </summary>
1533 /// <param name="packageId">The identity of the package to act on.</param>
1534 /// <param name="targetProductCode">The product code of the target of the patch.</param>
1535 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1536 public ExecutePatchTargetEventArgs(string packageId, string targetProductCode, bool cancelRecommendation)
1537 : base(cancelRecommendation)
1538 {
1539 this.PackageId = packageId;
1540 this.TargetProductCode = targetProductCode;
1541 }
1542
1543 /// <summary>
1544 /// Gets the identity of the package to act on.
1545 /// </summary>
1546 public string PackageId { get; private set; }
1547
1548 /// <summary>
1549 /// Gets the product code being targeted.
1550 /// </summary>
1551 public string TargetProductCode { get; private set; }
1552 }
1553
1554 /// <summary>
1555 /// Additional arguments used when Windows Installer sends an installation message.
1556 /// </summary>
1557 [Serializable]
1558 public class ExecuteMsiMessageEventArgs : ResultEventArgs
1559 {
1560 /// <summary>
1561 /// Creates a new instance of the <see cref="ExecuteMsiMessageEventArgs"/> class.
1562 /// </summary>
1563 /// <param name="packageId">The identity of the package that yielded this message.</param>
1564 /// <param name="messageType">The type of this message.</param>
1565 /// <param name="dwUIHint">Recommended display flags for this message.</param>
1566 /// <param name="message">The message.</param>
1567 /// <param name="data">The extended data for the message.</param>
1568 /// <param name="recommendation">Recommended result from engine.</param>
1569 /// <param name="result">The result to return to the engine.</param>
1570 public ExecuteMsiMessageEventArgs(string packageId, InstallMessage messageType, int dwUIHint, string message, string[] data, Result recommendation, Result result)
1571 : base(recommendation, result)
1572 {
1573 this.PackageId = packageId;
1574 this.MessageType = messageType;
1575 this.UIHint = dwUIHint;
1576 this.Message = message;
1577 this.Data = new ReadOnlyCollection<string>(data ?? new string[] { });
1578 }
1579
1580 /// <summary>
1581 /// Gets the identity of the package that yielded this message.
1582 /// </summary>
1583 public string PackageId { get; private set; }
1584
1585 /// <summary>
1586 /// Gets the type of this message.
1587 /// </summary>
1588 public InstallMessage MessageType { get; private set; }
1589
1590 /// <summary>
1591 /// Gets the recommended display flags for this message.
1592 /// </summary>
1593 public int UIHint { get; private set; }
1594
1595 /// <summary>
1596 /// Gets the message.
1597 /// </summary>
1598 public string Message { get; private set; }
1599
1600 /// <summary>
1601 /// Gets the extended data for the message.
1602 /// </summary>
1603 public IList<string> Data { get; private set; }
1604 }
1605
1606 /// <summary>
1607 /// Additional arugments used for file in use installation messages.
1608 /// </summary>
1609 [Serializable]
1610 public class ExecuteFilesInUseEventArgs : ResultEventArgs
1611 {
1612 /// <summary>
1613 /// Creates a new instance of the <see cref="ExecuteFilesInUseEventArgs"/> class.
1614 /// </summary>
1615 /// <param name="packageId">The identity of the package that yielded the files in use message.</param>
1616 /// <param name="files">The list of files in use.</param>
1617 /// <param name="recommendation">Recommended result from engine.</param>
1618 /// <param name="result">The result to return to the engine.</param>
1619 public ExecuteFilesInUseEventArgs(string packageId, string[] files, Result recommendation, Result result)
1620 : base(recommendation, result)
1621 {
1622 this.PackageId = packageId;
1623 this.Files = new ReadOnlyCollection<string>(files ?? new string[] { });
1624 }
1625
1626 /// <summary>
1627 /// Gets the identity of the package that yielded the files in use message.
1628 /// </summary>
1629 public string PackageId { get; private set; }
1630
1631 /// <summary>
1632 /// Gets the list of files in use.
1633 /// </summary>
1634 public IList<string> Files { get; private set; }
1635 }
1636
1637 /// <summary>
1638 /// Additional arguments used when the engine has completed installing a specific package.
1639 /// </summary>
1640 [Serializable]
1641 public class ExecutePackageCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION>
1642 {
1643 /// <summary>
1644 /// Creates a new instance of the <see cref="ExecutePackageCompleteEventArgs"/> class.
1645 /// </summary>
1646 /// <param name="packageId">The identity of the package that was acted on.</param>
1647 /// <param name="hrStatus">The return code of the operation.</param>
1648 /// <param name="restart">Whether a restart is required.</param>
1649 /// <param name="recommendation">Recommended action from engine.</param>
1650 /// <param name="action">The action to perform.</param>
1651 public ExecutePackageCompleteEventArgs(string packageId, int hrStatus, ApplyRestart restart, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_EXECUTEPACKAGECOMPLETE_ACTION action)
1652 : base(hrStatus, recommendation, action)
1653 {
1654 this.PackageId = packageId;
1655 this.Restart = restart;
1656 }
1657
1658 /// <summary>
1659 /// Gets the identity of the package that was acted on.
1660 /// </summary>
1661 public string PackageId { get; private set; }
1662
1663 /// <summary>
1664 /// Gets the package restart state after being applied.
1665 /// </summary>
1666 public ApplyRestart Restart { get; private set; }
1667 }
1668
1669 /// <summary>
1670 /// Additional arguments used when the engine has completed installing packages.
1671 /// </summary>
1672 [Serializable]
1673 public class ExecuteCompleteEventArgs : StatusEventArgs
1674 {
1675 /// <summary>
1676 /// Creates a new instance of the <see cref="ExecuteCompleteEventArgs"/> class.
1677 /// </summary>
1678 /// <param name="hrStatus">The return code of the operation.</param>
1679 public ExecuteCompleteEventArgs(int hrStatus)
1680 : base(hrStatus)
1681 {
1682 }
1683 }
1684
1685 /// <summary>
1686 /// Additional arguments used when the engine has completed installing the bundle.
1687 /// </summary>
1688 [Serializable]
1689 public class ApplyCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_APPLYCOMPLETE_ACTION>
1690 {
1691 /// <summary>
1692 /// Creates a new instance of the <see cref="ApplyCompleteEventArgs"/> clas.
1693 /// </summary>
1694 /// <param name="hrStatus">The return code of the operation.</param>
1695 /// <param name="restart">Whether a restart is required.</param>
1696 /// <param name="recommendation">Recommended action from engine.</param>
1697 /// <param name="action">The action to perform.</param>
1698 public ApplyCompleteEventArgs(int hrStatus, ApplyRestart restart, BOOTSTRAPPER_APPLYCOMPLETE_ACTION recommendation, BOOTSTRAPPER_APPLYCOMPLETE_ACTION action)
1699 : base(hrStatus, recommendation, action)
1700 {
1701 this.Restart = restart;
1702 }
1703
1704 /// <summary>
1705 /// Gets the apply restart state when complete.
1706 /// </summary>
1707 public ApplyRestart Restart { get; private set; }
1708 }
1709
1710 /// <summary>
1711 /// Additional arguments used by the engine to allow the BA to change the source
1712 /// using <see cref="Engine.SetLocalSource"/> or <see cref="Engine.SetDownloadSource"/>.
1713 /// </summary>
1714 [Serializable]
1715 public class ResolveSourceEventArgs : CancellableHResultEventArgs
1716 {
1717 /// <summary>
1718 /// Creates a new instance of the <see cref="ResolveSourceEventArgs"/> class.
1719 /// </summary>
1720 /// <param name="packageOrContainerId">The identity of the package or container that requires source.</param>
1721 /// <param name="payloadId">The identity of the payload that requires source.</param>
1722 /// <param name="localSource">The current path used for source resolution.</param>
1723 /// <param name="downloadSource">Optional URL to download container or payload.</param>
1724 /// <param name="recommendation">The recommended action from the engine.</param>
1725 /// <param name="action">The action to perform.</param>
1726 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1727 public ResolveSourceEventArgs(string packageOrContainerId, string payloadId, string localSource, string downloadSource, BOOTSTRAPPER_RESOLVESOURCE_ACTION recommendation, BOOTSTRAPPER_RESOLVESOURCE_ACTION action, bool cancelRecommendation)
1728 : base(cancelRecommendation)
1729 {
1730 this.PackageOrContainerId = packageOrContainerId;
1731 this.PayloadId = payloadId;
1732 this.LocalSource = localSource;
1733 this.DownloadSource = downloadSource;
1734 this.Recommendation = recommendation;
1735 this.Action = action;
1736 }
1737
1738 /// <summary>
1739 /// Gets the identity of the package or container that requires source.
1740 /// </summary>
1741 public string PackageOrContainerId { get; private set; }
1742
1743 /// <summary>
1744 /// Gets the identity of the payload that requires source.
1745 /// </summary>
1746 public string PayloadId { get; private set; }
1747
1748 /// <summary>
1749 /// Gets the current path used for source resolution.
1750 /// </summary>
1751 public string LocalSource { get; private set; }
1752
1753 /// <summary>
1754 /// Gets the optional URL to download container or payload.
1755 /// </summary>
1756 public string DownloadSource { get; private set; }
1757
1758 /// <summary>
1759 /// Gets the recommended action from the engine.
1760 /// </summary>
1761 public BOOTSTRAPPER_RESOLVESOURCE_ACTION Recommendation { get; private set; }
1762
1763 /// <summary>
1764 /// Gets or sets the action to perform.
1765 /// </summary>
1766 public BOOTSTRAPPER_RESOLVESOURCE_ACTION Action { get; set; }
1767 }
1768
1769 /// <summary>
1770 /// Additional arguments used by the engine when it has begun caching a specific package.
1771 /// </summary>
1772 [Serializable]
1773 public class CachePackageBeginEventArgs : CancellableHResultEventArgs
1774 {
1775 /// <summary>
1776 /// Creates a new instance of the <see cref="CachePackageBeginEventArgs"/> class.
1777 /// </summary>
1778 /// <param name="packageId">The identity of the package that is being cached.</param>
1779 /// <param name="cachePayloads">Number of payloads to be cached.</param>
1780 /// <param name="packageCacheSize">The size on disk required by the specific package.</param>
1781 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1782 public CachePackageBeginEventArgs(string packageId, int cachePayloads, long packageCacheSize, bool cancelRecommendation)
1783 : base(cancelRecommendation)
1784 {
1785 this.PackageId = packageId;
1786 this.CachePayloads = cachePayloads;
1787 this.PackageCacheSize = packageCacheSize;
1788 }
1789
1790 /// <summary>
1791 /// Gets the identity of the package that is being cached.
1792 /// </summary>
1793 public string PackageId { get; private set; }
1794
1795 /// <summary>
1796 /// Gets number of payloads to be cached.
1797 /// </summary>
1798 public long CachePayloads { get; private set; }
1799
1800 /// <summary>
1801 /// Gets the size on disk required by the specific package.
1802 /// </summary>
1803 public long PackageCacheSize { get; private set; }
1804 }
1805
1806 /// <summary>
1807 /// Additional arguments passed by the engine when it has completed caching a specific package.
1808 /// </summary>
1809 [Serializable]
1810 public class CachePackageCompleteEventArgs : ActionEventArgs<BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION>
1811 {
1812 /// <summary>
1813 /// Creates a new instance of the <see cref="CachePackageCompleteEventArgs"/> class.
1814 /// </summary>
1815 /// <param name="packageId">The identity of the package that was cached.</param>
1816 /// <param name="hrStatus">The return code of the operation.</param>
1817 /// <param name="recommendation">Recommended action from engine.</param>
1818 /// <param name="action">The action to perform.</param>
1819 public CachePackageCompleteEventArgs(string packageId, int hrStatus, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION recommendation, BOOTSTRAPPER_CACHEPACKAGECOMPLETE_ACTION action)
1820 : base(hrStatus, recommendation, action)
1821 {
1822 this.PackageId = packageId;
1823 }
1824
1825 /// <summary>
1826 /// Gets the identity of the package that was cached.
1827 /// </summary>
1828 public string PackageId { get; private set; }
1829 }
1830
1831 /// <summary>
1832 /// Additional arguments passed by the engine while executing on payload.
1833 /// </summary>
1834 [Serializable]
1835 public class ExecuteProgressEventArgs : CancellableHResultEventArgs
1836 {
1837 /// <summary>
1838 /// Creates a new instance of the <see cref="ExecuteProgressEventArgs"/> class.
1839 /// </summary>
1840 /// <param name="packageId">The identifier of the package being executed.</param>
1841 /// <param name="progressPercentage">The percentage from 0 to 100 of the execution progress for a single payload.</param>
1842 /// <param name="overallPercentage">The percentage from 0 to 100 of the execution progress for all payload.</param>
1843 /// <param name="cancelRecommendation">The recommendation from the engine.</param>
1844 public ExecuteProgressEventArgs(string packageId, int progressPercentage, int overallPercentage, bool cancelRecommendation)
1845 : base(cancelRecommendation)
1846 {
1847 this.PackageId = packageId;
1848 this.ProgressPercentage = progressPercentage;
1849 this.OverallPercentage = overallPercentage;
1850 }
1851
1852 /// <summary>
1853 /// Gets the identity of the package that was executed.
1854 /// </summary>
1855 public string PackageId { get; private set; }
1856
1857 /// <summary>
1858 /// Gets the percentage from 0 to 100 of the execution progress for a single payload.
1859 /// </summary>
1860 public int ProgressPercentage { get; private set; }
1861
1862 /// <summary>
1863 /// Gets the percentage from 0 to 100 of the execution progress for all payloads.
1864 /// </summary>
1865 public int OverallPercentage { get; private set; }
1866 }
1867
1868 /// <summary>
1869 /// Additional arguments passed by the engine before it tries to launch the preapproved executable.
1870 /// </summary>
1871 [Serializable]
1872 public class LaunchApprovedExeBeginArgs : CancellableHResultEventArgs
1873 {
1874 public LaunchApprovedExeBeginArgs(bool cancelRecommendation)
1875 : base(cancelRecommendation)
1876 {
1877 }
1878 }
1879
1880 /// <summary>
1881 /// Additional arguments passed by the engine after it finished trying to launch the preapproved executable.
1882 /// </summary>
1883 [Serializable]
1884 public class LaunchApprovedExeCompleteArgs : StatusEventArgs
1885 {
1886 private int processId;
1887
1888 public LaunchApprovedExeCompleteArgs(int hrStatus, int processId)
1889 : base(hrStatus)
1890 {
1891 this.processId = processId;
1892 }
1893
1894 /// <summary>
1895 /// Gets the ProcessId of the process that was launched.
1896 /// This is only valid if the status reports success.
1897 /// </summary>
1898 public int ProcessId
1899 {
1900 get { return this.processId; }
1901 }
1902 }
1903}