Esempio n. 1
0
        private void Stream_Closed(object sender, EventArgs e)
        {
            StreamWatcher watcher    = (StreamWatcher)sender;
            FileStream    fileStream = (FileStream)watcher.Stream;

            m_openHandles.Remove(fileStream.Name.ToLower());
        }
Esempio n. 2
0
        public override Stream OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
        {
            ValidatePath(path);
            string     fullPath   = m_directory.FullName + path;
            FileStream fileStream = File.Open(fullPath, mode, access, share);

            if (!m_openHandles.ContainsKey(fullPath.ToLower()))
            {
                m_openHandles.Add(fullPath.ToLower(), fileStream.SafeFileHandle);
            }
            StreamWatcher watcher = new StreamWatcher(fileStream);

            watcher.Closed += new EventHandler(Stream_Closed);
            return(watcher);
        }