Procházet zdrojové kódy

minor updates with output text zone

olinox před 9 roky
rodič
revize
6ddc4615e8

binární
.vs/barry/v14/.suo


+ 1 - 1
barry/MainWindow.xaml

@@ -5,7 +5,7 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:barry"
         mc:Ignorable="d"
-        Title="Barry the Elephant" Height="350" Width="654.611"
+        Title="Barry the Elephant" Height="350" Width="662.697"
         Loaded="OnWindowLoaded">
     <Grid Margin="0,0,109,0">
         <Grid.ColumnDefinitions>

+ 7 - 60
barry/MainWindow.xaml.cs

@@ -56,10 +56,10 @@ namespace barry
         internal void init_console()
         {
             txt_console.Document.Blocks.Clear();
-            print("**** BARRY Backup ****\n");
+            print("**** BARRY Backup ****");
             if (bkp == null)
             {
-                print(">> unknown machine");
+                print("  >> unknown machine");
                 btn_backup.IsEnabled = false;
                 btn_preview.IsEnabled = false;
             }
@@ -69,7 +69,6 @@ namespace barry
             }
         }
 
-
         internal string bkp_source()
         {
             return bkp.source_path();
@@ -86,12 +85,10 @@ namespace barry
             img_barry.Source = bitmap;
         }
 
-        private string last_added = "";
         public void print(string line, bool flush = false)
         {
-            txt_console.AppendText(line + "\n");
+            txt_console.AppendText(line + "\r");
             txt_console.ScrollToEnd();
-            last_added = line + "\n";
         }
 
         private void OnWindowLoaded(object sender, RoutedEventArgs e)
@@ -111,10 +108,10 @@ namespace barry
 
         public void run_backup()
         {
+            init_console();
             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_result = "SUCCESS";
-            init_console();
         }
 
         public void autoexec()
@@ -130,8 +127,9 @@ namespace barry
 
         public void preview_backup()
         {
-            cmd(String.Format("ROBOCOPY {0} {1} /E /XO /L", bkp_source(), bkp_target()));
             init_console();
+            cmd(String.Format("ROBOCOPY {0} {1} /E /XO /L /NJH", bkp_source(), bkp_target()));
+            
         }
 
         public void cmd(string cmd)
@@ -149,7 +147,7 @@ namespace barry
                 //p.StartInfo.RedirectStandardInput = true;
 
                 p.StartInfo.RedirectStandardError = true;
-                //p.StartInfo.StandardErrorEncoding = Encoding.UTF8;
+                p.StartInfo.StandardErrorEncoding = Encoding.UTF8;
                 p.StartInfo.CreateNoWindow = true;
                 p.OutputDataReceived += new DataReceivedEventHandler(process_ouput_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

+ 2 - 8
barry/OptionsWindow.xaml.cs

@@ -8,7 +8,6 @@ namespace barry
     /// </summary>
     public partial class OptionsWindow : Window
     {
-        //Methods methods = new Methods();
         BackupConfig bkp;
         bool _loaded = false;
         public OptionsWindow(BackupConfig current_bkp)
@@ -65,12 +64,6 @@ namespace barry
         private void txt_subdir_TextChanged(object sender, TextChangedEventArgs e)
         {
             if (!_loaded) { return; }
-            //if (! System.IO.Directory.Exists(txt_subdir.Text))
-            //{
-            //    lbl_decription.Content = "Wait! Barry does not find this directory on the computer!";
-            //    return;
-            //}
-            
             bkp.local_subdir = txt_subdir.Text;
             update_window();
         }
@@ -89,7 +82,8 @@ namespace barry
 
         private void btn_exploredevice_Click(object sender, RoutedEventArgs e)
         {
-            txt_subdir.Text = methods.select_directory_dialog("Select a directory on your device");
+            string dir = methods.select_directory_dialog("Select a directory on your device");
+            txt_subdir.Text = dir.Replace(methods.current_drive_letter(), "");
         }
 
         private void chk_autoexec_Checked(object sender, RoutedEventArgs e)

+ 5 - 5
barry/bin/Debug/barry.dat

@@ -6,9 +6,9 @@
     "last_bkp_date": "Never",
     "last_bkp_result": "",
     "last_bkp_target": "",
-    "dir_path": "E:\\Backup",
-    "local_subdir": "",
-    "local_subdir_path": "O:\\"
+    "dir_path": "G:\\test",
+    "local_subdir": "Projets\\sketchup",
+    "local_subdir_path": "E:\\Projets\\sketchup"
   },
   "55041-007-1341865-86915": {
     "machine_guid": "55041-007-1341865-86915",
@@ -19,7 +19,7 @@
     "last_bkp_target": "",
     "dir_path": "C:\\Users\\olivier.massot\\Documents\\barry_test\\",
     "local_subdir": "apps\\portable\\VLCPortable\\",
-    "local_subdir_path": "O:\\apps\\portable\\VLCPortable\\"
+    "local_subdir_path": "E:\\apps\\portable\\VLCPortable\\"
   },
   "00359-OEM-8992687-00006": {
     "machine_guid": "00359-OEM-8992687-00006",
@@ -30,6 +30,6 @@
     "last_bkp_target": "",
     "dir_path": "a:\\barry_bkp\\",
     "local_subdir": "",
-    "local_subdir_path": "O:\\"
+    "local_subdir_path": "E:\\"
   }
 }

binární
barry/bin/Debug/barry.exe


binární
barry/bin/Debug/barry.pdb


+ 6 - 12
barry/core/BackupConfig.cs

@@ -71,13 +71,9 @@ namespace barry
         public string describe()
         {
             
-            string msg = "Barry will copy all of your files and directories from {0} to {1}";
-            string usb_part = String.Format("your USB Device {0}, mapped in {1} ", methods.current_drive_label(), methods.current_drive_letter());
-            if (local_subdir.Length > 0)
-            {
-                usb_part += "(subdir: " + local_subdir + ")";
-            }
-            string cpu_part = String.Format("your computer {0}, in {1}", methods.computer_name(), dir_path);
+            string msg = "Barry will copy all of your files and directories from:\r {0}\r TO\r {1}";
+            string usb_part = String.Format("- {1}{2} (in '{0}')", methods.current_drive_label(), methods.current_drive_letter(), local_subdir);
+            string cpu_part = String.Format("- {1} (on pc {0})", methods.computer_name(), dir_path);
 
             if (bkp_type == 1)
             {
@@ -92,9 +88,7 @@ namespace barry
                 return "Problem: Barry doesn't know what he should do. And he REALLY does not like that...";
             }
 
-            msg += String.Format("\n {0} >>> {1}", source_path(), target_path());
-
-            msg += "\nThe last time Barry did that was " + last_bkp_date + ", and the result was: " + last_bkp_result;
+            msg += "\rLast execution: " + last_bkp_date;
             return msg;
         }
 
@@ -118,7 +112,7 @@ namespace barry
             {
                 //"This directory should NOT be on your usb device"
                 //throw new ArgumentException();
-                return "This directory should NOT be on your usb device: " + dir_path;
+                return "Target directory should NOT be on the drive where barry is installed: " + dir_path;
             }
 
             if (!Directory.Exists(local_subdir_path))
@@ -128,7 +122,7 @@ namespace barry
             else if (local_subdir.Length > 0 && !methods.is_subdir(local_subdir_path, methods.current_drive_letter()))
             {
                 //"This directory should be on your usb device"
-                return "This directory should be on your usb device: " + local_subdir_path;
+                return "Source directory should be on the drive where barry is installed: " + local_subdir_path;
             }
             return "";
         }

binární
barry/obj/Debug/MainWindow.baml


+ 1 - 1
barry/obj/Debug/MainWindow.g.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "47D9B25878492406E408A5BDF5B2B1A5"
+#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "5B28F31407A87C7791AB360031016D44"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     Ce code a été généré par un outil.

+ 1 - 1
barry/obj/Debug/MainWindow.g.i.cs

@@ -1,4 +1,4 @@
-#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "47D9B25878492406E408A5BDF5B2B1A5"
+#pragma checksum "..\..\MainWindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "5B28F31407A87C7791AB360031016D44"
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     Ce code a été généré par un outil.

+ 1 - 0
barry/obj/Debug/barry.csproj.FileListAbsolute.txt

@@ -50,3 +50,4 @@ E:\dev\barry\barry\obj\Debug\MainWindow.baml
 E:\dev\barry\barry\obj\Debug\barry.g.resources
 E:\dev\barry\barry\obj\Debug\barry.Properties.Resources.resources
 E:\dev\barry\barry\obj\Debug\barry.csproj.GenerateResource.Cache
+E:\dev\barry\barry\obj\Debug\barry.csprojResolveAssemblyReference.cache

binární
barry/obj/Debug/barry.csprojResolveAssemblyReference.cache


binární
barry/obj/Debug/barry.exe


binární
barry/obj/Debug/barry.g.resources


binární
barry/obj/Debug/barry.pdb


+ 1 - 1
barry/obj/Debug/barry_MarkupCompile.i.cache

@@ -16,5 +16,5 @@ E:\dev\barry\barry\App.xaml
 21557872302
 MainWindow.xaml;OptionsWindow.xaml;
 
-False
+True
 

+ 4 - 0
barry/obj/Debug/barry_MarkupCompile.i.lref

@@ -0,0 +1,4 @@
+
+
+FE:\dev\barry\barry\MainWindow.xaml;;
+