mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-26 18:24:43 +00:00
Compare commits
No commits in common. "4a32b2c8142df6ddc72b98012991aff502bae308" and "b2feaf3ba986863ce337b1de8f0731a7ca27c791" have entirely different histories.
4a32b2c814
...
b2feaf3ba9
105 changed files with 511 additions and 654 deletions
|
|
@ -2,7 +2,7 @@ root = true
|
|||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_style = tab
|
||||
tab_width = 4
|
||||
indent_size = 4
|
||||
end_of_line = crlf
|
||||
|
|
@ -84,13 +84,13 @@ csharp_style_prefer_readonly_struct_member = true:warning
|
|||
csharp_prefer_braces = true:warning
|
||||
csharp_prefer_simple_using_statement = true:warning
|
||||
csharp_prefer_system_threading_lock = true:warning
|
||||
csharp_style_namespace_declarations = file_scoped:warning
|
||||
csharp_style_namespace_declarations = block_scoped:warning
|
||||
csharp_style_prefer_method_group_conversion = true:warning
|
||||
csharp_style_prefer_primary_constructors = true:warning
|
||||
csharp_style_prefer_top_level_statements = false:warning
|
||||
csharp_prefer_simple_default_expression = true:warning
|
||||
csharp_style_deconstructed_variable_declaration = true:warning
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = false:warning
|
||||
csharp_style_inlined_variable_declaration = true:warning
|
||||
csharp_style_prefer_index_operator = false:warning
|
||||
csharp_style_prefer_local_over_anonymous_function = true:warning
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -59,8 +59,7 @@ namespace AmazTool
|
|||
Console.WriteLine(entry.FullName);
|
||||
|
||||
var lst = entry.FullName.Split(splitKey);
|
||||
if (lst.Length == 1)
|
||||
continue;
|
||||
if (lst.Length == 1) continue;
|
||||
var fullName = string.Join(splitKey, lst[1..lst.Length]);
|
||||
|
||||
if (string.Equals(Utils.GetExePath(), Utils.GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
||||
|
|
@ -102,4 +101,4 @@ namespace AmazTool
|
|||
Utils.StartV2RayN();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using Downloader;
|
||||
using System.Net;
|
||||
using Downloader;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
@ -181,4 +181,4 @@ namespace ServiceLib.Common
|
|||
downloadOpt = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,15 +38,13 @@ namespace ServiceLib.Common
|
|||
|
||||
public async Task<string?> GetAsync(string url)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(url))
|
||||
return null;
|
||||
if (Utils.IsNullOrEmpty(url)) return null;
|
||||
return await httpClient.GetStringAsync(url);
|
||||
}
|
||||
|
||||
public async Task<string?> GetAsync(HttpClient client, string url, CancellationToken token = default)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(url))
|
||||
return null;
|
||||
if (Utils.IsNullOrEmpty(url)) return null;
|
||||
return await client.GetStringAsync(url, token);
|
||||
}
|
||||
|
||||
|
|
@ -77,13 +75,11 @@ namespace ServiceLib.Common
|
|||
{
|
||||
ArgumentNullException.ThrowIfNull(url);
|
||||
ArgumentNullException.ThrowIfNull(fileName);
|
||||
if (File.Exists(fileName))
|
||||
File.Delete(fileName);
|
||||
if (File.Exists(fileName)) File.Delete(fileName);
|
||||
|
||||
using var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
throw new Exception(response.StatusCode.ToString());
|
||||
if (!response.IsSuccessStatusCode) throw new Exception(response.StatusCode.ToString());
|
||||
|
||||
var total = response.Content.Headers.ContentLength ?? -1L;
|
||||
var canReportProgress = total != -1 && progress != null;
|
||||
|
|
@ -101,8 +97,7 @@ namespace ServiceLib.Common
|
|||
var read = await stream.ReadAsync(buffer, token);
|
||||
totalRead += read;
|
||||
|
||||
if (read == 0)
|
||||
break;
|
||||
if (read == 0) break;
|
||||
await file.WriteAsync(buffer.AsMemory(0, read), token);
|
||||
|
||||
if (canReportProgress)
|
||||
|
|
@ -188,4 +183,4 @@ namespace ServiceLib.Common
|
|||
} while (isMoreToRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
|
|
@ -75,8 +75,7 @@ namespace ServiceLib.Common
|
|||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
if (disposed) return;
|
||||
disposed = true;
|
||||
|
||||
if (disposing)
|
||||
|
|
@ -174,4 +173,4 @@ namespace ServiceLib.Common
|
|||
}
|
||||
|
||||
#endregion Helper classes
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using NLog;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
|
||||
|
|
@ -27,16 +27,14 @@ namespace ServiceLib.Common
|
|||
|
||||
public static void SaveLog(string strContent)
|
||||
{
|
||||
if (!LogManager.IsLoggingEnabled())
|
||||
return;
|
||||
if (!LogManager.IsLoggingEnabled()) return;
|
||||
|
||||
LogManager.GetLogger("Log1").Info(strContent);
|
||||
}
|
||||
|
||||
public static void SaveLog(string strTitle, Exception ex)
|
||||
{
|
||||
if (!LogManager.IsLoggingEnabled())
|
||||
return;
|
||||
if (!LogManager.IsLoggingEnabled()) return;
|
||||
|
||||
var logger = LogManager.GetLogger("Log2");
|
||||
logger.Debug($"{strTitle},{ex.Message}");
|
||||
|
|
@ -47,4 +45,4 @@ namespace ServiceLib.Common
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,10 +19,8 @@ public static class ProcUtils
|
|||
}
|
||||
try
|
||||
{
|
||||
if (fileName.Contains(' '))
|
||||
fileName = fileName.AppendQuotes();
|
||||
if (arguments.Contains(' '))
|
||||
arguments = arguments.AppendQuotes();
|
||||
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
|
||||
if (arguments.Contains(' ')) arguments = arguments.AppendQuotes();
|
||||
|
||||
Process process = new()
|
||||
{
|
||||
|
|
@ -85,18 +83,10 @@ public static class ProcUtils
|
|||
|
||||
GetProcessKeyInfo(proc, review, out var procId, out var fileName, out var processName);
|
||||
|
||||
try
|
||||
{ proc?.Kill(true); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Kill(); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Close(); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Dispose(); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Kill(true); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Close(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
|
||||
await Task.Delay(300);
|
||||
await ProcessKillByKeyInfo(review, procId, fileName, processName);
|
||||
|
|
@ -107,8 +97,7 @@ public static class ProcUtils
|
|||
procId = null;
|
||||
fileName = null;
|
||||
processName = null;
|
||||
if (!review)
|
||||
return;
|
||||
if (!review) return;
|
||||
try
|
||||
{
|
||||
procId = proc?.Id;
|
||||
|
|
@ -147,4 +136,4 @@ public static class ProcUtils
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using SQLite;
|
||||
using System.Collections;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
@ -88,4 +88,4 @@ namespace ServiceLib.Common
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
@ -21,8 +21,7 @@ namespace ServiceLib.Common
|
|||
|
||||
public static bool BeginWithAny(this string s, IEnumerable<char> chars)
|
||||
{
|
||||
if (s.IsNullOrEmpty())
|
||||
return false;
|
||||
if (s.IsNullOrEmpty()) return false;
|
||||
return chars.Contains(s.First());
|
||||
}
|
||||
|
||||
|
|
@ -35,8 +34,7 @@ namespace ServiceLib.Common
|
|||
{
|
||||
while (reader.ReadLine() is { } line)
|
||||
{
|
||||
if (line.IsWhiteSpace())
|
||||
continue;
|
||||
if (line.IsWhiteSpace()) continue;
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
|
|
@ -71,4 +69,4 @@ namespace ServiceLib.Common
|
|||
return string.IsNullOrEmpty(value) ? string.Empty : $"\"{value}\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
|
|
@ -8,8 +10,6 @@ using System.Runtime.InteropServices;
|
|||
using System.Security.Cryptography;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
@ -176,8 +176,7 @@ namespace ServiceLib.Common
|
|||
{
|
||||
try
|
||||
{
|
||||
if (plainText.IsNullOrEmpty())
|
||||
return "";
|
||||
if (plainText.IsNullOrEmpty()) return "";
|
||||
plainText = plainText.Trim()
|
||||
.Replace(Environment.NewLine, "")
|
||||
.Replace("\n", "")
|
||||
|
|
@ -373,8 +372,7 @@ namespace ServiceLib.Common
|
|||
|
||||
public static bool IsBase64String(string? plainText)
|
||||
{
|
||||
if (plainText.IsNullOrEmpty())
|
||||
return false;
|
||||
if (plainText.IsNullOrEmpty()) return false;
|
||||
var buffer = new Span<byte>(new byte[plainText.Length]);
|
||||
return Convert.TryFromBase64String(plainText, buffer, out var _);
|
||||
}
|
||||
|
|
@ -464,12 +462,9 @@ namespace ServiceLib.Common
|
|||
if (IPAddress.TryParse(ip, out var address))
|
||||
{
|
||||
var ipBytes = address.GetAddressBytes();
|
||||
if (ipBytes[0] == 10)
|
||||
return true;
|
||||
if (ipBytes[0] == 172 && ipBytes[1] >= 16 && ipBytes[1] <= 31)
|
||||
return true;
|
||||
if (ipBytes[0] == 192 && ipBytes[1] == 168)
|
||||
return true;
|
||||
if (ipBytes[0] == 10) return true;
|
||||
if (ipBytes[0] == 172 && ipBytes[1] >= 16 && ipBytes[1] <= 31) return true;
|
||||
if (ipBytes[0] == 192 && ipBytes[1] == 168) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -609,11 +604,9 @@ namespace ServiceLib.Common
|
|||
|
||||
foreach (var host in hostsList)
|
||||
{
|
||||
if (host.StartsWith("#"))
|
||||
continue;
|
||||
if (host.StartsWith("#")) continue;
|
||||
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (hostItem.Length != 2)
|
||||
continue;
|
||||
if (hostItem.Length != 2) continue;
|
||||
systemHosts.Add(hostItem.Last(), hostItem.First());
|
||||
}
|
||||
}
|
||||
|
|
@ -882,10 +875,8 @@ namespace ServiceLib.Common
|
|||
|
||||
public static async Task<string?> SetLinuxChmod(string? fileName)
|
||||
{
|
||||
if (fileName.IsNullOrEmpty())
|
||||
return null;
|
||||
if (fileName.Contains(' '))
|
||||
fileName = fileName.AppendQuotes();
|
||||
if (fileName.IsNullOrEmpty()) return null;
|
||||
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
|
||||
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
|
||||
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
|
||||
return await GetCliWrapOutput("/bin/bash", arg);
|
||||
|
|
@ -913,4 +904,4 @@ namespace ServiceLib.Common
|
|||
|
||||
#endregion Platform
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
|
|
@ -55,20 +56,21 @@ namespace ServiceLib.Common
|
|||
|
||||
public static async Task RemoveTunDevice()
|
||||
{
|
||||
try
|
||||
{
|
||||
var sum = MD5.HashData(Encoding.UTF8.GetBytes("wintunsingbox_tun"));
|
||||
var guid = new Guid(sum);
|
||||
var pnpUtilPath = @"C:\Windows\System32\pnputil.exe";
|
||||
var arg = $$""" /remove-device "SWD\Wintun\{{{guid}}}" """;
|
||||
try
|
||||
{
|
||||
var sum = MD5.HashData(Encoding.UTF8.GetBytes("wintunsingbox_tun"));
|
||||
var guid = new Guid(sum);
|
||||
var pnpUtilPath = @"C:\Windows\System32\pnputil.exe";
|
||||
var arg = $$""" /remove-device "SWD\Wintun\{{{guid}}}" """;
|
||||
|
||||
// Try to remove the device
|
||||
await Utils.GetCliWrapOutput(pnpUtilPath, arg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Try to remove the device
|
||||
await Utils.GetCliWrapOutput(pnpUtilPath, arg);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Security.Principal;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
|
@ -29,12 +30,12 @@ namespace ServiceLib.Handler
|
|||
}
|
||||
else if (Utils.IsOSX())
|
||||
{
|
||||
await ClearTaskOSX();
|
||||
await ClearTaskOSX();
|
||||
|
||||
if (config.GuiItem.AutoRun)
|
||||
{
|
||||
await SetTaskOSX();
|
||||
}
|
||||
if (config.GuiItem.AutoRun)
|
||||
{
|
||||
await SetTaskOSX();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -171,46 +172,46 @@ namespace ServiceLib.Handler
|
|||
|
||||
private static async Task ClearTaskOSX()
|
||||
{
|
||||
try
|
||||
{
|
||||
var launchAgentPath = GetLaunchAgentPathMacOS();
|
||||
if (File.Exists(launchAgentPath))
|
||||
{
|
||||
var args = new[] { "-c", $"launchctl unload -w \"{launchAgentPath}\"" };
|
||||
await Utils.GetCliWrapOutput("/bin/bash", args);
|
||||
try
|
||||
{
|
||||
var launchAgentPath = GetLaunchAgentPathMacOS();
|
||||
if (File.Exists(launchAgentPath))
|
||||
{
|
||||
var args = new[] { "-c", $"launchctl unload -w \"{launchAgentPath}\"" };
|
||||
await Utils.GetCliWrapOutput("/bin/bash", args);
|
||||
|
||||
File.Delete(launchAgentPath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
}
|
||||
File.Delete(launchAgentPath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task SetTaskOSX()
|
||||
{
|
||||
try
|
||||
{
|
||||
var plistContent = GenerateLaunchAgentPlist();
|
||||
var launchAgentPath = GetLaunchAgentPathMacOS();
|
||||
await File.WriteAllTextAsync(launchAgentPath, plistContent);
|
||||
try
|
||||
{
|
||||
var plistContent = GenerateLaunchAgentPlist();
|
||||
var launchAgentPath = GetLaunchAgentPathMacOS();
|
||||
await File.WriteAllTextAsync(launchAgentPath, plistContent);
|
||||
|
||||
var args = new[] { "-c", $"launchctl load -w \"{launchAgentPath}\"" };
|
||||
await Utils.GetCliWrapOutput("/bin/bash", args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
}
|
||||
var args = new[] { "-c", $"launchctl load -w \"{launchAgentPath}\"" };
|
||||
await Utils.GetCliWrapOutput("/bin/bash", args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(_tag, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetLaunchAgentPathMacOS()
|
||||
{
|
||||
var homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var launchAgentPath = Path.Combine(homePath, "Library", "LaunchAgents", $"{Global.AppName}-LaunchAgent.plist");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(launchAgentPath));
|
||||
return launchAgentPath;
|
||||
var homePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var launchAgentPath = Path.Combine(homePath, "Library", "LaunchAgents", $"{Global.AppName}-LaunchAgent.plist");
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(launchAgentPath));
|
||||
return launchAgentPath;
|
||||
}
|
||||
|
||||
private static string GenerateLaunchAgentPlist()
|
||||
|
|
|
|||
|
|
@ -873,8 +873,7 @@ namespace ServiceLib.Handler
|
|||
|
||||
List<ProfileItem> lstKeep = new();
|
||||
List<ProfileItem> lstRemove = new();
|
||||
if (!config.GuiItem.KeepOlderDedupl)
|
||||
lstProfile.Reverse();
|
||||
if (!config.GuiItem.KeepOlderDedupl) lstProfile.Reverse();
|
||||
|
||||
foreach (ProfileItem item in lstProfile)
|
||||
{
|
||||
|
|
@ -1364,8 +1363,7 @@ namespace ServiceLib.Handler
|
|||
};
|
||||
|
||||
var uri = Utils.TryUri(url);
|
||||
if (uri == null)
|
||||
return -1;
|
||||
if (uri == null) return -1;
|
||||
//Do not allow http protocol
|
||||
if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost))
|
||||
{
|
||||
|
|
@ -1887,4 +1885,4 @@ namespace ServiceLib.Handler
|
|||
|
||||
#endregion Regional Presets
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -84,13 +84,13 @@ namespace ServiceLib.Handler
|
|||
await CoreStop();
|
||||
await Task.Delay(100);
|
||||
|
||||
if (Utils.IsWindows() && _config.TunModeItem.EnableTun)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
await WindowsUtils.RemoveTunDevice();
|
||||
}
|
||||
if (Utils.IsWindows() && _config.TunModeItem.EnableTun)
|
||||
{
|
||||
await Task.Delay(100);
|
||||
await WindowsUtils.RemoveTunDevice();
|
||||
}
|
||||
|
||||
await CoreStart(node);
|
||||
await CoreStart(node);
|
||||
await CoreStartPreService(node);
|
||||
if (_process != null)
|
||||
{
|
||||
|
|
@ -246,14 +246,12 @@ namespace ServiceLib.Handler
|
|||
{
|
||||
proc.OutputDataReceived += (sender, e) =>
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(e.Data))
|
||||
return;
|
||||
if (Utils.IsNullOrEmpty(e.Data)) return;
|
||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
||||
};
|
||||
proc.ErrorDataReceived += (sender, e) =>
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(e.Data))
|
||||
return;
|
||||
if (Utils.IsNullOrEmpty(e.Data)) return;
|
||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
||||
};
|
||||
}
|
||||
|
|
@ -267,8 +265,7 @@ namespace ServiceLib.Handler
|
|||
await Task.Delay(10);
|
||||
await proc.StandardInput.WriteLineAsync(pwd);
|
||||
}
|
||||
if (isNeedSudo)
|
||||
_linuxSudoPid = proc.Id;
|
||||
if (isNeedSudo) _linuxSudoPid = proc.Id;
|
||||
|
||||
if (displayLog)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Specialized;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
|
|
@ -214,8 +214,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
{
|
||||
foreach (var item in s)
|
||||
{
|
||||
if (str.Contains(item, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
if (str.Contains(item, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -237,4 +236,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return $"{Global.ProtocolShares[eConfigType]}{url}{query}{remark}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class Hysteria2Fmt : BaseFmt
|
||||
{
|
||||
|
|
@ -11,8 +11,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
return null;
|
||||
if (url == null) return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -29,8 +28,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -93,4 +91,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
|
|
@ -26,8 +26,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -83,8 +82,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
private static ProfileItem? ResolveSip002(string result)
|
||||
{
|
||||
var parsedUrl = Utils.TryUri(result);
|
||||
if (parsedUrl == null)
|
||||
return null;
|
||||
if (parsedUrl == null) return null;
|
||||
|
||||
ProfileItem item = new()
|
||||
{
|
||||
|
|
@ -171,4 +169,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class SocksFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -23,8 +23,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
var url = string.Empty;
|
||||
|
||||
var remark = string.Empty;
|
||||
|
|
@ -87,8 +86,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
private static ProfileItem? ResolveSocksNew(string result)
|
||||
{
|
||||
var parsedUrl = Utils.TryUri(result);
|
||||
if (parsedUrl == null)
|
||||
return null;
|
||||
if (parsedUrl == null) return null;
|
||||
|
||||
ProfileItem item = new()
|
||||
{
|
||||
|
|
@ -110,4 +108,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class TrojanFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -12,8 +12,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
return null;
|
||||
if (url == null) return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -28,8 +27,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -43,4 +41,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return ToUri(EConfigType.Trojan, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class TuicFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -12,8 +12,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
return null;
|
||||
if (url == null) return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -35,8 +34,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -58,4 +56,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return ToUri(EConfigType.TUIC, item.Address, item.Port, $"{item.Id}:{item.Security}", dicQuery, remark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class VLESSFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -13,8 +13,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
return null;
|
||||
if (url == null) return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -31,8 +30,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -54,4 +52,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return ToUri(EConfigType.VLESS, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class VmessFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -19,8 +19,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
VmessQRCode vmessQRCode = new()
|
||||
|
|
@ -107,8 +106,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
return null;
|
||||
if (url == null) return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -121,4 +119,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class WireguardFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -12,8 +12,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
return null;
|
||||
if (url == null) return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -32,8 +31,7 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
if (item == null) return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -62,4 +60,4 @@ namespace ServiceLib.Handler.Fmt
|
|||
return ToUri(EConfigType.WireGuard, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Net.Sockets;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
|
@ -89,8 +89,7 @@ namespace ServiceLib.Handler
|
|||
|
||||
public static void Stop()
|
||||
{
|
||||
if (_tcpListener == null)
|
||||
return;
|
||||
if (_tcpListener == null) return;
|
||||
try
|
||||
{
|
||||
_isRunning = false;
|
||||
|
|
@ -103,4 +102,4 @@ namespace ServiceLib.Handler
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -176,8 +176,7 @@ namespace ServiceLib.Handler.SysProxy
|
|||
}
|
||||
|
||||
// FREE the data ASAP
|
||||
if (list.szConnection != nint.Zero)
|
||||
Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (list.szConnection != nint.Zero) Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (optionCount > 1)
|
||||
{
|
||||
Marshal.FreeHGlobal(options[1].m_Value.m_StringPtr); // release mem 1
|
||||
|
|
@ -357,4 +356,4 @@ namespace ServiceLib.Handler.SysProxy
|
|||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Net;
|
||||
using System.Net;
|
||||
using WebDav;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
|
@ -61,8 +61,7 @@ namespace ServiceLib.Handler
|
|||
|
||||
private async Task<bool> TryCreateDir()
|
||||
{
|
||||
if (_client is null)
|
||||
return false;
|
||||
if (_client is null) return false;
|
||||
try
|
||||
{
|
||||
var result2 = await _client.Mkcol(_webDir);
|
||||
|
|
@ -177,4 +176,4 @@ namespace ServiceLib.Handler
|
|||
|
||||
public string GetLastError() => _lastDescription ?? string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1048,8 +1048,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||
var countDomain = 0;
|
||||
foreach (var it in item.Domain)
|
||||
{
|
||||
if (ParseV2Domain(it, rule1))
|
||||
countDomain++;
|
||||
if (ParseV2Domain(it, rule1)) countDomain++;
|
||||
}
|
||||
if (countDomain > 0)
|
||||
{
|
||||
|
|
@ -1063,8 +1062,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||
var countIp = 0;
|
||||
foreach (var it in item.Ip)
|
||||
{
|
||||
if (ParseV2Address(it, rule2))
|
||||
countIp++;
|
||||
if (ParseV2Address(it, rule2)) countIp++;
|
||||
}
|
||||
if (countIp > 0)
|
||||
{
|
||||
|
|
@ -1150,14 +1148,12 @@ namespace ServiceLib.Services.CoreConfig
|
|||
}
|
||||
else if (address.StartsWith("geoip:"))
|
||||
{
|
||||
if (rule.geoip is null)
|
||||
{ rule.geoip = new(); }
|
||||
if (rule.geoip is null) { rule.geoip = new(); }
|
||||
rule.geoip?.Add(address.Substring(6));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rule.ip_cidr is null)
|
||||
{ rule.ip_cidr = new(); }
|
||||
if (rule.ip_cidr is null) { rule.ip_cidr = new(); }
|
||||
rule.ip_cidr?.Add(address);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1275,8 +1271,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||
{
|
||||
static void AddRuleSets(List<string> ruleSets, List<string>? rule_set)
|
||||
{
|
||||
if (rule_set != null)
|
||||
ruleSets.AddRange(rule_set);
|
||||
if (rule_set != null) ruleSets.AddRange(rule_set);
|
||||
}
|
||||
var geosite = "geosite";
|
||||
var geoip = "geoip";
|
||||
|
|
@ -1344,8 +1339,7 @@ namespace ServiceLib.Services.CoreConfig
|
|||
singboxConfig.route.rule_set = [];
|
||||
foreach (var item in new HashSet<string>(ruleSets))
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(item))
|
||||
{ continue; }
|
||||
if (Utils.IsNullOrEmpty(item)) { continue; }
|
||||
var customRuleset = customRulesets.FirstOrDefault(t => t.tag != null && t.tag.Equals(item));
|
||||
if (customRuleset is null)
|
||||
{
|
||||
|
|
@ -1384,4 +1378,4 @@ namespace ServiceLib.Services.CoreConfig
|
|||
|
||||
#endregion private gen function
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace ServiceLib.Services
|
||||
{
|
||||
|
|
@ -119,8 +119,7 @@ namespace ServiceLib.Services
|
|||
|
||||
private void ExitLoop(string x)
|
||||
{
|
||||
if (_exitLoop)
|
||||
return;
|
||||
if (_exitLoop) return;
|
||||
_exitLoop = true;
|
||||
UpdateFunc("", ResUI.SpeedtestingStop);
|
||||
}
|
||||
|
|
@ -262,8 +261,7 @@ namespace ServiceLib.Services
|
|||
UpdateFunc(it.IndexId, "", ResUI.Speedtesting);
|
||||
|
||||
var item = await AppHandler.Instance.GetProfileItem(it.IndexId);
|
||||
if (item is null)
|
||||
continue;
|
||||
if (item is null) continue;
|
||||
|
||||
var webProxy = new WebProxy($"socks5://{Global.Loopback}:{it.Port}");
|
||||
|
||||
|
|
@ -325,8 +323,7 @@ namespace ServiceLib.Services
|
|||
UpdateFunc(it.IndexId, "", ResUI.Speedtesting);
|
||||
|
||||
var item = await AppHandler.Instance.GetProfileItem(it.IndexId);
|
||||
if (item is null)
|
||||
continue;
|
||||
if (item is null) continue;
|
||||
|
||||
var webProxy = new WebProxy($"socks5://{Global.Loopback}:{it.Port}");
|
||||
_ = downloadHandle.DownloadDataAsync(url, webProxy, timeout, (success, msg) =>
|
||||
|
|
@ -408,4 +405,4 @@ namespace ServiceLib.Services
|
|||
_updateFunc?.Invoke(new() { IndexId = indexId, Delay = delay, Speed = speed });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Net.WebSockets;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
|
||||
namespace ServiceLib.Services.Statistics
|
||||
|
|
@ -109,8 +109,7 @@ namespace ServiceLib.Services.Statistics
|
|||
|
||||
private void ParseOutput(string source, out ulong up, out ulong down)
|
||||
{
|
||||
up = 0;
|
||||
down = 0;
|
||||
up = 0; down = 0;
|
||||
try
|
||||
{
|
||||
var trafficItem = JsonUtils.Deserialize<TrafficItem>(source);
|
||||
|
|
@ -125,4 +124,4 @@ namespace ServiceLib.Services.Statistics
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Services.Statistics
|
||||
namespace ServiceLib.Services.Statistics
|
||||
{
|
||||
public class StatisticsXrayService
|
||||
{
|
||||
|
|
@ -63,8 +63,7 @@ namespace ServiceLib.Services.Statistics
|
|||
foreach (string key in source.stats.outbound.Keys)
|
||||
{
|
||||
var value = source.stats.outbound[key];
|
||||
if (value == null)
|
||||
continue;
|
||||
if (value == null) continue;
|
||||
var state = JsonUtils.Deserialize<V2rayMetricsVarsLink>(value.ToString());
|
||||
|
||||
if (key.StartsWith(Global.ProxyTag))
|
||||
|
|
@ -103,4 +102,4 @@ namespace ServiceLib.Services.Statistics
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -368,7 +368,6 @@ namespace ServiceLib.Services
|
|||
try
|
||||
{
|
||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
||||
var coreUrl = await GetUrlFromCore(coreInfo) ?? string.Empty;
|
||||
SemanticVersion curVersion;
|
||||
string message;
|
||||
string? url;
|
||||
|
|
@ -380,28 +379,28 @@ namespace ServiceLib.Services
|
|||
{
|
||||
curVersion = await GetCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
||||
url = string.Format(coreUrl, version.ToVersionString("v"));
|
||||
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"));
|
||||
break;
|
||||
}
|
||||
case ECoreType.mihomo:
|
||||
{
|
||||
curVersion = await GetCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, type, curVersion);
|
||||
url = string.Format(coreUrl, version.ToVersionString("v"));
|
||||
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"));
|
||||
break;
|
||||
}
|
||||
case ECoreType.sing_box:
|
||||
{
|
||||
curVersion = await GetCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
||||
url = string.Format(coreUrl, version.ToVersionString("v"), version);
|
||||
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"), version);
|
||||
break;
|
||||
}
|
||||
case ECoreType.v2rayN:
|
||||
{
|
||||
curVersion = new SemanticVersion(Utils.GetVersionInfo());
|
||||
message = string.Format(ResUI.IsLatestN, type, curVersion);
|
||||
url = string.Format(coreUrl, version);
|
||||
url = string.Format(GetUrlFromCore(coreInfo), version);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -423,18 +422,17 @@ namespace ServiceLib.Services
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<string?> GetUrlFromCore(CoreInfo? coreInfo)
|
||||
private string? GetUrlFromCore(CoreInfo? coreInfo)
|
||||
{
|
||||
if (Utils.IsWindows())
|
||||
{
|
||||
//Check for standalone windows .Net version
|
||||
if (coreInfo?.CoreType == ECoreType.v2rayN && RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
||||
if (coreInfo?.CoreType == ECoreType.v2rayN
|
||||
&& File.Exists(Path.Combine(Utils.StartupPath(), "wpfgfx_cor3.dll"))
|
||||
&& File.Exists(Path.Combine(Utils.StartupPath(), "D3DCompiler_47_cor3.dll"))
|
||||
)
|
||||
{
|
||||
var runtimes = await Utils.GetCliWrapOutput("dotnet", "--list-runtimes");
|
||||
if (runtimes == null || runtimes.Contains("Microsoft.WindowsDesktop.App 8") == false)
|
||||
{
|
||||
return coreInfo?.DownloadUrlWin64?.Replace(".zip", "-SelfContained.zip");
|
||||
}
|
||||
return coreInfo?.DownloadUrlWin64?.Replace(".zip", "-SelfContained.zip");
|
||||
}
|
||||
|
||||
return RuntimeInformation.ProcessArchitecture switch
|
||||
|
|
@ -588,4 +586,4 @@ namespace ServiceLib.Services
|
|||
|
||||
#endregion Geo private
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -113,4 +113,4 @@ namespace ServiceLib.ViewModels
|
|||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -94,4 +94,4 @@ namespace ServiceLib.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -179,4 +179,4 @@ namespace ServiceLib.ViewModels
|
|||
return await Task.FromResult(ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
using System.Reactive;
|
||||
using System.Runtime.InteropServices;
|
||||
using DynamicData;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -83,8 +83,7 @@ namespace ServiceLib.ViewModels
|
|||
for (var k = _checkUpdateModel.Count - 1; k >= 0; k--)
|
||||
{
|
||||
var item = _checkUpdateModel[k];
|
||||
if (item.IsSelected != true)
|
||||
continue;
|
||||
if (item.IsSelected != true) continue;
|
||||
|
||||
UpdateView(item.CoreType, "...");
|
||||
if (item.CoreType == _geo)
|
||||
|
|
@ -298,11 +297,10 @@ namespace ServiceLib.ViewModels
|
|||
public void UpdateViewResult(CheckUpdateModel model)
|
||||
{
|
||||
var found = _checkUpdateModel.FirstOrDefault(t => t.CoreType == model.CoreType);
|
||||
if (found == null)
|
||||
return;
|
||||
if (found == null) return;
|
||||
var itemCopy = JsonUtils.DeepCopy(found);
|
||||
itemCopy.Remarks = model.Remarks;
|
||||
_checkUpdateModel.Replace(found, itemCopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -115,8 +115,7 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
lstModel.Add(model);
|
||||
}
|
||||
if (lstModel.Count <= 0)
|
||||
{ return; }
|
||||
if (lstModel.Count <= 0) { return; }
|
||||
|
||||
_connectionItems.AddRange(lstModel);
|
||||
}
|
||||
|
|
@ -141,4 +140,4 @@ namespace ServiceLib.ViewModels
|
|||
await GetClashConnections();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using static ServiceLib.Models.ClashProviders;
|
||||
using static ServiceLib.Models.ClashProxies;
|
||||
|
||||
|
|
@ -463,4 +463,4 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
#endregion task
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -114,4 +114,4 @@ namespace ServiceLib.ViewModels
|
|||
_updateView?.Invoke(EViewAction.CloseWindow, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -570,8 +570,7 @@ namespace ServiceLib.ViewModels
|
|||
{
|
||||
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
|
||||
}
|
||||
else
|
||||
{ TabMainSelectedIndex = 0; }
|
||||
else { TabMainSelectedIndex = 0; }
|
||||
}
|
||||
|
||||
private async Task LoadCore()
|
||||
|
|
@ -612,4 +611,4 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
#endregion Presets
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Text.RegularExpressions;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -119,4 +119,4 @@ namespace ServiceLib.ViewModels
|
|||
_lastMsgFilterNotAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -415,4 +415,4 @@ namespace ServiceLib.ViewModels
|
|||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -841,4 +841,4 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
#endregion Subscription
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -90,4 +90,4 @@ namespace ServiceLib.ViewModels
|
|||
await _updateView?.Invoke(EViewAction.CloseWindow, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -338,4 +338,4 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
#endregion Import rules
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive;
|
||||
using DynamicData.Binding;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -202,4 +202,4 @@ namespace ServiceLib.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Reactive;
|
||||
using System.Text;
|
||||
using DynamicData.Binding;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
using System.Text;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -225,22 +225,19 @@ namespace ServiceLib.ViewModels
|
|||
private async Task AddServerViaClipboard()
|
||||
{
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
await service.AddServerViaClipboardAsync(null);
|
||||
if (service != null) await service.AddServerViaClipboardAsync(null);
|
||||
}
|
||||
|
||||
private async Task AddServerViaScan()
|
||||
{
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
await service.AddServerViaScanAsync();
|
||||
if (service != null) await service.AddServerViaScanAsync();
|
||||
}
|
||||
|
||||
private async Task UpdateSubscriptionProcess(bool blProxy)
|
||||
{
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
await service.UpdateSubscriptionProcess("", blProxy);
|
||||
if (service != null) await service.UpdateSubscriptionProcess("", blProxy);
|
||||
}
|
||||
|
||||
public async Task RefreshServersBiz()
|
||||
|
|
@ -499,4 +496,4 @@ namespace ServiceLib.ViewModels
|
|||
|
||||
#endregion UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Reactive;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -61,4 +61,4 @@ namespace ServiceLib.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Reactive;
|
||||
using DynamicData;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive;
|
||||
|
||||
namespace ServiceLib.ViewModels
|
||||
{
|
||||
|
|
@ -102,4 +102,4 @@ namespace ServiceLib.ViewModels
|
|||
IsModified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,8 +64,7 @@ public partial class App : Application
|
|||
{
|
||||
var clipboardData = await AvaUtils.GetClipboardData(desktop.MainWindow);
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
_ = service.AddServerViaClipboardAsync(clipboardData);
|
||||
if (service != null) _ = service.AddServerViaClipboardAsync(clipboardData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,8 +72,7 @@ public partial class App : Application
|
|||
private async void MenuExit_Click(object? sender, EventArgs e)
|
||||
{
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
await service.MyAppExitAsync(true);
|
||||
if (service != null) await service.MyAppExitAsync(true);
|
||||
service?.Shutdown(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Avalonia;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Media.Imaging;
|
||||
|
|
@ -13,8 +13,7 @@ namespace v2rayN.Desktop.Common
|
|||
try
|
||||
{
|
||||
var clipboard = TopLevel.GetTopLevel(owner)?.Clipboard;
|
||||
if (clipboard == null)
|
||||
return null;
|
||||
if (clipboard == null) return null;
|
||||
return await clipboard.GetTextAsync();
|
||||
}
|
||||
catch
|
||||
|
|
@ -28,8 +27,7 @@ namespace v2rayN.Desktop.Common
|
|||
try
|
||||
{
|
||||
var clipboard = TopLevel.GetTopLevel(visual)?.Clipboard;
|
||||
if (clipboard == null)
|
||||
return;
|
||||
if (clipboard == null) return;
|
||||
var dataObject = new DataObject();
|
||||
dataObject.Set(DataFormats.Text, strData);
|
||||
await clipboard.SetDataObjectAsync(dataObject);
|
||||
|
|
@ -53,4 +51,4 @@ namespace v2rayN.Desktop.Common
|
|||
return new(bitmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
|
|
@ -18,9 +18,8 @@ namespace v2rayN.Desktop.Common
|
|||
public static async Task<string?> OpenFileDialog(Window owner, FilePickerFileType? filter)
|
||||
{
|
||||
var sp = GetStorageProvider(owner);
|
||||
if (sp is null)
|
||||
return null;
|
||||
|
||||
if (sp is null) return null;
|
||||
|
||||
// Start async operation to open the dialog.
|
||||
var files = await sp.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
{
|
||||
|
|
@ -34,8 +33,7 @@ namespace v2rayN.Desktop.Common
|
|||
public static async Task<string?> SaveFileDialog(Window owner, string filter)
|
||||
{
|
||||
var sp = GetStorageProvider(owner);
|
||||
if (sp is null)
|
||||
return null;
|
||||
if (sp is null) return null;
|
||||
|
||||
// Start async operation to open the dialog.
|
||||
var files = await sp.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
|
|
@ -51,4 +49,4 @@ namespace v2rayN.Desktop.Common
|
|||
return topLevel?.StorageProvider;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using System.Globalization;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Media;
|
||||
using System.Globalization;
|
||||
|
||||
namespace v2rayN.Desktop.Converters
|
||||
{
|
||||
|
|
@ -23,4 +23,4 @@ namespace v2rayN.Desktop.Converters
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,5 +53,5 @@ internal class Program
|
|||
.WithFontByDefault()
|
||||
.LogToTrace()
|
||||
.UseReactiveUI()
|
||||
.With(new MacOSPlatformOptions { ShowInDock = false });
|
||||
}
|
||||
.With(new MacOSPlatformOptions { ShowInDock = false});
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Reactive.Linq;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Notifications;
|
||||
|
|
@ -8,6 +7,7 @@ using Avalonia.Styling;
|
|||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Semi.Avalonia;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace v2rayN.Desktop.ViewModels
|
||||
{
|
||||
|
|
@ -100,8 +100,7 @@ namespace v2rayN.Desktop.ViewModels
|
|||
private void ModifyFontSize()
|
||||
{
|
||||
double size = CurrentFontSize;
|
||||
if (size < Global.MinFontSize)
|
||||
return;
|
||||
if (size < Global.MinFontSize) return;
|
||||
|
||||
Style style = new(x => Selectors.Or(
|
||||
x.OfType<Button>(),
|
||||
|
|
@ -155,4 +154,4 @@ namespace v2rayN.Desktop.ViewModels
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -69,4 +69,4 @@ namespace v2rayN.Desktop.Views
|
|||
txtRemarks.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -368,4 +368,4 @@ namespace v2rayN.Desktop.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -69,4 +69,4 @@ namespace v2rayN.Desktop.Views
|
|||
return await Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -27,16 +27,14 @@ namespace v2rayN.Desktop.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherCheckUpdate:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.UpdateViewResult((CheckUpdateModel)obj),
|
||||
DispatcherPriority.Default);
|
||||
break;
|
||||
|
||||
case EViewAction.DispatcherCheckUpdateFinished:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.UpdateFinishedResult((bool)obj),
|
||||
DispatcherPriority.Default);
|
||||
|
|
@ -46,4 +44,4 @@ namespace v2rayN.Desktop.Views
|
|||
return await Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -34,8 +34,7 @@ namespace v2rayN.Desktop.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherRefreshConnections:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.RefreshConnections((List<ConnectionItem>?)obj),
|
||||
DispatcherPriority.Default);
|
||||
|
|
@ -63,4 +62,4 @@ namespace v2rayN.Desktop.Views
|
|||
ViewModel?.ClashConnectionClose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -49,8 +49,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.DispatcherProxiesDelayTest:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.ProxiesDelayTestResult((SpeedTestResult)obj),
|
||||
DispatcherPriority.Default);
|
||||
|
|
@ -79,4 +78,4 @@ namespace v2rayN.Desktop.Views
|
|||
ViewModel?.SetActiveProxy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -73,4 +73,4 @@ namespace v2rayN.Desktop.Views
|
|||
ProcUtils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/dns/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Controls.Notifications;
|
||||
|
|
@ -11,6 +10,7 @@ using DialogHostAvalonia;
|
|||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -181,13 +181,11 @@ namespace v2rayN.Desktop.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.AddServerWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new AddServerWindow((ProfileItem)obj).ShowDialog<bool>(this);
|
||||
|
||||
case EViewAction.AddServer2Window:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new AddServer2Window((ProfileItem)obj).ShowDialog<bool>(this);
|
||||
|
||||
case EViewAction.DNSSettingWindow:
|
||||
|
|
@ -212,8 +210,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.DispatcherStatistics:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.SetStatisticsResult((ServerSpeedItem)obj),
|
||||
DispatcherPriority.Default);
|
||||
|
|
@ -392,7 +389,7 @@ namespace v2rayN.Desktop.Views
|
|||
_blCloseByUser = true;
|
||||
StorageUI();
|
||||
|
||||
await ViewModel?.MyAppExitAsync(false);
|
||||
await ViewModel?.MyAppExitAsync(false);
|
||||
}
|
||||
|
||||
#endregion Event
|
||||
|
|
@ -401,32 +398,32 @@ namespace v2rayN.Desktop.Views
|
|||
|
||||
public void ShowHideWindow(bool? blShow)
|
||||
{
|
||||
var bl = blShow ?? (!_config.UiItem.ShowInTaskbar ^ (WindowState == WindowState.Minimized));
|
||||
if (bl)
|
||||
{
|
||||
this.Show();
|
||||
if (this.WindowState == WindowState.Minimized)
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
}
|
||||
this.Activate();
|
||||
this.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utils.IsOSX() || _config.UiItem.Hide2TrayWhenClose)
|
||||
{
|
||||
foreach (var ownedWindow in this.OwnedWindows)
|
||||
{
|
||||
ownedWindow.Close();
|
||||
}
|
||||
this.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
var bl = blShow ?? (!_config.UiItem.ShowInTaskbar ^ (WindowState==WindowState.Minimized));
|
||||
if (bl)
|
||||
{
|
||||
this.Show();
|
||||
if (this.WindowState == WindowState.Minimized)
|
||||
{
|
||||
this.WindowState = WindowState.Normal;
|
||||
}
|
||||
this.Activate();
|
||||
this.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Utils.IsOSX() || _config.UiItem.Hide2TrayWhenClose)
|
||||
{
|
||||
foreach (var ownedWindow in this.OwnedWindows)
|
||||
{
|
||||
ownedWindow.Close();
|
||||
}
|
||||
this.Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
}
|
||||
|
||||
_config.UiItem.ShowInTaskbar = bl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -27,8 +27,7 @@ namespace v2rayN.Desktop.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherShowMsg:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ShowMsg(obj),
|
||||
|
|
@ -76,4 +75,4 @@ namespace v2rayN.Desktop.Views
|
|||
ClearMsg();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -238,4 +238,4 @@ namespace v2rayN.Desktop.Views
|
|||
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
|
@ -8,6 +7,7 @@ using DialogHostAvalonia;
|
|||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -112,8 +112,7 @@ namespace v2rayN.Desktop.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
await AvaUtils.SetClipboardData(this, (string)obj);
|
||||
break;
|
||||
|
||||
|
|
@ -136,8 +135,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.SaveFileDialog:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
var fileName = await UI.SaveFileDialog(_window, "");
|
||||
if (fileName.IsNullOrEmpty())
|
||||
{
|
||||
|
|
@ -147,29 +145,24 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.AddServerWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new AddServerWindow((ProfileItem)obj).ShowDialog<bool>(_window);
|
||||
|
||||
case EViewAction.AddServer2Window:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new AddServer2Window((ProfileItem)obj).ShowDialog<bool>(_window);
|
||||
|
||||
case EViewAction.ShareServer:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
await ShareServer((string)obj);
|
||||
break;
|
||||
|
||||
case EViewAction.SubEditWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new SubEditWindow((SubItem)obj).ShowDialog<bool>(_window);
|
||||
|
||||
case EViewAction.DispatcherSpeedTest:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.SetSpeedTestResult((SpeedTestResult)obj),
|
||||
DispatcherPriority.Default);
|
||||
|
|
@ -205,8 +198,7 @@ namespace v2rayN.Desktop.Views
|
|||
private void LstProfiles_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)
|
||||
{
|
||||
var source = e.Source as Border;
|
||||
if (source?.Name == "HeaderBackground")
|
||||
return;
|
||||
if (source?.Name == "HeaderBackground") return;
|
||||
if (_config.UiItem.DoubleClick2Activate)
|
||||
{
|
||||
ViewModel?.SetDefaultServer();
|
||||
|
|
@ -482,4 +474,4 @@ namespace v2rayN.Desktop.Views
|
|||
|
||||
//#endregion Drag and Drop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Media.Imaging;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -28,11 +28,10 @@ namespace v2rayN.Desktop.Views
|
|||
|
||||
private Bitmap? ByteToBitmap(byte[]? bytes)
|
||||
{
|
||||
if (bytes is null)
|
||||
return null;
|
||||
if (bytes is null) return null;
|
||||
|
||||
using var ms = new MemoryStream(bytes);
|
||||
return new Bitmap(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -98,4 +98,4 @@ namespace v2rayN.Desktop.Views
|
|||
ProcUtils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.ReactiveUI;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -94,8 +95,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.RoutingRuleDetailsWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new RoutingRuleDetailsWindow((RulesItem)obj).ShowDialog<bool>(this);
|
||||
|
||||
case EViewAction.ImportRulesFromFile:
|
||||
|
|
@ -108,8 +108,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
await AvaUtils.SetClipboardData(this, (string)obj);
|
||||
break;
|
||||
|
||||
|
|
@ -207,4 +206,4 @@ namespace v2rayN.Desktop.Views
|
|||
ProcUtils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -75,8 +75,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.RoutingRuleSettingWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return await new RoutingRuleSettingWindow((RoutingItem)obj).ShowDialog<bool>(this);
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
|
|
@ -143,4 +142,4 @@ namespace v2rayN.Desktop.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
|
|
@ -6,6 +5,7 @@ using Avalonia.ReactiveUI;
|
|||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -50,8 +50,7 @@ namespace v2rayN.Desktop.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherServerAvailability:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
ViewModel?.TestServerAvailabilityResult((string)obj),
|
||||
DispatcherPriority.Default);
|
||||
|
|
@ -72,8 +71,7 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
await AvaUtils.SetClipboardData(this, (string)obj);
|
||||
break;
|
||||
}
|
||||
|
|
@ -96,4 +94,4 @@ namespace v2rayN.Desktop.Views
|
|||
ViewModel?.TestServerAvailability();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
|
|
@ -63,4 +63,4 @@ namespace v2rayN.Desktop.Views
|
|||
txtRemarks.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using DialogHostAvalonia;
|
||||
using DynamicData;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -52,15 +52,13 @@ namespace v2rayN.Desktop.Views
|
|||
break;
|
||||
|
||||
case EViewAction.SubEditWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
var window = new SubEditWindow((SubItem)obj);
|
||||
await window.ShowDialog(this);
|
||||
break;
|
||||
|
||||
case EViewAction.ShareSub:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
await ShareSub((string)obj);
|
||||
break;
|
||||
}
|
||||
|
|
@ -104,4 +102,4 @@ namespace v2rayN.Desktop.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.Desktop.ViewModels;
|
||||
|
||||
namespace v2rayN.Desktop.Views
|
||||
|
|
@ -39,4 +39,4 @@ namespace v2rayN.Desktop.Views
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
<Application
|
||||
<Application
|
||||
x:Class="v2rayN.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
ShutdownMode="OnExplicitShutdown"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
|
|
@ -231,4 +231,4 @@
|
|||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
</Application>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
using Microsoft.Win32;
|
||||
using System.Windows;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace v2rayN
|
||||
{
|
||||
|
|
@ -56,4 +56,4 @@ namespace v2rayN
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace v2rayN
|
||||
{
|
||||
|
|
@ -61,6 +64,8 @@ namespace v2rayN
|
|||
BitmapSizeOptions.FromEmptyOptions());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void SetDarkBorder(Window window, string? theme)
|
||||
{
|
||||
var isDark = theme switch
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
|
|
@ -37,20 +37,16 @@ namespace v2rayN.Handler
|
|||
private void Init()
|
||||
{
|
||||
_hotkeyTriggerDic.Clear();
|
||||
if (_config.GlobalHotkeys == null)
|
||||
return;
|
||||
if (_config.GlobalHotkeys == null) return;
|
||||
foreach (var item in _config.GlobalHotkeys)
|
||||
{
|
||||
if (item.KeyCode != null && (Key)item.KeyCode != Key.None)
|
||||
{
|
||||
int key = KeyInterop.VirtualKeyFromKey((Key)item.KeyCode);
|
||||
KeyModifiers modifiers = KeyModifiers.None;
|
||||
if (item.Control)
|
||||
modifiers |= KeyModifiers.Ctrl;
|
||||
if (item.Shift)
|
||||
modifiers |= KeyModifiers.Shift;
|
||||
if (item.Alt)
|
||||
modifiers |= KeyModifiers.Alt;
|
||||
if (item.Control) modifiers |= KeyModifiers.Ctrl;
|
||||
if (item.Shift) modifiers |= KeyModifiers.Shift;
|
||||
if (item.Alt) modifiers |= KeyModifiers.Alt;
|
||||
key = (key << 16) | (int)modifiers;
|
||||
if (!_hotkeyTriggerDic.ContainsKey(key))
|
||||
{
|
||||
|
|
@ -115,12 +111,9 @@ namespace v2rayN.Handler
|
|||
|
||||
var mdif = (KeyModifiers)_fsModifiers;
|
||||
var key = KeyInterop.KeyFromVirtualKey(_vkey);
|
||||
if ((mdif & KeyModifiers.Ctrl) == KeyModifiers.Ctrl)
|
||||
_hotkeyStr.Append($"{KeyModifiers.Ctrl}+");
|
||||
if ((mdif & KeyModifiers.Alt) == KeyModifiers.Alt)
|
||||
_hotkeyStr.Append($"{KeyModifiers.Alt}+");
|
||||
if ((mdif & KeyModifiers.Shift) == KeyModifiers.Shift)
|
||||
_hotkeyStr.Append($"{KeyModifiers.Shift}+");
|
||||
if ((mdif & KeyModifiers.Ctrl) == KeyModifiers.Ctrl) _hotkeyStr.Append($"{KeyModifiers.Ctrl}+");
|
||||
if ((mdif & KeyModifiers.Alt) == KeyModifiers.Alt) _hotkeyStr.Append($"{KeyModifiers.Alt}+");
|
||||
if ((mdif & KeyModifiers.Shift) == KeyModifiers.Shift) _hotkeyStr.Append($"{KeyModifiers.Shift}+");
|
||||
_hotkeyStr.Append(key.ToString());
|
||||
|
||||
foreach (var name in _hotkeyTriggerDic[hotkeycode])
|
||||
|
|
@ -182,4 +175,4 @@ namespace v2rayN.Handler
|
|||
NoRepeat = 0x4000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
using System.Reactive.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using MaterialDesignColors;
|
||||
|
|
@ -9,6 +5,10 @@ using MaterialDesignColors.ColorManipulation;
|
|||
using MaterialDesignThemes.Wpf;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using System.Reactive.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace v2rayN.ViewModels
|
||||
{
|
||||
|
|
@ -145,8 +145,7 @@ namespace v2rayN.ViewModels
|
|||
private void ModifyFontSize()
|
||||
{
|
||||
double size = (long)CurrentFontSize;
|
||||
if (size < Global.MinFontSize)
|
||||
return;
|
||||
if (size < Global.MinFontSize) return;
|
||||
|
||||
Application.Current.Resources["StdFontSize"] = size;
|
||||
Application.Current.Resources["StdFontSize1"] = size + 1;
|
||||
|
|
@ -186,4 +185,4 @@ namespace v2rayN.ViewModels
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -62,4 +62,4 @@ namespace v2rayN.Views
|
|||
txtRemarks.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -363,4 +363,4 @@ namespace v2rayN.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -53,4 +53,4 @@ namespace v2rayN.Views
|
|||
return await Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -27,8 +27,7 @@ namespace v2rayN.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherCheckUpdate:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.UpdateViewResult((CheckUpdateModel)obj);
|
||||
|
|
@ -36,8 +35,7 @@ namespace v2rayN.Views
|
|||
break;
|
||||
|
||||
case EViewAction.DispatcherCheckUpdateFinished:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.UpdateFinishedResult((bool)obj);
|
||||
|
|
@ -48,4 +46,4 @@ namespace v2rayN.Views
|
|||
return await Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<reactiveui:ReactiveUserControl
|
||||
x:Class="v2rayN.Views.ClashConnectionsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
d:DesignHeight="450"
|
||||
|
|
@ -101,4 +101,4 @@
|
|||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveUserControl>
|
||||
</reactiveui:ReactiveUserControl>
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -36,8 +36,7 @@ namespace v2rayN.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherRefreshConnections:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.RefreshConnections((List<ConnectionItem>?)obj);
|
||||
|
|
@ -66,4 +65,4 @@ namespace v2rayN.Views
|
|||
ViewModel?.ClashConnectionClose(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
<reactiveui:ReactiveUserControl
|
||||
x:Class="v2rayN.Views.ClashProxiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:v2rayN.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
xmlns:converters="clr-namespace:v2rayN.Converters"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:TypeArguments="vms:ClashProxiesViewModel"
|
||||
|
|
@ -188,4 +188,4 @@
|
|||
</ListView>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveUserControl>
|
||||
</reactiveui:ReactiveUserControl>
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -52,8 +52,7 @@ namespace v2rayN.Views
|
|||
|
||||
case EViewAction.DispatcherProxiesDelayTest:
|
||||
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.ProxiesDelayTestResult((SpeedTestResult)obj);
|
||||
|
|
@ -83,4 +82,4 @@ namespace v2rayN.Views
|
|||
ViewModel?.SetActiveProxy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -74,4 +74,4 @@ namespace v2rayN.Views
|
|||
ProcUtils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/dns/");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.GlobalHotkeySettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
Title="{x:Static resx:ResUI.menuSetting}"
|
||||
|
|
@ -175,4 +175,4 @@
|
|||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</reactiveui:ReactiveWindow>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
|
@ -75,12 +75,9 @@ namespace v2rayN.Views
|
|||
{
|
||||
var res = new StringBuilder();
|
||||
|
||||
if (item.Control)
|
||||
res.Append($"{ModifierKeys.Control}+");
|
||||
if (item.Shift)
|
||||
res.Append($"{ModifierKeys.Shift}+");
|
||||
if (item.Alt)
|
||||
res.Append($"{ModifierKeys.Alt}+");
|
||||
if (item.Control) res.Append($"{ModifierKeys.Control}+");
|
||||
if (item.Shift) res.Append($"{ModifierKeys.Shift}+");
|
||||
if (item.Alt) res.Append($"{ModifierKeys.Alt}+");
|
||||
if (item.KeyCode != null && (Key)item.KeyCode != Key.None)
|
||||
res.Append($"{(Key)item.KeyCode}");
|
||||
|
||||
|
|
@ -137,4 +134,4 @@ namespace v2rayN.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
xmlns:view="clr-namespace:v2rayN.Views"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
Title="v2rayN"
|
||||
Width="900"
|
||||
Height="700"
|
||||
|
|
@ -416,4 +416,4 @@
|
|||
</DockPanel>
|
||||
</Grid>
|
||||
</materialDesign:DialogHost>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</reactiveui:ReactiveWindow>
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
using MaterialDesignThemes.Wpf;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.ComponentModel;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
|
|
@ -6,9 +9,6 @@ using System.Windows.Input;
|
|||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using v2rayN.Handler;
|
||||
|
||||
namespace v2rayN.Views
|
||||
|
|
@ -168,13 +168,11 @@ namespace v2rayN.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.AddServerWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new AddServerWindow((ProfileItem)obj)).ShowDialog() ?? false;
|
||||
|
||||
case EViewAction.AddServer2Window:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new AddServer2Window((ProfileItem)obj)).ShowDialog() ?? false;
|
||||
|
||||
case EViewAction.DNSSettingWindow:
|
||||
|
|
@ -200,8 +198,7 @@ namespace v2rayN.Views
|
|||
break;
|
||||
|
||||
case EViewAction.DispatcherStatistics:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.SetStatisticsResult((ServerSpeedItem)obj);
|
||||
|
|
@ -283,12 +280,10 @@ namespace v2rayN.Views
|
|||
switch (e.Key)
|
||||
{
|
||||
case Key.V:
|
||||
if (Keyboard.FocusedElement is TextBox)
|
||||
return;
|
||||
if (Keyboard.FocusedElement is TextBox) return;
|
||||
var clipboardData = WindowsUtils.GetClipboardData();
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
_ = service.AddServerViaClipboardAsync(clipboardData);
|
||||
if (service != null) _ = service.AddServerViaClipboardAsync(clipboardData);
|
||||
break;
|
||||
|
||||
case Key.S:
|
||||
|
|
@ -393,10 +388,8 @@ namespace v2rayN.Views
|
|||
|
||||
var maxWidth = SystemParameters.WorkArea.Width;
|
||||
var maxHeight = SystemParameters.WorkArea.Height;
|
||||
if (Width > maxWidth)
|
||||
Width = maxWidth;
|
||||
if (Height > maxHeight)
|
||||
Height = maxHeight;
|
||||
if (Width > maxWidth) Width = maxWidth;
|
||||
if (Height > maxHeight) Height = maxHeight;
|
||||
if (_config.UiItem.MainGirdHeight1 > 0 && _config.UiItem.MainGirdHeight2 > 0)
|
||||
{
|
||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||
|
|
@ -456,4 +449,4 @@ namespace v2rayN.Views
|
|||
|
||||
#endregion UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -37,8 +37,7 @@ namespace v2rayN.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherShowMsg:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ShowMsg(obj);
|
||||
|
|
@ -88,4 +87,4 @@ namespace v2rayN.Views
|
|||
ClearMsg();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using ReactiveUI;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -258,4 +258,4 @@ namespace v2rayN.Views
|
|||
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,6 @@
|
|||
using MaterialDesignThemes.Wpf;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
|
@ -5,9 +8,6 @@ using System.Windows.Controls.Primitives;
|
|||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using v2rayN.Base;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
|
|
@ -99,8 +99,7 @@ namespace v2rayN.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
WindowsUtils.SetClipboardData((string)obj);
|
||||
break;
|
||||
|
||||
|
|
@ -123,8 +122,7 @@ namespace v2rayN.Views
|
|||
break;
|
||||
|
||||
case EViewAction.SaveFileDialog:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
if (UI.SaveFileDialog(out string fileName, "Config|*.json") != true)
|
||||
{
|
||||
return false;
|
||||
|
|
@ -133,29 +131,24 @@ namespace v2rayN.Views
|
|||
break;
|
||||
|
||||
case EViewAction.AddServerWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new AddServerWindow((ProfileItem)obj)).ShowDialog() ?? false;
|
||||
|
||||
case EViewAction.AddServer2Window:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new AddServer2Window((ProfileItem)obj)).ShowDialog() ?? false;
|
||||
|
||||
case EViewAction.ShareServer:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
ShareServer((string)obj);
|
||||
break;
|
||||
|
||||
case EViewAction.SubEditWindow:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new SubEditWindow((SubItem)obj)).ShowDialog() ?? false;
|
||||
|
||||
case EViewAction.DispatcherSpeedTest:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.SetSpeedTestResult((SpeedTestResult)obj);
|
||||
|
|
@ -410,16 +403,13 @@ namespace v2rayN.Views
|
|||
Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
|
||||
{
|
||||
// Get the dragged Item
|
||||
if (sender is not DataGrid listView)
|
||||
return;
|
||||
if (sender is not DataGrid listView) return;
|
||||
var listViewItem = FindAncestor<DataGridRow>((DependencyObject)e.OriginalSource);
|
||||
if (listViewItem == null)
|
||||
return; // Abort
|
||||
// Find the data behind the ListViewItem
|
||||
if (listViewItem == null) return; // Abort
|
||||
// Find the data behind the ListViewItem
|
||||
ProfileItemModel item = (ProfileItemModel)listView.ItemContainerGenerator.ItemFromContainer(listViewItem);
|
||||
if (item == null)
|
||||
return; // Abort
|
||||
// Initialize the drag & drop operation
|
||||
if (item == null) return; // Abort
|
||||
// Initialize the drag & drop operation
|
||||
startIndex = lstProfiles.SelectedIndex;
|
||||
DataObject dragData = new(formatData, item);
|
||||
DragDrop.DoDragDrop(listViewItem, dragData, DragDropEffects.Copy | DragDropEffects.Move);
|
||||
|
|
@ -439,8 +429,7 @@ namespace v2rayN.Views
|
|||
if (e.Data.GetDataPresent(formatData) && sender == e.Source)
|
||||
{
|
||||
// Get the drop Item destination
|
||||
if (sender is not DataGrid listView)
|
||||
return;
|
||||
if (sender is not DataGrid listView) return;
|
||||
var listViewItem = FindAncestor<DataGridRow>((DependencyObject)e.OriginalSource);
|
||||
if (listViewItem == null)
|
||||
{
|
||||
|
|
@ -450,8 +439,7 @@ namespace v2rayN.Views
|
|||
}
|
||||
// Find the data behind the Item
|
||||
ProfileItemModel item = (ProfileItemModel)listView.ItemContainerGenerator.ItemFromContainer(listViewItem);
|
||||
if (item == null)
|
||||
return;
|
||||
if (item == null) return;
|
||||
// Move item into observable collection
|
||||
// (this will be automatically reflected to lstView.ItemsSource)
|
||||
e.Effects = DragDropEffects.Move;
|
||||
|
|
@ -464,4 +452,4 @@ namespace v2rayN.Views
|
|||
|
||||
#endregion Drag and Drop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.RoutingRuleDetailsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
Title="{x:Static resx:ResUI.menuRoutingRuleDetailsSetting}"
|
||||
|
|
@ -242,4 +242,4 @@
|
|||
</GroupBox>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</reactiveui:ReactiveWindow>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -92,4 +92,4 @@ namespace v2rayN.Views
|
|||
ProcUtils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.RoutingRuleSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
Title="{x:Static resx:ResUI.menuRoutingRuleSetting}"
|
||||
|
|
@ -334,4 +334,4 @@
|
|||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</reactiveui:ReactiveWindow>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -89,8 +89,7 @@ namespace v2rayN.Views
|
|||
|
||||
case EViewAction.RoutingRuleDetailsWindow:
|
||||
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new RoutingRuleDetailsWindow((RulesItem)obj)).ShowDialog() ?? false;
|
||||
|
||||
case EViewAction.ImportRulesFromFile:
|
||||
|
|
@ -103,8 +102,7 @@ namespace v2rayN.Views
|
|||
break;
|
||||
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
WindowsUtils.SetClipboardData((string)obj);
|
||||
break;
|
||||
|
||||
|
|
@ -202,4 +200,4 @@ namespace v2rayN.Views
|
|||
ProcUtils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
@ -72,8 +72,7 @@ namespace v2rayN.Views
|
|||
|
||||
case EViewAction.RoutingRuleSettingWindow:
|
||||
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
return (new RoutingRuleSettingWindow((RoutingItem)obj)).ShowDialog() ?? false;
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
|
|
@ -143,4 +142,4 @@ namespace v2rayN.Views
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using v2rayN.Handler;
|
||||
|
||||
namespace v2rayN.Views
|
||||
|
|
@ -77,8 +77,7 @@ namespace v2rayN.Views
|
|||
switch (action)
|
||||
{
|
||||
case EViewAction.DispatcherServerAvailability:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
Application.Current?.Dispatcher.Invoke((() =>
|
||||
{
|
||||
ViewModel?.TestServerAvailabilityResult((string)obj);
|
||||
|
|
@ -99,10 +98,8 @@ namespace v2rayN.Views
|
|||
Application.Current.MainWindow.Icon = WindowsHandler.Instance.GetAppIcon(_config);
|
||||
}), DispatcherPriority.Normal);
|
||||
break;
|
||||
|
||||
case EViewAction.SetClipboardData:
|
||||
if (obj is null)
|
||||
return false;
|
||||
if (obj is null) return false;
|
||||
WindowsUtils.SetClipboardData((string)obj);
|
||||
break;
|
||||
}
|
||||
|
|
@ -113,8 +110,7 @@ namespace v2rayN.Views
|
|||
{
|
||||
tbNotify.Dispose();
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
if (service != null)
|
||||
await service.MyAppExitAsync(false);
|
||||
if (service != null) await service.MyAppExitAsync(false);
|
||||
}
|
||||
|
||||
private void txtRunningInfoDisplay_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||
|
|
@ -122,4 +118,4 @@ namespace v2rayN.Views
|
|||
ViewModel?.TestServerAvailability();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue