add padding; clean project
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
__QRCODELIB__
|
||||
</script>
|
||||
<style>
|
||||
html, body, table, div {
|
||||
padding: 0px;
|
||||
margin: 0 !important;
|
||||
}
|
||||
div#qrcode {
|
||||
margin: 5px !important;
|
||||
text-align: center;
|
||||
vertical-align: center;
|
||||
}
|
||||
#qrcode {
|
||||
width:190px;
|
||||
height:190px;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
height:100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qrcode" name="qrcode"></div>
|
||||
<script type="text/javascript">
|
||||
function genCode(code) {
|
||||
new QRCode("qrcode", {
|
||||
text: code,
|
||||
width: 200,
|
||||
height: 200,
|
||||
colorDark : "#000000",
|
||||
colorLight : "#ffffff",
|
||||
correctLevel : QRCode.CorrectLevel.H
|
||||
});
|
||||
}
|
||||
genCode("__SSURL__");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
-49
@@ -104,54 +104,5 @@ namespace Shadowsocks.Properties {
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <!doctype html>
|
||||
///<html>
|
||||
///<head>
|
||||
///<script>
|
||||
/// __QRCODELIB__
|
||||
///</script>
|
||||
///<style>
|
||||
/// html, body, table, div {
|
||||
/// padding: 0px;
|
||||
/// margin: 0 !important;
|
||||
/// }
|
||||
/// div#qrcode {
|
||||
/// margin: 5px !important;
|
||||
/// text-align: center;
|
||||
/// vertical-align: center;
|
||||
/// }
|
||||
/// #qrcode {
|
||||
/// width:190px;
|
||||
/// height:190px;
|
||||
/// }
|
||||
/// table {
|
||||
/// width: 100%;
|
||||
/// height:100%;
|
||||
/// }
|
||||
///</style>
|
||||
///</head>
|
||||
///<body>
|
||||
///<div id="qrcode" name="qrcode"></div>
|
||||
///<script type="text/javascript">
|
||||
/// function genCode(code) {
|
||||
/// new QRCode("qrcode" [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string qrcode {
|
||||
get {
|
||||
return ResourceManager.GetString("qrcode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] qrcode_min_js {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("qrcode_min_js", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,10 +130,4 @@
|
||||
<data name="proxy_pac_txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Data\proxy.pac.txt.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="qrcode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Data\qrcode.htm;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312</value>
|
||||
</data>
|
||||
<data name="qrcode_min_js" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Data\qrcode.min.js.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
+22
-23
@@ -28,42 +28,40 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.QRCodeWebBrowser = new System.Windows.Forms.WebBrowser();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// QRCodeWebBrowser
|
||||
//
|
||||
this.QRCodeWebBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.QRCodeWebBrowser.Location = new System.Drawing.Point(0, 0);
|
||||
this.QRCodeWebBrowser.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.QRCodeWebBrowser.MinimumSize = new System.Drawing.Size(20, 20);
|
||||
this.QRCodeWebBrowser.Name = "QRCodeWebBrowser";
|
||||
this.QRCodeWebBrowser.ScriptErrorsSuppressed = true;
|
||||
this.QRCodeWebBrowser.ScrollBarsEnabled = false;
|
||||
this.QRCodeWebBrowser.Size = new System.Drawing.Size(201, 203);
|
||||
this.QRCodeWebBrowser.TabIndex = 0;
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(10, 10);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(205, 205);
|
||||
this.pictureBox1.Size = new System.Drawing.Size(204, 202);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox1.TabIndex = 1;
|
||||
this.pictureBox1.TabStop = false;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.pictureBox1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.panel1.Size = new System.Drawing.Size(224, 222);
|
||||
this.panel1.TabIndex = 2;
|
||||
//
|
||||
// QRCodeForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.AutoSize = true;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.ClientSize = new System.Drawing.Size(205, 205);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.QRCodeWebBrowser);
|
||||
this.ClientSize = new System.Drawing.Size(224, 222);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
@@ -72,13 +70,14 @@
|
||||
this.Text = "QRCode";
|
||||
this.Load += new System.EventHandler(this.QRCodeForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.WebBrowser QRCodeWebBrowser;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace Shadowsocks.View
|
||||
private void GenQR(string ssconfig)
|
||||
{
|
||||
string qrText = ssconfig;
|
||||
QRCode4CS.QRCode qrCoded = new QRCode4CS.QRCode(6, QRErrorCorrectLevel.M);
|
||||
QRCode4CS.QRCode qrCoded = new QRCode4CS.QRCode(6, QRErrorCorrectLevel.H);
|
||||
qrCoded.AddData(qrText);
|
||||
qrCoded.Make();
|
||||
int blockSize = 5;
|
||||
@@ -62,32 +62,8 @@ namespace Shadowsocks.View
|
||||
pictureBox1.Image = drawArea;
|
||||
}
|
||||
|
||||
private string QRCodeHTML(string ssURL)
|
||||
{
|
||||
string html = Resources.qrcode;
|
||||
string qrcodeLib;
|
||||
|
||||
byte[] qrcodeGZ = Resources.qrcode_min_js;
|
||||
byte[] buffer = new byte[1024 * 1024]; // builtin pac gzip size: maximum 1M
|
||||
int n;
|
||||
|
||||
using (GZipStream input = new GZipStream(new MemoryStream(qrcodeGZ),
|
||||
CompressionMode.Decompress, false))
|
||||
{
|
||||
n = input.Read(buffer, 0, buffer.Length);
|
||||
if (n == 0)
|
||||
{
|
||||
throw new IOException("can not decompress qrcode lib");
|
||||
}
|
||||
qrcodeLib = System.Text.Encoding.UTF8.GetString(buffer, 0, n);
|
||||
}
|
||||
string result = html.Replace("__QRCODELIB__", qrcodeLib);
|
||||
return result.Replace("__SSURL__", ssURL);
|
||||
}
|
||||
|
||||
private void QRCodeForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
//QRCodeWebBrowser.DocumentText = QRCodeHTML(code);
|
||||
GenQR(code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;SIMPLE_JSON_NO_LINQ_EXPRESSION</DefineConstants>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
@@ -115,7 +115,6 @@
|
||||
<None Include="app.config" />
|
||||
<None Include="Data\polarssl.dll.gz" />
|
||||
<None Include="Data\polipo.exe.gz" />
|
||||
<None Include="Data\qrcode.min.js.gz" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
@@ -128,7 +127,6 @@
|
||||
<None Include="Data\proxy.pac.txt.gz" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Data\qrcode.htm" />
|
||||
<Content Include="shadowsocks.ico" />
|
||||
<None Include="Data\polipo_config.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user