0
Я пытаюсь использовать DotNetZip обрабатывать почтовые файлы, но всякий раз, когда я пытаюсь открыть файл, я получаю следующее сообщение об ошибке:FileStream не откроет устройства Win32, такие как дисковые разделы и ленточные накопители. (DotNetZip)
[SEVERE] System.ArgumentException: FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\.\" in the path.
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode)
at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)
at Ionic.Zip.ZipEntry.Extract(String baseDirectory)
at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)
at Ionic.Zip.ZipFile.ExtractAll(String path)
at ModsInstaller.Form1.MergeDirectories(String Path1, String Path2) in C:\Users\Admin\documents\visual studio 2010\Projects\ModsInstaller\ModsInstaller\Form1.cs:line 275
at ModsInstaller.Form1.CustomInstallForge() in C:\Users\Admin\documents\visual studio 2010\Projects\ModsInstaller\ModsInstaller\Form1.cs:line 259
at ModsInstaller.Form1.btn_install_Click(Object sender, EventArgs e) in C:\Users\Admin\documents\visual studio 2010\Projects\ModsInstaller\ModsInstaller\Form1.cs:line 120
и вот код:
private void MergeDirectories(string Path1, string Path2)
{
string outDirectory = Path.GetFullPath(workspace + "\\temp\\dir");
if (!Directory.Exists(outDirectory))
Directory.CreateDirectory(outDirectory);
Path1 = Path.GetFullPath(Path1);
Path2 = Path.GetFullPath(Path2);
Log("Extracting {0} to temp dir.", Path1);
using (ZipFile zip = ZipFile.Read(Path1))
{
zip.ExtractAll(outDirectory); //this line throws the error
}
Log("Extraction sucessfull");
Log("Extracted {0} to temp dir.", Path2);
ZipFile.Read(Path2).ExtractAll(Path.GetFullPath(workspace + "\\temp\\dir"));
Log("Extraction sucessfull");
ZipFile z = new ZipFile(workspace + "\\temp\\build.jar");
z.AddDirectory(workspace + "\\temp\\dir");
z.Save();
z.Dispose();
}
и когда я вставляю точку останова, я вижу следующее:
outDirectory = "C:\\Users\\Admin\\documents\\visual studio 2010\\Projects\\ModsInstaller\\ModsInstaller\\bin\\Debug\\temp\\dir"
Может ли кто-нибудь указать, что я делаю неправильно?
Спасибо.
С дальнейшими испытаниями я не могу показаться, чтобы воспроизвести вашу ошибку. Какова была ценность переменной 'workspace'? – jrbeverly
huh, я скопировал ваш код, чтобы проверить его, но он все равно выдает ошибку. Значение рабочей области: «C: \\ Users \\ Admin \\ documents \\ visual studio 2010 \\ Projects \\ ModsInstaller \\ ModsInstaller \\ bin \\ Debug" – Doodles
Какая ошибка? Это точно такая же ошибка, как и раньше? или какая-либо разница? – jrbeverly