stuff
This commit is contained in:
parent
e1dde73f42
commit
8a496e779b
@ -1,14 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.ServiceProcess;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
|
using System.ServiceProcess;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
using BlubbFish.Utils;
|
using BlubbFish.Utils;
|
||||||
|
|
||||||
namespace NetMonitorServer {
|
namespace NetMonitorServer {
|
||||||
@ -17,6 +14,7 @@ namespace NetMonitorServer {
|
|||||||
private static UdpClient receiveStream;
|
private static UdpClient receiveStream;
|
||||||
private static FileLogger log;
|
private static FileLogger log;
|
||||||
private static OwnObject.LogLevel loglevel;
|
private static OwnObject.LogLevel loglevel;
|
||||||
|
|
||||||
public MainService() {
|
public MainService() {
|
||||||
string folder = Factory.getSettings().getValue("program", "logfolder");
|
string folder = Factory.getSettings().getValue("program", "logfolder");
|
||||||
folder = folder.EndsWith("\\") ? folder : folder + "\\";
|
folder = folder.EndsWith("\\") ? folder : folder + "\\";
|
||||||
|
|||||||
@ -1,139 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{7813196F-D729-44A2-81C7-82BB83E207F5}</ProjectGuid>
|
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
<RootNamespace>NetMonitorServer</RootNamespace>
|
<RootNamespace>NetmonitorServer</RootNamespace>
|
||||||
<AssemblyName>NetMonitorServer</AssemblyName>
|
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
|
||||||
<TargetFrameworkProfile>
|
|
||||||
</TargetFrameworkProfile>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
|
||||||
<PublishUrl>veröffentlichen\</PublishUrl>
|
|
||||||
<Install>true</Install>
|
|
||||||
<InstallFrom>Disk</InstallFrom>
|
|
||||||
<UpdateEnabled>false</UpdateEnabled>
|
|
||||||
<UpdateMode>Foreground</UpdateMode>
|
|
||||||
<UpdateInterval>7</UpdateInterval>
|
|
||||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
|
||||||
<UpdatePeriodically>false</UpdatePeriodically>
|
|
||||||
<UpdateRequired>false</UpdateRequired>
|
|
||||||
<MapFileExtensions>true</MapFileExtensions>
|
|
||||||
<ApplicationRevision>0</ApplicationRevision>
|
|
||||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>..\bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
|
||||||
<DebugType>none</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>..\bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>
|
|
||||||
</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<StartupObject />
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
|
||||||
<Reference Include="System.Configuration.Install" />
|
<PackageReference Include="TopShelf.ServiceInstaller" Version="4.3.0" />
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Windows.Forms" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.ServiceProcess" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ActionClass.cs" />
|
<ProjectReference Include="..\..\Utils\Utils\Utils\Utils.csproj" />
|
||||||
<Compile Include="Controller\OpenVpnController.cs" />
|
|
||||||
<Compile Include="Factory.cs" />
|
|
||||||
<Compile Include="Actions\SetOpenVPNService.cs" />
|
|
||||||
<Compile Include="Actions\SetService.cs" />
|
|
||||||
<Compile Include="MainService.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="MainService.Designer.cs">
|
|
||||||
<DependentUpon>MainService.cs</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Program.cs">
|
|
||||||
<SubType>Component</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
|
||||||
<Compile Include="Actions\SetNetworks.cs" />
|
|
||||||
<Compile Include="ServerModel.cs" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<EmbeddedResource Include="MainService.resx">
|
|
||||||
<DependentUpon>MainService.cs</DependentUpon>
|
|
||||||
</EmbeddedResource>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="icon.ico" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\Utils\Utils\Utils.csproj">
|
|
||||||
<Project>{fac8ce64-bf13-4ece-8097-aeb5dd060098}</Project>
|
|
||||||
<Name>Utils</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="app.manifest">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
|
|
||||||
<Install>true</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
|
||||||
<Visible>False</Visible>
|
|
||||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
|
||||||
<Install>false</Install>
|
|
||||||
</BootstrapperPackage>
|
|
||||||
</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>
|
</Project>
|
||||||
@ -1,21 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
<PropertyGroup />
|
||||||
<StartArguments>-r</StartArguments>
|
<ItemGroup>
|
||||||
<StartAction>Program</StartAction>
|
<Compile Update="MainService.cs">
|
||||||
<StartProgram>D:\Visual Studio 2012\Projects\netmonitor\bin\Debug\NetMonitorServer.exe</StartProgram>
|
<SubType>Component</SubType>
|
||||||
</PropertyGroup>
|
</Compile>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
<Compile Update="Program.cs">
|
||||||
<StartArguments>-r</StartArguments>
|
<SubType>Component</SubType>
|
||||||
</PropertyGroup>
|
</Compile>
|
||||||
<PropertyGroup>
|
</ItemGroup>
|
||||||
<PublishUrlHistory>veröffentlichen\</PublishUrlHistory>
|
|
||||||
<InstallUrlHistory />
|
|
||||||
<SupportUrlHistory />
|
|
||||||
<UpdateUrlHistory />
|
|
||||||
<BootstrapperUrlHistory />
|
|
||||||
<ErrorReportUrlHistory />
|
|
||||||
<FallbackCulture>de-DE</FallbackCulture>
|
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
|
||||||
</PropertyGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,48 +1,42 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.ServiceProcess;
|
|
||||||
using System.Text;
|
|
||||||
using System.Configuration.Install;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Configuration.Install;
|
||||||
|
using System.ServiceProcess;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using BlubbFish.Utils;
|
||||||
|
|
||||||
namespace NetMonitorServer {
|
namespace NetMonitorServer {
|
||||||
[RunInstaller(true)]
|
[RunInstaller(true)]
|
||||||
public class TestWinInstaller : Installer {
|
public class InstallWindowsService : Installer {
|
||||||
private ServiceInstaller m_ThisService;
|
public InstallWindowsService() {
|
||||||
private ServiceProcessInstaller m_ThisServiceProcess;
|
this.Installers.Add(new ServiceInstaller {
|
||||||
|
ServiceName = "NetMonitorServer",
|
||||||
public TestWinInstaller() {
|
StartType = ServiceStartMode.Automatic,
|
||||||
m_ThisService = new ServiceInstaller();
|
Description = "Teil von NetMonitor der die Systemnahen Befele ausführt",
|
||||||
m_ThisServiceProcess = new ServiceProcessInstaller();
|
DisplayName = "Netmonitor Server"
|
||||||
|
});
|
||||||
m_ThisServiceProcess.Account = ServiceAccount.LocalSystem;
|
this.Installers.Add(new ServiceProcessInstaller {
|
||||||
m_ThisService.ServiceName = "NetMonitorServer";
|
Account = ServiceAccount.LocalSystem
|
||||||
m_ThisService.StartType = ServiceStartMode.Automatic;
|
});
|
||||||
m_ThisService.Description = "Teil von NetMonitor der die Systemnahen Befele ausführt";
|
|
||||||
m_ThisService.DisplayName = "Netzwerk Settings Tool";
|
|
||||||
|
|
||||||
Installers.Add(m_ThisService);
|
|
||||||
Installers.Add(m_ThisServiceProcess);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static class Program {
|
|
||||||
/// <summary>
|
class Program {
|
||||||
/// The main entry point for the application.
|
static void Main(String[] args) => new Program(args);
|
||||||
/// </summary>
|
|
||||||
static void Main(string[] args) {
|
public Program(String[] args) {
|
||||||
if(args.Length == 0) {
|
CmdArgs.Instance.SetArguments(new Dictionary<String, CmdArgs.VaildArguments> {
|
||||||
ServiceBase[] ServicesToRun;
|
{ "-r", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single, false) }
|
||||||
ServicesToRun = new ServiceBase[]
|
}, args);
|
||||||
{
|
|
||||||
new MainService()
|
if(CmdArgs.Instance.HasArgumentType("-r")) {
|
||||||
};
|
ServiceBase.Run(new ServiceBase[] { new MainService() });
|
||||||
ServiceBase.Run(ServicesToRun);
|
} else {
|
||||||
} else if(args.Length == 1 && args[0] == "-r") {
|
new MainService().StartServiceConsole(args);
|
||||||
MainService s = new MainService();
|
|
||||||
s.StartServiceConsole(args);
|
|
||||||
while(true) {
|
while(true) {
|
||||||
System.Threading.Thread.Sleep(100);
|
Thread.Sleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,31 +1,18 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using BlubbFish.Utils;
|
||||||
using System.Diagnostics;
|
|
||||||
using NetMonitorServer.Controller;
|
using NetMonitorServer.Controller;
|
||||||
|
|
||||||
namespace NetMonitorServer {
|
namespace NetMonitorServer {
|
||||||
class ServerModel {
|
class ServerModel : OwnSingeton<ServerModel> {
|
||||||
private static volatile ServerModel instance;
|
|
||||||
private static object syncRoot = new Object();
|
|
||||||
public static ServerModel Instance {
|
|
||||||
get {
|
|
||||||
if(instance == null) {
|
|
||||||
lock(syncRoot) {
|
|
||||||
if(instance == null)
|
|
||||||
instance = new ServerModel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private ServerModel() {
|
|
||||||
openvpnInstances = new Dictionary<string, OpenVpnController>();
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Openvpn Instanzen Dictionary
|
/// Openvpn Instanzen Dictionary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Dictionary<string, OpenVpnController> openvpnInstances;
|
public Dictionary<String, OpenVpnController> openvpnInstances;
|
||||||
|
|
||||||
|
private ServerModel() => this.openvpnInstances = new Dictionary<String, OpenVpnController>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user