private void Form1_Load(object sender, EventArgs e) { Login login = new Login(); client = new FTPManagerClass(hostingname, hostingpassword, host); manager = new FTP(host, hostingname, hostingpassword); dataGridView1.Rows.Clear(); string[] files = manager.FilesOnServer(""); int i = 0; foreach (string filename in files) { if (filename == username) { i = 1; } dataGridView1.Rows.Add(filename); } if (i == 0) { manager.CreateDirectory(username); } RefreshGet(); }
internal static bool HideBackup(string Backup) { if (string.IsNullOrEmpty(UserAccount.Name)) { return(false); } string Trash = "VNX+ - Backup Trash\\"; Backup = Backup.Replace("/", "§"); string[] List = FTP.TreeDir(UserDir); if (!List.Contains(Backup)) { return(false); } if (!List.Contains("VNX+ - Backup Trash")) { FTP.CreateDirectory(UserDir + Trash); } return(FTP.MoveFile(UserDir + Backup, "\\" + UserDir + Trash + Backup)); }
private void button6_Click(object sender, EventArgs e) { manager.CreateDirectory(textBox4.Text); RefreshGet(); }
internal static bool Backup(string[] Strings, bool IsSave = false) { try { if (GetConfig("VNXTLP", "OfflineBackup", false) == "true" && !IsSave) { Save(BackupFileName, Strings, true); } if (string.IsNullOrEmpty(UserAccount.Name)) { return(false); } UploadingBackup = true; string UserDir = @"Backup\" + UserAccount.Name; if (!UserDirExist || !BackupDirExist) { BackupDirExist = Exist("Backup"); if (!BackupDirExist) { FTP.CreateDirectory("Backup"); } UserDirExist = Exist(UserAccount.Name, "Backup"); if (!UserDirExist) { FTP.CreateDirectory(UserDir); } } DateTime Now = DateTime.Now; string BackupName = string.Format("\\{0} - {1}§{2}§{3} At {4}:{5}{6} ({7})", Path.GetFileNameWithoutExtension(ScriptPath), Now.Day, Now.Month, Now.Year, Now.Hour, Now.Minute, Path.GetExtension(ScriptPath), (IsSave ? "Saved" : "Auto")); byte[] Backup = new byte[4]; BitConverter.GetBytes((uint)Strings.Length).CopyTo(Backup, 0); if (!BitConverter.IsLittleEndian) { Array.Reverse(Backup, 0, Backup.Length); } foreach (string Str in Strings) { byte[] String = Encoding.UTF8.GetBytes(Str); Array.Resize(ref String, String.Length + 1); for (int i = 0; i < String.Length; i++) { String[i] = XOR(String[i]); } int Pos = Backup.Length; Array.Resize(ref Backup, Backup.Length + String.Length); String.CopyTo(Backup, Pos); } FTP.Upload(UserDir + BackupName, Backup); UploadingBackup = false; return(true); } catch { UploadingBackup = false; return(false); } }