1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-11 05:43:26 +00:00

stub out projects for the solution

This commit is contained in:
Kyle Spearrin
2017-05-11 21:50:13 -04:00
parent e5f3b30edd
commit 3de0755fb3
25 changed files with 2067 additions and 0 deletions

62
src/Service/Service.cs Normal file
View File

@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace Service
{
[DesignerCategory("Code")]
public class Service : ServiceBase
{
private IContainer _components;
private EventLog _eventLog;
public Service()
{
ServiceName = "bitwarden Directory Connector";
_components = new Container();
_eventLog = new EventLog();
_eventLog.Source = ServiceName;
_eventLog.Log = "bitwarden";
var eventLogSupprot = _eventLog as ISupportInitialize;
eventLogSupprot.BeginInit();
if(!EventLog.SourceExists(_eventLog.Source))
{
EventLog.CreateEventSource(ServiceName, _eventLog.Log);
}
eventLogSupprot.EndInit();
}
protected override void Dispose(bool disposing)
{
if(disposing)
{
_eventLog?.Dispose();
_eventLog = null;
_components?.Dispose();
_components = null;
}
base.Dispose(disposing);
}
protected override void OnStart(string[] args)
{
_eventLog.WriteEntry("Service started!", EventLogEntryType.Information);
}
protected override void OnStop()
{
_eventLog.WriteEntry("Service stopped!", EventLogEntryType.Information);
}
}
}