Tabs/Spaces consistency.

This commit is contained in:
orkira 2018-01-22 15:50:00 +06:00
parent c39db5baa7
commit 31e760390d
5 changed files with 40 additions and 40 deletions

View File

@ -19,11 +19,11 @@
"Type": "Runtime", "Type": "Runtime",
"LoadingPhase": "PreDefault", "LoadingPhase": "PreDefault",
"WhitelistPlatforms" : "WhitelistPlatforms" :
[ [
"Win64", "Win64",
"Linux", "Linux",
"Mac" "Mac"
] ]
} }
] ]
} }

View File

@ -47,8 +47,8 @@ public class DiscordRpc : ModuleRules
DynamicallyLoadedModuleNames.AddRange( DynamicallyLoadedModuleNames.AddRange(
new string[] new string[]
{ {
// ... add any modules that your module loads dynamically here ... // ... add any modules that your module loads dynamically here ...
} }
); );
string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Source", "ThirdParty", "DiscordRpcLibrary")); string BaseDirectory = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Source", "ThirdParty", "DiscordRpcLibrary"));

View File

@ -7,26 +7,26 @@
#define LOCTEXT_NAMESPACE "FDiscordRpcModule" #define LOCTEXT_NAMESPACE "FDiscordRpcModule"
void FDiscordRpcModule::StartupModule() void FDiscordRpcModule::StartupModule()
{ {
#if !PLATFORM_LINUX #if !PLATFORM_LINUX
#if defined(DISCORD_DYNAMIC_LIB) #if defined(DISCORD_DYNAMIC_LIB)
// Get the base directory of this plugin // Get the base directory of this plugin
FString BaseDir = IPluginManager::Get().FindPlugin("DiscordRpc")->GetBaseDir(); FString BaseDir = IPluginManager::Get().FindPlugin("DiscordRpc")->GetBaseDir();
const FString SDKDir = FPaths::Combine(*BaseDir, TEXT("Source"), TEXT("ThirdParty"), TEXT("DiscordRpcLibrary")); const FString SDKDir = FPaths::Combine(*BaseDir, TEXT("Source"), TEXT("ThirdParty"), TEXT("DiscordRpcLibrary"));
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS
const FString LibName = TEXT("discord-rpc"); const FString LibName = TEXT("discord-rpc");
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Win64")); const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Win64"));
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) { if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional.")); FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
FreeDependency(DiscordRpcLibraryHandle); FreeDependency(DiscordRpcLibraryHandle);
} }
#elif PLATFORM_MAC #elif PLATFORM_MAC
const FString LibName = TEXT("libdiscord-rpc"); const FString LibName = TEXT("libdiscord-rpc");
const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Mac")); const FString LibDir = FPaths::Combine(*SDKDir, TEXT("Mac"));
if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) { if (!LoadDependency(LibDir, LibName, DiscordRpcLibraryHandle)) {
FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional.")); FMessageDialog::Open(EAppMsgType::Ok, LOCTEXT(LOCTEXT_NAMESPACE, "Failed to load DiscordRpc plugin. Plug-in will not be functional."));
FreeDependency(DiscordRpcLibraryHandle); FreeDependency(DiscordRpcLibraryHandle);
} }
#endif #endif
#endif #endif
#endif #endif
@ -37,33 +37,33 @@ void FDiscordRpcModule::ShutdownModule()
// Free the dll handle // Free the dll handle
#if !PLATFORM_LINUX #if !PLATFORM_LINUX
#if defined(DISCORD_DYNAMIC_LIB) #if defined(DISCORD_DYNAMIC_LIB)
FreeDependency(DiscordRpcLibraryHandle); FreeDependency(DiscordRpcLibraryHandle);
#endif #endif
#endif #endif
} }
bool FDiscordRpcModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle) bool FDiscordRpcModule::LoadDependency(const FString& Dir, const FString& Name, void*& Handle)
{ {
FString Lib = Name + TEXT(".") + FPlatformProcess::GetModuleExtension(); FString Lib = Name + TEXT(".") + FPlatformProcess::GetModuleExtension();
FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine(*Dir, *Lib); FString Path = Dir.IsEmpty() ? *Lib : FPaths::Combine(*Dir, *Lib);
Handle = FPlatformProcess::GetDllHandle(*Path); Handle = FPlatformProcess::GetDllHandle(*Path);
if (Handle == nullptr) if (Handle == nullptr)
{ {
return false; return false;
} }
return true; return true;
} }
void FDiscordRpcModule::FreeDependency(void*& Handle) void FDiscordRpcModule::FreeDependency(void*& Handle)
{ {
if (Handle != nullptr) if (Handle != nullptr)
{ {
FPlatformProcess::FreeDllHandle(Handle); FPlatformProcess::FreeDllHandle(Handle);
Handle = nullptr; Handle = nullptr;
} }
} }
#undef LOCTEXT_NAMESPACE #undef LOCTEXT_NAMESPACE

View File

@ -66,8 +66,8 @@ static void JoinRequestHandler(const DiscordJoinRequest* request)
} }
void UDiscordRpc::Initialize(const FString& applicationId, void UDiscordRpc::Initialize(const FString& applicationId,
bool autoRegister, bool autoRegister,
const FString& optionalSteamId) const FString& optionalSteamId)
{ {
self = this; self = this;
IsConnected = false; IsConnected = false;
@ -87,7 +87,7 @@ void UDiscordRpc::Initialize(const FString& applicationId,
auto appId = StringCast<ANSICHAR>(*applicationId); auto appId = StringCast<ANSICHAR>(*applicationId);
auto steamId = StringCast<ANSICHAR>(*optionalSteamId); auto steamId = StringCast<ANSICHAR>(*optionalSteamId);
Discord_Initialize( Discord_Initialize(
(const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get()); (const char*)appId.Get(), &handlers, autoRegister, (const char*)steamId.Get());
} }
void UDiscordRpc::Shutdown() void UDiscordRpc::Shutdown()

View File

@ -13,8 +13,8 @@ public:
private: private:
/** Handle to the test dll we will load */ /** Handle to the test dll we will load */
void* DiscordRpcLibraryHandle; void* DiscordRpcLibraryHandle;
/** StartupModule is covered with defines, these functions are the place to put breakpoints */ /** StartupModule is covered with defines, these functions are the place to put breakpoints */
static bool LoadDependency(const FString& Dir, const FString& Name, void*& Handle); static bool LoadDependency(const FString& Dir, const FString& Name, void*& Handle);
static void FreeDependency(void*& Handle); static void FreeDependency(void*& Handle);
}; };