blob: 54afc2cf22fe8932433ae1a1ffa0c2e17dde514f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// 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.
namespace WixToolsetTest.TestCA
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using WixToolset.Dtf.WindowsInstaller;
public class CustomActions
{
[CustomAction]
public static ActionResult ImmediateCA(Session session)
{
session.Log("Begin ImmediateCA");
var path = Path.Combine(Path.GetTempPath(), "ImmediateCA.txt");
WriteNow(path);
return ActionResult.Success;
}
[CustomAction]
public static ActionResult ExecuteImmediateCA(Session session)
{
session.Log("Begin ExecuteImmediateCA");
var path = Path.Combine(Path.GetTempPath(), "ExecuteImmediateCA.txt");
WriteNow(path);
return ActionResult.Success;
}
[CustomAction]
public static ActionResult ImpersonatedDeferredCA(Session session)
{
session.Log("Begin ImpersonatedDeferredCA");
var path = Path.Combine(Path.GetTempPath(), "ImpersonatedDeferredCA.txt");
WriteNow(path);
return ActionResult.Success;
}
[CustomAction]
public static ActionResult DeferredCA(Session session)
{
session.Log("Begin DeferredCA");
WriteNow(@"C:\Windows\Installer\DeferredCA.txt");
return ActionResult.Success;
}
private static void WriteNow(string path)
{
using (var file = File.Create(path))
{
var now = Encoding.UTF8.GetBytes(DateTime.Now.ToString("o"));
file.Write(now, 0, now.Length);
}
}
}
}
|