App.xaml.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using Vinno.IUS.Common.Configuration;
  10. namespace EncyptTool
  11. {
  12. /// <summary>
  13. /// App.xaml 的交互逻辑
  14. /// </summary>
  15. public partial class App : Application
  16. {
  17. protected override void OnStartup(StartupEventArgs e)
  18. {
  19. if (e.Args.Length == 3)
  20. {
  21. if (e.Args[0].ToLower() == "/cmd")
  22. {
  23. var configEncrypter = new ConfigCrypter();
  24. var source = e.Args[1];
  25. var destination = e.Args[2];
  26. var textToBeEncrypt = File.ReadAllText(source);
  27. var encryptedText = configEncrypter.EncryptDES(textToBeEncrypt);
  28. File.WriteAllText(destination, encryptedText);
  29. Current.Shutdown(0);
  30. return;
  31. }
  32. }
  33. base.OnStartup(e);
  34. }
  35. }
  36. }