diff --git a/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj b/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj index dabbfee..c26bc90 100644 --- a/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj +++ b/EftPatchHelper/EftPatchHelper/EftPatchHelper.csproj @@ -2,16 +2,17 @@ Exe - net6.0 + net8.0 enable enable - 1.4.2 - 1.4.2 + 1.5.1 + 1.5.1 + @@ -24,9 +25,6 @@ Resources\Gitea.dll - - Resources\GoFileSharp.dll - diff --git a/EftPatchHelper/EftPatchHelper/Model/GoFileUpload.cs b/EftPatchHelper/EftPatchHelper/Model/GoFileUpload.cs index 5ca5349..2bb1e65 100644 --- a/EftPatchHelper/EftPatchHelper/Model/GoFileUpload.cs +++ b/EftPatchHelper/EftPatchHelper/Model/GoFileUpload.cs @@ -1,12 +1,17 @@ using EftPatchHelper.Interfaces; using GoFileSharp; +using GoFileSharp.Model; +using GoFileSharp.Model.GoFileData; using GoFileSharp.Model.GoFileData.Wrappers; + namespace EftPatchHelper.Model { public class GoFileUpload : IFileUpload { + private GoFile _goFile; public FileInfo UploadFileInfo { get; private set; } + private DirectLink? _directLink = null; private GoFileFile _uploadedFile; private string _folderId; @@ -16,7 +21,11 @@ namespace EftPatchHelper.Model public GoFileUpload(FileInfo file, string apiToken, string folderId) { - GoFile.ApiToken = apiToken; + _goFile = new GoFile(new GoFileOptions + { + ApiToken = apiToken + }); + _folderId = folderId; UploadFileInfo = file; ServiceName = "GoFile"; @@ -26,12 +35,12 @@ namespace EftPatchHelper.Model public string GetLink() { - return _uploadedFile.DirectLink; + return _directLink?.Link ?? ""; } public async Task UploadAsync(IProgress? progress = null) { - var folder = await GoFile.GetFolder(_folderId); + var folder = await _goFile.GetFolderAsync(_folderId); if (folder == null) { @@ -42,7 +51,9 @@ namespace EftPatchHelper.Model if(uploadedFile == null) return false; - if(!await uploadedFile.SetDirectLink(true)) + _directLink = await uploadedFile.AddDirectLink(); + + if(_directLink == null) { return false; } diff --git a/EftPatchHelper/EftPatchHelper/Resources/GoFileSharp.dll b/EftPatchHelper/EftPatchHelper/Resources/GoFileSharp.dll deleted file mode 100644 index c603fa1..0000000 Binary files a/EftPatchHelper/EftPatchHelper/Resources/GoFileSharp.dll and /dev/null differ