Я работал над проектом WebGL с использованием Unity 2017. Мы используем ICSharpCode.SharpZipLib.Zip
для создания zip-файлов и загрузки их на наш сервер.Это работало хорошо, используя следующий код:
public string ZipFiles(List<string> files)
{
// create new zip file
string zipPath = Application.persistentDataPath + "/upload.zip";
try
{
// prepare
FileStream fsOut = File.Create(zipPath);
ZipFile zip = ZipFile.Create(fsOut);
// fill
zip.BeginUpdate();
foreach (string file in files)
{
zip.Add(file, Path.GetFileName(file));
}
Debug.Log("Zip before commit");
zip.CommitUpdate();
Debug.Log("Zip after commit");
zip.Close();
Debug.Log("Zip after close");
fsOut.Close();
Debug.Log("Zip filestream closed");
}
catch (Exception ex)
{
Debug.Log("Exception Zip: " + ex);
}
// finish
return zipPath;
}
Теперь с обновлением до Unity 2018.1 мы также обновились до .Net 4.6 - все отлично работает в редакторе.
Используя WebGL, создайтесбой приложения при zip.CommitUpdate();
Журнал ошибок отображает только:
NotSupportedException: Encoding 437 data could not be found. Make sure you have correct international codeset assembly installed and enabled.
at System.Text.Encoding.GetEncoding (System.Int32 codepage) [0x00000] in <00000000000000000000000000000000>:0
(Filename: currently not available on il2cpp Line: -1)
Мне кажется, это очень бесполезный журнал ошибок ...
zip-файл в файле-система загружена, но пуста.Доступны файлы: один xml и два json-файла.(Уже проверил с File.exists
ранее ...)
Может кто-нибудь помочь?Спасибо!