// Copyright Epic Games, Inc. All Rights Reserved.
#include "DesktopPlatformBaseEx.h"
#include "HAL/FileManager.h"
#include "Misc/FileHelper.h"
#include "Misc/Paths.h"
#include "Misc/Guid.h"
#include "Misc/ConfigCacheIni.h"
#include "Misc/FeedbackContext.h"
#include "Misc/App.h"
#include "Misc/EngineVersion.h"
#include "Serialization/JsonTypes.h"
#include "Serialization/JsonReader.h"
#include "Serialization/JsonSerializer.h"
#include "Modules/ModuleManager.h"
#include "DesktopPlatformPrivateEx.h"
#include "Misc/OutputDeviceRedirector.h"
#define LOCTEXT_NAMESPACE "DesktopPlatform"
FDesktopPlatformBaseEx::FDesktopPlatformBaseEx()
{
LauncherInstallationTimestamp = FDateTime::MinValue();
}
FString FDesktopPlatformBaseEx::GetEngineDescription(const FString& Identifier)
{
// Official release versions just have a version number
if(IsStockEngineRelease(Identifier))
{
return Identifier;
}
// Otherwise get the path
FString RootDir;
if(!GetEngineRootDirFromIdentifier(Identifier, RootDir))
{
return FString();
}
// Convert it to a platform directory
FString PlatformRootDir = RootDir;
FPaths::MakePlatformFilename(PlatformRootDir);
// Perforce build
if (IsSourceDistribution(RootDir))
{
return FString::Printf(TEXT("Source build at %s"), *PlatformRootDir);
}
else
{
return FString::Printf(TEXT("Binary build at %s"), *PlatformRootDir);
}
}
FString FDesktopPlatformBaseEx::GetCurrentEngineIdentifier()
{
if(CurrentEngineIdentifier.Len() == 0 && !GetEngineIdentifierFromRootDir(FPlatformMisc::RootDir(), CurrentEngineIdentifier))
{
CurrentEngineIdentifier.Empty();
}
return CurrentEngineIdentifier;
}
void FDesktopPlatformBaseEx::EnumerateLauncherEngineInstallations(TMap<FString, FString> &OutInstallations)
{
// Cache the launcher install list if necessary
ReadLauncherInstallationList();
// We've got a list of launcher installations. Filter it by the engine installations.
for(TMap<FString, FString>::TConstIterator Iter(LauncherInstallationList); Iter; ++Iter)
{
FString AppName = Iter.Key();
if(AppName.RemoveFromStart(TEXT("UE_"), ESearchCase::CaseSensitive))
{
OutInstallations.Add(AppName, Iter.Value());
}
}
}
void FDesktopPlatformBaseEx::EnumerateLauncherSampleInstallations(TArray<FString> &OutInstallations)
{
// Cache the launcher install list if necessary
ReadLauncherInstallationList();
// We've got a list of launcher installations. Filter it by the engine installations.
for(TMap<FString, FString>::TConstIterator Iter(LauncherInstallationList); Iter; ++Iter)
{
FString AppName = Iter.Key();
if(!AppName.StartsWith(TEXT("UE_"), ESearchCase::CaseSensitive))
{
OutInstallations.Add(Iter.Value());
}
}
}
void FDesktopPlatformBaseEx::EnumerateLauncherSampleProjects(TArray<FString> &OutFileNames)
{
// Enumerate all the sample installation directories
TArray<FString> LauncherSampleDirectories;
EnumerateLauncherSampleInstallations(LauncherSampleDirectories);
// Find all the project files within them
for(int32 Idx = 0; Idx < LauncherSampleDirectories.Num(); Idx++)
{
TArray<FString> FileNames;
IFileManager::Get().FindFiles(FileNames, *(LauncherSampleDirectories[Idx] / TEXT("*.uproject")), true, false);
OutFileNames.Append(FileNames);
}
}
bool FDesktopPlatformBaseEx::GetEngineRootDirFromIdentifier(const FString &Identifier, FString &OutRootDir)
{
// Get all the installations
TMap<FString, FString> Installations;
EnumerateEngineInstallations(Installations);
// Find the one with the right identifier
for (TMap<FString, FString>::TConstIterator Iter(Installations); Iter; ++Iter)
{
if (Iter->Key == Identifier)
{
OutRootDir = Iter->Value;
return true;
}
}
return false;
}
bool FDesktopPlatformBaseEx::GetEngineIdentifierFromRootDir(const FString &RootDir, FString &OutIdentifier)
{
// Get all the installations
TMap<FString, FString> Installations;
EnumerateEngineInstallations(Installations);
// Normalize the root directory
FString NormalizedRootDir = RootDir;
FPaths::CollapseRelativeDirectories(NormalizedRootDir);
FPaths::NormalizeDirectoryName(NormalizedRootDir);
// Find the label for the given directory
for (TMap<FString, FString>::TConstIterator Iter(Installations); Iter; ++Iter)
{
if (Iter->Value == NormalizedRootDir)
{
OutIdentifier = Iter->Key;
return true;
}
}
// Otherwise just try to add it
return RegisterEngineInstallation(RootDir, OutIdentifier);
}
bool FDesktopPlatformBaseEx::GetDefaultEngineIdentifier(FString &OutId)
{
TMap<FString, FString> Installations;
EnumerateEngineInstallations(Installations);
bool bRes = false;
if (Installations.Num() > 0)
{
// Default to the first install
TMap<FString, FString>::TConstIterator Iter(Installations);
OutId = Iter.Key();
++Iter;
// Try to find the most preferred install
for(; Iter; ++Iter)
{
if(IsPreferredEngineIdentifier(Iter.Key(), OutId))
{
OutId = Iter.Key();
}
}
}
return bRes;
}
bool FDesktopPlatformBaseEx::GetDefaultEngineRootDir(FString &OutDirName)
{
FString Identifier;
return GetDefaultEngineIdentifier(Identifier) && GetEngineRootDirFromIdentifier(Identifier, OutDirName);
}
bool FDesktopPlatformBaseEx::IsPreferredEngineIdentifier(const FString &Identifier, const FString &OtherIdentifier)
{
int32 Version = ParseReleaseVersion(Identifier);
int32 OtherVersion = ParseReleaseVersion(OtherIdentifier);
if(Version != OtherVersion)
{
return Version > OtherVersion;
}
else
{
return Identifier > OtherIdentifier;
}
}
bool FDesktopPlatformBaseEx::TryGetEngineVersion(const FString& RootDir, FEngineVersion& OutVersion)
{
// Read the file to a string
FString VersionText;
if(FFileHelper::LoadFileToString(VersionText, *(RootDir / TEXT("Engine/Build/Build.version"))))
{
// Deserialize a JSON object from the string
TSharedPtr< FJsonObject > Object;
TSharedRef< TJsonReader<> > Reader = TJsonReaderFactory<>::Create(VersionText);
if(FJsonSerializer::Deserialize(Reader, Object) && Object.IsValid())
{
int32 MajorVersion = 0;
int32 MinorVersion = 0;
int32 PatchVersion = 0;
if(Object->TryGetNumberField(TEXT("MajorVersion"), MajorVersion) && Object->TryGetNumberField(TEXT("MinorVersion"), MinorVersion) && Object->TryGetNumberField(TEXT("PatchVersion"), PatchVersion))
{
int32 Changelist = 0;
if(!Object->TryGetNumberField(TEXT("Changelist"), Changelist))
{
Changelist = 0;
}
int32 IsLicenseeVersion = 0;
if(!Object->TryGetNumberField(TEXT("IsLicenseeVersion"), IsLicenseeVersion))
{
IsLicenseeVersion = 0;
}
FString BranchName;
if(!Object->TryGetStringField(TEXT("BranchName"), BranchName))
{
BranchName = FString();
}
int EncodedChangelist = (IsLicenseeVersion == 0)? Changelist : FEngineVersionBase::EncodeLicenseeChangelist(Changelist);
OutVersion = FEngineVersion(MajorVersion, MinorVersion, PatchVersion, EncodedChangelist, BranchName);
return true;
}
}
}
// Try to read the version file
FString VersionHeader;
if(FFileHelper::LoadFileToString(VersionHeader, *(RootDir / TEXT("Engine/Source/Runtime/Launch/Resources/Version.h"))))
{
int32 MajorVersion = -1;
int32 MinorVersion = -1;
int32 PatchVersion = -1;
int32 Changelist = 0;
int32 IsLicenseeVersion = 0;
FString BranchName;
// Scan the file for version defines
const TCHAR* TextPos = *VersionHeader;
while(*TextPos)
{
// Skip over any newlines
while(FChar::IsWhitespace(*TextPos))
{
TextPos++;
}
// Buffer up a line of tokens
TArray<FString> Tokens;
while(*TextPos != '\n' && *TextPos != 0)
{
if(*TextPos == ' ' || *TextPos == '\t' || *TextPos == '\r')
{
// Skip over whitespace
Tex
没有合适的资源?快使用搜索试试~ 我知道了~
SelectDialog.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共59个文件
h:30个
cpp:25个
cs:3个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 0 95 下载量 200 浏览量
2021-08-05
17:12:10
上传
评论
收藏 128KB ZIP 举报
温馨提示
UE4/UE5 调用打开系统窗口崩溃, 适用于4.25每个版本和4.26每个版本
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![exe](https://img-home.csdnimg.cn/images/20210720083343.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 59 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/1582a2291e144bb1913d709f4d880d99_u011718663.jpg!1)
WhiteTian
- 粉丝: 2189
- 资源: 14
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- 基于SSM开发的旅游信息管理系统程序.zip
- 医学图像分割数据:covid-19肺部感染区域分割【包含3个切面的切片数据、标签文件、可视化代码】
- 基于jsp+servlet实现的图书管理系统(源码+数据库 )
- 大河网servlet+jsp+jdbc的java原生小项目,包含了servlet过滤器和监听器的简单应用
- 链表-基于Java的单链表基本操作之链表相交.zip
- 链表-基于Java的单链表基本操作之删除操作.zip
- 链表-基于Java的单链表基本操作之逆向输出.zip
- 链表-基于Java的单链表基本操作之链表排序.zip
- 链表-基于Java的单链表基本操作之回文链表判断.zip
- 链表-基于Java的单链表基本操作之查找操作.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)