예제 #1
0
        protected virtual SerializationFileSystemTree GetTreeForPath(string path, string database)
        {
            SerializationFileSystemTree foundTree = null;

            foreach (var tree in Trees)
            {
                if (!tree.DatabaseName.Equals(database, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }
                if (!tree.ContainsPath(path))
                {
                    continue;
                }

                if (foundTree != null)
                {
                    throw new InvalidOperationException($"The trees {foundTree.Name} and {tree.Name} both contained the global path {path} - overlapping trees are not allowed.");
                }

                foundTree = tree;
            }

            return(foundTree);
        }
예제 #2
0
        // note: we pass in these params (formatter, datacache) so that overriding classes may get access to private vars indirectly (can't get at them otherwise because this is called from the constructor)
        protected virtual SerializationFileSystemTree CreateTree(TreeRoot root, ISerializationFormatter formatter, bool useDataCache)
        {
            var tree = new SerializationFileSystemTree(root.Name, root.Path, root.DatabaseName, Path.Combine(PhysicalRootPath, root.Name), formatter, useDataCache);

            tree.TreeItemChanged += metadata =>
            {
                foreach (var watcher in ChangeWatchers)
                {
                    watcher(metadata, tree.DatabaseName);
                }
            };

            return(tree);
        }
        // note: we pass in these params (formatter, datacache) so that overriding classes may get access to private vars indirectly (can't get at them otherwise because this is called from the constructor)
        protected virtual SerializationFileSystemTree CreateTree(TreeRoot root, ISerializationFormatter formatter, bool useDataCache)
        {
            var tree = new SerializationFileSystemTree(root.Name, root.Path, root.DatabaseName, Path.Combine(PhysicalRootPath, root.Name), formatter, useDataCache);
            tree.TreeItemChanged += metadata =>
            {
                foreach (var watcher in ChangeWatchers) watcher(metadata, tree.DatabaseName);
            };

            return tree;
        }