Exemple #1
0
            private Fixture()
            {
                _operations = new ProxyGenerator().CreateInterfaceProxyWithTargetInterface <IDokanOperations>(null, _interceptor);

                var loggerMock = new Mock <ILogger>();

                loggerMock.Setup(l => l.Info(It.IsAny <string>())).Callback((string message) => Console.WriteLine(message));
                _logger = loggerMock.Object;

                Reset(null);
                SetupGetRoot();

                // DokanOptions.RemovableDrive
                // HACK: handle non-unique parameter set of DokanOperations.Mount() by explicitely specifying AllocationUnitSize and SectorSize
                var options = DokanOptions.DebugMode | DokanOptions.NetworkDrive | DokanOptions.MountManager | DokanOptions.CurrentSession | DokanOptions.UserModeLock;

                (_mounterThread = new Thread(new ThreadStart(() =>
                                                             _operations.Mount(MOUNT_POINT, options, 5, 121, TimeSpan.FromMinutes(5), null, 512, 512)))).Start();
                var mountedDrive = GetDriveInfo();

                while (!mountedDrive.IsReady)
                {
                    Thread.Sleep(50);
                }
            }
Exemple #2
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.Information("Mounting MongoDb@{ConnectionString} as {MountPoint}",
                                _commandLineArguments.ConnectionString, _commandLineArguments.MountPoint);

            Task.Factory.StartNew(() =>
            {
                try
                {
                    _dokanOperations.Mount
                    (
                        _commandLineArguments.MountPoint,
                        DokanOptions.WriteProtection,
                        _commandLineArguments.ThreadCount,
                        _dokanLogger
                    );
                }
                catch (Exception exception)
                {
                    _logger.Fatal(exception, "Exception on mouting filesystem.");
                    _lifetime.StopApplication();
                }
            }, TaskCreationOptions.LongRunning);

            return(Task.CompletedTask);
        }
Exemple #3
0
 public void Start()
 {
     System.IO.Directory.SetCurrentDirectory(Application.StartupPath);
     try
     {
         sshfs_.Mount(mountPoint_, opt_, threadCount_);
     }
     catch (DokanException ex)
     {
         MessageBox.Show(ex.Message, "Error");
         Application.Exit();
     }
     Debug.WriteLine("DokanNet.Main end");
 }
Exemple #4
0
            private Fixture()
            {
                operations = new ProxyGenerator().CreateInterfaceProxyWithTargetInterface <IDokanOperations>(null, interceptor);

                var loggerMock = new Mock <NLog.ILogger>();

                loggerMock.Setup(l => l.Trace(It.IsAny <string>())).Callback((string message) => Console.WriteLine(message));
                logger = loggerMock.Object;

                Reset();
                SetupGetRoot();

                (mounterThread = new Thread(new ThreadStart(() => operations.Mount(MOUNT_POINT, DokanOptions.DebugMode | DokanOptions.RemovableDrive, 5, 1000, TimeSpan.FromMinutes(5))))).Start();
                var mountedDrive = GetDriveInfo();

                while (!mountedDrive.IsReady)
                {
                    Thread.Sleep(50);
                }
            }