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

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