|
@@ -232,6 +232,22 @@ void KillProcess(const std::wstring& processName) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+bool CheckPPPConnection() {
|
|
|
+ RASCONN rasConn[256];
|
|
|
+ DWORD dwSize = sizeof(rasConn);
|
|
|
+ DWORD dwConnections = 0;
|
|
|
+ rasConn[0].dwSize = sizeof(RASCONN);
|
|
|
+
|
|
|
+ if (RasEnumConnections(rasConn, &dwSize, &dwConnections) == ERROR_SUCCESS) {
|
|
|
+ for (DWORD i = 0; i < dwConnections; i++) {
|
|
|
+ if (rasConn[i].szDeviceType == RASDT_PPPoE) {
|
|
|
+ return true; // 检测到 PPPoE 连接
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
namespace wl_base_help {
|
|
|
|
|
|
// static
|
|
@@ -259,6 +275,7 @@ WlBaseHelpPlugin::~WlBaseHelpPlugin() {}
|
|
|
void WlBaseHelpPlugin::HandleMethodCall(
|
|
|
const flutter::MethodCall<flutter::EncodableValue>& method_call,
|
|
|
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
|
|
|
+
|
|
|
if (method_call.method_name().compare("startProxy") == 0) {
|
|
|
const auto* arguments = std::get_if<flutter::EncodableMap>(method_call.arguments());
|
|
|
int port = std::get<int>(arguments->at(flutter::EncodableValue("port")));
|
|
@@ -270,9 +287,10 @@ void WlBaseHelpPlugin::HandleMethodCall(
|
|
|
} else if (method_call.method_name().compare("isProxyEnabled") == 0) {
|
|
|
bool enabled = isProxyEnabled();
|
|
|
result->Success(flutter::EncodableValue(enabled));
|
|
|
- }
|
|
|
-
|
|
|
- if (method_call.method_name().compare("isProcessRunning") == 0) {
|
|
|
+ } else if (method_call.method_name().compare("isDialUpEnabled") == 0) {
|
|
|
+ bool dialUpEnabled = isDialUpEnabled();
|
|
|
+ result->Success(flutter::EncodableValue(dialUpEnabled));
|
|
|
+ } else if (method_call.method_name().compare("isProcessRunning") == 0) {
|
|
|
const auto* arguments = std::get_if<flutter::EncodableMap>(method_call.arguments());
|
|
|
auto processName = std::get<std::string>(arguments->find(flutter::EncodableValue("processName"))->second);
|
|
|
bool isRunning = IsProcessRunning(std::wstring(processName.begin(), processName.end()));
|