mirror of
https://github.com/proxysu/ProxySU.git
synced 2025-02-16 22:53:13 +03:00
添加用于v2rayN导入v2rayN节点的网址和二维码
This commit is contained in:
parent
ea03d1ae6d
commit
34cfe84261
@ -104,14 +104,17 @@
|
|||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition></ColumnDefinition>
|
<ColumnDefinition></ColumnDefinition>
|
||||||
<ColumnDefinition></ColumnDefinition>
|
<ColumnDefinition></ColumnDefinition>
|
||||||
|
<ColumnDefinition></ColumnDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Button Content="测试接收到的模参数" Grid.Column="0" Grid.Row="0" Margin="10" Click="Button_Click"></Button>
|
<Button Content="测试接收到的模参数" Grid.Column="0" Grid.Row="0" Margin="10" Click="Button_Click"></Button>
|
||||||
<Button Content="测试结果窗口" Grid.Column="0" Grid.Row="1" Margin="10" Click="Button_Click_1"></Button>
|
<Button Content="测试结果窗口" Grid.Column="0" Grid.Row="1" Margin="10" Click="Button_Click_1"></Button>
|
||||||
<Button Content="测试ssh命令" Grid.Column="1" Grid.Row="0" Click="Button_Click_2"></Button>
|
<Button Content="测试ssh命令" Grid.Column="1" Grid.Row="0" Margin="10" Click="Button_Click_2"></Button>
|
||||||
|
<Button Content="测试生成v2rayN导入格式" Grid.Column="2" Grid.Row="0" Margin="10" Click="Button_Click_3"></Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
@ -11,11 +11,11 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Renci.SshNet;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using Renci.SshNet;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
@ -777,6 +777,16 @@ namespace ProxySU
|
|||||||
WindowTemplateConfiguration windowTemplateConfiguration = new WindowTemplateConfiguration();
|
WindowTemplateConfiguration windowTemplateConfiguration = new WindowTemplateConfiguration();
|
||||||
windowTemplateConfiguration.ShowDialog();
|
windowTemplateConfiguration.ShowDialog();
|
||||||
}
|
}
|
||||||
|
private void ButtonGuideConfiguration_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("尚未完善,敬请期待");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAdvancedConfiguration_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("尚未完善,敬请期待");
|
||||||
|
}
|
||||||
|
|
||||||
//测试接收到的模板参数
|
//测试接收到的模板参数
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -815,15 +825,50 @@ namespace ProxySU
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//测试生成v2rayN导入格式json
|
||||||
private void ButtonGuideConfiguration_Click(object sender, RoutedEventArgs e)
|
// {
|
||||||
|
// "v": "2",
|
||||||
|
// "ps": "",
|
||||||
|
// "add": "",
|
||||||
|
// "port": "",
|
||||||
|
// "id": "",
|
||||||
|
// "aid": "16",
|
||||||
|
// "net": "tcp",
|
||||||
|
// "type": "none",
|
||||||
|
// "host": "",
|
||||||
|
// "path": "",
|
||||||
|
// "tls": ""
|
||||||
|
//}
|
||||||
|
private void Button_Click_3(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
MessageBox.Show("尚未完善,敬请期待");
|
string v2rayNjsonFile = @"{
|
||||||
}
|
""v"": """",
|
||||||
|
""ps"": """",
|
||||||
|
""add"": """",
|
||||||
|
""port"": """",
|
||||||
|
""id"": """",
|
||||||
|
""aid"": """",
|
||||||
|
""net"": """",
|
||||||
|
""type"": """",
|
||||||
|
""host"": """",
|
||||||
|
""path"": """",
|
||||||
|
""tls"": """"
|
||||||
|
}";
|
||||||
|
//MessageBox.Show(v2rayNjsonFile);
|
||||||
|
JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
|
||||||
|
v2rayNjsonObject["v"] = "2";
|
||||||
|
v2rayNjsonObject["add"] = "";
|
||||||
|
v2rayNjsonObject["port"] = "";
|
||||||
|
v2rayNjsonObject["id"] = "";
|
||||||
|
v2rayNjsonObject["aid"] = "16";
|
||||||
|
v2rayNjsonObject["net"] = "";
|
||||||
|
v2rayNjsonObject["type"] = "";
|
||||||
|
v2rayNjsonObject["host"] = "";
|
||||||
|
v2rayNjsonObject["path"] = "";
|
||||||
|
v2rayNjsonObject["tls"] = "";
|
||||||
|
v2rayNjsonObject["ps"] = v2rayNjsonObject["add"];
|
||||||
|
//MessageBox.Show(v2rayNjsonObject["v"].ToString());
|
||||||
|
|
||||||
private void ButtonAdvancedConfiguration_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
MessageBox.Show("尚未完善,敬请期待");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>del "$(TargetDir)*.xml"
|
<PostBuildEvent>del "$(TargetDir)*.xml"
|
||||||
del "$(TargetDir)*.pdb"
|
del "$(TargetDir)*.pdb"
|
||||||
"D:\Program Files\7-Zip\7z.exe" a $(TargetDir)Release.zip $(TargetDir)</PostBuildEvent>
|
del "$(TargetDir)*.zip"
|
||||||
|
"D:\Program Files\7-Zip\7z.exe" a $(TargetDir)Release.zip $(TargetDir) -xr!config</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
@ -24,6 +24,8 @@
|
|||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
|
<RowDefinition></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Text="地址(address)" Grid.Column="0" Grid.Row="0" Margin="8"></TextBlock>
|
<TextBlock Text="地址(address)" Grid.Column="0" Grid.Row="0" Margin="8"></TextBlock>
|
||||||
<TextBox x:Name="TextBoxHostAddress" IsReadOnly="True" Grid.Column="1" Grid.Row="0" Margin="8"></TextBox>
|
<TextBox x:Name="TextBoxHostAddress" IsReadOnly="True" Grid.Column="1" Grid.Row="0" Margin="8"></TextBox>
|
||||||
@ -34,21 +36,26 @@
|
|||||||
<TextBlock Text="用户ID(uuid)" Grid.Column="0" Grid.Row="2" Margin="8"></TextBlock>
|
<TextBlock Text="用户ID(uuid)" Grid.Column="0" Grid.Row="2" Margin="8"></TextBlock>
|
||||||
<TextBox x:Name="TextBoxUUID" IsReadOnly="True" Grid.Column="1" Grid.Row="2" Margin="8"></TextBox>
|
<TextBox x:Name="TextBoxUUID" IsReadOnly="True" Grid.Column="1" Grid.Row="2" Margin="8"></TextBox>
|
||||||
<TextBlock Text="说明" Grid.Column="2" Grid.Row="2"></TextBlock>
|
<TextBlock Text="说明" Grid.Column="2" Grid.Row="2"></TextBlock>
|
||||||
<TextBlock Text="加密方式" Grid.Column="0" Grid.Row="3" Margin="8"></TextBlock>
|
<TextBlock Text="额外ID" Grid.Column="0" Grid.Row="3" Margin="8"></TextBlock>
|
||||||
<TextBox x:Name="TextBoxEncryption" IsReadOnly="True" Grid.Column="1" Grid.Row="3" Margin="8"></TextBox>
|
<TextBox x:Name="TextBoxUUIDextra" IsReadOnly="False" Grid.Column="1" Grid.Row="3" Margin="8"></TextBox>
|
||||||
<TextBlock Text="说明" Grid.Column="2" Grid.Row="3"></TextBlock>
|
<TextBlock Text="默认16,可以填不超过64的值,客户端没有此选项可不填" TextWrapping="Wrap" Grid.Column="2" Grid.Row="3"></TextBlock>
|
||||||
<TextBlock Text="传输协议" Grid.Column="0" Grid.Row="4" Margin="8"></TextBlock>
|
<TextBlock Text="加密方式" Grid.Column="0" Grid.Row="4" Margin="8"></TextBlock>
|
||||||
<TextBox x:Name="TextBoxTransmission" IsReadOnly="True" Grid.Column="1" Grid.Row="4" Margin="8"></TextBox>
|
<TextBox x:Name="TextBoxEncryption" IsReadOnly="True" Grid.Column="1" Grid.Row="4" Margin="8"></TextBox>
|
||||||
<TextBlock Text="说明" Grid.Column="2" Grid.Row="4"></TextBlock>
|
<TextBlock Text="默认auto" Grid.Column="2" Grid.Row="4"></TextBlock>
|
||||||
<TextBlock Text="伪装类型" Grid.Column="0" Grid.Row="5" Margin="8"></TextBlock>
|
<TextBlock Text="传输协议" Grid.Column="0" Grid.Row="5" Margin="8"></TextBlock>
|
||||||
<TextBox x:Name="TextBoxCamouflageType" IsReadOnly="True" Grid.Column="1" Grid.Row="5" Margin="8"></TextBox>
|
<TextBox x:Name="TextBoxTransmission" IsReadOnly="True" Grid.Column="1" Grid.Row="5" Margin="8"></TextBox>
|
||||||
<TextBlock Text="说明" Grid.Column="2" Grid.Row="5"></TextBlock>
|
<TextBlock Text="说明" Grid.Column="2" Grid.Row="5"></TextBlock>
|
||||||
<TextBlock Text="路径(Path)" Grid.Column="0" Grid.Row="6" Margin="8"></TextBlock>
|
<TextBlock Text="伪装类型" Grid.Column="0" Grid.Row="6" Margin="8"></TextBlock>
|
||||||
<TextBox x:Name="TextBoxPath" IsReadOnly="True" Grid.Column="1" Grid.Row="6" Margin="8"></TextBox>
|
<TextBox x:Name="TextBoxCamouflageType" IsReadOnly="True" Grid.Column="1" Grid.Row="6" Margin="8"></TextBox>
|
||||||
<TextBlock Text="说明" Grid.Column="2" Grid.Row="6"></TextBlock>
|
<TextBlock Text="说明" Grid.Column="2" Grid.Row="6"></TextBlock>
|
||||||
|
<TextBlock x:Name="TextBlockPath" Text="路径(Path)" Grid.Column="0" Grid.Row="7" Margin="8"></TextBlock>
|
||||||
<TextBlock Text="以上参数可以手动输入客户端,用于V2ray官方客户端的配置文件已经存放入config目录下,点击确定可打开" Grid.Column="0" Grid.Row="7" Grid.ColumnSpan="2" TextWrapping="Wrap"></TextBlock>
|
<TextBox x:Name="TextBoxPath" IsReadOnly="True" Grid.Column="1" Grid.Row="7" Margin="8"></TextBox>
|
||||||
<Button Content="确定" Grid.Column="2" Grid.Row="7" Grid.RowSpan="2" Margin="20" Click="Button_Click"></Button>
|
<TextBlock x:Name="TextBlockPathExplain" Text="说明" Grid.Column="2" Grid.Row="7"></TextBlock>
|
||||||
|
<TextBlock x:Name="TextBlocTLSonOrNo" Text="是否使用TLS" Grid.Column="0" Grid.Row="8" Margin="8"></TextBlock>
|
||||||
|
<TextBox x:Name="TextBoxTLS" IsReadOnly="True" Grid.Column="1" Grid.Row="8" Margin="8"></TextBox>
|
||||||
|
<TextBlock x:Name="TextBlocTLSonOrNoExplain" Text="说明" Grid.Column="2" Grid.Row="8"></TextBlock>
|
||||||
|
<TextBlock Text="以上参数可以手动输入客户端,用于V2ray官方客户端的配置文件已经存放入config目录下,点击确定可打开" Grid.Column="0" Grid.Row="9" Grid.ColumnSpan="2" TextWrapping="Wrap"></TextBlock>
|
||||||
|
<Button Content="确定" Grid.Column="2" Grid.Row="9" Grid.RowSpan="2" Margin="20" Click="Button_Click"></Button>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
@ -10,6 +10,14 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.IO;
|
||||||
|
using Renci.SshNet;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json.Serialization;
|
||||||
|
using System.Drawing;
|
||||||
|
using QRCoder;
|
||||||
|
|
||||||
|
|
||||||
namespace ProxySU
|
namespace ProxySU
|
||||||
{
|
{
|
||||||
@ -27,6 +35,8 @@ namespace ProxySU
|
|||||||
TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1];
|
TextBoxPort.Text = MainWindow.ReceiveConfigurationParameters[1];
|
||||||
//用户ID(uuid)
|
//用户ID(uuid)
|
||||||
TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
|
TextBoxUUID.Text = MainWindow.ReceiveConfigurationParameters[2];
|
||||||
|
//额外ID
|
||||||
|
TextBoxUUIDextra.Text = "16";
|
||||||
//路径Path
|
//路径Path
|
||||||
TextBoxPath.Text = MainWindow.ReceiveConfigurationParameters[3];
|
TextBoxPath.Text = MainWindow.ReceiveConfigurationParameters[3];
|
||||||
//加密方式,一般都为auto
|
//加密方式,一般都为auto
|
||||||
@ -34,36 +44,171 @@ namespace ProxySU
|
|||||||
//伪装类型
|
//伪装类型
|
||||||
TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5];
|
TextBoxCamouflageType.Text = MainWindow.ReceiveConfigurationParameters[5];
|
||||||
|
|
||||||
if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCP"))
|
if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web"))
|
||||||
{
|
{
|
||||||
TextBoxTransmission.Text = "tcp";
|
TextBoxTransmission.Text = "ws";
|
||||||
}
|
TextBoxCamouflageType.Text = "none";
|
||||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "WebSocketTLS2Web"))
|
ShowPathAndTLS();
|
||||||
{
|
TextBoxTLS.Text = "tls";
|
||||||
TextBoxTransmission.Text = "WebSocket(ws)";
|
|
||||||
}
|
}
|
||||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp"))
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TCPhttp"))
|
||||||
{
|
{
|
||||||
TextBoxTransmission.Text = "tcp";
|
TextBoxTransmission.Text = "tcp";
|
||||||
|
TextBoxCamouflageType.Text = "http";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
}
|
}
|
||||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "MkcpNone") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS") || String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "MkcpNone"))
|
||||||
{
|
{
|
||||||
TextBoxTransmission.Text = "mKCP(kcp)";
|
TextBoxTransmission.Text = "kcp";
|
||||||
|
TextBoxCamouflageType.Text = "none";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
|
}
|
||||||
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2SRTP"))
|
||||||
|
{
|
||||||
|
TextBoxTransmission.Text = "kcp";
|
||||||
|
TextBoxCamouflageType.Text = "srtp";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
|
}
|
||||||
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCPuTP"))
|
||||||
|
{
|
||||||
|
TextBoxTransmission.Text = "kcp";
|
||||||
|
TextBoxCamouflageType.Text = "utp";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
|
}
|
||||||
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WechatVideo"))
|
||||||
|
{
|
||||||
|
TextBoxTransmission.Text = "kcp";
|
||||||
|
TextBoxCamouflageType.Text = "wechat-video";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
|
}
|
||||||
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2DTLS"))
|
||||||
|
{
|
||||||
|
TextBoxTransmission.Text = "kcp";
|
||||||
|
TextBoxCamouflageType.Text = "dtls";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
|
}
|
||||||
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
|
||||||
|
{
|
||||||
|
TextBoxTransmission.Text = "kcp";
|
||||||
|
TextBoxCamouflageType.Text = "wireguard";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "HTTP2"))
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "HTTP2"))
|
||||||
{
|
{
|
||||||
TextBoxTransmission.Text = "h2";
|
TextBoxTransmission.Text = "h2";
|
||||||
|
TextBoxCamouflageType.Text = "none";
|
||||||
|
ShowPathAndTLS();
|
||||||
|
TextBoxTLS.Text = "tls";
|
||||||
}
|
}
|
||||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TLS"))
|
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "TLS"))
|
||||||
{
|
{
|
||||||
TextBoxTransmission.Text = "";
|
TextBoxTransmission.Text = "tcp";
|
||||||
|
TextBoxCamouflageType.Text = "none";
|
||||||
|
TextBoxTLS.Text = "tls";
|
||||||
|
HidePathAndTLS();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TextBoxTransmission.Text = "tcp";
|
||||||
|
TextBoxCamouflageType.Text = "none";
|
||||||
|
TextBoxTLS.Text = "none";
|
||||||
|
HidePathAndTLS();
|
||||||
|
}
|
||||||
|
|
||||||
|
GenerateV2rayNshareQRcodeAndBase64Url();
|
||||||
|
|
||||||
|
}
|
||||||
|
private void HidePathAndTLS()
|
||||||
|
{
|
||||||
|
TextBlockPath.Visibility = Visibility.Collapsed;
|
||||||
|
TextBoxPath.Visibility = Visibility.Collapsed;
|
||||||
|
TextBlockPathExplain.Visibility = Visibility.Collapsed;
|
||||||
|
//TextBlocTLSonOrNo.Visibility = Visibility.Collapsed;
|
||||||
|
//TextBoxTLS.Visibility = Visibility.Collapsed;
|
||||||
|
//TextBlocTLSonOrNoExplain.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
private void ShowPathAndTLS()
|
||||||
|
{
|
||||||
|
TextBlockPath.Visibility = Visibility.Visible;
|
||||||
|
TextBoxPath.Visibility = Visibility.Visible;
|
||||||
|
TextBlockPathExplain.Visibility = Visibility.Visible;
|
||||||
|
//TextBlocTLSonOrNo.Visibility = Visibility.Visible;
|
||||||
|
//TextBoxTLS.Visibility = Visibility.Visible;
|
||||||
|
//TextBlocTLSonOrNoExplain.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
//生成v2rayN客户端导入文件
|
||||||
|
private void GenerateV2rayNshareQRcodeAndBase64Url()
|
||||||
|
{
|
||||||
|
//生成v2rayN的json文件
|
||||||
|
string v2rayNjsonFile = @"
|
||||||
|
{
|
||||||
|
""v"": """",
|
||||||
|
""ps"": """",
|
||||||
|
""add"": """",
|
||||||
|
""port"": """",
|
||||||
|
""id"": """",
|
||||||
|
""aid"": """",
|
||||||
|
""net"": """",
|
||||||
|
""type"": """",
|
||||||
|
""host"": """",
|
||||||
|
""path"": """",
|
||||||
|
""tls"": """"
|
||||||
|
}";
|
||||||
|
//MessageBox.Show(v2rayNjsonFile);
|
||||||
|
JObject v2rayNjsonObject = JObject.Parse(v2rayNjsonFile);
|
||||||
|
v2rayNjsonObject["v"] = "2";
|
||||||
|
v2rayNjsonObject["add"] = TextBoxHostAddress.Text.ToString(); //设置域名
|
||||||
|
v2rayNjsonObject["port"] = TextBoxPort.Text.ToString(); //设置端口
|
||||||
|
v2rayNjsonObject["id"] = TextBoxUUID.Text.ToString(); //设置uuid
|
||||||
|
v2rayNjsonObject["aid"] = TextBoxUUIDextra.Text.ToString(); //设置额外ID
|
||||||
|
v2rayNjsonObject["net"] = TextBoxTransmission.Text.ToString(); //设置传输模式
|
||||||
|
v2rayNjsonObject["type"] = TextBoxCamouflageType.Text.ToString(); //设置伪装类型
|
||||||
|
v2rayNjsonObject["host"] = "";
|
||||||
|
v2rayNjsonObject["path"] = TextBoxPath.Text.ToString(); //设置路径
|
||||||
|
v2rayNjsonObject["tls"] = TextBoxTLS.Text.ToString(); //设置是否启用TLS
|
||||||
|
v2rayNjsonObject["ps"] = v2rayNjsonObject["add"]; //设置备注
|
||||||
|
//MessageBox.Show(v2rayNjsonObject["v"].ToString());
|
||||||
|
|
||||||
|
|
||||||
|
MessageBox.Show(v2rayNjsonObject.ToString());
|
||||||
|
string vmessUrl = "vmess://" + ToBase64Encode(v2rayNjsonObject.ToString());
|
||||||
|
using (StreamWriter sw = new StreamWriter(@"config\v2rayNvmessUrl.txt"))
|
||||||
|
{
|
||||||
|
sw.WriteLine(vmessUrl);
|
||||||
|
|
||||||
|
}
|
||||||
|
CreateQRCode(vmessUrl);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//生成base64
|
||||||
|
private string ToBase64Encode(string text)
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(text))
|
||||||
|
{
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] textBytes = Encoding.UTF8.GetBytes(text);
|
||||||
|
return Convert.ToBase64String(textBytes);
|
||||||
|
}
|
||||||
|
//生成QRcoder图片
|
||||||
|
private void CreateQRCode(string varBase64)
|
||||||
|
{
|
||||||
|
//string varBase64 = varBase64;
|
||||||
|
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||||
|
QRCodeData qrCodeData = qrGenerator.CreateQrCode(varBase64, QRCodeGenerator.ECCLevel.Q);
|
||||||
|
QRCode qrCode = new QRCode(qrCodeData);
|
||||||
|
Bitmap qrCodeImage = qrCode.GetGraphic(20);
|
||||||
|
qrCodeImage.Save(@"config\v2rayN.bmp");
|
||||||
|
}
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string openFolderPath = @"config";
|
string openFolderPath = @"config";
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user