public override void Sync(System.String name) { EnsureOpen(); System.IO.FileInfo fullFile = new System.IO.FileInfo(System.IO.Path.Combine(internalDirectory.FullName, name)); bool success = false; int retryCount = 0; System.IO.IOException exc = null; while (!success && retryCount < 5) { retryCount++; System.IO.FileStream file = null; try { try { file = new System.IO.FileStream(fullFile.FullName, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite); FileSupport.Sync(file); success = true; } finally { if (file != null) { file.Close(); } } } catch (System.IO.IOException ioe) { if (exc == null) { exc = ioe; } // Pause 5 msec System.Threading.Thread.Sleep(5); } } if (!success && exc != null) { // Throw original exception throw exc; } }