public override INode SelectReadNode(OverlayedFileSystem overlayedFileSystem, INodeAddress address, NodeType nodeType)
            {
                lock (overlayedFileSystem.FileSystems)
                {
                    if (overlayedFileSystem.FileSystems.Count == 0)
                    {
                        throw new InvalidOperationException("Overlayed FileSystem isn't initialized with any file systems");
                    }

                    foreach (var node in overlayedFileSystem.FileSystems.Select(fs => fs.Resolve(address.AbsolutePath, nodeType)).Where(node => node.Exists))
                    {
                        return(node);
                    }

                    return(overlayedFileSystem.FileSystems[0].Resolve(address.AbsolutePath, nodeType));
                }
            }
		public void Test_Make_Overlayed_FileSystem()
		{
			var fileSystem1 = this.WorkingDirectory.ResolveDirectory("Directory1").CreateView();
			var fileSystem2 = this.WorkingDirectory.ResolveDirectory("Directory2").CreateView();

			var overlayedFileSystem = new OverlayedFileSystem(fileSystem1, fileSystem2);

			var dir = overlayedFileSystem.RootDirectory;

			var list = dir.GetChildNames().ToList();

			Assert.AreEqual(5, list.Count);

			var file = dir.ResolveFile("C.txt");

			Assert.AreEqual(2, file.GetAlternates().Count());
			Assert.IsTrue(file.Exists);
			Assert.AreEqual("C.txt", file.GetContent().GetReader().ReadToEndThenClose());

			file = dir.ResolveFile("A.txt");
			Assert.AreEqual(2, file.GetAlternates().Count());
			Assert.IsTrue(file.Exists);
			Assert.AreEqual("A.txt", file.GetContent().GetReader().ReadToEndThenClose());

			file = dir.ResolveFile("B.txt");
			Assert.AreEqual(2, file.GetAlternates().Count());
			Assert.IsTrue(file.Exists);
			Assert.AreEqual("B.txt", file.GetContent().GetReader().ReadToEndThenClose());

			var subdir = dir.ResolveDirectory("SubDirectory1");
			Assert.AreEqual(2, subdir.GetAlternates().Count());
			Assert.IsTrue(subdir.Exists);

			file = dir.ResolveFile("SubDirectory1/A.csv");
			Assert.IsTrue(file.Exists);
			Assert.AreEqual(2, file.GetAlternates().Count());
			Assert.AreEqual("A.csv", file.GetContent().GetReader().ReadToEndThenClose());
			Assert.AreEqual("A.csv(2)", file.GetAlternates().ToList()[1].GetContent().GetReader().ReadToEndThenClose());
		}
		public OverlayedDirectory(OverlayedFileSystem fileSystem, INodeAddress nodeAddress, IDirectory directory)
			: base(directory)
		{
			this.fileSystem = fileSystem;
			this.nodeAddress = nodeAddress;
		}
 public OverlayedDirectory(OverlayedFileSystem fileSystem, INodeAddress nodeAddress, IDirectory directory)
     : base(directory)
 {
     this.fileSystem  = fileSystem;
     this.nodeAddress = nodeAddress;
 }
		public virtual bool SelectNodeForOperation(OverlayedFileSystem fileSystem, FileSystemActivity operation, INodeAddress address, NodeType nodeType, out INode[] nodes)
		{
			nodes = null;

			return false;
		}
		public abstract INode SelectReadNode(OverlayedFileSystem fileSystem, INodeAddress address, NodeType nodeType);
		public virtual INode SelectWriteNode(OverlayedFileSystem fileSystem, INodeAddress address, NodeType nodeType)
		{
			return SelectReadNode(fileSystem, address, nodeType);
		}
			public override INode SelectReadNode(OverlayedFileSystem overlayedFileSystem, INodeAddress address, NodeType nodeType)
			{
				lock (overlayedFileSystem.FileSystems)
				{
					if (overlayedFileSystem.FileSystems.Count == 0)
					{
						throw new InvalidOperationException("Overlayed FileSystem isn't initialized with any file systems");
					}

					foreach (var fs in overlayedFileSystem.FileSystems)
					{
						var node = fs.Resolve(address.AbsolutePath, nodeType);
						
						if (node.Exists)
						{
							return node;
						}
					}

					return ((IFileSystem)overlayedFileSystem.FileSystems[0]).Resolve(address.AbsolutePath, nodeType);
				}
			}
		public override INode SelectReadNode(OverlayedFileSystem fileSystem, INodeAddress address, NodeType nodeType)
		{
			return getReadNodeFunction(fileSystem, address, nodeType);
		}
 public OverlayedFile(OverlayedFileSystem fileSystem, INodeAddress nodeAddress, IFile file)
     : base(file)
 {
     this.fileSystem  = fileSystem;
     this.nodeAddress = nodeAddress;
 }
        public virtual bool SelectNodeForOperation(OverlayedFileSystem fileSystem, FileSystemActivity operation, INodeAddress address, NodeType nodeType, out INode[] nodes)
        {
            nodes = null;

            return(false);
        }
 public abstract INode SelectReadNode(OverlayedFileSystem fileSystem, INodeAddress address, NodeType nodeType);
 public virtual INode SelectWriteNode(OverlayedFileSystem fileSystem, INodeAddress address, NodeType nodeType)
 {
     return(SelectReadNode(fileSystem, address, nodeType));
 }
 public override INode SelectReadNode(OverlayedFileSystem fileSystem, INodeAddress address, NodeType nodeType)
 {
     return(getReadNodeFunction(fileSystem, address, nodeType));
 }
		public OverlayedFile(OverlayedFileSystem fileSystem, INodeAddress nodeAddress, IFile file)
			: base(file)
		{
			this.fileSystem = fileSystem;
			this.nodeAddress = nodeAddress;
		}