Ejemplo n.º 1
0
 public NFSProxy(System.Net.IPAddress address)
 {
     nfsClient = new NFSClient(NFSClient.NFSVersion.v3);
     nfsClient.Connect(address, 500, 500, 600000);
 }
Ejemplo n.º 2
0
        private void Connect()
        {
            IPAddress ipAddress = new IPAddress(ipAddressControl1.GetAddressBytes());

            if (PingServer(ipAddress))
            {
                NFSClient.NFSVersion ver = NFSClient.NFSVersion.v2;
                if (cboxVer.SelectedItem.ToString() == "V3")
                {
                    ver = NFSClient.NFSVersion.v3;
                }

                mNFS = new NFSClient(ver);
                int      UserId   = int.Parse(tbUserId.Text);
                int      GroupId  = int.Parse(tbGroupId.Text);
                Encoding encoding = Encoding.ASCII;
                if (chkUnicode.Checked)
                {
                    encoding = Encoding.UTF8;
                }
                mNFS.Connect(ipAddress, UserId, GroupId, (int)nupTimeOut.Value, encoding, chkUsePrivilegedPorts.Checked);
                cboxRemoteDevices.Items.Clear();
                foreach (string strDev in mNFS.GetExportedDevices())
                {
                    cboxRemoteDevices.Items.Add(strDev);
                }
                if (cboxRemoteDevices.Items.Count > 0)
                {
                    gboxMount.Enabled = true;
                }
                btnConnect.Enabled            = false;
                btnDisconnect.Enabled         = true;
                ipAddressControl1.Enabled     = false;
                cboxVer.Enabled               = false;
                tbGroupId.Enabled             = false;
                tbUserId.Enabled              = false;
                nupTimeOut.Enabled            = false;
                chkUnicode.Enabled            = false;
                chkAutoConnect.Enabled        = false;
                chkUsePrivilegedPorts.Enabled = false;

                if (cboxLocalDrive.Items.Count > NekoDrive.Properties.Settings.Default.DriveLetter)
                {
                    cboxLocalDrive.SelectedIndex = NekoDrive.Properties.Settings.Default.DriveLetter;
                }

                if (cboxRemoteDevices.Items.Count > NekoDrive.Properties.Settings.Default.RemoteDevice)
                {
                    cboxRemoteDevices.SelectedIndex = NekoDrive.Properties.Settings.Default.RemoteDevice;
                }

                chkAutoMount.Checked = NekoDrive.Properties.Settings.Default.AutoMount;
                tbDriveLabel.Text    = NekoDrive.Properties.Settings.Default.DriveLabel;
                chkUnicode.Checked   = NekoDrive.Properties.Settings.Default.Unicode;

                if (chkAutoMount.Checked)
                {
                    this.WindowState = FormWindowState.Minimized;
                    MountDrive();
                }
            }
            else
            {
                throw new ApplicationException("Server not found!");
            }
        }