-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a96fec
commit 172e049
Showing
10 changed files
with
4,023 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using EbaySharp.Entities.Sell.Feed; | ||
using EbaySharp.Source; | ||
|
||
namespace EbaySharp.Controllers | ||
{ | ||
class FeedController | ||
{ | ||
private string accessToken; | ||
public FeedController(string accessToken) | ||
{ | ||
this.accessToken = accessToken; | ||
} | ||
|
||
#region TASK | ||
|
||
public async Task<ResultFile> GetResultFile(string taskId) | ||
{ | ||
string requestUrl = $"{Constants.API_SERVER_URL}{Constants.SELL.ENDPOINT_URL}{Constants.SELL.FEED.ENDPOINT_URL}{string.Format(Constants.SELL.FEED.METHODS.GET_DOWNLOAD_RESULT_FILE, taskId)}"; | ||
return await new RequestExecuter().ExecuteGetRequest<ResultFile>(requestUrl, $"Bearer {accessToken}"); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using ICSharpCode.SharpZipLib.Zip; | ||
|
||
namespace EbaySharp.Entities.Sell.Feed | ||
{ | ||
public class ResultFile | ||
{ | ||
public string FileName { get; set; } | ||
public Stream FileContent { get; set; } | ||
public async Task SaveUncompressed(string folderPath) | ||
{ | ||
using (ZipInputStream s = new ZipInputStream(FileContent)) | ||
{ | ||
ZipEntry theEntry; | ||
while ((theEntry = s.GetNextEntry()) != null) | ||
{ | ||
using (FileStream streamWriter = File.Create($"{folderPath}\\{FileName.Replace(".zip","")}")) | ||
{ | ||
|
||
int size = 2048; | ||
byte[] data = new byte[2048]; | ||
while (true) | ||
{ | ||
size = await s.ReadAsync(data, 0, data.Length); | ||
if (size > 0) | ||
{ | ||
await streamWriter.WriteAsync(data, 0, size); | ||
} | ||
else | ||
{ | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.