diff --git a/tools/DAEserv/DAEserv.sln b/tools/DAEserv/DAEserv.sln deleted file mode 100644 index 18790d93e2ff66b2c40731fff2043b212e054f5c..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DAEserv", "DAEserv\DAEserv.vcxproj", "{60C9EAAB-AE44-468B-9F18-17C9724DE716}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {60C9EAAB-AE44-468B-9F18-17C9724DE716}.Debug|Win32.ActiveCfg = Debug|Win32 - {60C9EAAB-AE44-468B-9F18-17C9724DE716}.Debug|Win32.Build.0 = Debug|Win32 - {60C9EAAB-AE44-468B-9F18-17C9724DE716}.Release|Win32.ActiveCfg = Release|Win32 - {60C9EAAB-AE44-468B-9F18-17C9724DE716}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/tools/DAEserv/DAEserv/AssemblyInfo.cpp b/tools/DAEserv/DAEserv/AssemblyInfo.cpp deleted file mode 100644 index 1a77e0140c6dc9d270d8094d0153d89047ba9ed8..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/AssemblyInfo.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include "stdafx.h" - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Permissions; - -// -// 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:AssemblyTitleAttribute("DAEserv")]; -[assembly:AssemblyDescriptionAttribute("")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("")]; -[assembly:AssemblyProductAttribute("DAEserv")]; -[assembly:AssemblyCopyrightAttribute("Copyright (c) 2008")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the value or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly:AssemblyVersionAttribute("1.0.*")]; - -[assembly:ComVisible(false)]; - -[assembly:CLSCompliantAttribute(true)]; - -[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; - diff --git a/tools/DAEserv/DAEserv/DAEserv.vcproj b/tools/DAEserv/DAEserv/DAEserv.vcproj deleted file mode 100644 index ec5f7a8acfa699eea35cf98108eb938b00bc9325..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/DAEserv.vcproj +++ /dev/null @@ -1,300 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="DAEserv" - ProjectGUID="{60C9EAAB-AE44-468B-9F18-17C9724DE716}" - RootNamespace="DAEserv" - Keyword="ManagedCProj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - ManagedExtensions="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG;_WIN32_WINNT=0x0400" - RuntimeLibrary="3" - UsePrecompiledHeader="2" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(NoInherit)" - LinkIncremental="2" - GenerateDebugInformation="true" - AssemblyDebug="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - ManagedExtensions="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="C:\Mantid\Code\Third_Party\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WIN32_WINNT=0x0400;_CRT_SECURE_NO_DEPRECATE" - RuntimeLibrary="2" - UsePrecompiledHeader="2" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="$(NoInherit) WS2_32.lib" - LinkIncremental="1" - GenerateDebugInformation="true" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - <AssemblyReference - RelativePath="System.dll" - AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" - /> - <AssemblyReference - RelativePath="System.Data.dll" - AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86" - /> - <AssemblyReference - RelativePath="System.ServiceProcess.dll" - AssemblyName="System.ServiceProcess, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - /> - <AssemblyReference - RelativePath="System.Configuration.Install.dll" - AssemblyName="System.Configuration.Install, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - /> - <AssemblyReference - RelativePath="System.XML.dll" - AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" - /> - <AssemblyReference - RelativePath="System.Management.dll" - AssemblyName="System.Management, Version=2.0.0.0, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - /> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\AssemblyInfo.cpp" - > - </File> - <File - RelativePath=".\DAEservWinService.cpp" - > - </File> - <File - RelativePath=".\isisds_command.cpp" - > - </File> - <File - RelativePath=".\ProjectInstaller.cpp" - > - </File> - <File - RelativePath=".\stdafx.cpp" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="1" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCLCompilerTool" - UsePrecompiledHeader="1" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\work.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\DAEservWinService.h" - FileType="1" - > - <File - RelativePath=".\DAEservWinService.resX" - SubType="Designer" - > - </File> - </File> - <File - RelativePath=".\isisds_command.h" - > - </File> - <File - RelativePath=".\ProjectInstaller.h" - FileType="1" - SubType="Component" - > - <File - RelativePath=".\ProjectInstaller.resx" - SubType="Designer" - > - </File> - </File> - <File - RelativePath=".\resource.h" - > - </File> - <File - RelativePath=".\stdafx.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - <File - RelativePath=".\app.ico" - > - </File> - <File - RelativePath=".\app.rc" - > - </File> - </Filter> - <File - RelativePath=".\ReadMe.txt" - > - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/tools/DAEserv/DAEserv/DAEserv.vcproj.CLRC.hqs74821.user b/tools/DAEserv/DAEserv/DAEserv.vcproj.CLRC.hqs74821.user deleted file mode 100644 index 6635a408da53e1ddbad83ac04e0650bcf0885992..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/DAEserv.vcproj.CLRC.hqs74821.user +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioUserFile - ProjectType="Visual C++" - Version="8.00" - ShowAllFiles="false" - > - <Configurations> - <Configuration - Name="Debug|Win32" - > - <DebugSettings - Command="$(TargetPath)" - WorkingDirectory="" - CommandArguments="" - Attach="false" - DebuggerType="3" - Remote="1" - RemoteMachine="NDW675" - RemoteCommand="" - HttpUrl="" - PDBPath="" - SQLDebugging="" - Environment="" - EnvironmentMerge="true" - DebuggerFlavor="" - MPIRunCommand="" - MPIRunArguments="" - MPIRunWorkingDirectory="" - ApplicationCommand="" - ApplicationArguments="" - ShimCommand="" - MPIAcceptMode="" - MPIAcceptFilter="" - /> - </Configuration> - <Configuration - Name="Release|Win32" - > - <DebugSettings - Command="$(TargetPath)" - WorkingDirectory="" - CommandArguments="" - Attach="false" - DebuggerType="3" - Remote="1" - RemoteMachine="NDW675" - RemoteCommand="" - HttpUrl="" - PDBPath="" - SQLDebugging="" - Environment="" - EnvironmentMerge="true" - DebuggerFlavor="" - MPIRunCommand="" - MPIRunArguments="" - MPIRunWorkingDirectory="" - ApplicationCommand="" - ApplicationArguments="" - ShimCommand="" - MPIAcceptMode="" - MPIAcceptFilter="" - /> - </Configuration> - </Configurations> -</VisualStudioUserFile> diff --git a/tools/DAEserv/DAEserv/DAEservWinService.cpp b/tools/DAEserv/DAEserv/DAEservWinService.cpp deleted file mode 100644 index 02a76cb6bac899966145b381163d0a254bcc8355..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/DAEservWinService.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -// DAEserv.cpp : main Windows Service project file. - -#include "stdafx.h" -#include <string.h> -#include "DAEservWinService.h" -#include <windows.h> - -using namespace DAEserv; -using namespace System::Text; -using namespace System::Security::Policy; -using namespace System::Reflection; - -DWORD WINAPI startService(LPVOID p); - -//To install/uninstall the service, type: "DAEserv.exe -Install [-u]" -int _tmain(int argc, _TCHAR* argv[]) -{ - if (argc >= 2) - { - if (argv[1][0] == _T('/')) - { - argv[1][0] = _T('-'); - } - - if (_tcsicmp(argv[1], _T("-Install")) == 0) - { - array<String^>^ myargs = System::Environment::GetCommandLineArgs(); - array<String^>^ args = gcnew array<String^>(myargs->Length - 1); - - // Set args[0] with the full path to the assembly, - Assembly^ assem = Assembly::GetExecutingAssembly(); - args[0] = assem->Location; - - Array::Copy(myargs, 2, args, 1, args->Length - 1); - AppDomain^ dom = AppDomain::CreateDomain(L"execDom"); - Type^ type = System::Object::typeid; - String^ path = type->Assembly->Location; - StringBuilder^ sb = gcnew StringBuilder(path->Substring(0, path->LastIndexOf(L"\\"))); - sb->Append(L"\\InstallUtil.exe"); - Evidence^ evidence = gcnew Evidence(); - dom->ExecuteAssembly(sb->ToString(), evidence, args); - } - } - else - { - ServiceBase::Run(gcnew DAEservWinService()); - } -} - diff --git a/tools/DAEserv/DAEserv/DAEservWinService.h b/tools/DAEserv/DAEserv/DAEservWinService.h deleted file mode 100644 index 986ba810a99bdf2f37e4f1cf0cdec3ff4a08857f..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/DAEservWinService.h +++ /dev/null @@ -1,90 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -#pragma once - -#include <windows.h> - -using namespace System; -using namespace System::Collections; -using namespace System::ServiceProcess; -using namespace System::ComponentModel; - -DWORD WINAPI startService(LPVOID p); - -namespace DAEserv { - - /// <summary> - /// Summary for DAEservWinService - /// </summary> - /// - /// WARNING: If you change the name of this class, you will need to change the - /// 'Resource File Name' property for the managed resource compiler tool - /// associated with all .resx files this class depends on. Otherwise, - /// the designers will not be able to interact properly with localized - /// resources associated with this form. - public ref class DAEservWinService : public System::ServiceProcess::ServiceBase - { - public: - DAEservWinService() - { - InitializeComponent(); - // - //TODO: Add the constructor code here - // - } - protected: - /// <summary> - /// Clean up any resources being used. - /// </summary> - ~DAEservWinService() - { - if (components) - { - delete components; - } - } - - /// <summary> - /// Set things in motion so your service can do its work. - /// </summary> - virtual void OnStart(array<String^>^ args) override - { - // TODO: Add code here to start your service. - DWORD ID; - HANDLE thread = CreateThread(NULL,0,&startService,0,0,&ID); - } - - /// <summary> - /// Stop this service. - /// </summary> - virtual void OnStop() override - { - // TODO: Add code here to perform any tear-down necessary to stop your service. - } - - private: - /// <summary> - /// Required designer variable. - /// </summary> - System::ComponentModel::Container ^components; - -#pragma region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - void InitializeComponent(void) - { - this->components = gcnew System::ComponentModel::Container(); - this->CanStop = true; - this->CanPauseAndContinue = true; - this->AutoLog = true; - this->ServiceName = L"DAEservWinService"; - } -#pragma endregion - }; -} diff --git a/tools/DAEserv/DAEserv/DAEservWinService.resX b/tools/DAEserv/DAEserv/DAEservWinService.resX deleted file mode 100644 index de824e1eebee2baf2ca6b6748d8c7fb2713ed739..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/DAEservWinService.resX +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1">this is my long string</data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - [base64 mime encoded serialized CLR Framework object] - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - [base64 mime encoded string representing a byte array form of the CLR Framework object] - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a CLR class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> -</root> \ No newline at end of file diff --git a/tools/DAEserv/DAEserv/ProjectInstaller.cpp b/tools/DAEserv/DAEserv/ProjectInstaller.cpp deleted file mode 100644 index 43ef2da539192dbe73a7e18ef520ee352252252e..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/ProjectInstaller.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -#include "StdAfx.h" -#include "ProjectInstaller.h" diff --git a/tools/DAEserv/DAEserv/ProjectInstaller.h b/tools/DAEserv/DAEserv/ProjectInstaller.h deleted file mode 100644 index 9018b6da32008102261d125f6641268983c217fd..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/ProjectInstaller.h +++ /dev/null @@ -1,86 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -#pragma once - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; - - -namespace DAEserv { - - [RunInstaller(true)] - - /// <summary> - /// Summary for ProjectInstaller - /// </summary> - public ref class ProjectInstaller : public System::Configuration::Install::Installer - { - public: - ProjectInstaller(void) - { - InitializeComponent(); - // - //TODO: Add the constructor code here - // - } - - protected: - /// <summary> - /// Clean up any resources being used. - /// </summary> - ~ProjectInstaller() - { - if (components) - { - delete components; - } - } - private: System::ServiceProcess::ServiceProcessInstaller^ serviceProcessInstaller1; - protected: - private: System::ServiceProcess::ServiceInstaller^ serviceInstaller1; - - private: - /// <summary> - /// Required designer variable. - /// </summary> - System::ComponentModel::Container ^components; - -#pragma region Windows Form Designer generated code - /// <summary> - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// </summary> - void InitializeComponent(void) - { - this->serviceProcessInstaller1 = (gcnew System::ServiceProcess::ServiceProcessInstaller()); - this->serviceInstaller1 = (gcnew System::ServiceProcess::ServiceInstaller()); - // - // serviceProcessInstaller1 - // - this->serviceProcessInstaller1->Account = System::ServiceProcess::ServiceAccount::LocalSystem; - this->serviceProcessInstaller1->Password = nullptr; - this->serviceProcessInstaller1->Username = nullptr; - // - // serviceInstaller1 - // - this->serviceInstaller1->ServiceName = L"DAEservWinService"; - this->serviceInstaller1->StartType = System::ServiceProcess::ServiceStartMode::Automatic; - this->serviceInstaller1->AfterInstall += gcnew System::Configuration::Install::InstallEventHandler(this, &ProjectInstaller::serviceInstaller1_AfterInstall); - // - // ProjectInstaller - // - this->Installers->AddRange(gcnew cli::array< System::Configuration::Install::Installer^ >(2) {this->serviceProcessInstaller1, - this->serviceInstaller1}); - - } -#pragma endregion - private: System::Void serviceInstaller1_AfterInstall(System::Object^ sender, System::Configuration::Install::InstallEventArgs^ e) { - } - }; -} diff --git a/tools/DAEserv/DAEserv/ProjectInstaller.resx b/tools/DAEserv/DAEserv/ProjectInstaller.resx deleted file mode 100644 index 58601895865326ce6a3c8bcf407f07b116abcc9a..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/ProjectInstaller.resx +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<root> - <!-- - Microsoft ResX Schema - - Version 2.0 - - The primary goals of this format is to allow a simple XML format - that is mostly human readable. The generation and parsing of the - various data types are done through the TypeConverter classes - associated with the data types. - - Example: - - ... ado.net/XML headers & schema ... - <resheader name="resmimetype">text/microsoft-resx</resheader> - <resheader name="version">2.0</resheader> - <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> - <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> - <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> - <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> - <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> - <value>[base64 mime encoded serialized .NET Framework object]</value> - </data> - <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> - <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> - <comment>This is a comment</comment> - </data> - - There are any number of "resheader" rows that contain simple - name/value pairs. - - Each data row contains a name, and value. The row also contains a - type or mimetype. Type corresponds to a .NET class that support - text/value conversion through the TypeConverter architecture. - Classes that don't support this are serialized and stored with the - mimetype set. - - The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not - extensible. For a given mimetype the value must be set accordingly: - - Note - application/x-microsoft.net.object.binary.base64 is the format - that the ResXResourceWriter will generate, however the reader can - read any of the formats listed below. - - mimetype: application/x-microsoft.net.object.binary.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.soap.base64 - value : The object must be serialized with - : System.Runtime.Serialization.Formatters.Soap.SoapFormatter - : and then encoded with base64 encoding. - - mimetype: application/x-microsoft.net.object.bytearray.base64 - value : The object must be serialized into a byte array - : using a System.ComponentModel.TypeConverter - : and then encoded with base64 encoding. - --> - <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> - <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> - <xsd:element name="root" msdata:IsDataSet="true"> - <xsd:complexType> - <xsd:choice maxOccurs="unbounded"> - <xsd:element name="metadata"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" /> - </xsd:sequence> - <xsd:attribute name="name" use="required" type="xsd:string" /> - <xsd:attribute name="type" type="xsd:string" /> - <xsd:attribute name="mimetype" type="xsd:string" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="assembly"> - <xsd:complexType> - <xsd:attribute name="alias" type="xsd:string" /> - <xsd:attribute name="name" type="xsd:string" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="data"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> - <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> - <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> - <xsd:attribute ref="xml:space" /> - </xsd:complexType> - </xsd:element> - <xsd:element name="resheader"> - <xsd:complexType> - <xsd:sequence> - <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> - </xsd:sequence> - <xsd:attribute name="name" type="xsd:string" use="required" /> - </xsd:complexType> - </xsd:element> - </xsd:choice> - </xsd:complexType> - </xsd:element> - </xsd:schema> - <resheader name="resmimetype"> - <value>text/microsoft-resx</value> - </resheader> - <resheader name="version"> - <value>2.0</value> - </resheader> - <resheader name="reader"> - <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <resheader name="writer"> - <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </resheader> - <metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 54</value> - </metadata> - <metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>187, 17</value> - </metadata> - <metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> - <value>False</value> - </metadata> -</root> \ No newline at end of file diff --git a/tools/DAEserv/DAEserv/ReadMe.txt b/tools/DAEserv/DAEserv/ReadMe.txt deleted file mode 100644 index 936ef5f94488297862d856c4f7b9359ed4df4857..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/ReadMe.txt +++ /dev/null @@ -1,33 +0,0 @@ -======================================================================== - APPLICATION : DAEserv Project Overview -======================================================================== - -Windows Service Wizard has created this DAEserv Application for you. - -This file contains a summary of what you will find in each of the files that -make up your DAEserv application. - -DAEserv.vcproj - This is the main project file for VC++ projects generated using a Windows Service Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations. - -DAEservWinService.cpp - This is the main application source file. - -AssemblyInfo.cpp - Contains custom attributes for modifying assembly metadata. - - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -Windows Service Wizard uses "TODO:" to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// - -To run your service: - 1. Build the project - 2. From the command line, run: - DAEserv.exe -Install diff --git a/tools/DAEserv/DAEserv/app.ico b/tools/DAEserv/DAEserv/app.ico deleted file mode 100644 index 3a5525fd794f7a7c5c8e6187f470ea3af38cd2b6..0000000000000000000000000000000000000000 Binary files a/tools/DAEserv/DAEserv/app.ico and /dev/null differ diff --git a/tools/DAEserv/DAEserv/app.rc b/tools/DAEserv/DAEserv/app.rc deleted file mode 100644 index 807aa89666df8ea82369bdbdfefb8294bf5a19b1..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/app.rc +++ /dev/null @@ -1,63 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon placed first or with lowest ID value becomes application icon - -LANGUAGE 9, 1 -#pragma code_page(1252) -1 ICON "app.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" - "\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/tools/DAEserv/DAEserv/isisds_command.cpp b/tools/DAEserv/DAEserv/isisds_command.cpp deleted file mode 100644 index b354735c73272a643e4cd6d5e4e83a4756458797..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/isisds_command.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/** - - @file isisds_command.cpp - - IDC interface - minimal socket interface to the DAE - - @author Freddie Akeroyd, STFC ISIS Facility - @date 31/07/2008 - - Copyright © 2007-8 STFC Rutherford Appleton Laboratory - - This file is part of ISIS Instrument control program. - you can redistribute it and/or modify it under the terms of the - GNU General Public License -*/ - - -#include "stdafx.h" - -#include <stdio.h> -#include "isisds_command.h" - -using namespace std; - -/* - * versions of these structures - * increment major for incompatible changes - * increment minor for backward compatible changes on server - */ -#define ISISDS_MAJOR_VER 1 -#define ISISDS_MINOR_VER 1 - -#ifndef _WIN32 -#define closesocket close -#include <stdlib.h> -#include <stdio.h> -#include <stdarg.h> -#include <string.h> -#include <sys/socket.h> -#include <netdb.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <fcntl.h> -#include <unistd.h> -#include <sys/select.h> -#endif - -/* wait until read len bytes, return <=0 on error */ -static int recv_all(SOCKET s, void* buffer, int len, int flags) -{ - char* cbuffer = (char*)buffer; - int n, ntot; - ntot = 0; - while(len > 0) - { - n = recv(s, cbuffer, len, flags); - if (n <= 0) - { - return n; /* error */ - } - len -= n; - cbuffer += n; - ntot += n; - } - return ntot; -} - -/* clear out old data from a socket */ -static void clear_replies(SOCKET s) -{ - static char buffer[100000]; - struct timeval timeout = { 0, 0 }; - fd_set fds; - int done = 0; - while(!done) - { - FD_ZERO(&fds); - FD_SET(s, &fds); - if ( (select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0) && FD_ISSET(s, &fds) ) - { - recv(s, buffer, sizeof(buffer), 0); - } - else - { - done = 1; - } - } -} - -/* - * client: open a socket and perform initial negotiation - * return connected socket or INVALID_SOCKET on error - */ -SOCKET isisds_send_open(const char* host, ISISDSAccessMode access_type) -{ - SOCKET s; - int setkeepalive = 1; - struct hostent *hostp; - struct sockaddr_in address; - int n; - char *comm, *comm_data; -/* int len_comm_data; */ - isisds_open_t op; - ISISDSDataType data_type; - int dims_array[10], ndims; - - if ( (hostp = gethostbyname(host)) == NULL ) - { - return INVALID_SOCKET; - } - memset(&address, 0, sizeof(address)); - memcpy(&(address.sin_addr.s_addr), hostp->h_addr_list[0], hostp->h_length); - address.sin_family = AF_INET; - address.sin_port = htons(ISISDS_PORT); - s = socket(PF_INET, SOCK_STREAM, 0); - if (s == INVALID_SOCKET) - { - return INVALID_SOCKET; - } - setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, (char*)&setkeepalive, sizeof(setkeepalive)); - if (connect(s, (struct sockaddr*)&address, sizeof(address)) == -1) - { - closesocket(s); - return INVALID_SOCKET; - } -/* socket connected */ - op.ver_major = ISISDS_MAJOR_VER; - op.ver_minor = ISISDS_MINOR_VER; - op.pid = 0; - op.access_type = access_type; - strncpy(op.user, "faa", sizeof(op.user)); - strncpy(op.host, "localhost", sizeof(op.host)); - op.len = sizeof(op); - if ( (n = send(s, (char*)&op, sizeof(op), 0)) != sizeof(op) ) - { - closesocket(s); - return INVALID_SOCKET; - } - if (isisds_recv_command_alloc(s, &comm, (void**)&comm_data, &data_type, dims_array, &ndims) <= 0) - { - closesocket(s); - return INVALID_SOCKET; - } - if (comm_data != NULL) - { - free(comm_data); - } - if (!strcmp(comm, "OK")) - { - free(comm); - return s; - } - else - { - free(comm); - closesocket(s); - return INVALID_SOCKET; - } -} - -/* - * server - * client minor ver <= server minor ver - */ -int isisds_recv_open(SOCKET s, ISISDSAccessMode* access_type) -{ - int n; - isisds_open_t op; - if ( (n = recv_all(s, (char*)&op, sizeof(op), 0)) != sizeof(op) ) - { - return -1; - } - if ( op.len != sizeof(op) ) - { - return -1; - } - if ( (op.ver_major != ISISDS_MAJOR_VER) || (op.ver_minor > ISISDS_MINOR_VER) ) - { - return -1; - } - //cout<<"op.len="<<op.len<<'\n'; - //cout<<"host= "<<op.host<<'\n'; - //cout<<"user= "<<op.user<<'\n'; - - *access_type = (ISISDSAccessMode)op.access_type; - return isisds_send_command(s, "OK", NULL, ISISDSUnknown, NULL, 0); -} -/* - * return > 0 on success - * if dims_array == NULL, ndims is length - * on graceful termination should get an FD_CLOSE from client, should then send any data - * shutdown(s, SD_SEND) and then closesocket() - */ -int isisds_send_command(SOCKET s, const char* command, const void* data, ISISDSDataType type, const int dims_array[], int ndims) -{ - int i, n, len_data; - isisds_command_header_t comm; - memset(&comm, 0, sizeof(comm)); - if (dims_array == NULL) - { - comm.ndims = 1; - comm.dims_array[0] = ndims; - len_data = ndims * isisds_type_size[type]; - } - else - { - len_data = 1; - comm.ndims = ndims; - for(i=0; i<ndims; i++) - { - len_data *= dims_array[i]; - comm.dims_array[i] = dims_array[i]; - } - len_data *= isisds_type_size[type]; - } - comm.len = sizeof(comm) + len_data; - comm.type = type; - strncpy(comm.command, command, sizeof(comm.command)); - clear_replies(s); - n = send(s, (char*)&comm, sizeof(comm), 0); - if ( (n == sizeof(comm)) && (data != NULL) && (len_data > 0) ) - { - n = send(s, (const char*)data, len_data, 0); - } - return n; -} - -/* if not do_alloc, then type and dims_array are checked */ -static int isisds_recv_command_helper(SOCKET s, char** command, void** data, ISISDSDataType* type, int dims_array[], int* ndims, int do_alloc) -{ - int n, len_data, size_in, i; - isisds_command_header_t comm; - n = recv_all(s, (char*)&comm, sizeof(comm), 0); - if (n != sizeof(comm)) - { - return -1; - } - *command = (char*)malloc(sizeof(comm.command) + 1); - strncpy(*command, comm.command, sizeof(comm.command)); - (*command)[sizeof(comm.command)] = '\0'; - len_data = comm.len - sizeof(comm); /* in bytes */ - if (len_data < 0) - { - return -1; /* error */ - } - else if (len_data == 0) - { - dims_array[0] = 0; -/* *ndims = 0; */ - *type = ISISDSUnknown; - return n; /* all ok, just no extra data */ - } -/* isisds_report(0, 0, "Received data Type = \"%s\", ndims = %d\n", isisds_type_name[comm.type], comm.ndims); */ - if (do_alloc) - { - *data = malloc(len_data + 1); - ((char*)(*data))[len_data] = '\0'; - } - else - { - size_in = 1; - for(i=0; i < *ndims; i++) - { - size_in *= dims_array[i]; - } - size_in *= isisds_type_size[*type]; - if (size_in < len_data) - { - isisds_report(0,0,"data array too small %d < %d\n", size_in, len_data); - return -1; - } - if (size_in > len_data) /* only NULL terminate if space */ - { - ((char*)(*data))[len_data] = '\0'; - } - } - n = recv_all(s, *data, len_data, 0); - if (n != len_data) - { - free(*data); - *data = NULL; - len_data = 0; - return -1; - } - /* only update values if changed ... allows Read only parameters to be passed */ - if ( do_alloc || (*ndims != comm.ndims) ) - { - *ndims = comm.ndims; - } - if ( do_alloc || (*type != comm.type) ) - { - *type = (ISISDSDataType)comm.type; - } - for(i=0; i < comm.ndims; i++) - { - dims_array[i] = comm.dims_array[i]; - } - return n; -} - -/* return > 0 on success */ -int isisds_recv_command(SOCKET s, char* command, int* len_command, void* data, ISISDSDataType* type, int dims_array[], int* ndims) -{ - int t_dims[8] = { 1, 0, 0, 0, 0, 0, 0, 0 }; - int t_ndims = 1; - int istat; - char* command_temp = NULL; - if (type == NULL) - { - return -1; - } - if ( dims_array == NULL || ndims == NULL || (*ndims <= 1 && dims_array[0] <= 1) ) - { - /* assume single simple value */ - istat = isisds_recv_command_helper(s, &command_temp, &data, type, t_dims, &t_ndims, 0); - if ( (t_ndims != 1) || (t_dims[0] != 1) ) - { - istat = -1; - } - } - else - { - istat = isisds_recv_command_helper(s, &command_temp, &data, type, dims_array, ndims, 0); - } - strncpy(command, command_temp, *len_command); - *len_command = strlen(command_temp); - free(command_temp); - return istat; -} - -/* return > 0 on success */ -int isisds_recv_command_alloc(SOCKET s, char** command, void** data, ISISDSDataType* type, int dims_array[], int* ndims) -{ - if (ndims == NULL || dims_array == NULL || type == NULL) - { - return -1; - } - if (data == NULL || command == NULL) - { - return -1; - } - *data = NULL; - *command = NULL; - /* *ndims = 0; */ - dims_array[0] = 0; - *type = ISISDSUnknown; - return isisds_recv_command_helper(s, command, data, type, dims_array, ndims, 1); -} - -int isisds_send_close(SOCKET s) -{ - /* shutdown((*pfh)->s, SD_SEND); indicate no more data to send SHUT_WR - * check for FD_READ and recv any other stuff from server - * check for FD_CLOSE and closesocket() - */ - closesocket(s); - return 0; -} - -static void default_status_reporter(int status, int code, const char* message) -{ - printf("ISISDS: %d %d %s\n", status, code, message); -} - -static isisds_error_report_t status_reporter = default_status_reporter; - -int isisds_report(int status, int code, const char* format, ... ) -{ - va_list ap; - char* message = (char*)malloc(1024); - va_start(ap, format); - vsprintf(message, format, ap); - va_end(ap); - (*status_reporter)(status, code, message); - free(message); - return 0; -} - -int isisds_set_report_func(isisds_error_report_t report_func) -{ - status_reporter = report_func; - return 0; -} diff --git a/tools/DAEserv/DAEserv/isisds_command.h b/tools/DAEserv/DAEserv/isisds_command.h deleted file mode 100644 index f3cb5caa356676bec8ff1e5270f41fa7ace7d810..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/isisds_command.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - - @file isisds_command.h - - IDC interface - minimal socket interface to the DAE - - @author Freddie Akeroyd, STFC ISIS Facility - @date 31/07/2008 - - Copyright © 2007-8 STFC Rutherford Appleton Laboratory - - This file is part of ISIS Instrument control program. - you can redistribute it and/or modify it under the terms of the - GNU General Public License -*/ - - -#ifndef ISISDS_COMMAND_H -#define ISISDS_COMMAND_H - -typedef void (*isisds_error_report_t)(int status, int code, const char* messsage); - -#define ISISDS_PORT 6789 - -#ifdef _WIN32 -#include <winsock2.h> -#else -#define SOCKET int -#define INVALID_SOCKET -1 -#endif /* _WIN32 */ - -typedef enum { ISISDSDAEAccess = 0, ISISDSCRPTAccess = 1} ISISDSAccessMode; - -typedef enum { ISISDSUnknown = 0, ISISDSInt32 = 1, ISISDSReal32 = 2, ISISDSReal64 = 3, ISISDSChar = 4 } ISISDSDataType; -static int isisds_type_size[] = { 0, 4, 4, 8, 1 }; -static const char* isisds_type_name[] = { "Unknown", "Int32", "Real32", "Real64", "Char" }; -static const char* isisds_type_code[] = { "U00", "I32", "R32", "R64", "C08" }; /* 3 char in length */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -SOCKET isisds_send_open(const char* host, ISISDSAccessMode access_type); -int isisds_recv_open(SOCKET s, ISISDSAccessMode* access_type); -int isisds_send_command(SOCKET s, const char* command, const void* data, ISISDSDataType type, const int dims_array[], int ndims); -int isisds_recv_command_alloc(SOCKET s, char** command, void** data, ISISDSDataType* type, int dims_array[], int* ndims); -int isisds_recv_command(SOCKET s, char* command, int* len_command, void* data, ISISDSDataType* type, int dims_array[], int* ndims); -int isisds_send_close(SOCKET s); - -int isisds_set_report_func(isisds_error_report_t report_func); -int isisds_report(int status, int code, const char* format, ... ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/* - * try to align to 64 bit (8 bytes) boundaries - */ -typedef struct -{ - int len; - int ver_major; - int ver_minor; - int pid; - int access_type; /* 0 =dae, 1 = crpt */ - int pad[1]; - char user[32]; - char host[64]; -} isisds_open_t; - -/* - * used for sends and replies once a connection open - * try to align to 64 bits (8 bytes) boundaries - */ -typedef struct -{ - int len; /* of this structure plus any additional data (in bytes) */ - int type; /* ISISDSDataType */ - int ndims; - int dims_array[11]; - char command[32]; - /* additional data (if any) will follow this */ -} isisds_command_header_t; - -#endif /* ISISDS_COMMAND_H */ diff --git a/tools/DAEserv/DAEserv/resource.h b/tools/DAEserv/DAEserv/resource.h deleted file mode 100644 index 913236fb45b2a3d7fe618ff32acdf9fe0444ceb5..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/resource.h +++ /dev/null @@ -1,9 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by app.rc diff --git a/tools/DAEserv/DAEserv/stdafx.cpp b/tools/DAEserv/DAEserv/stdafx.cpp deleted file mode 100644 index c71bf0e14efdb820d1574f308bc7d38a821cdd53..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/stdafx.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -// stdafx.cpp : source file that includes just the standard includes -// DAEserv.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" \ No newline at end of file diff --git a/tools/DAEserv/DAEserv/stdafx.h b/tools/DAEserv/DAEserv/stdafx.h deleted file mode 100644 index 24b4845280a0f6371860c3f37465420c395c00b2..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/stdafx.h +++ /dev/null @@ -1,17 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -#pragma once - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include <stdio.h> -#include <tchar.h> - -// TODO: reference additional headers your program requires here - diff --git a/tools/DAEserv/DAEserv/work.cpp b/tools/DAEserv/DAEserv/work.cpp deleted file mode 100644 index acce5e24e21e00a3172696680f3fb1b34238d504..0000000000000000000000000000000000000000 --- a/tools/DAEserv/DAEserv/work.cpp +++ /dev/null @@ -1,464 +0,0 @@ -// Mantid Repository : https://github.com/mantidproject/mantid -// -// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI, -// NScD Oak Ridge National Laboratory, European Spallation Source -// & Institut Laue - Langevin -// SPDX - License - Identifier: GPL - 3.0 + -#include "stdafx.h" - -#include "isisds_command.h" - -#include <winsock2.h> -#include <ws2tcpip.h> -#include <stdlib.h> -#include <stdio.h> -#include <iostream> -#include <string> -#include <vector> -#include <valarray> -#include <ctime> -#include <fstream> -#include <boost/math/special_functions/erf.hpp> - -using namespace std; -// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib - -#define DEFAULT_BUFLEN 512 -#define DEFAULT_PORT "6789" - -#define FINISH( s ) cout<<s<<"\n"; \ - closesocket(ClientSocket); \ - WSACleanup(); \ - return 1; \ - -bool read_command(SOCKET s); -int peakFun(int i,float x, int t, float dc); - -//ofstream ofil("C:\\Mantid\\Code\\DAEserv\\release\\tmp.txt"); - -struct Workspace -{ - typedef float real_t; - Workspace() - { - - ifstream fil("configDAE.txt"); - if (!fil) - { - numberOfSpectra = 3; - numberOfBins = 100; - x_start = 0.01; - x_end = 2000; - } - else - { - fil>>numberOfSpectra - >>numberOfBins - >>x_start - >>x_end; - } - numberOfPeriods = 1; - alpha = (x_end-x_start)/(numberOfBins+1); - peakStep = (x_end-x_start)/(numberOfSpectra); - - y.resize(numberOfSpectra); - x.resize(numberOfBins+1); - float dx = alpha; - x[0] = x_start; - for(size_t i=1;i<x.size();i++) - { - if (alpha < 0) dx = -x[i-1]*alpha; - x[i] = x[i-1] + dx; - } - for(int i=0;i<numberOfSpectra;i++) - { - y[i].resize(numberOfBins+1); - for(size_t j=0;j<y[i].size();j++) - { - y[i][j] = peakFun(i,x[j],0,peakStep); - } - } - ndet = numberOfSpectra; - udet.resize(ndet); - spec.resize(ndet); - for(int i=0;i<ndet;i++) - { - udet[i] = 1000 + i + 1; - spec[i] = i+1; - } - } - valarray< real_t > x; - vector< valarray<int> > y; - int numberOfSpectra; - int numberOfPeriods; - int numberOfBins; - int ndet; - valarray<int> udet,spec; - float x_start; - float x_end; - float alpha; - float peakStep; -}; - - -struct ThreadData -{ - SOCKET s; - DWORD ID; - HANDLE thread; - time_t start_time; - bool done; -}; - -// Thread functions -DWORD WINAPI workingThread(LPVOID p); -DWORD WINAPI updatingThread(LPVOID p); - -// Global variables -Workspace workspace; -vector<ThreadData*> thData; -bool updatingData = false; -bool readingData = false; -HANDLE updatingThreadHandle = NULL; - -DWORD WINAPI startService(LPVOID p) -{ - - WSADATA wsaData; - SOCKET ListenSocket = INVALID_SOCKET, - ClientSocket = INVALID_SOCKET; - struct addrinfo *result = NULL, - hints; -// char recvbuf[DEFAULT_BUFLEN]; - int iResult;//, iSendResult; - int recvbuflen = DEFAULT_BUFLEN; - - - // Initialize Winsock - iResult = WSAStartup(MAKEWORD(2,2), &wsaData); - if (iResult != 0) { - printf("WSAStartup failed: %d\n", iResult); - return 1; - } - - ZeroMemory(&hints, sizeof(hints)); - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - hints.ai_flags = AI_PASSIVE; - - // Resolve the server address and port - iResult = getaddrinfo(NULL, DEFAULT_PORT, &hints, &result); - if ( iResult != 0 ) { - printf("getaddrinfo failed: %d\n", iResult); - WSACleanup(); - return 1; - } - - updatingThreadHandle = CreateThread(NULL,0,&updatingThread,NULL,0,NULL); - - for(;;) - { - // Create a SOCKET for connecting to server - ListenSocket = socket(result->ai_family, result->ai_socktype, 0); - if (ListenSocket == INVALID_SOCKET) { - printf("socket failed: %ld\n", WSAGetLastError()); - freeaddrinfo(result); - WSACleanup(); - return 1; - } - - // Setup the TCP listening socket - iResult = bind( ListenSocket, result->ai_addr, (int)result->ai_addrlen); - if (iResult == SOCKET_ERROR) { - printf("bind failed: %d\n", WSAGetLastError()); - freeaddrinfo(result); - closesocket(ListenSocket); - WSACleanup(); - return 1; - } - -// freeaddrinfo(result); - - iResult = listen(ListenSocket, SOMAXCONN); - if (iResult == SOCKET_ERROR) { - printf("listen failed: %d\n", WSAGetLastError()); - closesocket(ListenSocket); - WSACleanup(); - return 1; - } - - // Accept a client socket - ClientSocket = accept(ListenSocket, NULL, NULL); - if (ClientSocket == INVALID_SOCKET) { - printf("accept failed: %d\n", WSAGetLastError()); - closesocket(ListenSocket); - WSACleanup(); - return 1; - } - - // No longer need server socket - closesocket(ListenSocket); - - //ofil<<"Number of running threads "<<thData.size()<<'\n'; - ThreadData *td = new ThreadData; - td->s = ClientSocket; - td->done = false; - time_t curr_time = time(NULL); - td->start_time = curr_time; - thData.push_back(td); - td->thread = CreateThread(NULL,0,&workingThread,td,0,&td->ID); - for(vector<ThreadData*>::iterator t=thData.begin();t!=thData.end();t++) - { - if ((**t).done) - { - delete *t; - t = thData.erase(t); - } - double diff = difftime(curr_time,(**t).start_time); - //ofil<<(**t).ID<<" diff="<<diff<<endl; - // thread unfinished after 60 seconds is treated as failed and terminated - if(diff > 2. && !(**t).done) - { - cerr<<"Terminate "<<(**t).ID<<endl; - TerminateThread((**t).thread,0); - closesocket((**t).s); - delete *t; - t = thData.erase(t); - } - } - - } - - - WSACleanup(); - for(vector<ThreadData*>::iterator t=thData.begin();t!=thData.end();t++) - delete *t; - return 0; -} - -bool read_command(SOCKET s) -{ - char comm_buffer[256]; - int comm_buff_size = sizeof(comm_buffer); -// ISISDSDataType ret_type; - int sv_dims_array[1] = { 1 }, sv_ndims = 1; // used for rading single values with IDC routines -// int dims_array[2]; - - isisds_command_header_t comm; - ZeroMemory(&comm,sizeof(comm)); - int stat = recv(s, (char*)&comm, sizeof(comm), 0); - if (stat < 0) return false; - if (comm.len < 0) return false; - //ofil<<" Command "<<comm.command<<' '<<comm.len<<'\n'; - //ofil<<" Type "<<comm.type<<' '<<isisds_type_name[comm.type]<<'\n'; - //ofil<<" NDims "<<comm.ndims<<'\n'; - //for(int i=0;i<comm.ndims;i++) - // ofil<<" dim_"<<i<<"= "<<comm.dims_array[i]<<endl;//*/ - stat = recv(s, comm_buffer, comm_buff_size, 0); - //ofil<<"Data size="<<stat<<endl; - if (stat < 0) return false; - if (comm.type == ISISDSChar) - { - comm_buffer[stat] = '\0'; - string name(comm_buffer); - //ofil<<name<<endl; - if (name == "NSP1") - { - isisds_send_command(s, "OK", &workspace.numberOfSpectra, ISISDSInt32, sv_dims_array, sv_ndims); - return true; - } - - if (name == "NPER") - { - isisds_send_command(s, "OK", &workspace.numberOfPeriods, ISISDSInt32, sv_dims_array, sv_ndims); - return true; - } - - if (name == "NTC1") - { - isisds_send_command(s, "OK", &workspace.numberOfBins, ISISDSInt32, sv_dims_array, sv_ndims); - return true; - } - - if (name == "RTCB1") - { - int dim = (int)workspace.x.size(); - int n = isisds_send_command(s, "OK", &workspace.x[0], ISISDSReal32, &dim, sv_ndims); - return true; - } - - if (name == "NAME") - { - int dim = 7; - char instr[] = "DAESERV"; - int n = isisds_send_command(s, "OK", instr, ISISDSChar, &dim, sv_ndims); - return true; - } - - if (name == "CNT1") - { - int dim = (int)workspace.x.size()*workspace.y.size(); - int *data = new int[dim]; - int mv_dims_array[1], mv_ndims = 1; - mv_dims_array[0] = dim; - int k = 0; - for(size_t i=0;i<workspace.y.size();i++) - for(size_t j=0;j<workspace.y[i].size();j++) - data[k++] = workspace.y[i][j]; - isisds_send_command(s, "OK", data, ISISDSInt32, mv_dims_array, mv_ndims); - delete[] data; - return true; - } - - if (name == "RRPB") - { - int dim = 32; - float rpb[32]; - rpb[8] = 0.1; - int n = isisds_send_command(s, "OK", rpb, ISISDSReal32, &dim, sv_ndims); - return true; - } - - if (name == "NDET") - { - isisds_send_command(s, "OK", &workspace.ndet, ISISDSInt32, sv_dims_array, sv_ndims); - return true; - } - - if (name == "UDET") - { - int dim = workspace.ndet; - isisds_send_command(s, "OK", &workspace.udet[0], ISISDSInt32,&dim, sv_ndims); - return true; - } - - if (name == "SPEC") - { - int dim = workspace.ndet; - isisds_send_command(s, "OK", &workspace.spec[0], ISISDSInt32, &dim, sv_ndims); - return true; - } - - } - else if (comm.type == ISISDSInt32) - { - //ofil<<"Reading data\n"; - int *idat = (int*)comm_buffer; - int n = comm.dims_array[0]; - //for(int i=0;i<n;i++) - // ofil<<"int("<<i<<")="<<idat[i]<<'\n'; - int dim = workspace.numberOfBins+1; - int i = idat[0]-1; - if (i < 0 || i >= dim) - { - cerr<<"Spectrum number out of range\n"; - return false; - } - int res = isisds_send_command(s, "OK", &workspace.y[i][0], ISISDSInt32, &dim, sv_ndims); - return true; - } - return false; -} - -DWORD WINAPI workingThread(LPVOID p){ - - if (updatingData) WaitForSingleObject(updatingThreadHandle,10000); - readingData = true; - - ThreadData& data = *(ThreadData*)p; - SOCKET ClientSocket = data.s; - - ISISDSAccessMode access_type; - int stat = isisds_recv_open(ClientSocket, &access_type); - if (stat <= 0) - { - readingData = false; - FINISH("Couldnt connect") - } - - - // Receive until the peer shuts down the connection - bool ok = true; - do { - - //ofil<<"Running\n"; - ok = read_command(ClientSocket); - - } while (ok); - - // shutdown the connection since we're done - int iResult = shutdown(ClientSocket, SD_SEND); - if (iResult == SOCKET_ERROR) { - printf("shutdown failed: %d\n", WSAGetLastError()); - closesocket(ClientSocket); - WSACleanup(); - readingData = false; - return 1; - }//*/ - - // cleanup - closesocket(ClientSocket); - - //ofil<<"Stopping "<<data.ID<<endl; - - data.done = true; - readingData = false; - return 0; -} - - -int peakFun(int i,float xx, int t, float dc) -{ - double x = double(xx); - double I=10*t; - double a=2.; - double b=0.03; - double c=100 + double(dc)*i; - double s=8; - double bk=8; - double s2 = s*s; - double p1 = a/2*(a*s2+2*(x-c)); - double p2 = (a*s2+(x-c))/sqrt(2*s2); - double p3 = b/2*(b*s2-2*(x-c)); - double p4 = (b*s2-(x-c))/sqrt(s*s2); - if (p1 > 400) p1 = 400; - if (p1 > 400) p1 = 400; - if (p1 < -400) p1 = -400; - if (p3 > 400) p3 = 400; - if (p3 < -400) p3 = -400; - double res = I*(exp(p1)*boost::math::erfc(p2)+ exp(p3)*boost::math::erfc(p4))+bk; - return int(res); -} - -DWORD WINAPI updatingThread(LPVOID p){ - - HANDLE timer = CreateWaitableTimerA(NULL,FALSE,"tim"); - if (timer == NULL) - return -1; - - LARGE_INTEGER tstart = {0,0}; - if (!SetWaitableTimer(timer,&tstart,10000,NULL,NULL,TRUE)) - return -1; - - for(int t=0;;t++) - { - if (t > 300) t = 0; - if (WaitForSingleObject(timer,20000) == WAIT_FAILED) - return -1; - - if (readingData) continue; - updatingData = true; - int length = workspace.numberOfBins+1; - for(int i=0;i<workspace.numberOfSpectra;i++) - { - for(size_t j=0;j<length;j++) - { - workspace.y[i][j] = peakFun(i,workspace.x[j],t,workspace.peakStep); - } - } - updatingData = false; - - } - return 0; -}