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.7 kB

10 years ago
12 years ago
12 years ago
10 years ago
12 years ago
12 years ago
10 years ago
10 years ago
10 years ago
12 years ago
10 years ago
12 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using Shadowsocks.Controller;
  2. using Shadowsocks.Properties;
  3. using Shadowsocks.View;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using System.Runtime.InteropServices;
  8. using System.Windows.Forms;
  9. namespace Shadowsocks
  10. {
  11. static class Program
  12. {
  13. [DllImport("Kernel32.dll")]
  14. private static extern IntPtr LoadLibrary(string path);
  15. /// <summary>
  16. /// 应用程序的主入口点。
  17. /// </summary>
  18. [STAThread]
  19. static void Main()
  20. {
  21. string tempPath = Path.GetTempPath();
  22. string dllPath = tempPath + "/polarssl.dll";
  23. try
  24. {
  25. FileManager.UncompressFile(dllPath, Resources.polarssl_dll);
  26. }
  27. catch (IOException e)
  28. {
  29. Console.WriteLine(e.ToString());
  30. }
  31. LoadLibrary(dllPath);
  32. try
  33. {
  34. FileStream fs = new FileStream("shadowsocks.log", FileMode.Append);
  35. TextWriter tmp = Console.Out;
  36. StreamWriter sw = new StreamWriter(fs);
  37. sw.AutoFlush = true;
  38. Console.SetOut(sw);
  39. Console.SetError(sw);
  40. }
  41. catch (IOException e)
  42. {
  43. Console.WriteLine(e.ToString());
  44. }
  45. Application.EnableVisualStyles();
  46. Application.SetCompatibleTextRenderingDefault(false);
  47. ShadowsocksController controller = new ShadowsocksController();
  48. // TODO run without a main form to save RAM
  49. Application.Run(new ConfigForm(controller));
  50. }
  51. }
  52. }