private void btnok_Click(object sender, EventArgs e) { var sys = VirtualEnvironments.Get(txtcsys.Text); if (sys != null) { //user auth var user = sys.Users.FirstOrDefault(x => x.Username == txtcuser.Text && x.Password == txtcpass.Text); if (user != null) { OpenConnection = sys; CurrentRemoteUser = user; if (Mounts.Count == 3) { Mounts.RemoveAt(2); } Mounts.Add(sys.Filesystem); ChangeDirectory("2:"); pnlconnect.Hide(); connectToRemoteServerToolStripMenuItem.Text = "Reauthenticate"; disconnectToolStripMenuItem.Visible = true; return; } Infobox.Show("Access denied.", "Authentication failed for the specified user. Connection aborted."); return; } var t = new System.Threading.Thread(() => { System.Threading.Thread.Sleep(5000); Infobox.Show("Connection timeout.", "Cannot connect to the specified system name..."); }); t.IsBackground = true; t.Start(); }
private void button3_Click(object sender, EventArgs e) { var picker = new FolderBrowserDialog(); if (picker.ShowDialog() == DialogResult.OK) { var inf = new System.IO.DirectoryInfo(picker.SelectedPath); var dir = new Directory { Name = inf.Name, permissions = Objects.UserPermissions.Guest, }; Mounts.Add(dir); string mpath = (Mounts.Count - 1) + ":/"; Import(inf.FullName, mpath); SetupTree(); } }
private void button2_Click(object sender, EventArgs e) { Infobox.PromptText("Create filesystem", "Please name your file system.", (result) => { if (string.IsNullOrWhiteSpace(result)) { MessageBox.Show(text: "ShiftFS does not allow blank volume names.", caption: "Volume name can't be blank", icon: MessageBoxIcon.Error, buttons: MessageBoxButtons.OK); } else { var dir = new Directory(); dir.Name = result; dir.permissions = Objects.UserPermissions.Guest; Mounts.Add(dir); SetupTree(); } }); }
public void AddDisk(WorkspacePath path, IFileSystem disk) { // If we are out of open disks, remove the last one if (TotalDisks == MaxDisks) { RemoveDisk(Disks.Last()); } // Attempt to remove the disk if it is already inserted RemoveDisk(path); // Add the new disk to the disk mount Mounts.Add(new KeyValuePair <WorkspacePath, IFileSystem>(path, disk)); if (!_disks.Contains(path)) { _disks.Add(path); } // InvalidateDisks(); }
public void MountWorkspace(string name) { var filePath = WorkspacePath.Root.AppendDirectory("User"); // Make sure that the user directory exits if (Exists(filePath)) { filePath = filePath.AppendDirectory(name); // If the filesystem doesn't exit, we want to create it if (!Exists(filePath)) { CreateDirectory(filePath); } } var workspaceDisk = new SubFileSystem(this, filePath); Mounts.Add( new KeyValuePair <WorkspacePath, IFileSystem>(WorkspacePath.Root.AppendDirectory("Workspace"), workspaceDisk)); }
public void AddMount(KeyValuePair <WorkspacePath, IFileSystem> mount) { Mounts.Add(mount); }