Esempio n. 1
0
        /// <summary>
        /// Invoke the whole backup process - get sources, discover files, copy to destination
        /// </summary>
        public void InvokeBackup()
        {
            try
            {
                //BackupStarted?.Invoke();

                //while (!cts.IsCancellationRequested)
                //{
                //    Thread.Sleep(1000);
                //    Debug.WriteLine("WORKING");
                //}
                //Debug.WriteLine("COMPLETE");
                //isWorking = false;
                //return;

                var sources = SourcesManager.GetSources();
                var files   = DiscoverFiles(sources);
                SaveDiscoveredFiles(files);
                CopyFilesAsync();
                UpdateTimestamp(sources);

                //BackupCompleted?.Invoke();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                //BackupError?.Invoke(ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Update the timestamp on the sources file
        /// </summary>
        public static void UpdateTimestamp(IEnumerable <Source> sources)
        {
            foreach (var s in sources)
            {
                s.LastBackup = DateTime.Now;
            }

            SourcesManager.SaveSources(sources);
        }