コード例 #1
0
ファイル: ModuleHelpers.cs プロジェクト: Lukas0610/ndiscutils
        public static void MountStream(Stream stream, BaseMountOptions opts)
        {
            using (var mountPoint = new DiscFileSystemMountPoint(stream, opts))
            {
                Logger.Info("Preparing mount point at {0}:\\ (read-only={1})", opts.Letter, opts.ReadOnly);

                DokanOptions mountOptions = DokanOptions.FixedDrive | DokanOptions.MountManager;

                if (mountPoint.IsReadOnly)
                {
                    mountOptions |= DokanOptions.WriteProtection;
                }

                Logger.Info("Attributes: 0x{0:X} ({1})", mountOptions, mountOptions.ToString());

                try
                {
                    Logger.Info("Attempting to mount stream at {0}:\\ with {1} thread(s)", opts.Letter, opts.Threads);
                    mountPoint.Mount($"{opts.Letter}:", mountOptions, opts.Threads,
                                     DiscFileSystemMountPoint.VERSION, TimeSpan.FromSeconds(5),
                                     $"nDiscUtils\\{opts.Letter}", new DokanNullLogger());
                }
                catch (DokanException dex)
                {
                    Logger.Exception("Internal Dokan Exception: {0}", dex.Message);
                    Logger.Exception(dex);
                }
            }
        }