53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using Getf.Service.Transfer.Core;
|
|
using SuperSocket.SocketEngine;
|
|
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 Getf.Service.Transfer.WinService
|
|
{
|
|
public partial class Service1 : ServiceBase
|
|
{
|
|
private Server _Server;
|
|
public Service1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnStart(string[] args)
|
|
{
|
|
/*var ipInfo = System.Configuration.ConfigurationManager.AppSettings["IpInfo"].Split(':');
|
|
_Server = new Server();
|
|
if (ipInfo[0] != String.Empty)
|
|
{
|
|
_Server.Setup(ipInfo[0], int.Parse(ipInfo[1]));
|
|
}
|
|
else
|
|
{
|
|
_Server.Setup(int.Parse(ipInfo[1]));
|
|
}
|
|
_Server.Start();*/
|
|
|
|
var boostrap = BootstrapFactory.CreateBootstrap();
|
|
boostrap.Initialize();
|
|
boostrap.Start();
|
|
}
|
|
|
|
protected override void OnStop()
|
|
{
|
|
if (_Server != null)
|
|
{
|
|
_Server.Stop();
|
|
_Server.Dispose();
|
|
_Server = null;
|
|
}
|
|
}
|
|
}
|
|
}
|