так что у меня есть эта проблема, которую я не могу понять в данный момент. Я уже загрузил исправленный Ionic.zip из "http://dotnetzip.codeplex.com/workitem/14049< /а>".
Я протестировал свой код в проекте, отличном от Silverlight, с использованием ionic.zip для обычного С# и его работы. Но при изменении кода для silverlight (lightswitch) я продолжаю получать ошибку «IBM437».
Вот как выглядит мой код
void selectFileWindow_Closed(object sender, EventArgs e)
{
SelectFileWindow selectFileWindow = (SelectFileWindow)sender;
string selectFileStream = sender.ToString();
var parsedString = selectFileStream.Split(',');
if (selectFileWindow.DialogResult == true && (selectFileWindow.myStream != null))
{
foreach (FileStream myZippedStream in selectFileWindow.myStream)
{
string zippedLocation = myZippedStream.Name;
var parsedLocation = zippedLocation.Split('\\');
string fileName = parsedLocation[parsedLocation.Length - 1];
//filename is equal to something like "myfile.zip"
// We want to turn that to "myfile.txt)
fileName = (fileName.Substring(0, fileName.Length - 3)) + "txt";
using (FileStream fs = File.Create("c:\\temp\\gftTempFile.txt"))
{
using (var ms = new MemoryStream())
{
//ReadOptions myOptions = new ReadOptions();
//myOptions.Encoding = System.Text.Encoding.UTF8;
//using (ZipFile myZip = ZipFile.Read(myZippedStream, myOptions))
// I have tried using the commentted code but it gives the same error
using (ZipFile myZip = ZipFile.Read(myZippedStream))
{
ZipEntry myEntry = myZip[fileName];
myEntry.Extract(ms);
ms.WriteTo(fs);
fs.Close();
ImportGift.importGift(fs, this.DataWorkspace);
try
{
fs.Close();
fs.Dispose();
ms.Close();
ms.Dispose();
File.Delete("c:\\temp\\gftTempFile.txt");
}
catch { }
}
}
}
}
doneLoading = true;
}
}