|
@@ -56,10 +56,10 @@ namespace barry
|
|
|
internal void init_console()
|
|
internal void init_console()
|
|
|
{
|
|
{
|
|
|
txt_console.Document.Blocks.Clear();
|
|
txt_console.Document.Blocks.Clear();
|
|
|
- print("**** BARRY Backup ****\n");
|
|
|
|
|
|
|
+ print("**** BARRY Backup ****");
|
|
|
if (bkp == null)
|
|
if (bkp == null)
|
|
|
{
|
|
{
|
|
|
- print(">> unknown machine");
|
|
|
|
|
|
|
+ print(" >> unknown machine");
|
|
|
btn_backup.IsEnabled = false;
|
|
btn_backup.IsEnabled = false;
|
|
|
btn_preview.IsEnabled = false;
|
|
btn_preview.IsEnabled = false;
|
|
|
}
|
|
}
|
|
@@ -69,7 +69,6 @@ namespace barry
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
internal string bkp_source()
|
|
internal string bkp_source()
|
|
|
{
|
|
{
|
|
|
return bkp.source_path();
|
|
return bkp.source_path();
|
|
@@ -86,12 +85,10 @@ namespace barry
|
|
|
img_barry.Source = bitmap;
|
|
img_barry.Source = bitmap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private string last_added = "";
|
|
|
|
|
public void print(string line, bool flush = false)
|
|
public void print(string line, bool flush = false)
|
|
|
{
|
|
{
|
|
|
- txt_console.AppendText(line + "\n");
|
|
|
|
|
|
|
+ txt_console.AppendText(line + "\r");
|
|
|
txt_console.ScrollToEnd();
|
|
txt_console.ScrollToEnd();
|
|
|
- last_added = line + "\n";
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OnWindowLoaded(object sender, RoutedEventArgs e)
|
|
private void OnWindowLoaded(object sender, RoutedEventArgs e)
|
|
@@ -111,10 +108,10 @@ namespace barry
|
|
|
|
|
|
|
|
public void run_backup()
|
|
public void run_backup()
|
|
|
{
|
|
{
|
|
|
|
|
+ init_console();
|
|
|
cmd(String.Format("ROBOCOPY {0} {1} /E /XO /w:1 /r:3 /NP", bkp_source(), bkp_target()));
|
|
cmd(String.Format("ROBOCOPY {0} {1} /E /XO /w:1 /r:3 /NP", bkp_source(), bkp_target()));
|
|
|
bkp.last_bkp_date = String.Format("{0:yyyy-mm-dd hh:mm}", DateTime.Now);
|
|
bkp.last_bkp_date = String.Format("{0:yyyy-mm-dd hh:mm}", DateTime.Now);
|
|
|
bkp.last_bkp_result = "SUCCESS";
|
|
bkp.last_bkp_result = "SUCCESS";
|
|
|
- init_console();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void autoexec()
|
|
public void autoexec()
|
|
@@ -130,8 +127,9 @@ namespace barry
|
|
|
|
|
|
|
|
public void preview_backup()
|
|
public void preview_backup()
|
|
|
{
|
|
{
|
|
|
- cmd(String.Format("ROBOCOPY {0} {1} /E /XO /L", bkp_source(), bkp_target()));
|
|
|
|
|
init_console();
|
|
init_console();
|
|
|
|
|
+ cmd(String.Format("ROBOCOPY {0} {1} /E /XO /L /NJH", bkp_source(), bkp_target()));
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void cmd(string cmd)
|
|
public void cmd(string cmd)
|
|
@@ -149,7 +147,7 @@ namespace barry
|
|
|
//p.StartInfo.RedirectStandardInput = true;
|
|
//p.StartInfo.RedirectStandardInput = true;
|
|
|
|
|
|
|
|
p.StartInfo.RedirectStandardError = true;
|
|
p.StartInfo.RedirectStandardError = true;
|
|
|
- //p.StartInfo.StandardErrorEncoding = Encoding.UTF8;
|
|
|
|
|
|
|
+ p.StartInfo.StandardErrorEncoding = Encoding.UTF8;
|
|
|
p.StartInfo.CreateNoWindow = true;
|
|
p.StartInfo.CreateNoWindow = true;
|
|
|
p.OutputDataReceived += new DataReceivedEventHandler(process_ouput_handler);
|
|
p.OutputDataReceived += new DataReceivedEventHandler(process_ouput_handler);
|
|
|
//p.ErrorDataReceived += new DataReceivedEventHandler(process_error_handler);
|
|
//p.ErrorDataReceived += new DataReceivedEventHandler(process_error_handler);
|
|
@@ -196,54 +194,3 @@ namespace barry
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// *** BACKUP
|
|
|
|
|
-// 1- read the configuration file
|
|
|
|
|
-// IF NOT: warn, and create an empty, then quit
|
|
|
|
|
-// IF INVALID: warn and quit
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-// 2- control media name to see if good source
|
|
|
|
|
-// OR check existnce of a file which is nor copied
|
|
|
|
|
-// OR mark the destination directory as a backup dir and warn before being launbching from there
|
|
|
|
|
-// IF NOT: quit
|
|
|
|
|
-
|
|
|
|
|
-// 3- check the computer name (or mac adress?) >> UUID
|
|
|
|
|
-// if not found in cpu list: quit
|
|
|
|
|
-
|
|
|
|
|
-// 4- get the map letter and expand source
|
|
|
|
|
-
|
|
|
|
|
-// 5- get the destination path in config file
|
|
|
|
|
-// expands it
|
|
|
|
|
-// if none|inexistent|unauthorized, warn and displays a selection dialog
|
|
|
|
|
-// if cancelled, cancel prog and quit
|
|
|
|
|
-
|
|
|
|
|
-// 6- Displays the ongoing copy operation with source and destination
|
|
|
|
|
-
|
|
|
|
|
-// ***** to replace robocopy?
|
|
|
|
|
-// opt- analyse the source and destination:
|
|
|
|
|
-// build a tree of files
|
|
|
|
|
-// if source file do not exist in destination: copy
|
|
|
|
|
-// if source file is older than destination, replace it
|
|
|
|
|
-
|
|
|
|
|
-// #renamed file case:
|
|
|
|
|
-// if 2 files have same signature but differents names, propose to rename
|
|
|
|
|
-// #renamed dir case
|
|
|
|
|
-//
|
|
|
|
|
-// #moved file case
|
|
|
|
|
-//
|
|
|
|
|
-// #moved dir case
|
|
|
|
|
-//
|
|
|
|
|
-// ****
|
|
|
|
|
-
|
|
|
|
|
-// 8- Waits 14 seconds and propose a key to cancel
|
|
|
|
|
-
|
|
|
|
|
-// 9- process to copy
|
|
|
|
|
-
|
|
|
|
|
-// 10- displays results
|
|
|
|
|
-
|
|
|
|
|
-// END OF BACKUP
|
|
|
|
|
-
|
|
|
|
|
-// other tools:
|
|
|
|
|
-// purge backup: propose to remove or trash destination files which do not exist anymore in source
|
|
|
|
|
-// add this computer: add a computer in the list of backup targets
|
|
|
|
|
-// enable autorun: copy usbAR on the post, configure and run
|
|
|