Partial Checkin for Remote Desktop Services: Framework
This commit is contained in:
parent
25252051b5
commit
cae5f06f61
28 changed files with 924 additions and 10 deletions
|
@ -0,0 +1,22 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WebsitePanel.Providers.RemoteDesktopServices.Windows2012")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("WebsitePanel.Providers.RemoteDesktopServices.Windows2012")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("bec9fe6e-d9f3-4f13-a1e7-2a6ae97c7cc4")]
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.18010
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyCompany("Outercurve Foundation")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2012 Outercurve Foundation.")]
|
||||
[assembly: AssemblyVersion("2.1.0.1")]
|
||||
[assembly: AssemblyFileVersion("2.1.0.1")]
|
||||
[assembly: AssemblyInformationalVersion("2.1.0")]
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{411EFA7F-DE87-4D37-BD15-95787CF77411}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WebsitePanel.Providers.RemoteDesktopServices.Windows2012</RootNamespace>
|
||||
<AssemblyName>WebsitePanel.Providers.RemoteDesktopServices.Windows2012</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\WebsitePanel.Server\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WebsitePanel.Providers.Base">
|
||||
<HintPath>..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebsitePanel.Server.Utils">
|
||||
<HintPath>..\WebsitePanel.Server.Utils\bin\Debug\WebsitePanel.Server.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Windows2012.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="VersionInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,100 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
|
||||
using WebsitePanel.Server.Utils;
|
||||
using WebsitePanel.Providers.Utils;
|
||||
using WebsitePanel.Providers.OS;
|
||||
|
||||
|
||||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class Windows2012 : HostingServiceProviderBase
|
||||
{
|
||||
|
||||
#region Properties
|
||||
protected string UsersHome
|
||||
{
|
||||
get { return FileUtils.EvaluateSystemVariables(ProviderSettings["UsersHome"]); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region HostingServiceProvider methods
|
||||
public override string[] Install()
|
||||
{
|
||||
List<string> messages = new List<string>();
|
||||
|
||||
// create folder if it not exists
|
||||
try
|
||||
{
|
||||
if (!FileUtils.DirectoryExists(UsersHome))
|
||||
{
|
||||
FileUtils.CreateDirectory(UsersHome);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messages.Add(String.Format("Folder '{0}' could not be created: {1}",
|
||||
UsersHome, ex.Message));
|
||||
}
|
||||
return messages.ToArray();
|
||||
}
|
||||
|
||||
public override void DeleteServiceItems(ServiceProviderItem[] items)
|
||||
{
|
||||
foreach (ServiceProviderItem item in items)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (item is HomeFolder)
|
||||
// delete home folder
|
||||
FileUtils.DeleteFile(item.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override ServiceProviderItemDiskSpace[] GetServiceItemsDiskSpace(ServiceProviderItem[] items)
|
||||
{
|
||||
List<ServiceProviderItemDiskSpace> itemsDiskspace = new List<ServiceProviderItemDiskSpace>();
|
||||
foreach (ServiceProviderItem item in items)
|
||||
{
|
||||
if (item is HomeFolder)
|
||||
{
|
||||
try
|
||||
{
|
||||
string path = item.Name;
|
||||
|
||||
Log.WriteStart(String.Format("Calculating '{0}' folder size", path));
|
||||
|
||||
// calculate disk space
|
||||
ServiceProviderItemDiskSpace diskspace = new ServiceProviderItemDiskSpace();
|
||||
diskspace.ItemId = item.Id;
|
||||
diskspace.DiskSpace = FileUtils.CalculateFolderSize(path);
|
||||
itemsDiskspace.Add(diskspace);
|
||||
|
||||
Log.WriteEnd(String.Format("Calculating '{0}' folder size", path));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
return itemsDiskspace.ToArray();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override bool IsInstalled()
|
||||
{
|
||||
Server.Utils.OS.WindowsVersion version = WebsitePanel.Server.Utils.OS.GetVersion();
|
||||
return version == WebsitePanel.Server.Utils.OS.WindowsVersion.WindowsServer2012;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue