mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
I2P -> .NET
This commit is contained in:
parent
f176f1909b
commit
fdb0ce6703
272 changed files with 5702 additions and 8931 deletions
|
@ -11,7 +11,7 @@
|
|||
#include "Win32/Win32App.h"
|
||||
#endif
|
||||
|
||||
namespace i2p
|
||||
namespace dotnet
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace util
|
|||
if (!Daemon_Singleton::init(argc, argv))
|
||||
return false;
|
||||
|
||||
std::string serviceControl; i2p::config::GetOption("svcctl", serviceControl);
|
||||
std::string serviceControl; dotnet::config::GetOption("svcctl", serviceControl);
|
||||
if (serviceControl == "install")
|
||||
{
|
||||
LogPrint(eLogInfo, "WinSVC: installing ", SERVICE_NAME, " as service");
|
||||
|
@ -50,8 +50,8 @@ namespace util
|
|||
if (isDaemon)
|
||||
{
|
||||
LogPrint(eLogDebug, "Daemon: running as service");
|
||||
I2PService service((PSTR)SERVICE_NAME);
|
||||
if (!I2PService::Run(service))
|
||||
DotNetService service((PSTR)SERVICE_NAME);
|
||||
if (!DotNetService::Run(service))
|
||||
{
|
||||
LogPrint(eLogError, "Daemon: Service failed to run w/err 0x%08lx\n", GetLastError());
|
||||
return false;
|
||||
|
@ -71,19 +71,19 @@ namespace util
|
|||
setlocale(LC_ALL, "Russian");
|
||||
setlocale(LC_TIME, "C");
|
||||
#ifdef WIN32_APP
|
||||
if (!i2p::win32::StartWin32App ()) return false;
|
||||
if (!dotnet::win32::StartWin32App ()) return false;
|
||||
|
||||
// override log
|
||||
i2p::config::SetOption("log", std::string ("file"));
|
||||
dotnet::config::SetOption("log", std::string ("file"));
|
||||
#endif
|
||||
bool ret = Daemon_Singleton::start();
|
||||
if (ret && i2p::log::Logger().GetLogType() == eLogFile)
|
||||
if (ret && dotnet::log::Logger().GetLogType() == eLogFile)
|
||||
{
|
||||
// TODO: find out where this garbage to console comes from
|
||||
SetStdHandle(STD_OUTPUT_HANDLE, INVALID_HANDLE_VALUE);
|
||||
SetStdHandle(STD_ERROR_HANDLE, INVALID_HANDLE_VALUE);
|
||||
}
|
||||
bool insomnia; i2p::config::GetOption("insomnia", insomnia);
|
||||
bool insomnia; dotnet::config::GetOption("insomnia", insomnia);
|
||||
if (insomnia)
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED);
|
||||
return ret;
|
||||
|
@ -92,7 +92,7 @@ namespace util
|
|||
bool DaemonWin32::stop()
|
||||
{
|
||||
#ifdef WIN32_APP
|
||||
i2p::win32::StopWin32App ();
|
||||
dotnet::win32::StopWin32App ();
|
||||
#endif
|
||||
return Daemon_Singleton::stop();
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ namespace util
|
|||
void DaemonWin32::run ()
|
||||
{
|
||||
#ifdef WIN32_APP
|
||||
i2p::win32::RunWin32App ();
|
||||
dotnet::win32::RunWin32App ();
|
||||
#else
|
||||
while (running)
|
||||
{
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
#error this file is not editable by Microsoft Visual C++
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
#include "../libi2pd/version.h"
|
||||
#include "../libdotnet/version.h"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION I2PD_VERSION_MAJOR,I2PD_VERSION_MINOR,I2PD_VERSION_MICRO,I2PD_VERSION_PATCH
|
||||
PRODUCTVERSION I2P_VERSION_MAJOR,I2P_VERSION_MINOR,I2P_VERSION_MICRO,I2P_VERSION_PATCH
|
||||
FILEVERSION DOTNET_VERSION_MAJOR,DOTNET_VERSION_MINOR,DOTNET_VERSION_MICRO,DOTNET_VERSION_PATCH
|
||||
PRODUCTVERSION DOTNET_VERSION_MAJOR,DOTNET_VERSION_MINOR,DOTNET_VERSION_MICRO,DOTNET_VERSION_PATCH
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
|
@ -21,14 +21,14 @@ BEGIN
|
|||
BEGIN
|
||||
BLOCK "040904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Purple I2P"
|
||||
VALUE "FileDescription", "C++ I2P daemon"
|
||||
VALUE "FileVersion", I2PD_VERSION
|
||||
VALUE "CompanyName", "Purple DOTNET"
|
||||
VALUE "FileDescription", "C++ DOTNET daemon"
|
||||
VALUE "FileVersion", DOTNET_VERSION
|
||||
VALUE "InternalName", CODENAME
|
||||
VALUE "LegalCopyright", "Copyright (C) 2013-2017, The PurpleI2P Project"
|
||||
VALUE "OriginalFilename", "i2pd"
|
||||
VALUE "ProductName", "Purple I2P"
|
||||
VALUE "ProductVersion", I2P_VERSION
|
||||
VALUE "OriginalFilename", "dotnet"
|
||||
VALUE "ProductName", "Purple DOTNET"
|
||||
VALUE "ProductVersion", DOTNET_VERSION
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define FRAME_UPDATE_TIMER 2101
|
||||
#define IDT_GRACEFUL_TUNNELCHECK_TIMER 2102
|
||||
|
||||
namespace i2p
|
||||
namespace dotnet
|
||||
{
|
||||
namespace win32
|
||||
{
|
||||
|
@ -47,14 +47,14 @@ namespace win32
|
|||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_APP, "Show app");
|
||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_ABOUT, "&About...");
|
||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
|
||||
if(!i2p::context.AcceptsTunnels())
|
||||
if(!dotnet::context.AcceptsTunnels())
|
||||
InsertMenu (hPopup, -1,
|
||||
i2p::util::DaemonWin32::Instance ().isGraceful ? MF_BYPOSITION | MF_STRING | MF_GRAYED : MF_BYPOSITION | MF_STRING,
|
||||
dotnet::util::DaemonWin32::Instance ().isGraceful ? MF_BYPOSITION | MF_STRING | MF_GRAYED : MF_BYPOSITION | MF_STRING,
|
||||
ID_ACCEPT_TRANSIT, "Accept &transit");
|
||||
else
|
||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_DECLINE_TRANSIT, "Decline &transit");
|
||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_RELOAD, "&Reload configs");
|
||||
if (!i2p::util::DaemonWin32::Instance ().isGraceful)
|
||||
if (!dotnet::util::DaemonWin32::Instance ().isGraceful)
|
||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_GRACEFUL_SHUTDOWN, "&Graceful shutdown");
|
||||
else
|
||||
InsertMenu (hPopup, -1, MF_BYPOSITION | MF_STRING, ID_STOP_GRACEFUL_SHUTDOWN, "Stop &graceful shutdown");
|
||||
|
@ -85,8 +85,8 @@ namespace win32
|
|||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_INFO;
|
||||
nid.uCallbackMessage = WM_TRAYICON;
|
||||
nid.hIcon = LoadIcon (GetModuleHandle(NULL), MAKEINTRESOURCE (MAINICON));
|
||||
strcpy (nid.szTip, "i2pd");
|
||||
strcpy (nid.szInfo, "i2pd is starting");
|
||||
strcpy (nid.szTip, "dotnet");
|
||||
strcpy (nid.szInfo, "dotnet is starting");
|
||||
Shell_NotifyIcon(NIM_ADD, &nid );
|
||||
}
|
||||
|
||||
|
@ -140,14 +140,14 @@ namespace win32
|
|||
{
|
||||
s << "\n";
|
||||
s << "Status: ";
|
||||
switch (i2p::context.GetStatus())
|
||||
switch (dotnet::context.GetStatus())
|
||||
{
|
||||
case eRouterStatusOK: s << "OK"; break;
|
||||
case eRouterStatusTesting: s << "Testing"; break;
|
||||
case eRouterStatusFirewalled: s << "Firewalled"; break;
|
||||
case eRouterStatusError:
|
||||
{
|
||||
switch (i2p::context.GetError())
|
||||
switch (dotnet::context.GetError())
|
||||
{
|
||||
case eRouterErrorClockSkew: s << "Clock skew"; break;
|
||||
default: s << "Error";
|
||||
|
@ -157,8 +157,8 @@ namespace win32
|
|||
default: s << "Unknown";
|
||||
}
|
||||
s << "; ";
|
||||
s << "Success Rate: " << i2p::tunnel::tunnels.GetTunnelCreationSuccessRate() << "%\n";
|
||||
s << "Uptime: "; ShowUptime(s, i2p::context.GetUptime ());
|
||||
s << "Success Rate: " << dotnet::tunnel::tunnels.GetTunnelCreationSuccessRate() << "%\n";
|
||||
s << "Uptime: "; ShowUptime(s, dotnet::context.GetUptime ());
|
||||
if (GracefulShutdownEndtime != 0)
|
||||
{
|
||||
DWORD GracefulTimeLeft = (GracefulShutdownEndtime - GetTickCount()) / 1000;
|
||||
|
@ -166,18 +166,18 @@ namespace win32
|
|||
}
|
||||
else
|
||||
s << "\n";
|
||||
s << "Inbound: " << i2p::transport::transports.GetInBandwidth() / 1024 << " KiB/s; ";
|
||||
s << "Outbound: " << i2p::transport::transports.GetOutBandwidth() / 1024 << " KiB/s\n";
|
||||
s << "Received: "; ShowTransfered (s, i2p::transport::transports.GetTotalReceivedBytes());
|
||||
s << "Sent: "; ShowTransfered (s, i2p::transport::transports.GetTotalSentBytes());
|
||||
s << "Inbound: " << dotnet::transport::transports.GetInBandwidth() / 1024 << " KiB/s; ";
|
||||
s << "Outbound: " << dotnet::transport::transports.GetOutBandwidth() / 1024 << " KiB/s\n";
|
||||
s << "Received: "; ShowTransfered (s, dotnet::transport::transports.GetTotalReceivedBytes());
|
||||
s << "Sent: "; ShowTransfered (s, dotnet::transport::transports.GetTotalSentBytes());
|
||||
s << "\n";
|
||||
s << "Routers: " << i2p::data::netdb.GetNumRouters () << "; ";
|
||||
s << "Floodfills: " << i2p::data::netdb.GetNumFloodfills () << "; ";
|
||||
s << "LeaseSets: " << i2p::data::netdb.GetNumLeaseSets () << "\n";
|
||||
s << "Routers: " << dotnet::data::netdb.GetNumRouters () << "; ";
|
||||
s << "Floodfills: " << dotnet::data::netdb.GetNumFloodfills () << "; ";
|
||||
s << "LeaseSets: " << dotnet::data::netdb.GetNumLeaseSets () << "\n";
|
||||
s << "Tunnels: ";
|
||||
s << "In: " << i2p::tunnel::tunnels.CountInboundTunnels() << "; ";
|
||||
s << "Out: " << i2p::tunnel::tunnels.CountOutboundTunnels() << "; ";
|
||||
s << "Transit: " << i2p::tunnel::tunnels.CountTransitTunnels() << "\n";
|
||||
s << "In: " << dotnet::tunnel::tunnels.CountInboundTunnels() << "; ";
|
||||
s << "Out: " << dotnet::tunnel::tunnels.CountOutboundTunnels() << "; ";
|
||||
s << "Transit: " << dotnet::tunnel::tunnels.CountTransitTunnels() << "\n";
|
||||
s << "\n";
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,8 @@ namespace win32
|
|||
case ID_ABOUT:
|
||||
{
|
||||
std::stringstream text;
|
||||
text << "Version: " << I2PD_VERSION << " " << CODENAME;
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
|
||||
text << "Version: " << DOTNET_VERSION << " " << CODENAME;
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("dotnet"), MB_ICONINFORMATION | MB_OK );
|
||||
return 0;
|
||||
}
|
||||
case ID_EXIT:
|
||||
|
@ -220,51 +220,51 @@ namespace win32
|
|||
}
|
||||
case ID_ACCEPT_TRANSIT:
|
||||
{
|
||||
i2p::context.SetAcceptsTunnels (true);
|
||||
dotnet::context.SetAcceptsTunnels (true);
|
||||
std::stringstream text;
|
||||
text << "I2Pd now accept transit tunnels";
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
|
||||
text << "DOTNET now accept transit tunnels";
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("dotnet"), MB_ICONINFORMATION | MB_OK );
|
||||
return 0;
|
||||
}
|
||||
case ID_DECLINE_TRANSIT:
|
||||
{
|
||||
i2p::context.SetAcceptsTunnels (false);
|
||||
dotnet::context.SetAcceptsTunnels (false);
|
||||
std::stringstream text;
|
||||
text << "I2Pd now decline new transit tunnels";
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
|
||||
text << "DOTNET now decline new transit tunnels";
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("dotnet"), MB_ICONINFORMATION | MB_OK );
|
||||
return 0;
|
||||
}
|
||||
case ID_GRACEFUL_SHUTDOWN:
|
||||
{
|
||||
i2p::context.SetAcceptsTunnels (false);
|
||||
dotnet::context.SetAcceptsTunnels (false);
|
||||
SetTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER, 10*60*1000, nullptr); // 10 minutes
|
||||
SetTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER, 1000, nullptr); // check tunnels every second
|
||||
GracefulShutdownEndtime = GetTickCount() + 10*60*1000;
|
||||
i2p::util::DaemonWin32::Instance ().isGraceful = true;
|
||||
dotnet::util::DaemonWin32::Instance ().isGraceful = true;
|
||||
return 0;
|
||||
}
|
||||
case ID_STOP_GRACEFUL_SHUTDOWN:
|
||||
{
|
||||
i2p::context.SetAcceptsTunnels (true);
|
||||
dotnet::context.SetAcceptsTunnels (true);
|
||||
KillTimer (hWnd, IDT_GRACEFUL_SHUTDOWN_TIMER);
|
||||
KillTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER);
|
||||
GracefulShutdownEndtime = 0;
|
||||
i2p::util::DaemonWin32::Instance ().isGraceful = false;
|
||||
dotnet::util::DaemonWin32::Instance ().isGraceful = false;
|
||||
return 0;
|
||||
}
|
||||
case ID_RELOAD:
|
||||
{
|
||||
i2p::client::context.ReloadConfig();
|
||||
dotnet::client::context.ReloadConfig();
|
||||
std::stringstream text;
|
||||
text << "I2Pd reloading configs...";
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("i2pd"), MB_ICONINFORMATION | MB_OK );
|
||||
text << "DOTNET reloading configs...";
|
||||
MessageBox( hWnd, TEXT(text.str ().c_str ()), TEXT("dotnet"), MB_ICONINFORMATION | MB_OK );
|
||||
return 0;
|
||||
}
|
||||
case ID_CONSOLE:
|
||||
{
|
||||
char buf[30];
|
||||
std::string httpAddr; i2p::config::GetOption("http.address", httpAddr);
|
||||
uint16_t httpPort; i2p::config::GetOption("http.port", httpPort);
|
||||
std::string httpAddr; dotnet::config::GetOption("http.address", httpAddr);
|
||||
uint16_t httpPort; dotnet::config::GetOption("http.port", httpPort);
|
||||
snprintf(buf, 30, "http://%s:%d", httpAddr.c_str(), httpPort);
|
||||
ShellExecute(NULL, "open", buf, NULL, NULL, SW_SHOWNORMAL);
|
||||
return 0;
|
||||
|
@ -290,7 +290,7 @@ namespace win32
|
|||
}
|
||||
case SC_CLOSE:
|
||||
{
|
||||
std::string close; i2p::config::GetOption("close", close);
|
||||
std::string close; dotnet::config::GetOption("close", close);
|
||||
if (0 == close.compare("ask"))
|
||||
switch(::MessageBox(hWnd, "Would you like to minimize instead of exiting?"
|
||||
" You can add 'close' configuration option. Valid values are: ask, minimize, exit.",
|
||||
|
@ -346,7 +346,7 @@ namespace win32
|
|||
}
|
||||
case IDT_GRACEFUL_TUNNELCHECK_TIMER:
|
||||
{
|
||||
if (i2p::tunnel::tunnels.CountTransitTunnels() == 0)
|
||||
if (dotnet::tunnel::tunnels.CountTransitTunnels() == 0)
|
||||
PostMessage (hWnd, WM_CLOSE, 0, 0);
|
||||
else
|
||||
SetTimer (hWnd, IDT_GRACEFUL_TUNNELCHECK_TIMER, 1000, nullptr);
|
||||
|
@ -384,9 +384,9 @@ namespace win32
|
|||
|
||||
bool StartWin32App ()
|
||||
{
|
||||
if (FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd")))
|
||||
if (FindWindow (DOTNET_WIN32_CLASSNAME, TEXT("dotnet")))
|
||||
{
|
||||
MessageBox(NULL, TEXT("I2Pd is running already"), TEXT("Warning"), MB_OK);
|
||||
MessageBox(NULL, TEXT("DOTNET is running already"), TEXT("Warning"), MB_OK);
|
||||
return false;
|
||||
}
|
||||
// register main window
|
||||
|
@ -404,10 +404,10 @@ namespace win32
|
|||
//wclx.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wclx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wclx.lpszMenuName = NULL;
|
||||
wclx.lpszClassName = I2PD_WIN32_CLASSNAME;
|
||||
wclx.lpszClassName = DOTNET_WIN32_CLASSNAME;
|
||||
RegisterClassEx (&wclx);
|
||||
// create new window
|
||||
if (!CreateWindow(I2PD_WIN32_CLASSNAME, TEXT("i2pd"), WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 100, 100, 350, 210, NULL, NULL, hInst, NULL))
|
||||
if (!CreateWindow(DOTNET_WIN32_CLASSNAME, TEXT("dotnet"), WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 100, 100, 350, 210, NULL, NULL, hInst, NULL))
|
||||
{
|
||||
MessageBox(NULL, "Failed to create main window", TEXT("Warning!"), MB_ICONERROR | MB_OK | MB_TOPMOST);
|
||||
return false;
|
||||
|
@ -428,15 +428,15 @@ namespace win32
|
|||
|
||||
void StopWin32App ()
|
||||
{
|
||||
HWND hWnd = FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd"));
|
||||
HWND hWnd = FindWindow (DOTNET_WIN32_CLASSNAME, TEXT("dotnet"));
|
||||
if (hWnd)
|
||||
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_EXIT, 0), 0);
|
||||
UnregisterClass (I2PD_WIN32_CLASSNAME, GetModuleHandle(NULL));
|
||||
UnregisterClass (DOTNET_WIN32_CLASSNAME, GetModuleHandle(NULL));
|
||||
}
|
||||
|
||||
bool GracefulShutdown ()
|
||||
{
|
||||
HWND hWnd = FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd"));
|
||||
HWND hWnd = FindWindow (DOTNET_WIN32_CLASSNAME, TEXT("dotnet"));
|
||||
if (hWnd)
|
||||
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_GRACEFUL_SHUTDOWN, 0), 0);
|
||||
return hWnd;
|
||||
|
@ -444,7 +444,7 @@ namespace win32
|
|||
|
||||
bool StopGracefulShutdown ()
|
||||
{
|
||||
HWND hWnd = FindWindow (I2PD_WIN32_CLASSNAME, TEXT("i2pd"));
|
||||
HWND hWnd = FindWindow (DOTNET_WIN32_CLASSNAME, TEXT("dotnet"));
|
||||
if (hWnd)
|
||||
PostMessage (hWnd, WM_COMMAND, MAKEWPARAM(ID_STOP_GRACEFUL_SHUTDOWN, 0), 0);
|
||||
return hWnd;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef WIN32APP_H__
|
||||
#define WIN32APP_H__
|
||||
|
||||
#define I2PD_WIN32_CLASSNAME "i2pd main window"
|
||||
#define DOTNET_WIN32_CLASSNAME "dotnet main window"
|
||||
|
||||
namespace i2p
|
||||
namespace dotnet
|
||||
{
|
||||
namespace win32
|
||||
{
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include "Daemon.h"
|
||||
#include "Log.h"
|
||||
|
||||
I2PService *I2PService::s_service = NULL;
|
||||
DotNetService *DotNetService::s_service = NULL;
|
||||
|
||||
BOOL I2PService::isService()
|
||||
BOOL DotNetService::isService()
|
||||
{
|
||||
BOOL bIsService = FALSE;
|
||||
HWINSTA hWinStation = GetProcessWindowStation();
|
||||
|
@ -27,7 +27,7 @@ BOOL I2PService::isService()
|
|||
return bIsService;
|
||||
}
|
||||
|
||||
BOOL I2PService::Run(I2PService &service)
|
||||
BOOL DotNetService::Run(DotNetService &service)
|
||||
{
|
||||
s_service = &service;
|
||||
SERVICE_TABLE_ENTRY serviceTable[] =
|
||||
|
@ -38,7 +38,7 @@ BOOL I2PService::Run(I2PService &service)
|
|||
return StartServiceCtrlDispatcher(serviceTable);
|
||||
}
|
||||
|
||||
void WINAPI I2PService::ServiceMain(DWORD dwArgc, PSTR *pszArgv)
|
||||
void WINAPI DotNetService::ServiceMain(DWORD dwArgc, PSTR *pszArgv)
|
||||
{
|
||||
assert(s_service != NULL);
|
||||
s_service->m_statusHandle = RegisterServiceCtrlHandler(
|
||||
|
@ -51,7 +51,7 @@ void WINAPI I2PService::ServiceMain(DWORD dwArgc, PSTR *pszArgv)
|
|||
}
|
||||
|
||||
|
||||
void WINAPI I2PService::ServiceCtrlHandler(DWORD dwCtrl)
|
||||
void WINAPI DotNetService::ServiceCtrlHandler(DWORD dwCtrl)
|
||||
{
|
||||
switch (dwCtrl)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ void WINAPI I2PService::ServiceCtrlHandler(DWORD dwCtrl)
|
|||
}
|
||||
}
|
||||
|
||||
I2PService::I2PService(PSTR pszServiceName,
|
||||
DotNetService::DotNetService(PSTR pszServiceName,
|
||||
BOOL fCanStop,
|
||||
BOOL fCanShutdown,
|
||||
BOOL fCanPauseContinue)
|
||||
|
@ -97,7 +97,7 @@ I2PService::I2PService(PSTR pszServiceName,
|
|||
}
|
||||
}
|
||||
|
||||
I2PService::~I2PService(void)
|
||||
DotNetService::~DotNetService(void)
|
||||
{
|
||||
if (m_hStoppedEvent)
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ I2PService::~I2PService(void)
|
|||
}
|
||||
}
|
||||
|
||||
void I2PService::Start(DWORD dwArgc, PSTR *pszArgv)
|
||||
void DotNetService::Start(DWORD dwArgc, PSTR *pszArgv)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -126,18 +126,18 @@ void I2PService::Start(DWORD dwArgc, PSTR *pszArgv)
|
|||
}
|
||||
}
|
||||
|
||||
void I2PService::OnStart(DWORD dwArgc, PSTR *pszArgv)
|
||||
void DotNetService::OnStart(DWORD dwArgc, PSTR *pszArgv)
|
||||
{
|
||||
LogPrint(eLogInfo, "Win32Service in OnStart", EVENTLOG_INFORMATION_TYPE);
|
||||
Daemon.start();
|
||||
//i2p::util::config::OptionParser(dwArgc, pszArgv);
|
||||
//i2p::util::filesystem::ReadConfigFile(i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs);
|
||||
//i2p::context.OverrideNTCPAddress(i2p::util::config::GetCharArg("-host", "127.0.0.1"),
|
||||
// i2p::util::config::GetArg("-port", 17070));
|
||||
_worker = new std::thread(std::bind(&I2PService::WorkerThread, this));
|
||||
//dotnet::util::config::OptionParser(dwArgc, pszArgv);
|
||||
//dotnet::util::filesystem::ReadConfigFile(dotnet::util::config::mapArgs, dotnet::util::config::mapMultiArgs);
|
||||
//dotnet::context.OverrideNTCPAddress(dotnet::util::config::GetCharArg("-host", "127.0.0.1"),
|
||||
// dotnet::util::config::GetArg("-port", 17070));
|
||||
_worker = new std::thread(std::bind(&DotNetService::WorkerThread, this));
|
||||
}
|
||||
|
||||
void I2PService::WorkerThread()
|
||||
void DotNetService::WorkerThread()
|
||||
{
|
||||
while (!m_fStopping)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ void I2PService::WorkerThread()
|
|||
SetEvent(m_hStoppedEvent);
|
||||
}
|
||||
|
||||
void I2PService::Stop()
|
||||
void DotNetService::Stop()
|
||||
{
|
||||
DWORD dwOriginalState = m_status.dwCurrentState;
|
||||
try
|
||||
|
@ -168,7 +168,7 @@ void I2PService::Stop()
|
|||
}
|
||||
}
|
||||
|
||||
void I2PService::OnStop()
|
||||
void DotNetService::OnStop()
|
||||
{
|
||||
// Log a service stop message to the Application log.
|
||||
LogPrint(eLogInfo, "Win32Service in OnStop", EVENTLOG_INFORMATION_TYPE);
|
||||
|
@ -182,7 +182,7 @@ void I2PService::OnStop()
|
|||
delete _worker;
|
||||
}
|
||||
|
||||
void I2PService::Pause()
|
||||
void DotNetService::Pause()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -202,11 +202,11 @@ void I2PService::Pause()
|
|||
}
|
||||
}
|
||||
|
||||
void I2PService::OnPause()
|
||||
void DotNetService::OnPause()
|
||||
{
|
||||
}
|
||||
|
||||
void I2PService::Continue()
|
||||
void DotNetService::Continue()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -226,11 +226,11 @@ void I2PService::Continue()
|
|||
}
|
||||
}
|
||||
|
||||
void I2PService::OnContinue()
|
||||
void DotNetService::OnContinue()
|
||||
{
|
||||
}
|
||||
|
||||
void I2PService::Shutdown()
|
||||
void DotNetService::Shutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -247,11 +247,11 @@ void I2PService::Shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
void I2PService::OnShutdown()
|
||||
void DotNetService::OnShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
void I2PService::SetServiceStatus(DWORD dwCurrentState,
|
||||
void DotNetService::SetServiceStatus(DWORD dwCurrentState,
|
||||
DWORD dwWin32ExitCode,
|
||||
DWORD dwWaitHint)
|
||||
{
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
// Internal name of the service
|
||||
#define SERVICE_NAME "i2pdService"
|
||||
#define SERVICE_NAME "dotnetService"
|
||||
|
||||
// Displayed name of the service
|
||||
#define SERVICE_DISPLAY_NAME "i2pd router service"
|
||||
#define SERVICE_DISPLAY_NAME "dotnet router service"
|
||||
|
||||
// Service start options.
|
||||
#define SERVICE_START_TYPE SERVICE_DEMAND_START
|
||||
|
@ -24,19 +24,19 @@
|
|||
#define SERVICE_PASSWORD NULL
|
||||
#endif
|
||||
|
||||
class I2PService
|
||||
class DotNetService
|
||||
{
|
||||
public:
|
||||
|
||||
I2PService(PSTR pszServiceName,
|
||||
DotNetService(PSTR pszServiceName,
|
||||
BOOL fCanStop = TRUE,
|
||||
BOOL fCanShutdown = TRUE,
|
||||
BOOL fCanPauseContinue = FALSE);
|
||||
|
||||
virtual ~I2PService(void);
|
||||
virtual ~DotNetService(void);
|
||||
|
||||
static BOOL isService();
|
||||
static BOOL Run(I2PService &service);
|
||||
static BOOL Run(DotNetService &service);
|
||||
void Stop();
|
||||
|
||||
protected:
|
||||
|
@ -59,7 +59,7 @@ private:
|
|||
void Pause();
|
||||
void Continue();
|
||||
void Shutdown();
|
||||
static I2PService* s_service;
|
||||
static DotNetService* s_service;
|
||||
PSTR m_name;
|
||||
SERVICE_STATUS m_status;
|
||||
SERVICE_STATUS_HANDLE m_statusHandle;
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
#define I2Pd_AppName "i2pd"
|
||||
#define I2Pd_ver "2.25.0"
|
||||
#define I2Pd_Publisher "PurpleI2P"
|
||||
#define DOTNET_AppName "dotnet"
|
||||
#define DOTNET_ver "2.25.0"
|
||||
#define DOTNET_Publisher "PurpleI2P"
|
||||
|
||||
[Setup]
|
||||
AppName={#I2Pd_AppName}
|
||||
AppVersion={#I2Pd_ver}
|
||||
AppPublisher={#I2Pd_Publisher}
|
||||
DefaultDirName={pf}\I2Pd
|
||||
DefaultGroupName=I2Pd
|
||||
UninstallDisplayIcon={app}\I2Pd.exe
|
||||
AppName={#DOTNET_AppName}
|
||||
AppVersion={#DOTNET_ver}
|
||||
AppPublisher={#DOTNET_Publisher}
|
||||
DefaultDirName={pf}\DOTNET
|
||||
DefaultGroupName=DOTNET
|
||||
UninstallDisplayIcon={app}\DOTNET.exe
|
||||
OutputDir=.
|
||||
LicenseFile=../LICENSE
|
||||
OutputBaseFilename=setup_{#I2Pd_AppName}_v{#I2Pd_ver}
|
||||
OutputBaseFilename=setup_{#DOTNET_AppName}_v{#DOTNET_ver}
|
||||
SetupIconFile=mask.ico
|
||||
InternalCompressLevel=ultra64
|
||||
Compression=lzma/ultra64
|
||||
SolidCompression=true
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
AppVerName={#I2Pd_AppName}
|
||||
AppVerName={#DOTNET_AppName}
|
||||
ExtraDiskSpaceRequired=15
|
||||
AppID={{621A23E0-3CF4-4BD6-97BC-4835EA5206A2}
|
||||
AppPublisherURL=http://i2pd.website/
|
||||
AppSupportURL=https://github.com/PurpleI2P/i2pd/issues
|
||||
AppUpdatesURL=https://github.com/PurpleI2P/i2pd/releases
|
||||
AppPublisherURL=http://dotnet.website/
|
||||
AppSupportURL=https://github.com/PurpleI2P/dotnet/issues
|
||||
AppUpdatesURL=https://github.com/PurpleI2P/dotnet/releases
|
||||
|
||||
[Files]
|
||||
Source: ..\i2pd_x86.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: not IsWin64
|
||||
Source: ..\i2pd_x64.exe; DestDir: {app}; DestName: i2pd.exe; Flags: ignoreversion; Check: IsWin64
|
||||
Source: ..\dotnet_x86.exe; DestDir: {app}; DestName: dotnet.exe; Flags: ignoreversion; Check: not IsWin64
|
||||
Source: ..\dotnet_x64.exe; DestDir: {app}; DestName: dotnet.exe; Flags: ignoreversion; Check: IsWin64
|
||||
Source: ..\README.md; DestDir: {app}; DestName: Readme.txt; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\i2pd.conf; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\subscriptions.txt; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\tunnels.conf; DestDir: {userappdata}\i2pd; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\certificates\*; DestDir: {userappdata}\i2pd\certificates; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
||||
Source: ..\contrib\tunnels.d\*; DestDir: {userappdata}\i2pd\tunnels.d; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
||||
Source: ..\contrib\dotnet.conf; DestDir: {userappdata}\dotnet; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\subscriptions.txt; DestDir: {userappdata}\dotnet; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\tunnels.conf; DestDir: {userappdata}\dotnet; Flags: onlyifdoesntexist
|
||||
Source: ..\contrib\certificates\*; DestDir: {userappdata}\dotnet\certificates; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
||||
Source: ..\contrib\tunnels.d\*; DestDir: {userappdata}\dotnet\tunnels.d; Flags: onlyifdoesntexist recursesubdirs createallsubdirs
|
||||
|
||||
[Icons]
|
||||
Name: {group}\I2Pd; Filename: {app}\i2pd.exe
|
||||
Name: {group}\DOTNET; Filename: {app}\dotnet.exe
|
||||
Name: {group}\Readme; Filename: {app}\Readme.txt
|
||||
|
||||
[UninstallDelete]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue