-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackupDialog.cs
More file actions
63 lines (56 loc) · 1.62 KB
/
Copy pathBackupDialog.cs
File metadata and controls
63 lines (56 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace C__Backup
{
public partial class BackupDialog : Form
{
private List<string> ns;
private List<string[]> ft;
private string nameFileTxt;
private string backupOtherDir;
public BackupDialog(List<string> ns, List<string[]> ft, string nameFileTxt, string backupOtherDir)
{
this.ns = ns;
this.ft = ft;
this.nameFileTxt = nameFileTxt;
this.backupOtherDir = backupOtherDir;
InitializeComponent();
}
public void Set(string from = "", string to = "", string info = "", int actual = -1, int backup = -1)
{
if (from != "") txtFromDir.Text = "From Directory: " + from;
if (to != "") txtToDir.Text = "To Directory: " + to;
if (info != "") txtInfo.Text = "Info:\nNot Implemented";
if (actual != -1) prgsActual.Value = actual;
if (backup != -1) prgsBackup.Value = backup;
Refresh();
}
private void BackupDialog_Load(object sender, EventArgs e)
{
// Doing NameFolder to txt file
for (int i = 0; i < ns.Count; i++)
{
Set(to: backupOtherDir);
Set(from: ns[i], actual: 0);
List<string> names = Directory.GetFileSystemEntries(ns[i]).ToList();
Set(actual: 50);
File.Create(nameFileTxt).Close();
File.AppendAllLines(nameFileTxt, names);
Set(actual: 100);
}
Set(backup: 3);
// Copy Folders
for (int i = 0; i < ft.Count; i++)
{
Set(from: ft[i][0], to: ft[i][0], actual: 0);
// TODO: Copy directories
// TODO: Make info folder string
Set(backup: 3 + ((i+1) * 97 / ft.Count));
}
Close();
}
}
}