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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Net; | |
using System.Text; | |
using System.Threading.Tasks; | |
public class AsyncHttpWebRequest | |
{ | |
private HttpWebRequest webRequest; |
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 sample function uses SharpZipLib (http://icsharpcode.github.io/SharpZipLib/) to extract | |
// a zip file without blocking Unity's main thread. Remember to call it with StartCoroutine(). | |
// Byte data is passed so a MemoryStream object is created inside the function to prevent it | |
// from being reclaimed by the garbage collector. | |
public IEnumerator ExtractZipFile(byte[] zipFileData, string targetDirectory, int bufferSize = 256 * 1024) | |
{ | |
Directory.CreateDirectory(targetDirectory); | |
using (MemoryStream fileStream = new MemoryStream()) |