Example #1
0
 public override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_fileSystem != null)
         {
             _fileSystem.Dispose();
             _fileSystem = null;
         }
     }
     base.Dispose(disposing);
 }
Example #2
0
 public override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_fileSystem != null)
         {
             _fileSystem.Dispose();
             _fileSystem = null;
         }
     }
     base.Dispose(disposing);
 }
Example #3
0
        public override void Connect(Uri uri, string username, string password)
        {
            string fsPath = uri.AbsolutePath;

            // Find the best (least specific) export
            string bestRoot        = null;
            int    bestMatchLength = int.MaxValue;

            foreach (string export in NfsFileSystem.GetExports(uri.Host))
            {
                if (fsPath.Length >= export.Length)
                {
                    int matchLength = export.Length;
                    for (int i = 0; i < export.Length; ++i)
                    {
                        if (export[i] != fsPath[i])
                        {
                            matchLength = i;
                            break;
                        }
                    }

                    if (matchLength < bestMatchLength)
                    {
                        bestRoot        = export;
                        bestMatchLength = matchLength;
                    }
                }
            }

            if (bestRoot == null)
            {
                throw new IOException(string.Format(CultureInfo.InvariantCulture,
                                                    "Unable to find an NFS export providing access to '{0}'", fsPath));
            }

            _fileSystem = new NfsFileSystem(uri.Host, bestRoot);
            _path       = fsPath.Substring(bestRoot.Length).Replace('/', '\\');
            _extraInfo  = uri.Fragment.TrimStart('#');
        }
Example #4
0
        public override void Connect(Uri uri, string username, string password)
        {
            string fsPath = uri.AbsolutePath;

            // Find the best (least specific) export
            string bestRoot = null;
            int bestMatchLength = int.MaxValue;
            foreach (var export in NfsFileSystem.GetExports(uri.Host))
            {
                if (fsPath.Length >= export.Length)
                {
                    int matchLength = export.Length;
                    for (int i = 0; i < export.Length; ++i)
                    {
                        if (export[i] != fsPath[i])
                        {
                            matchLength = i;
                            break;
                        }
                    }

                    if (matchLength < bestMatchLength)
                    {
                        bestRoot = export;
                        bestMatchLength = matchLength;
                    }
                }
            }

            if (bestRoot == null)
            {
                throw new IOException(string.Format(CultureInfo.InvariantCulture, "Unable to find an NFS export providing access to '{0}'", fsPath));
            }

            _fileSystem = new NfsFileSystem(uri.Host, bestRoot);
            _path = fsPath.Substring(bestRoot.Length).Replace('/', '\\');
            _extraInfo = uri.Fragment.TrimStart('#');
        }