-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathPSServiceControl.cs
More file actions
92 lines (69 loc) · 3.18 KB
/
Copy pathPSServiceControl.cs
File metadata and controls
92 lines (69 loc) · 3.18 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
namespace ServiceControl.Management.PowerShell
{
using System;
using System.Linq;
using NuGet.Versioning;
using ServiceControlInstaller.Engine.Configuration.ServiceControl;
using ServiceControlInstaller.Engine.Instances;
public class PsServiceControl
{
public string ServiceName { get; set; }
public string InstanceName { get; set; }
public string Url { get; set; }
public string HostName { get; set; }
public int Port { get; set; }
public int? DatabaseMaintenancePort { get; set; }
public string InstallPath { get; set; }
public string DBPath { get; set; }
public string LogPath { get; set; }
public string TransportPackageName { get; set; }
public string ConnectionString { get; set; }
public string ErrorQueue { get; set; }
public string ErrorLogQueue { get; set; }
public bool ForwardErrorMessages { get; set; }
public TimeSpan ErrorRetentionPeriod { get; set; }
public string AuditQueue { get; set; }
public string AuditLogQueue { get; set; }
public bool ForwardAuditMessages { get; set; }
public string ServiceAccount { get; set; }
public SemanticVersion Version { get; set; }
public object[] RemoteInstances { get; set; }
public bool EnableFullTextSearchOnBodies { get; set; }
public static PsServiceControl FromInstance(ServiceControlInstance instance)
{
var result = new PsServiceControl
{
ServiceName = instance.Name,
InstanceName = instance.InstanceName,
Url = instance.Url,
HostName = instance.HostName,
Port = instance.Port,
DatabaseMaintenancePort = instance.DatabaseMaintenancePort,
InstallPath = instance.InstallPath,
LogPath = instance.LogPath,
DBPath = instance.DBPath,
TransportPackageName = instance.TransportPackage.DisplayName,
ConnectionString = instance.ConnectionString,
ErrorQueue = instance.ErrorQueue,
ErrorLogQueue = instance.ForwardErrorMessages ? instance.ErrorLogQueue : null,
ForwardErrorMessages = instance.ForwardErrorMessages,
ServiceAccount = instance.ServiceAccount,
Version = instance.Version,
AuditQueue = instance.AuditQueue,
AuditLogQueue = instance.ForwardAuditMessages ? instance.AuditLogQueue : null,
ForwardAuditMessages = instance.ForwardAuditMessages,
ErrorRetentionPeriod = instance.ErrorRetentionPeriod,
EnableFullTextSearchOnBodies = instance.EnableFullTextSearchOnBodies,
RemoteInstances = instance.RemoteInstances.Select<RemoteInstanceSetting, object>(i =>
{
if (string.IsNullOrEmpty(i.QueueAddress))
{
return new { i.ApiUri };
}
return new { i.ApiUri, i.QueueAddress };
}).ToArray()
};
return result;
}
}
}