Version now change with AssemblyVersion add open on lan option Add an option to choose whether to open on lan or not. add log switch and modify detector Add an option to select whether to open log or not. Add a detector to check whether the server setting changed. small bug Fix a small bug add modify detector Don't reload server if config not change. add about form Add an about form instead of just open link. add log switch and modify detector Add an option to select whether to open log or not. Add a detector to check whether the server setting changed. small bug Fix a small bug add modify detector Don't reload server if config not change.pull/45/head
@@ -15,6 +15,7 @@ namespace Shadowsocks.Controller | |||||
{ | { | ||||
private static int PORT = 8090; | private static int PORT = 8090; | ||||
private static string PAC_FILE = "pac.txt"; | private static string PAC_FILE = "pac.txt"; | ||||
public bool openOnLan; | |||||
Socket _listener; | Socket _listener; | ||||
FileSystemWatcher watcher; | FileSystemWatcher watcher; | ||||
@@ -12,6 +12,7 @@ namespace Shadowsocks.Controller | |||||
class PolipoRunner | class PolipoRunner | ||||
{ | { | ||||
private Process _process; | private Process _process; | ||||
public bool openOnLan; | |||||
public void Start(Configuration configuration) | public void Start(Configuration configuration) | ||||
{ | { | ||||
@@ -31,10 +32,10 @@ namespace Shadowsocks.Controller | |||||
Console.WriteLine(e.ToString()); | Console.WriteLine(e.ToString()); | ||||
} | } | ||||
} | } | ||||
string temppath = Path.GetTempPath(); | |||||
string temppath = Path.GetTempPath(); | |||||
string polipoConfig = Resources.polipo_config; | string polipoConfig = Resources.polipo_config; | ||||
polipoConfig = polipoConfig.Replace("__SOCKS_PORT__", server.local_port.ToString()); | polipoConfig = polipoConfig.Replace("__SOCKS_PORT__", server.local_port.ToString()); | ||||
polipoConfig = polipoConfig.Replace("__POLIPO_BIND_IP__", configuration.shareOverLan ? "0.0.0.0" : "127.0.0.1"); | |||||
polipoConfig = polipoConfig.Replace("__POLIPO_BIND_IP__", configuration.shareOverLan ? "0.0.0.0" : "127.0.0.1"); | |||||
FileManager.ByteArrayToFile(temppath + "/polipo.conf", System.Text.Encoding.UTF8.GetBytes(polipoConfig)); | FileManager.ByteArrayToFile(temppath + "/polipo.conf", System.Text.Encoding.UTF8.GetBytes(polipoConfig)); | ||||
FileManager.UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe); | FileManager.UncompressFile(temppath + "/ss_polipo.exe", Resources.polipo_exe); | ||||
@@ -35,6 +35,7 @@ namespace Shadowsocks.Controller | |||||
public ShadowsocksController() | public ShadowsocksController() | ||||
{ | { | ||||
_config = Configuration.Load(); | _config = Configuration.Load(); | ||||
polipoRunner = new PolipoRunner(); | polipoRunner = new PolipoRunner(); | ||||
polipoRunner.Start(_config); | polipoRunner.Start(_config); | ||||
local = new Local(_config); | local = new Local(_config); | ||||
@@ -46,8 +46,8 @@ namespace Shadowsocks | |||||
Console.WriteLine(e.ToString()); | Console.WriteLine(e.ToString()); | ||||
} | } | ||||
LoadLibrary(dllPath); | LoadLibrary(dllPath); | ||||
Logging.OpenLogFile(); | |||||
Logging.OpenLogFile(); | |||||
Application.EnableVisualStyles(); | Application.EnableVisualStyles(); | ||||
Application.SetCompatibleTextRenderingDefault(false); | Application.SetCompatibleTextRenderingDefault(false); | ||||
ShadowsocksController controller = new ShadowsocksController(); | ShadowsocksController controller = new ShadowsocksController(); | ||||
@@ -24,12 +24,12 @@ namespace Shadowsocks.View | |||||
private void GenQR(string ssconfig) | private void GenQR(string ssconfig) | ||||
{ | { | ||||
string qrText = ssconfig; | |||||
string qrText = ssconfig; | |||||
QRCode4CS.Options options = new QRCode4CS.Options(); | QRCode4CS.Options options = new QRCode4CS.Options(); | ||||
options.Text = qrText; | options.Text = qrText; | ||||
QRCode4CS.QRCode qrCoded = null; | QRCode4CS.QRCode qrCoded = null; | ||||
bool success = false; | bool success = false; | ||||
foreach (var level in new QRErrorCorrectLevel[]{QRErrorCorrectLevel.H, QRErrorCorrectLevel.Q, QRErrorCorrectLevel.M, QRErrorCorrectLevel.L}) | |||||
foreach (var level in new QRErrorCorrectLevel[]{QRErrorCorrectLevel.H, QRErrorCorrectLevel.Q, QRErrorCorrectLevel.M, QRErrorCorrectLevel.L}) | |||||
{ | { | ||||
for (int i = 3; i < 10; i++) | for (int i = 3; i < 10; i++) | ||||
{ | { | ||||
@@ -60,7 +60,7 @@ | |||||
</PropertyGroup> | </PropertyGroup> | ||||
<ItemGroup> | <ItemGroup> | ||||
<Reference Include="System" /> | <Reference Include="System" /> | ||||
<Reference Include="System.Data" /> | |||||
<Reference Include="System.Data" /> | |||||
<Reference Include="System.Drawing" /> | <Reference Include="System.Drawing" /> | ||||
<Reference Include="System.Windows.Forms" /> | <Reference Include="System.Windows.Forms" /> | ||||
<Reference Include="System.XML" /> | <Reference Include="System.XML" /> | ||||