//************************************************************************************************************* private async void RemotePath_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Down || e.KeyCode == Keys.Up) { await RemoteList.LoadList(RemotePath.Text); } }
//************************************************************************************************************* private void RemotePin_Click(object sender, EventArgs e) { if (RemotePath.FindStringExact(RemoteList.CurrentDirectory) == -1) { RemoteList.PinFolder(); } else { RemoteList.UnpinFolder(); } }
//************************************************************************************************************* private void OnLoad(object sender, EventArgs e) { ShellImageList.SetSmallImageList(LocalList); ShellImageList.SetSmallImageList(RemoteList); LocalList.Init(this); RemoteList.Init(this, remoteIO); QueueList.Init(this, remoteIO); localPinTip.SetToolTip(LocalPin, ""); remotePinTip.SetToolTip(RemotePin, ""); linkTip.SetToolTip(LinkPath, ""); }
//************************************************************************************************************* private void OnLoad(object sender, EventArgs e) { ShellImageList.SetSmallImageList(LocalList); ShellImageList.SetSmallImageList(RemoteList); statusMain.Items["statusMainLabel"].Text = ""; statusLocal.Items["statusLocalLabel"].Text = ""; statusRemote.Items["statusRemoteLabel"].Text = ""; LocalList.Init(this); RemoteList.Init(this, remoteIO); QueueList.Init(this, remoteIO); localPinTip.SetToolTip(LocalPin, ""); remotePinTip.SetToolTip(RemotePin, ""); linkTip.SetToolTip(LinkPath, ""); }
//************************************************************************************************************* private void LinkFolders() { int LocalPinID = LocalList.PinFolder(); int RemotePinID = RemoteList.PinFolder(); //TODO: Move this into the Config using (XwDbCommand sql = new XwDbCommand(Config.GetConnectionString(), "Data.SQLite")) { sql.ExecuteTX($"UPDATE Pins SET LinkTo=NULL WHERE LinkTo={LocalPinID}"); sql.ExecuteTX($"UPDATE Pins SET LinkTo=NULL WHERE LinkTo={RemotePinID}"); sql.ExecuteTX($"UPDATE Pins SET LinkTo={LocalPinID} WHERE ID={RemotePinID}"); sql.ExecuteTX($"UPDATE Pins SET LinkTo={RemotePinID} WHERE ID={LocalPinID}"); LinkPath.Image = Resources.link; linkTip.SetToolTip(LinkPath, "Unlink folders"); LinkPath.Tag = true; } }
//************************************************************************************************************* public async Task CheckLink(string path, bool local) { if (SkipCheckLink) { SkipCheckLink = false; return; } //TODO: Move this into the Config using (XwDbCommand sql = new XwDbCommand(Config.GetConnectionString(), "Data.SQLite")) { sql.AddParameter("Local", local); sql.ExecuteTX($@"SELECT l.[path] FROM pins p INNER JOIN pins l ON l.ID=p.LinkTo WHERE p.Local=@Local AND p.path='{path}' AND p.ServerID={server.ID}"); if (sql.Read()) { LinkPath.Tag = true; LinkPath.Image = Resources.link; string link = sql.Value(0).ToString(); linkTip.SetToolTip(LinkPath, "Unlink folders"); if (local) { await RemoteList.LoadList(link); } else { LocalList.LoadList(link); } } else { LinkPath.Tag = false; LinkPath.Image = Resources.link_break; linkTip.SetToolTip(LinkPath, "Link local and remote folders"); } } }
//******************************************************************************************** private void OnLoad(object sender, EventArgs e) { ShellImageList.SetSmallImageList(LocalList); ShellImageList.SetSmallImageList(RemoteList); /* * Don't remember why i did this * try * { * IPAddress[] addresses = Dns.GetHostAddresses(this.server.Host); * server.Host = addresses[0].ToString(); * } * catch { } */ LocalList.Init(this); RemoteList.Init(this, remoteIO); QueueList.Init(this, remoteIO); localPinTip.SetToolTip(LocalPin, ""); remotePinTip.SetToolTip(RemotePin, ""); linkTip.SetToolTip(LinkPath, ""); }
//************************************************************************************************************* public async Task Connect() { loadingCircle1.Active = true; loadingCircle1.InnerCircleRadius = 15; loadingCircle1.OuterCircleRadius = 30; loadingCircle1.SpokeThickness = 5; loadingCircle1.Top = (this.Height / 2) + 10; loadingCircle1.Left = (this.Width / 2) - 40; loadingCircle1.Visible = true; loadingCircle1.BringToFront(); SetStatusText("Connecting..."); Update(); XwRemoteIOResult result = null; switch (server.Type) { case ServerType.FTP: result = await remoteIO.ConnectToFTP( server.Host, server.Port, server.Username, server.Password, server.FtpDataType, server.Encryption); break; case ServerType.SFTP: result = await remoteIO.ConnectToSFTP( server.Host, server.Port, server.Username, server.Password, server.SshKey); break; case ServerType.AWSS3: result = await remoteIO.ConnectToAWSS3( server.Host, server.Username, server.Password); break; case ServerType.AZUREFILE: result = await remoteIO.ConnectToAZUREFILE( server.Username, server.Password); break; default: throw new Exception("Invalid engine"); } if (result.Success) { Log(result.Message); await RemoteList.Load(); } else { loadingCircle1.Visible = false; SetStatusText(result.Message); } }
//************************************************************************************************************* private async void RemotePath_DropDownClosed(object sender, EventArgs e) { RemoteList.CheckLick = true; string path = (RemotePath.SelectedItem == null) ? RemotePath.Text : RemotePath.SelectedItem.ToString(); await RemoteList.LoadList(path); }