mirror of
https://github.com/storytold/RuntimeFilesDownloader.git
synced 2026-10-09 00:09:42 +00:00
add documentation and minor design changes
This commit is contained in:
@@ -11,16 +11,10 @@ Runtime Files Downloader plugin for Unreal Engine. Allows you to download any fi
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||
|

|
||||||
|
|
||||||
## How to install
|
## Documentation
|
||||||
There're two ways to install the plugin:
|
Click on the following link to view the documentation - https://unreal.blog/runtime-files-downloader-documentation
|
||||||
1) [Through the marketplace (not ready yet)](https://www.unrealengine.com/marketplace/product/runtime-files-downloader).
|
|
||||||
2) Manual installation. Just extract the "RuntimeFilesDownloader" folder into your plugins project folder to get the following path: "[ProjectName]/Plugins/RuntimeFilesDownloader".
|
|
||||||
|
|
||||||
## How to use
|
|
||||||
There are two ways to use this plugin: using Blueprints and C++:
|
|
||||||
1. Blueprints. Just reopen your Unreal project and use "Create Downloader" and "Download File" nodes.
|
|
||||||
2. C++. Open your "[ProjectName].Build.cs" and find a block of ` PublicDependencyModuleNames ` or ` PrivateDependencyModuleNames ` (it depends on your needs). Add `"RuntimeFilesDownloader"` String inside this block. After just include "RuntimeFilesDownloaderBPLibrary.h" using ` #include "RuntimeFilesDownloaderBPLibrary.h" ` where needed.
|
|
||||||
|
|
||||||
## Legal info
|
## Legal info
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,7 @@
|
|||||||
"PS4",
|
"PS4",
|
||||||
"HTML5",
|
"HTML5",
|
||||||
"TVOS",
|
"TVOS",
|
||||||
"Switch",
|
"Switch"
|
||||||
"Unknown"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+6
-10
@@ -4,12 +4,11 @@
|
|||||||
#include "RuntimeFilesDownloader.h"
|
#include "RuntimeFilesDownloader.h"
|
||||||
|
|
||||||
URuntimeFilesDownloaderBPLibrary::URuntimeFilesDownloaderBPLibrary(const FObjectInitializer& ObjectInitializer)
|
URuntimeFilesDownloaderBPLibrary::URuntimeFilesDownloaderBPLibrary(const FObjectInitializer& ObjectInitializer)
|
||||||
: Super(ObjectInitializer)
|
: Super(ObjectInitializer)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
URuntimeFilesDownloaderBPLibrary::URuntimeFilesDownloaderBPLibrary() :
|
URuntimeFilesDownloaderBPLibrary::URuntimeFilesDownloaderBPLibrary() :
|
||||||
FileUrl(TEXT(""))
|
FileUrl(TEXT(""))
|
||||||
, FileSavePath(TEXT(""))
|
, FileSavePath(TEXT(""))
|
||||||
@@ -20,23 +19,22 @@ URuntimeFilesDownloaderBPLibrary::~URuntimeFilesDownloaderBPLibrary()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
URuntimeFilesDownloaderBPLibrary* URuntimeFilesDownloaderBPLibrary::MakeDownloader()
|
URuntimeFilesDownloaderBPLibrary* URuntimeFilesDownloaderBPLibrary::CreateDownloader()
|
||||||
{
|
{
|
||||||
URuntimeFilesDownloaderBPLibrary* Downloader = NewObject<URuntimeFilesDownloaderBPLibrary>();
|
URuntimeFilesDownloaderBPLibrary* Downloader = NewObject<URuntimeFilesDownloaderBPLibrary>();
|
||||||
return Downloader;
|
return Downloader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
URuntimeFilesDownloaderBPLibrary* URuntimeFilesDownloaderBPLibrary::DownloadFile(const FString& URL, FString SavePath)
|
||||||
URuntimeFilesDownloaderBPLibrary* URuntimeFilesDownloaderBPLibrary::DownloadFile(const FString& Url, FString SavePath)
|
|
||||||
{
|
{
|
||||||
URuntimeFilesDownloaderBPLibrary* Downloader = NewObject<URuntimeFilesDownloaderBPLibrary>();
|
URuntimeFilesDownloaderBPLibrary* Downloader = NewObject<URuntimeFilesDownloaderBPLibrary>();
|
||||||
FileUrl = Url;
|
FileUrl = URL;
|
||||||
FileSavePath = SavePath;
|
FileSavePath = SavePath;
|
||||||
|
|
||||||
TSharedRef< IHttpRequest, ESPMode::ThreadSafe > HttpRequest = FHttpModule::Get().CreateRequest();
|
TSharedRef< IHttpRequest, ESPMode::ThreadSafe > HttpRequest = FHttpModule::Get().CreateRequest();
|
||||||
|
|
||||||
HttpRequest->SetVerb("GET");
|
HttpRequest->SetVerb("GET");
|
||||||
HttpRequest->SetURL(Url);
|
HttpRequest->SetURL(URL);
|
||||||
HttpRequest->OnProcessRequestComplete().BindUObject(this, &URuntimeFilesDownloaderBPLibrary::OnReady);
|
HttpRequest->OnProcessRequestComplete().BindUObject(this, &URuntimeFilesDownloaderBPLibrary::OnReady);
|
||||||
HttpRequest->OnRequestProgress().BindUObject(this, &URuntimeFilesDownloaderBPLibrary::OnProgress_Internal);
|
HttpRequest->OnRequestProgress().BindUObject(this, &URuntimeFilesDownloaderBPLibrary::OnProgress_Internal);
|
||||||
|
|
||||||
@@ -45,8 +43,6 @@ URuntimeFilesDownloaderBPLibrary* URuntimeFilesDownloaderBPLibrary::DownloadFile
|
|||||||
AddToRoot();
|
AddToRoot();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void URuntimeFilesDownloaderBPLibrary::OnReady(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
|
void URuntimeFilesDownloaderBPLibrary::OnReady(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
|
||||||
|
|||||||
+5
-6
@@ -61,19 +61,18 @@ public:
|
|||||||
*
|
*
|
||||||
* @return The FileDownloader object. Bind to it's OnResult event to know when it's done downloading.
|
* @return The FileDownloader object. Bind to it's OnResult event to know when it's done downloading.
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Meta = (DisplayName = "Create Downloader"), Category = "RuntimeFilesDownloader")
|
UFUNCTION(BlueprintCallable, Category = "RuntimeFilesDownloader")
|
||||||
static URuntimeFilesDownloaderBPLibrary* MakeDownloader();
|
static URuntimeFilesDownloaderBPLibrary* CreateDownloader();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts downloading a file and saves it when done. Bind to the OnResult
|
* Starts downloading a file and saves it when done.
|
||||||
* event to know when the download is done (preferrably, before calling this function).
|
|
||||||
*
|
*
|
||||||
* @param Url The file Url to be downloaded.
|
* @param Url The file Url to be downloaded.
|
||||||
* @param SavePath The absolute path and file name to save the downloaded file.
|
* @param SavePath The absolute path and file name to save the downloaded file.
|
||||||
* @return Returns itself.
|
* @return Returns itself.
|
||||||
*/
|
*/
|
||||||
UFUNCTION(BlueprintCallable, Meta = (DisplayName = "Download File"), Category = "RuntimeFilesDownloader")
|
UFUNCTION(BlueprintCallable, Category = "RuntimeFilesDownloader")
|
||||||
URuntimeFilesDownloaderBPLibrary* DownloadFile(const FString & Url, FString SavePath);
|
URuntimeFilesDownloaderBPLibrary* DownloadFile(const FString & URL, FString SavePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user