embed polarssl into exe

This commit is contained in:
clowwindy
2014-11-06 01:55:37 +08:00
parent 56365fdf96
commit 17765a772f
7 changed files with 38 additions and 8 deletions
+12 -3
View File
@@ -1,12 +1,17 @@
using System;
using shadowsocks_csharp.Properties;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace shadowsocks_csharp
{
static class Program
{
[DllImport("Kernel32.dll")]
private static extern IntPtr LoadLibrary(string path);
/// <summary>
/// 应用程序的主入口点。
/// </summary>
@@ -14,14 +19,18 @@ namespace shadowsocks_csharp
static void Main()
{
try
{
{
string tempPath = Path.GetTempPath();
string dllPath = tempPath + "/polarssl.dll";
PolipoRunner.UncompressFile(dllPath, Resources.polarssl_dll);
LoadLibrary(dllPath);
FileStream fs = new FileStream("shadowsocks.log", FileMode.Append);
TextWriter tmp = Console.Out;
StreamWriter sw = new StreamWriter(fs);
sw.AutoFlush = true;
Console.SetOut(sw);
Console.SetError(sw);
}
catch (IOException e)
{