This commit is contained in:
博麟 吴 2022-03-06 00:07:30 +08:00
parent 0d77595904
commit c3ae168aca
No known key found for this signature in database
GPG key ID: 39282DB97B90BC3F
6 changed files with 53 additions and 97 deletions

View file

@ -10,12 +10,13 @@ namespace v2rayN.Forms
{ {
InitializeComponent(); InitializeComponent();
} }
private void QRCodeControl_Load(object sender, System.EventArgs e) private void QRCodeControl_Load(object sender, System.EventArgs e)
{ {
txtUrl.MouseUp += txtUrl_MouseUp; txtUrl.MouseUp += txtUrl_MouseUp;
} }
void txtUrl_MouseUp(object sender, MouseEventArgs e) private void txtUrl_MouseUp(object sender, MouseEventArgs e)
{ {
txtUrl.SelectAll(); txtUrl.SelectAll();
} }

View file

@ -1,64 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <root>
<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: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:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true"> <xsd:element name="root" msdata:IsDataSet="true">
@ -117,20 +57,24 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtUrl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms"> <data name="txtUrl.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Bottom</value> <value>Bottom</value>
</data> </data>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="txtUrl.Location" type="System.Drawing.Point, System.Drawing"> <data name="txtUrl.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 371</value> <value>0, 527</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtUrl.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data> </data>
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="txtUrl.Multiline" type="System.Boolean, mscorlib"> <data name="txtUrl.Multiline" type="System.Boolean, mscorlib">
<value>True</value> <value>True</value>
</data> </data>
<data name="txtUrl.Size" type="System.Drawing.Size, System.Drawing"> <data name="txtUrl.Size" type="System.Drawing.Size, System.Drawing">
<value>356, 70</value> <value>415, 98</value>
</data> </data>
<data name="txtUrl.TabIndex" type="System.Int32, mscorlib"> <data name="txtUrl.TabIndex" type="System.Int32, mscorlib">
<value>0</value> <value>0</value>
@ -139,7 +83,7 @@
<value>txtUrl</value> <value>txtUrl</value>
</data> </data>
<data name="&gt;&gt;txtUrl.Type" xml:space="preserve"> <data name="&gt;&gt;txtUrl.Type" xml:space="preserve">
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.TextBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;txtUrl.Parent" xml:space="preserve"> <data name="&gt;&gt;txtUrl.Parent" xml:space="preserve">
<value>$this</value> <value>$this</value>
@ -153,8 +97,11 @@
<data name="picQRCode.Location" type="System.Drawing.Point, System.Drawing"> <data name="picQRCode.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value> <value>0, 0</value>
</data> </data>
<data name="picQRCode.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data>
<data name="picQRCode.Size" type="System.Drawing.Size, System.Drawing"> <data name="picQRCode.Size" type="System.Drawing.Size, System.Drawing">
<value>356, 371</value> <value>415, 527</value>
</data> </data>
<data name="picQRCode.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms"> <data name="picQRCode.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
<value>Zoom</value> <value>Zoom</value>
@ -166,7 +113,7 @@
<value>picQRCode</value> <value>picQRCode</value>
</data> </data>
<data name="&gt;&gt;picQRCode.Type" xml:space="preserve"> <data name="&gt;&gt;picQRCode.Type" xml:space="preserve">
<value>System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.PictureBox, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="&gt;&gt;picQRCode.Parent" xml:space="preserve"> <data name="&gt;&gt;picQRCode.Parent" xml:space="preserve">
<value>$this</value> <value>$this</value>
@ -178,15 +125,18 @@
<value>True</value> <value>True</value>
</metadata> </metadata>
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing"> <data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
<value>6, 12</value> <value>7, 17</value>
</data>
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
<value>4, 4, 4, 4</value>
</data> </data>
<data name="$this.Size" type="System.Drawing.Size, System.Drawing"> <data name="$this.Size" type="System.Drawing.Size, System.Drawing">
<value>356, 441</value> <value>415, 625</value>
</data> </data>
<data name="&gt;&gt;$this.Name" xml:space="preserve"> <data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>QRCodeControl</value> <value>QRCodeControl</value>
</data> </data>
<data name="&gt;&gt;$this.Type" xml:space="preserve"> <data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Windows.Forms.UserControl, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
</root> </root>

View file

@ -1,6 +1,7 @@
using System.Drawing; using System.Drawing;
using ZXing; using ZXing;
using ZXing.QrCode; using ZXing.QrCode;
using ZXing.Windows.Compatibility;
namespace v2rayN.Handler namespace v2rayN.Handler
{ {

View file

@ -290,7 +290,7 @@ namespace v2rayN.Handler
try try
{ {
Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13); Utils.SetSecurityProtocol(LazyConfig.Instance.GetConfig().enableSecurityProtocolTls13);
WebRequestHandler webRequestHandler = new WebRequestHandler HttpClientHandler webRequestHandler = new HttpClientHandler
{ {
AllowAutoRedirect = false AllowAutoRedirect = false
}; };

View file

@ -22,12 +22,12 @@ using v2rayN.Base;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Web; using System.Web;
using log4net; using log4net;
using ZXing.Windows.Compatibility;
namespace v2rayN namespace v2rayN
{ {
class Utils internal class Utils
{ {
#region Json操作 #region Json操作
/// <summary> /// <summary>
@ -55,7 +55,6 @@ namespace v2rayN
return result; return result;
} }
/// <summary> /// <summary>
/// 取得存储资源 /// 取得存储资源
/// </summary> /// </summary>
@ -167,7 +166,8 @@ namespace v2rayN
return null; return null;
} }
} }
#endregion
#endregion Json操作
#region #region
@ -199,6 +199,7 @@ namespace v2rayN
return string.Empty; return string.Empty;
} }
} }
/// <summary> /// <summary>
/// 逗号分隔的字符串,转List<string> /// 逗号分隔的字符串,转List<string>
/// </summary> /// </summary>
@ -353,18 +354,17 @@ namespace v2rayN
return $"{string.Format("{0:f1}", result)} {unit}"; return $"{string.Format("{0:f1}", result)} {unit}";
} }
public static string UrlEncode(string url) public static string UrlEncode(string url)
{ {
return HttpUtility.UrlEncode(url); return HttpUtility.UrlEncode(url);
} }
public static string UrlDecode(string url) public static string UrlDecode(string url)
{ {
return HttpUtility.UrlDecode(url); return HttpUtility.UrlDecode(url);
} }
#endregion
#endregion
#region #region
@ -433,7 +433,6 @@ namespace v2rayN
} }
} }
//模式字符串 //模式字符串
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$"; string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
@ -482,8 +481,10 @@ namespace v2rayN
{ {
case AddressFamily.InterNetwork: case AddressFamily.InterNetwork:
return false; return false;
case AddressFamily.InterNetworkV6: case AddressFamily.InterNetworkV6:
return true; return true;
default: default:
return false; return false;
} }
@ -491,11 +492,12 @@ namespace v2rayN
return false; return false;
} }
#endregion #endregion
#region #region
private static string autoRunName = "v2rayNAutoRun"; private static string autoRunName = "v2rayNAutoRun";
private static string autoRunRegPath private static string autoRunRegPath
{ {
get get
@ -651,7 +653,7 @@ namespace v2rayN
} }
} }
#endregion #endregion
#region #region
@ -754,7 +756,8 @@ namespace v2rayN
} }
return inUse; return inUse;
} }
#endregion
#endregion
#region #region
@ -902,7 +905,8 @@ namespace v2rayN
return fileName; return fileName;
} }
#endregion
#endregion
#region TempPath #region TempPath
@ -934,7 +938,7 @@ namespace v2rayN
return Encoding.UTF8.GetString(sb.ToArray()); return Encoding.UTF8.GetString(sb.ToArray());
} }
#endregion #endregion TempPath
#region Log #region Log
@ -943,6 +947,7 @@ namespace v2rayN
var logger = LogManager.GetLogger("Log1"); var logger = LogManager.GetLogger("Log1");
logger.Info(strContent); logger.Info(strContent);
} }
public static void SaveLog(string strTitle, Exception ex) public static void SaveLog(string strTitle, Exception ex)
{ {
var logger = LogManager.GetLogger("Log2"); var logger = LogManager.GetLogger("Log2");
@ -950,8 +955,7 @@ namespace v2rayN
logger.Debug(ex); logger.Debug(ex);
} }
#endregion #endregion Log
#region scan screen #region scan screen
@ -1008,7 +1012,6 @@ namespace v2rayN
return string.Empty; return string.Empty;
} }
#endregion #endregion scan screen
} }
} }

View file

@ -142,6 +142,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0-preview.1.22076.8" /> <PackageReference Include="Microsoft.Windows.Compatibility" Version="7.0.0-preview.1.22076.8" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.10" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<PostBuildEvent>copy /y $(SolutionDir)v2rayUpgrade\$(OutDir)* $(TargetDir) <PostBuildEvent>copy /y $(SolutionDir)v2rayUpgrade\$(OutDir)* $(TargetDir)