Beispiel #1
0
        public override bool HasCommonRoot(FileLocator other)
        {
            DiscFileLocator otherDiscLocator = other as DiscFileLocator;

            if (otherDiscLocator == null)
            {
                return false;
            }

            // Common root if the same file system instance.
            return Object.ReferenceEquals(otherDiscLocator._fileSystem, _fileSystem);
        }
Beispiel #2
0
        internal string MakeRelativePath(FileLocator fileLocator, string path)
        {
            if (!HasCommonRoot(fileLocator))
            {
                return null;
            }

            string ourFullPath = GetFullPath(string.Empty) + @"\";
            string otherFullPath = fileLocator.GetFullPath(path);

            return Utilities.MakeRelativePath(otherFullPath, ourFullPath);
        }
        internal static VirtualDiskLayer OpenDiskLayer(FileLocator locator, string path, FileAccess access)
        {
            string extension = Path.GetExtension(path).ToUpperInvariant();

            if (extension.StartsWith(".", StringComparison.Ordinal))
            {
                extension = extension.Substring(1);
            }

            VirtualDiskFactory factory;

            if (VirtualDiskManager.ExtensionMap.TryGetValue(extension, out factory))
            {
                return(factory.OpenDiskLayer(locator, path, access));
            }

            return(null);
        }
Beispiel #4
0
        public override bool HasCommonRoot(FileLocator other)
        {
            LocalFileLocator otherLocal = other as LocalFileLocator;
            if (otherLocal == null)
            {
                return false;
            }

            // If the paths have drive specifiers, then common root depends on them having a common
            // drive letter.
            string otherDir = otherLocal._dir;
            if (otherDir.Length >= 2 && _dir.Length >= 2)
            {
                if (otherDir[1] == ':' && _dir[1] == ':')
                {
                    return Char.ToUpperInvariant(otherDir[0]) == Char.ToUpperInvariant(_dir[0]);
                }
            }

            return true;
        }
Beispiel #5
0
        public override bool HasCommonRoot(FileLocator other)
        {
            LocalFileLocator otherLocal = other as LocalFileLocator;

            if (otherLocal == null)
            {
                return(false);
            }

            // If the paths have drive specifiers, then common root depends on them having a common
            // drive letter.
            string otherDir = otherLocal._dir;

            if (otherDir.Length >= 2 && _dir.Length >= 2)
            {
                if (otherDir[1] == ':' && _dir[1] == ':')
                {
                    return(Char.ToUpperInvariant(otherDir[0]) == Char.ToUpperInvariant(_dir[0]));
                }
            }

            return(true);
        }
Beispiel #6
0
 public abstract bool HasCommonRoot(FileLocator other);
Beispiel #7
0
        internal static VirtualDiskLayer OpenDiskLayer(FileLocator locator, string path, FileAccess access)
        {
            string extension = Path.GetExtension(path).ToUpperInvariant();
            if (extension.StartsWith(".", StringComparison.Ordinal))
            {
                extension = extension.Substring(1);
            }

            VirtualDiskFactory factory;
            if (ExtensionMap.TryGetValue(extension, out factory))
            {
                return factory.OpenDiskLayer(locator, path, access);
            }

            return null;
        }
Beispiel #8
0
 public abstract bool HasCommonRoot(FileLocator other);
 public abstract VirtualDisk OpenDisk(FileLocator locator, string path, FileAccess access);
 public abstract VirtualDisk CreateDisk(FileLocator locator, string variant, string path, long capacity, Geometry geometry, Dictionary <string, string> parameters);
Beispiel #11
0
 public abstract VirtualDiskLayer OpenDiskLayer(FileLocator locator, string path, FileAccess access);
Beispiel #12
0
 public virtual VirtualDisk OpenDisk(FileLocator locator, string path, string extraInfo, Dictionary<string, string> parameters, FileAccess access)
 {
     return OpenDisk(locator, path, access);
 }
Beispiel #13
0
 public abstract VirtualDisk CreateDisk(FileLocator locator, string variant, string path, VirtualDiskParameters diskParameters);
 public abstract VirtualDisk CreateDisk(FileLocator locator, string variant, string path, long capacity, Geometry geometry, Dictionary<string, string> parameters);
 public virtual VirtualDisk OpenDisk(FileLocator locator, string path, string extraInfo, Dictionary <string, string> parameters, FileAccess access)
 {
     return(OpenDisk(locator, path, access));
 }
 public abstract VirtualDisk CreateDisk(FileLocator locator, string variant, string path, VirtualDiskParameters diskParameters);