-
Notifications
You must be signed in to change notification settings - Fork 28
/
Service.ashx
43 lines (40 loc) · 2.17 KB
/
Service.ashx
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
<%@ WebHandler Language="C#" Class="Service" %>
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using ScreenConnect;
[DemandPermission(PermissionInfo.AdministerPermission)]
public class Service : WebServiceBase
{
public async Task NotifyCreatedVersionSessionGroup()
{
await ExtensionRuntime.SetExtensionSettingAsync(ExtensionContext.Current.ExtensionID, "CreateVersionSessionGroup", "0");
}
public void SetVersionCustomProperties()
{
var resourceManager = WebResourceManager.Instance;
var agentidproperty = Int32.Parse(ExtensionContext.Current.GetSettingValue("AgentIDCustomProperty"));
var agentversionproperty = Int32.Parse(ExtensionContext.Current.GetSettingValue("AgentVersionCustomProperty"));
new List<string>() { "LabelText", "AccessVisible", "MeetingVisible", "SupportVisible" }.ForEach(delegate (string resource) {
resourceManager.SaveResourceOverride("SessionProperty.Custom"+ agentversionproperty +"." + resource, new Dictionary<string, string>() { { resource.Equals("LabelText") ? CultureInfo.CurrentCulture.Name : "InvariantCultureKey", resource.Equals("LabelText") ? WebResources.GetString("Diagnostics.Automate.VersionLabel") : "true" } }
.Select(cultureKeyToOverrideValue =>
Extensions.CreateKeyValuePair(
cultureKeyToOverrideValue.Key == "InvariantCultureKey" ? CultureInfo.InvariantCulture : CultureInfo.GetCultureInfo(cultureKeyToOverrideValue.Key),
(object)cultureKeyToOverrideValue.Value
)
)
);
resourceManager.SaveResourceOverride("SessionProperty.Custom"+ agentidproperty +"." + resource, new Dictionary<string, string>() { { resource.Equals("LabelText") ? CultureInfo.CurrentCulture.Name : "InvariantCultureKey",
resource.Equals("LabelText") ? WebResources.GetString("Diagnostics.Automate.IDLabel") : "true" } }
.Select(cultureKeyToOverrideValue =>
Extensions.CreateKeyValuePair(
cultureKeyToOverrideValue.Key == "InvariantCultureKey" ? CultureInfo.InvariantCulture : CultureInfo.GetCultureInfo(cultureKeyToOverrideValue.Key),
(object)cultureKeyToOverrideValue.Value
)
)
);
});
}
}