Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7425e09ebc | ||
|
|
e1a90da2a4 | ||
|
|
6a5432c861 | ||
|
|
5acfadcdb6 | ||
|
|
9901c2a574 | ||
|
|
e038beee3e | ||
|
|
c66ede2f59 | ||
|
|
c54735e0e4 | ||
|
|
60dc9e7d71 | ||
|
|
02f75f899f | ||
|
|
eda92b80e1 | ||
|
|
ccec6be210 | ||
|
|
01c059c4e3 | ||
|
|
a0e79f37bc |
@@ -1,4 +1,13 @@
|
|||||||
2.5 2015-07-11
|
2.5.2 2015-08-04
|
||||||
|
- Add log viewer
|
||||||
|
|
||||||
|
2.5.1 2015-07-26
|
||||||
|
- Prevent HA from switching servers too frequently
|
||||||
|
- Fix server settings can not be updated when using HA
|
||||||
|
- Fix server port can't be 8123
|
||||||
|
- Other minor fixes
|
||||||
|
|
||||||
|
2.5 2015-07-25
|
||||||
- Support load balance
|
- Support load balance
|
||||||
- Support high availability
|
- Support high availability
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ Shadowsocks for Windows
|
|||||||
|
|
||||||
[![Build Status]][Appveyor]
|
[![Build Status]][Appveyor]
|
||||||
|
|
||||||
|
Announcement: We'll drop .Net 2.0 support in our next release. The minimal installation
|
||||||
|
requirement will be .Net 4.0. If you have any questions, please post in the issue tracker.
|
||||||
|
|
||||||
#### Features
|
#### Features
|
||||||
|
|
||||||
1. System proxy configuration
|
1. System proxy configuration
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ namespace Shadowsocks.Controller
|
|||||||
public void CreateRemote()
|
public void CreateRemote()
|
||||||
{
|
{
|
||||||
Server server = controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)connection.RemoteEndPoint);
|
Server server = controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)connection.RemoteEndPoint);
|
||||||
|
if (server == null || server.server == "")
|
||||||
|
{
|
||||||
|
throw new ArgumentException("No server configured");
|
||||||
|
}
|
||||||
this.encryptor = EncryptorFactory.GetEncryptor(server.method, server.password);
|
this.encryptor = EncryptorFactory.GetEncryptor(server.method, server.password);
|
||||||
this.server = server;
|
this.server = server;
|
||||||
}
|
}
|
||||||
@@ -310,6 +314,7 @@ namespace Shadowsocks.Controller
|
|||||||
|
|
||||||
StartConnect();
|
StartConnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logging.LogUsefulException(e);
|
Logging.LogUsefulException(e);
|
||||||
@@ -429,7 +434,7 @@ namespace Shadowsocks.Controller
|
|||||||
|
|
||||||
StartPipe();
|
StartPipe();
|
||||||
}
|
}
|
||||||
catch (ArgumentException e)
|
catch (ArgumentException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.Controller
|
|||||||
public string LatestVersionURL;
|
public string LatestVersionURL;
|
||||||
public event EventHandler NewVersionFound;
|
public event EventHandler NewVersionFound;
|
||||||
|
|
||||||
public const string Version = "2.5";
|
public const string Version = "2.5.2";
|
||||||
|
|
||||||
public void CheckUpdate(Configuration config)
|
public void CheckUpdate(Configuration config)
|
||||||
{
|
{
|
||||||
@@ -80,30 +80,6 @@ namespace Shadowsocks.Controller
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check dotnet 4.0
|
|
||||||
AssemblyName[] references = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
|
|
||||||
Version dotNetVersion = Environment.Version;
|
|
||||||
foreach (AssemblyName reference in references)
|
|
||||||
{
|
|
||||||
if (reference.Name == "mscorlib")
|
|
||||||
{
|
|
||||||
dotNetVersion = reference.Version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dotNetVersion.Major >= 4)
|
|
||||||
{
|
|
||||||
if (url.IndexOf("dotnet4.0") < 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (url.IndexOf("dotnet4.0") >= 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string version = ParseVersionFromURL(url);
|
string version = ParseVersionFromURL(url);
|
||||||
if (version == null)
|
if (version == null)
|
||||||
{
|
{
|
||||||
@@ -154,7 +130,7 @@ namespace Shadowsocks.Controller
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.ToString());
|
Logging.Debug(ex.ToString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,10 @@ namespace Shadowsocks.Controller
|
|||||||
{
|
{
|
||||||
return strategy.GetAServer(type, localIPEndPoint);
|
return strategy.GetAServer(type, localIPEndPoint);
|
||||||
}
|
}
|
||||||
|
if (_config.index < 0)
|
||||||
|
{
|
||||||
|
_config.index = 0;
|
||||||
|
}
|
||||||
return GetCurrentServer();
|
return GetCurrentServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +297,8 @@ namespace Shadowsocks.Controller
|
|||||||
polipoRunner.Stop();
|
polipoRunner.Stop();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var strategy in GetStrategies())
|
var strategy = GetCurrentStrategy();
|
||||||
|
if (strategy != null)
|
||||||
{
|
{
|
||||||
strategy.ReloadServers();
|
strategy.ReloadServers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Shadowsocks.Controller.Strategy
|
|||||||
{
|
{
|
||||||
class HighAvailabilityStrategy : IStrategy
|
class HighAvailabilityStrategy : IStrategy
|
||||||
{
|
{
|
||||||
protected Server _currentServer;
|
protected ServerStatus _currentServer;
|
||||||
protected Dictionary<Server, ServerStatus> _serverStatus;
|
protected Dictionary<Server, ServerStatus> _serverStatus;
|
||||||
ShadowsocksController _controller;
|
ShadowsocksController _controller;
|
||||||
Random _random;
|
Random _random;
|
||||||
@@ -67,6 +67,11 @@ namespace Shadowsocks.Controller.Strategy
|
|||||||
status.lastTimeDetectLatency = DateTime.Now;
|
status.lastTimeDetectLatency = DateTime.Now;
|
||||||
newServerStatus[server] = status;
|
newServerStatus[server] = status;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// update settings for existing server
|
||||||
|
newServerStatus[server].server = server;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_serverStatus = newServerStatus;
|
_serverStatus = newServerStatus;
|
||||||
|
|
||||||
@@ -79,7 +84,11 @@ namespace Shadowsocks.Controller.Strategy
|
|||||||
{
|
{
|
||||||
ChooseNewServer();
|
ChooseNewServer();
|
||||||
}
|
}
|
||||||
return _currentServer;
|
if (_currentServer == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return _currentServer.server;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +99,7 @@ namespace Shadowsocks.Controller.Strategy
|
|||||||
*/
|
*/
|
||||||
public void ChooseNewServer()
|
public void ChooseNewServer()
|
||||||
{
|
{
|
||||||
Server oldServer = _currentServer;
|
ServerStatus oldServer = _currentServer;
|
||||||
List<ServerStatus> servers = new List<ServerStatus>(_serverStatus.Values);
|
List<ServerStatus> servers = new List<ServerStatus>(_serverStatus.Values);
|
||||||
DateTime now = DateTime.Now;
|
DateTime now = DateTime.Now;
|
||||||
foreach (var status in servers)
|
foreach (var status in servers)
|
||||||
@@ -120,12 +129,11 @@ namespace Shadowsocks.Controller.Strategy
|
|||||||
}
|
}
|
||||||
if (max != null)
|
if (max != null)
|
||||||
{
|
{
|
||||||
_currentServer = max.server;
|
if (_currentServer == null || max.score - _currentServer.score > 200)
|
||||||
if (_currentServer != oldServer)
|
|
||||||
{
|
{
|
||||||
Console.WriteLine("HA switching to server: {0}", _currentServer.FriendlyName());
|
_currentServer = max;
|
||||||
|
Console.WriteLine("HA switching to server: {0}", _currentServer.server.FriendlyName());
|
||||||
}
|
}
|
||||||
Logging.Debug(String.Format("choosing server: {0}", _currentServer.FriendlyName()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,13 @@ namespace Shadowsocks.Model
|
|||||||
{
|
{
|
||||||
config.localPort = 1080;
|
config.localPort = 1080;
|
||||||
}
|
}
|
||||||
|
if (config.index == -1)
|
||||||
|
{
|
||||||
|
if (config.strategy == null)
|
||||||
|
{
|
||||||
|
config.index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -86,6 +93,13 @@ namespace Shadowsocks.Model
|
|||||||
{
|
{
|
||||||
config.index = -1;
|
config.index = -1;
|
||||||
}
|
}
|
||||||
|
if (config.index == -1)
|
||||||
|
{
|
||||||
|
if (config.strategy == null)
|
||||||
|
{
|
||||||
|
config.index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
config.isDefault = false;
|
config.isDefault = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -121,6 +135,11 @@ namespace Shadowsocks.Model
|
|||||||
{
|
{
|
||||||
throw new ArgumentException(I18N.GetString("Port out of range"));
|
throw new ArgumentException(I18N.GetString("Port out of range"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CheckLocalPort(int port)
|
||||||
|
{
|
||||||
|
CheckPort(port);
|
||||||
if (port == 8123)
|
if (port == 8123)
|
||||||
{
|
{
|
||||||
throw new ArgumentException(I18N.GetString("Port can't be 8123"));
|
throw new ArgumentException(I18N.GetString("Port can't be 8123"));
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
// Runtime Version:4.0.30319.34209
|
// Runtime Version:4.0.30319.42000
|
||||||
//
|
//
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
// the code is regenerated.
|
// the code is regenerated.
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace Shadowsocks.View
|
|||||||
};
|
};
|
||||||
int localPort = int.Parse(ProxyPortTextBox.Text);
|
int localPort = int.Parse(ProxyPortTextBox.Text);
|
||||||
Configuration.CheckServer(server);
|
Configuration.CheckServer(server);
|
||||||
Configuration.CheckPort(localPort);
|
Configuration.CheckLocalPort(localPort);
|
||||||
_modifiedConfiguration.configs[_oldSelectedIndex] = server;
|
_modifiedConfiguration.configs[_oldSelectedIndex] = server;
|
||||||
_modifiedConfiguration.localPort = localPort;
|
_modifiedConfiguration.localPort = localPort;
|
||||||
|
|
||||||
|
|||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
namespace Shadowsocks.View
|
||||||
|
{
|
||||||
|
partial class LogForm
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
|
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||||
|
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||||
|
this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
|
||||||
|
this.menuItem1 = new System.Windows.Forms.MenuItem();
|
||||||
|
this.menuItem2 = new System.Windows.Forms.MenuItem();
|
||||||
|
this.menuItem4 = new System.Windows.Forms.MenuItem();
|
||||||
|
this.SuspendLayout();
|
||||||
|
//
|
||||||
|
// textBox1
|
||||||
|
//
|
||||||
|
this.textBox1.BackColor = System.Drawing.Color.Black;
|
||||||
|
this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
|
this.textBox1.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
|
this.textBox1.ForeColor = System.Drawing.Color.White;
|
||||||
|
this.textBox1.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.textBox1.MaxLength = 2147483647;
|
||||||
|
this.textBox1.Multiline = true;
|
||||||
|
this.textBox1.Name = "textBox1";
|
||||||
|
this.textBox1.ReadOnly = true;
|
||||||
|
this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
|
||||||
|
this.textBox1.Size = new System.Drawing.Size(547, 382);
|
||||||
|
this.textBox1.TabIndex = 0;
|
||||||
|
this.textBox1.WordWrap = false;
|
||||||
|
//
|
||||||
|
// contextMenuStrip1
|
||||||
|
//
|
||||||
|
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||||
|
this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
|
||||||
|
//
|
||||||
|
// mainMenu1
|
||||||
|
//
|
||||||
|
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
||||||
|
this.menuItem1});
|
||||||
|
//
|
||||||
|
// menuItem1
|
||||||
|
//
|
||||||
|
this.menuItem1.Index = 0;
|
||||||
|
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
||||||
|
this.menuItem2,
|
||||||
|
this.menuItem4});
|
||||||
|
this.menuItem1.Text = "&File";
|
||||||
|
//
|
||||||
|
// menuItem2
|
||||||
|
//
|
||||||
|
this.menuItem2.Index = 0;
|
||||||
|
this.menuItem2.Text = "&Open Location";
|
||||||
|
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
|
||||||
|
//
|
||||||
|
// menuItem4
|
||||||
|
//
|
||||||
|
this.menuItem4.Index = 1;
|
||||||
|
this.menuItem4.Text = "E&xit";
|
||||||
|
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
|
||||||
|
//
|
||||||
|
// LogForm
|
||||||
|
//
|
||||||
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.ClientSize = new System.Drawing.Size(547, 382);
|
||||||
|
this.Controls.Add(this.textBox1);
|
||||||
|
this.Menu = this.mainMenu1;
|
||||||
|
this.Name = "LogForm";
|
||||||
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
|
this.Text = "Log Viewer";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LogForm_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.LogForm_Load);
|
||||||
|
this.Shown += new System.EventHandler(this.LogForm_Shown);
|
||||||
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.TextBox textBox1;
|
||||||
|
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||||
|
private System.Windows.Forms.MainMenu mainMenu1;
|
||||||
|
private System.Windows.Forms.MenuItem menuItem1;
|
||||||
|
private System.Windows.Forms.MenuItem menuItem2;
|
||||||
|
private System.Windows.Forms.MenuItem menuItem4;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
using Shadowsocks.Properties;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Shadowsocks.View
|
||||||
|
{
|
||||||
|
public partial class LogForm : Form
|
||||||
|
{
|
||||||
|
FileSystemWatcher watcher;
|
||||||
|
long lastOffset;
|
||||||
|
string filename;
|
||||||
|
Timer timer;
|
||||||
|
const int BACK_OFFSET = 65536;
|
||||||
|
|
||||||
|
public LogForm(string filename)
|
||||||
|
{
|
||||||
|
this.filename = filename;
|
||||||
|
InitializeComponent();
|
||||||
|
this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Timer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitContent()
|
||||||
|
{
|
||||||
|
using (StreamReader reader = new StreamReader(new FileStream(filename,
|
||||||
|
FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||||
|
{
|
||||||
|
if (reader.BaseStream.Length > BACK_OFFSET)
|
||||||
|
{
|
||||||
|
reader.BaseStream.Seek(-BACK_OFFSET, SeekOrigin.End);
|
||||||
|
reader.ReadLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
string line = "";
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
textBox1.AppendText(line + "\r\n");
|
||||||
|
|
||||||
|
textBox1.ScrollToCaret();
|
||||||
|
|
||||||
|
lastOffset = reader.BaseStream.Position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateContent()
|
||||||
|
{
|
||||||
|
using (StreamReader reader = new StreamReader(new FileStream(filename,
|
||||||
|
FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
|
||||||
|
{
|
||||||
|
reader.BaseStream.Seek(lastOffset, SeekOrigin.Begin);
|
||||||
|
|
||||||
|
string line = "";
|
||||||
|
bool changed = false;
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
textBox1.AppendText(line + "\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
textBox1.ScrollToCaret();
|
||||||
|
}
|
||||||
|
|
||||||
|
lastOffset = reader.BaseStream.Position;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
InitContent();
|
||||||
|
timer = new Timer();
|
||||||
|
timer.Interval = 300;
|
||||||
|
timer.Tick += Timer_Tick;
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void menuItem2_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
string argument = @"/select, " + filename;
|
||||||
|
System.Diagnostics.Process.Start("explorer.exe", argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void menuItem3_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void menuItem4_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogForm_Shown(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
textBox1.ScrollToCaret();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
|
<metadata name="mainMenu1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>172, 17</value>
|
||||||
|
</metadata>
|
||||||
|
</root>
|
||||||
@@ -412,7 +412,7 @@ namespace Shadowsocks.View
|
|||||||
{
|
{
|
||||||
string argument = Logging.LogFile;
|
string argument = Logging.LogFile;
|
||||||
|
|
||||||
System.Diagnostics.Process.Start("notepad.exe", argument);
|
new LogForm(argument).Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QRCodeItem_Click(object sender, EventArgs e)
|
private void QRCodeItem_Click(object sender, EventArgs e)
|
||||||
|
|||||||
Executable → Regular
+12
-4
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Shadowsocks</RootNamespace>
|
<RootNamespace>Shadowsocks</RootNamespace>
|
||||||
<AssemblyName>Shadowsocks</AssemblyName>
|
<AssemblyName>Shadowsocks</AssemblyName>
|
||||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<StartupObject>
|
<StartupObject>
|
||||||
</StartupObject>
|
</StartupObject>
|
||||||
@@ -21,8 +21,7 @@
|
|||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
</UpgradeBackupLocation>
|
</UpgradeBackupLocation>
|
||||||
<OldToolsVersion>3.5</OldToolsVersion>
|
<OldToolsVersion>3.5</OldToolsVersion>
|
||||||
<TargetFrameworkProfile>
|
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||||
</TargetFrameworkProfile>
|
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
<InstallFrom>Disk</InstallFrom>
|
<InstallFrom>Disk</InstallFrom>
|
||||||
@@ -167,6 +166,12 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Controller\ShadowsocksController.cs" />
|
<Compile Include="Controller\ShadowsocksController.cs" />
|
||||||
<Compile Include="Controller\System\SystemProxy.cs" />
|
<Compile Include="Controller\System\SystemProxy.cs" />
|
||||||
|
<Compile Include="View\LogForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="View\LogForm.Designer.cs">
|
||||||
|
<DependentUpon>LogForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="View\MenuViewController.cs" />
|
<Compile Include="View\MenuViewController.cs" />
|
||||||
<Compile Include="View\QRCodeForm.cs">
|
<Compile Include="View\QRCodeForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
@@ -186,6 +191,9 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="View\LogForm.resx">
|
||||||
|
<DependentUpon>LogForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="View\QRCodeForm.resx">
|
<EmbeddedResource Include="View\QRCodeForm.resx">
|
||||||
<DependentUpon>QRCodeForm.cs</DependentUpon>
|
<DependentUpon>QRCodeForm.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
|||||||
Reference in New Issue
Block a user