diff --git a/SafeExamBrowser.Service.UnitTests/Properties/AssemblyInfo.cs b/SafeExamBrowser.Service.UnitTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..724f7ce8 --- /dev/null +++ b/SafeExamBrowser.Service.UnitTests/Properties/AssemblyInfo.cs @@ -0,0 +1,17 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("SafeExamBrowser.Service.UnitTests")] +[assembly: AssemblyDescription("Safe Exam Browser")] +[assembly: AssemblyCompany("ETH Zürich")] +[assembly: AssemblyProduct("SafeExamBrowser.Service.UnitTests")] +[assembly: AssemblyCopyright("Copyright © 2019 ETH Zürich, Educational Development and Technology (LET)")] + +[assembly: ComVisible(false)] + +[assembly: Guid("26c4aaee-3902-400c-a154-63a357dea2f8")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/SafeExamBrowser.Service.UnitTests/SafeExamBrowser.Service.UnitTests.csproj b/SafeExamBrowser.Service.UnitTests/SafeExamBrowser.Service.UnitTests.csproj new file mode 100644 index 00000000..90149c69 --- /dev/null +++ b/SafeExamBrowser.Service.UnitTests/SafeExamBrowser.Service.UnitTests.csproj @@ -0,0 +1,67 @@ + + + + + + Debug + AnyCPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8} + Library + Properties + SafeExamBrowser.Service.UnitTests + SafeExamBrowser.Service.UnitTests + v4.7.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/SafeExamBrowser.Service.UnitTests/packages.config b/SafeExamBrowser.Service.UnitTests/packages.config new file mode 100644 index 00000000..2f7c5a18 --- /dev/null +++ b/SafeExamBrowser.Service.UnitTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/SafeExamBrowser.Service/App.config b/SafeExamBrowser.Service/App.config new file mode 100644 index 00000000..56efbc7b --- /dev/null +++ b/SafeExamBrowser.Service/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SafeExamBrowser.Service/CompositionRoot.cs b/SafeExamBrowser.Service/CompositionRoot.cs new file mode 100644 index 00000000..e8e757c2 --- /dev/null +++ b/SafeExamBrowser.Service/CompositionRoot.cs @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +namespace SafeExamBrowser.Service +{ + internal class CompositionRoot + { + internal void BuildObjectGraph() + { + + } + } +} diff --git a/SafeExamBrowser.Service/Installer.cs b/SafeExamBrowser.Service/Installer.cs new file mode 100644 index 00000000..99efedb9 --- /dev/null +++ b/SafeExamBrowser.Service/Installer.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +using System.ComponentModel; +using System.ServiceProcess; + +namespace SafeExamBrowser.Service +{ + [RunInstaller(true)] + public class Installer : System.Configuration.Install.Installer + { + private ServiceProcessInstaller process; + private ServiceInstaller service; + + public Installer() + { + process = new ServiceProcessInstaller(); + process.Account = ServiceAccount.LocalSystem; + + service = new ServiceInstaller(); + service.Description = "Performs operations which require elevated privileges."; + service.DisplayName = "Safe Exam Browser Service"; + service.ServiceName = nameof(SafeExamBrowser.Service); + service.StartType = ServiceStartMode.Automatic; + + Installers.Add(process); + Installers.Add(service); + } + } +} diff --git a/SafeExamBrowser.Service/Properties/AssemblyInfo.cs b/SafeExamBrowser.Service/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..22ac2c99 --- /dev/null +++ b/SafeExamBrowser.Service/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +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("SafeExamBrowser.Service")] +[assembly: AssemblyDescription("Safe Exam Browser")] +[assembly: AssemblyCompany("ETH Zürich")] +[assembly: AssemblyProduct("SafeExamBrowser.Service")] +[assembly: AssemblyCopyright("Copyright © 2019 ETH Zürich, Educational Development and Technology (LET)")] + +// 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("fa3c6692-dfed-4afa-bd58-9a3da2753c78")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyInformationalVersion("1.0.0.0")] diff --git a/SafeExamBrowser.Service/SafeExamBrowser.Service.csproj b/SafeExamBrowser.Service/SafeExamBrowser.Service.csproj new file mode 100644 index 00000000..15e1baf7 --- /dev/null +++ b/SafeExamBrowser.Service/SafeExamBrowser.Service.csproj @@ -0,0 +1,55 @@ + + + + + Debug + AnyCPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78} + WinExe + SafeExamBrowser.Service + SafeExamBrowser.Service + v4.7.2 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + Component + + + Component + + + + + + + + \ No newline at end of file diff --git a/SafeExamBrowser.Service/Service.cs b/SafeExamBrowser.Service/Service.cs new file mode 100644 index 00000000..2f69194b --- /dev/null +++ b/SafeExamBrowser.Service/Service.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET) + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +using System.ServiceProcess; + +namespace SafeExamBrowser.Service +{ + public class Service : ServiceBase + { + private CompositionRoot instances; + + public Service() + { + CanPauseAndContinue = false; + ServiceName = nameof(SafeExamBrowser.Service); + } + + public static void Main() + { + Run(new Service()); + } + + protected override void OnStart(string[] args) + { + //instances = new CompositionRoot(); + //instances.BuildObjectGraph(); + //instances.LogStartupInformation(); + + //var success = instances.ServiceController.TryStart(); + + //if (!success) + //{ + // Environment.Exit(-1); + //} + } + + protected override void OnStop() + { + //instances?.ServiceController?.Terminate(); + //instances?.LogShutdownInformation(); + } + } +} diff --git a/SafeExamBrowser.sln b/SafeExamBrowser.sln index 63f70632..73b48daf 100644 --- a/SafeExamBrowser.sln +++ b/SafeExamBrowser.sln @@ -58,6 +58,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterfa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterface.Shared", "SafeExamBrowser.UserInterface.Shared\SafeExamBrowser.UserInterface.Shared.csproj", "{38525928-87BA-4F8C-8010-4EB97BFAAE13}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Service", "SafeExamBrowser.Service\SafeExamBrowser.Service.csproj", "{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Service.UnitTests", "SafeExamBrowser.Service.UnitTests\SafeExamBrowser.Service.UnitTests.csproj", "{26C4AAEE-3902-400C-A154-63A357DEA2F8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -242,6 +246,22 @@ Global {38525928-87BA-4F8C-8010-4EB97BFAAE13}.Release|Any CPU.Build.0 = Release|Any CPU {38525928-87BA-4F8C-8010-4EB97BFAAE13}.Release|x86.ActiveCfg = Release|x86 {38525928-87BA-4F8C-8010-4EB97BFAAE13}.Release|x86.Build.0 = Release|x86 + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|x86.ActiveCfg = Debug|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|x86.Build.0 = Debug|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|Any CPU.Build.0 = Release|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|x86.ActiveCfg = Release|Any CPU + {FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|x86.Build.0 = Release|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|x86.ActiveCfg = Debug|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|x86.Build.0 = Debug|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|Any CPU.Build.0 = Release|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|x86.ActiveCfg = Release|Any CPU + {26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/appveyor.yml b/appveyor.yml index 7de1bd0a..b0873eaa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,5 +26,8 @@ after_test: - codecov -f "coverage.xml" artifacts: - path: SafeExamBrowser.Runtime\bin\$(platform)\$(configuration) - name: '$(appveyor_build_version)_Base' + name: '$(appveyor_build_version)_Base_Application' + type: zip + - path: SafeExamBrowser.Service\bin\$(platform)\$(configuration) + name: '$(appveyor_build_version)_Base_Service' type: zip