Esempio n. 1
0
        // Constructor(s)
        internal ContentManager(ContentManagerArgs args)
        {
            // Initialize dictionaries
            _content    = new Dictionary <string, ContentContainer>();
            _extensions = new Dictionary <string, ProcessContent>(args.Extensions); // Set extensions from args

            // Set content base path (after arguments)
            if (args.RelativePath)                                  // If the path is relative
            {
                _basePath += AppDomain.CurrentDomain.BaseDirectory; // Add ...
            }
            _basePath += args.ContentPath;

            // Initialize file watcher
            _watcher = new FileSystemWatcher(_basePath.Remove(_basePath.Length - 1, 1));
            _watcher.IncludeSubdirectories = true;
            _watcher.EnableRaisingEvents   = true;

            _watcher.NotifyFilter = NotifyFilters.LastAccess |
                                    NotifyFilters.LastWrite |
                                    NotifyFilters.FileName |
                                    NotifyFilters.DirectoryName;

            _watcher.Changed += new FileSystemEventHandler(OnChanged);
            _watcher.Created += new FileSystemEventHandler(OnChanged);
            _watcher.Deleted += new FileSystemEventHandler(OnChanged);
            _watcher.Renamed += new RenamedEventHandler(OnRenamed);
        }
Esempio n. 2
0
 public ContentManagerArgs(ContentManagerArgs args)
 {
     ContentPath        = args.ContentPath;
     RelativePath       = args.RelativePath;
     SafeContentLoading = args.SafeContentLoading;
     Extensions         = new Dictionary <string, ProcessContent>(args.Extensions);
 }