Esempio n. 1
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);
        }
        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);
        }
Esempio n. 3
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);
        }
        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;
        }
Esempio n. 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);
        }
Esempio n. 6
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;
        }
Esempio n. 7
0
 public abstract bool HasCommonRoot(FileLocator other);
 public abstract VirtualDiskLayer OpenDiskLayer(FileLocator locator, string path, FileAccess access);
 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);
Esempio n. 11
0
 public abstract bool HasCommonRoot(FileLocator other);
Esempio n. 12
0
 public abstract VirtualDiskLayer OpenDiskLayer(FileLocator locator, string path, FileAccess access);
Esempio n. 13
0
 public virtual VirtualDisk OpenDisk(FileLocator locator, string path, string extraInfo, Dictionary <string, string> parameters, FileAccess access)
 {
     return(OpenDisk(locator, path, access));
 }
Esempio n. 14
0
 public abstract VirtualDisk CreateDisk(FileLocator locator, string variant, string path, VirtualDiskParameters diskParameters);