bolar_2 backup

This commit is contained in:
2026-11-27 16:38:11 +08:00
commit e96d6d19df
305 changed files with 43350 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
#include "core/remote_behavior.h"
#include <cstring>
namespace borla {
const char* ToString(ButtonAction action)
{
switch (action) {
case ButtonAction::kUnspecified:
return "";
case ButtonAction::kFriendMode:
return "friend_mode";
case ButtonAction::kNetworkSwitch:
return "network_switch";
case ButtonAction::kNothing:
return "nothing";
}
return "";
}
bool ParseButtonAction(const char* value, ButtonAction* action)
{
if (value == nullptr || action == nullptr) {
return false;
}
if (std::strcmp(value, "friend_mode") == 0) {
*action = ButtonAction::kFriendMode;
return true;
}
if (std::strcmp(value, "network_switch") == 0) {
*action = ButtonAction::kNetworkSwitch;
return true;
}
if (std::strcmp(value, "nothing") == 0) {
*action = ButtonAction::kNothing;
return true;
}
return false;
}
bool IsAllowedConnectionPrompt(LocalPrompt prompt)
{
return prompt == LocalPrompt::kServerError ||
prompt == LocalPrompt::kNoNetwork ||
prompt == LocalPrompt::kError;
}
bool ParseConnectionPrompt(const char* value, LocalPrompt* prompt)
{
if (value == nullptr || prompt == nullptr) {
return false;
}
if (std::strcmp(value, "server_error") == 0) {
*prompt = LocalPrompt::kServerError;
return true;
}
if (std::strcmp(value, "no_network") == 0) {
*prompt = LocalPrompt::kNoNetwork;
return true;
}
if (std::strcmp(value, "error") == 0) {
*prompt = LocalPrompt::kError;
return true;
}
return false;
}
} // namespace borla