You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Program.cs 1.6 kB

10 years ago
12 years ago
10 years ago
10 years ago
10 years ago
12 years ago
10 years ago
12 years ago
12 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
12 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Shadowsocks.Controller;
  2. using Shadowsocks.Properties;
  3. using Shadowsocks.View;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using System.Threading;
  9. using System.Windows.Forms;
  10. namespace Shadowsocks
  11. {
  12. static class Program
  13. {
  14. /// <summary>
  15. /// 应用程序的主入口点。
  16. /// </summary>
  17. [STAThread]
  18. static void Main()
  19. {
  20. using (Mutex mutex = new Mutex(false, "Global\\" + "71981632-A427-497F-AB91-241CD227EC1F"))
  21. {
  22. if (!mutex.WaitOne(0, false))
  23. {
  24. Process[] oldProcesses = Process.GetProcessesByName("Shadowsocks");
  25. if (oldProcesses.Length > 0)
  26. {
  27. Process oldProcess = oldProcesses[0];
  28. }
  29. MessageBox.Show("Shadowsocks is already running.\n\nFind Shadowsocks icon in your notify tray.");
  30. return;
  31. }
  32. Directory.SetCurrentDirectory(Application.StartupPath);
  33. #if !DEBUG
  34. Logging.OpenLogFile();
  35. #endif
  36. Application.EnableVisualStyles();
  37. Application.SetCompatibleTextRenderingDefault(false);
  38. ShadowsocksController controller = new ShadowsocksController();
  39. MenuViewController viewController = new MenuViewController(controller);
  40. Application.Run();
  41. }
  42. }
  43. }
  44. }