コード例 #1
0
        public void Remove(string DisplayName)
        {
            DirectoryWatcher dir = (DirectoryWatcher)m_WatchedDirs[DisplayName];

            dir.Dispose();

            if (!m_InternalUse)
            {
                WatchSettings settings = null;
                m_WatchedDirs.Remove(DisplayName);

                if (m_ConfigFilename.Length == 0)
                {
                    settings = new WatchSettings("WatchedDirectories");
                    settings.Remove(DisplayName);
                }
                else
                {
                    settings = new WatchSettings(m_ConfigFilename, "WatchedDirectories");
                    settings.Remove(DisplayName);
                }
            }

            return;
        }
コード例 #2
0
        public void Add(string DisplayName, string DirectoryPath)
        {
            DirectoryWatcher dir = new DirectoryWatcher(DisplayName, DirectoryPath);

            m_WatchedDirs.Add(DisplayName, dir);

            if (!m_InternalUse)
            {
                WatchSettings settings = null;

                if (m_ConfigFilename.Length == 0)
                {
                    settings = new WatchSettings("WatchedDirectories");
                    settings.Add(DisplayName, DirectoryPath);
                }
                else
                {
                    settings = new WatchSettings(m_ConfigFilename, "WatchedDirectories");
                    settings.Add(DisplayName, DirectoryPath);
                }
            }

            return;
        }