1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
private FileSystemWatcher watcher = new FileSystemWatcher();
private FileSystemEventArgs arg;
private FastZip fz = new FastZip();
private void OnCreated(object source, FileSystemEventArgs e)
{
arg = e;
Thread th = new Thread(new ThreadStart(Zip));
th.Start();
}
private void Zip()
{
try
{
watcher = (FileSystemWatcher)Application["watcher"];
fz.ExtractZip(arg.FullPath, watcher.Path, "");
}
catch
{
// le fichier n'a peut-être pas fini de s'uploader, on reessaie 5 secondes plus tard
Thread.Sleep(5000);
Zip();
}
} |
Partager