diff --git a/shadowsocks-csharp/Data/qrcode.htm b/shadowsocks-csharp/Data/qrcode.htm deleted file mode 100644 index b5fba382..00000000 --- a/shadowsocks-csharp/Data/qrcode.htm +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -
- - - diff --git a/shadowsocks-csharp/Data/qrcode.min.js.gz b/shadowsocks-csharp/Data/qrcode.min.js.gz deleted file mode 100644 index 48de1fc9..00000000 Binary files a/shadowsocks-csharp/Data/qrcode.min.js.gz and /dev/null differ diff --git a/shadowsocks-csharp/Properties/Resources.Designer.cs b/shadowsocks-csharp/Properties/Resources.Designer.cs index 36db144e..8c4f781e 100755 --- a/shadowsocks-csharp/Properties/Resources.Designer.cs +++ b/shadowsocks-csharp/Properties/Resources.Designer.cs @@ -104,54 +104,5 @@ namespace Shadowsocks.Properties { return ((byte[])(obj)); } } - - /// - /// 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]";. - /// - internal static string qrcode { - get { - return ResourceManager.GetString("qrcode", resourceCulture); - } - } - - /// - /// Looks up a localized resource of type System.Byte[]. - /// - internal static byte[] qrcode_min_js { - get { - object obj = ResourceManager.GetObject("qrcode_min_js", resourceCulture); - return ((byte[])(obj)); - } - } } } diff --git a/shadowsocks-csharp/Properties/Resources.resx b/shadowsocks-csharp/Properties/Resources.resx index 520c1732..14c098ec 100755 --- a/shadowsocks-csharp/Properties/Resources.resx +++ b/shadowsocks-csharp/Properties/Resources.resx @@ -130,10 +130,4 @@ ..\Data\proxy.pac.txt.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Data\qrcode.htm;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312 - - - ..\Data\qrcode.min.js.gz;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - \ No newline at end of file diff --git a/shadowsocks-csharp/View/QRCodeForm.Designer.cs b/shadowsocks-csharp/View/QRCodeForm.Designer.cs index f09de916..53037e16 100755 --- a/shadowsocks-csharp/View/QRCodeForm.Designer.cs +++ b/shadowsocks-csharp/View/QRCodeForm.Designer.cs @@ -28,42 +28,40 @@ /// 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; } } \ No newline at end of file diff --git a/shadowsocks-csharp/View/QRCodeForm.cs b/shadowsocks-csharp/View/QRCodeForm.cs index f34d8101..0a0ec840 100755 --- a/shadowsocks-csharp/View/QRCodeForm.cs +++ b/shadowsocks-csharp/View/QRCodeForm.cs @@ -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); } } diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index 9e7c7553..c1c08d22 100755 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -50,7 +50,7 @@ bin\x86\Release\ - TRACE;SIMPLE_JSON_NO_LINQ_EXPRESSION + TRACE true pdbonly x86 @@ -115,7 +115,6 @@ - SettingsSingleFileGenerator Settings.Designer.cs @@ -128,7 +127,6 @@ -