This repository was archived by the owner on Mar 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathManagementUnitWrapper.cs
More file actions
56 lines (45 loc) · 1.85 KB
/
ManagementUnitWrapper.cs
File metadata and controls
56 lines (45 loc) · 1.85 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
//-----------------------------------------------------------------------
// <copyright>
// Copyright (C) Ruslan Yakushev for the PHP Manager for IIS project.
//
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//-----------------------------------------------------------------------
using Microsoft.Web.Administration;
using Microsoft.Web.Management.Server;
namespace Web.Management.PHP.Config
{
internal sealed class ManagementUnitWrapper : IConfigurationWrapper
{
private readonly ManagementUnit _managementUnit;
public ManagementUnitWrapper(ManagementUnit managementUnit)
{
_managementUnit = managementUnit;
}
#region IConfigurationWrapper Members
public void CommitChanges()
{
_managementUnit.Update();
}
public Configuration GetAppHostConfiguration()
{
return _managementUnit.ServerManager.GetApplicationHostConfiguration();
}
public DefaultDocument.DefaultDocumentSection GetDefaultDocumentSection()
{
var config = _managementUnit.Configuration;
return (DefaultDocument.DefaultDocumentSection)config.GetSection("system.webServer/defaultDocument", typeof(DefaultDocument.DefaultDocumentSection));
}
public Handlers.HandlersSection GetHandlersSection()
{
var config = _managementUnit.Configuration;
return (Handlers.HandlersSection)config.GetSection("system.webServer/handlers", typeof(Handlers.HandlersSection));
}
public bool IsServerConfigurationPath()
{
return (_managementUnit.ConfigurationPath.PathType == ConfigurationPathType.Server);
}
#endregion
}
}