Beispiel #1
0
        public void WriteArchive(List <EntryData> EntryList, Stream BaseStream)
        {
            if (EntryList.Count == 0)
            {
                BaseStream.Close();
                DeleteArchive();
                return;
            }
            UserDataIOManager.GenerateNewCryptoRNGAndSave();
            Stream        CryptoStream = Crypto.AESStream.CtrEncryptionStreamCurrentSession(BaseStream);
            ArchiveWriter Writer       = new ArchiveWriter(CryptoStream, EntryList.Count);

            try
            {
                for (int i = 0; i < EntryList.Count; i++)
                {
                    Writer.WriteEntry(EntryList[i]);
                }
            }
            catch (Exception ex)
            {
                ExceptionThrownEvent?.Invoke(ex);
            }
            finally
            {
                Writer.Close();
                GC.Collect();
                ProgressCompletedEvent?.Invoke();
            }
        }
Beispiel #2
0
 /// <summary>
 /// UI委托处理
 /// </summary>
 /// <param name="uiTask"></param>
 public void Start(Action uiTask)
 {
     try
     {
         uiTask.Invoke();
     }
     catch (InvalidOperationException e)
     {
     }
     finally
     {
         ProgressCompleted?.Invoke();
     }
 }
Beispiel #3
0
 /// <summary>
 /// UI委托处理
 /// </summary>
 /// <param name="uiTask"></param>
 public async void StartAsync(Func <Task> uiTask)
 {
     try
     {
         await uiTask.Invoke();
     }
     catch (InvalidOperationException e)
     {
     }
     finally
     {
         ProgressCompleted?.Invoke();
     }
 }
Beispiel #4
0
 /// <summary>
 /// UI委托处理
 /// </summary>
 /// <param name="uiTask"></param>
 public void Start(Action uiTask)
 {
     try
     {
         uiTask.Invoke();
     }
     catch (InvalidOperationException e)
     {
         Console.WriteLine($"UI交互处理,产生异常!{ e.Message}");
     }
     finally
     {
         ProgressCompleted?.Invoke();
     }
 }
Beispiel #5
0
 /// <summary>
 /// UI委托处理
 /// </summary>
 /// <param name="uiTask"></param>
 public async void StartAsync(Func <Task> uiTask)
 {
     try
     {
         await uiTask.Invoke();
     }
     catch (InvalidOperationException e)
     {
         Console.WriteLine($"UI交互处理,产生异常!{ e.Message}");
     }
     finally
     {
         ProgressCompleted?.Invoke();
     }
 }
 protected void OnProgressCompleted(ProgressCompletedEventArgs e)
 {
     ProgressCompleted?.Invoke(this, e);
 }
Beispiel #7
0
 protected virtual void OnProgressCompleted(EventArgs args)
 {
     ProgressCompleted?.Invoke(this, args);
 }