Merge branch 'master' into master

This commit is contained in:
2dust 2024-10-14 17:50:36 +08:00 committed by GitHub
commit e15a55dbbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
56 changed files with 841 additions and 958 deletions

View file

@ -36,7 +36,7 @@ namespace ServiceLib.Common
}
};
using var downloader = new Downloader.DownloadService(downloadOpt);
await using var downloader = new Downloader.DownloadService(downloadOpt);
downloader.DownloadFileCompleted += (sender, value) =>
{
if (value.Error != null)
@ -46,12 +46,12 @@ namespace ServiceLib.Common
};
using var cts = new CancellationTokenSource();
using var stream = await downloader.DownloadFileTaskAsync(address: url, cts.Token).WaitAsync(TimeSpan.FromSeconds(timeout), cts.Token);
await using var stream = await downloader.DownloadFileTaskAsync(address: url, cts.Token).WaitAsync(TimeSpan.FromSeconds(timeout), cts.Token);
using StreamReader reader = new(stream);
downloadOpt = null;
return reader.ReadToEnd();
return await reader.ReadToEndAsync(cts.Token);
}
public async Task DownloadDataAsync4Speed(IWebProxy webProxy, string url, IProgress<string> progress, int timeout)
@ -72,11 +72,11 @@ namespace ServiceLib.Common
}
};
DateTime totalDatetime = DateTime.Now;
int totalSecond = 0;
var totalDatetime = DateTime.Now;
var totalSecond = 0;
var hasValue = false;
double maxSpeed = 0;
using var downloader = new Downloader.DownloadService(downloadOpt);
await using var downloader = new Downloader.DownloadService(downloadOpt);
//downloader.DownloadStarted += (sender, value) =>
//{
// if (progress != null)
@ -86,7 +86,7 @@ namespace ServiceLib.Common
//};
downloader.DownloadProgressChanged += (sender, value) =>
{
TimeSpan ts = (DateTime.Now - totalDatetime);
var ts = (DateTime.Now - totalDatetime);
if (progress != null && ts.Seconds > totalSecond)
{
hasValue = true;
@ -112,7 +112,7 @@ namespace ServiceLib.Common
//progress.Report("......");
using var cts = new CancellationTokenSource();
cts.CancelAfter(timeout * 1000);
using var stream = await downloader.DownloadFileTaskAsync(address: url, cts.Token);
await using var stream = await downloader.DownloadFileTaskAsync(address: url, cts.Token);
downloadOpt = null;
}
@ -145,7 +145,7 @@ namespace ServiceLib.Common
var progressPercentage = 0;
var hasValue = false;
using var downloader = new Downloader.DownloadService(downloadOpt);
await using var downloader = new Downloader.DownloadService(downloadOpt);
downloader.DownloadStarted += (sender, value) =>
{
progress?.Report(0);

View file

@ -23,7 +23,7 @@ namespace ServiceLib.Common
{
try
{
using FileStream fs = File.Create(fileName);
using var fs = File.Create(fileName);
using GZipStream input = new(new MemoryStream(content), CompressionMode.Decompress, false);
input.CopyTo(fs);
}
@ -38,8 +38,8 @@ namespace ServiceLib.Common
try
{
FileInfo fileInfo = new(fileName);
using FileStream originalFileStream = fileInfo.OpenRead();
using FileStream decompressedFileStream = File.Create(toName != null ? Path.Combine(toPath, toName) : toPath);
using var originalFileStream = fileInfo.OpenRead();
using var decompressedFileStream = File.Create(toName != null ? Path.Combine(toPath, toName) : toPath);
using GZipStream decompressionStream = new(originalFileStream, CompressionMode.Decompress);
decompressionStream.CopyTo(decompressedFileStream);
}
@ -54,7 +54,7 @@ namespace ServiceLib.Common
return NonExclusiveReadAllText(path, Encoding.Default);
}
public static string NonExclusiveReadAllText(string path, Encoding encoding)
private static string NonExclusiveReadAllText(string path, Encoding encoding)
{
try
{
@ -73,8 +73,8 @@ namespace ServiceLib.Common
{
try
{
using ZipArchive archive = ZipFile.OpenRead(fileName);
foreach (ZipArchiveEntry entry in archive.Entries)
using var archive = ZipFile.OpenRead(fileName);
foreach (var entry in archive.Entries)
{
if (entry.Length == 0)
{
@ -110,7 +110,7 @@ namespace ServiceLib.Common
}
try
{
using ZipArchive archive = ZipFile.OpenRead(fileName);
using var archive = ZipFile.OpenRead(fileName);
return archive.Entries.Select(entry => entry.FullName).ToList();
}
catch (Exception ex)
@ -149,13 +149,13 @@ namespace ServiceLib.Common
throw new DirectoryNotFoundException($"Source directory not found: {dir.FullName}");
// Cache directories before we start copying
DirectoryInfo[] dirs = dir.GetDirectories();
var dirs = dir.GetDirectories();
// Create the destination directory
Directory.CreateDirectory(destinationDir);
// Get the files in the source directory and copy to the destination directory
foreach (FileInfo file in dir.GetFiles())
foreach (var file in dir.GetFiles())
{
if (Utils.IsNotEmpty(ignoredName) && file.Name.Contains(ignoredName))
{
@ -165,16 +165,16 @@ namespace ServiceLib.Common
{
continue;
}
string targetFilePath = Path.Combine(destinationDir, file.Name);
var targetFilePath = Path.Combine(destinationDir, file.Name);
file.CopyTo(targetFilePath);
}
// If recursive and copying subdirectories, recursively call this method
if (recursive)
{
foreach (DirectoryInfo subDir in dirs)
foreach (var subDir in dirs)
{
string newDestinationDir = Path.Combine(destinationDir, subDir.Name);
var newDestinationDir = Path.Combine(destinationDir, subDir.Name);
CopyDirectory(subDir.FullName, newDestinationDir, true, ignoredName);
}
}

View file

@ -27,7 +27,7 @@ namespace ServiceLib.Common
try
{
HttpResponseMessage response = await httpClient.GetAsync(url);
var response = await httpClient.GetAsync(url);
return await response.Content.ReadAsStringAsync();
}
catch
@ -84,8 +84,8 @@ namespace ServiceLib.Common
var total = response.Content.Headers.ContentLength ?? -1L;
var canReportProgress = total != -1 && progress != null;
using var stream = await response.Content.ReadAsStreamAsync(token);
using var file = File.Create(fileName);
await using var stream = await response.Content.ReadAsStreamAsync(token);
await using var file = File.Create(fileName);
var totalRead = 0L;
var buffer = new byte[1024 * 1024];
var progressPercentage = 0;
@ -98,7 +98,7 @@ namespace ServiceLib.Common
totalRead += read;
if (read == 0) break;
file.Write(buffer, 0, read);
await file.WriteAsync(buffer, 0, read, token);
if (canReportProgress)
{
@ -133,13 +133,13 @@ namespace ServiceLib.Common
//var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L;
//var canReportProgress = total != -1 && progress != null;
using var stream = await response.Content.ReadAsStreamAsync(token);
await using var stream = await response.Content.ReadAsStreamAsync(token);
var totalRead = 0L;
var buffer = new byte[1024 * 64];
var isMoreToRead = true;
string progressSpeed = string.Empty;
DateTime totalDatetime = DateTime.Now;
int totalSecond = 0;
var progressSpeed = string.Empty;
var totalDatetime = DateTime.Now;
var totalSecond = 0;
do
{
@ -168,7 +168,7 @@ namespace ServiceLib.Common
totalRead += read;
TimeSpan ts = (DateTime.Now - totalDatetime);
var ts = (DateTime.Now - totalDatetime);
if (progress != null && ts.Seconds > totalSecond)
{
totalSecond = ts.Seconds;

View file

@ -8,7 +8,7 @@ namespace ServiceLib.Common
* http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net
*/
public class Job : IDisposable
public sealed class Job : IDisposable
{
private IntPtr handle = IntPtr.Zero;
@ -73,7 +73,7 @@ namespace ServiceLib.Common
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
private void Dispose(bool disposing)
{
if (disposed) return;
disposed = true;

View file

@ -69,7 +69,7 @@ namespace ServiceLib.Common
/// <returns></returns>
public static string Serialize(object? obj, bool indented = true)
{
string result = string.Empty;
var result = string.Empty;
try
{
if (obj == null)
@ -112,7 +112,7 @@ namespace ServiceLib.Common
}
try
{
using FileStream file = File.Create(filePath);
using var file = File.Create(filePath);
var options = new JsonSerializerOptions
{

View file

@ -7,7 +7,7 @@ namespace ServiceLib.Common
public static byte[]? GenQRCode(string? url)
{
using QRCodeGenerator qrGenerator = new();
using QRCodeData qrCodeData = qrGenerator.CreateQrCode(url ?? string.Empty, QRCodeGenerator.ECCLevel.Q);
using var qrCodeData = qrGenerator.CreateQrCode(url ?? string.Empty, QRCodeGenerator.ECCLevel.Q);
using PngByteQRCode qrCode = new(qrCodeData);
return qrCode.GetGraphic(20);
}

View file

@ -17,7 +17,7 @@ namespace ServiceLib.Common
private static IOrderedQueryable<T> _OrderBy<T>(IQueryable<T> query, string propertyName, bool isDesc)
{
string methodname = (isDesc) ? "OrderByDescendingInternal" : "OrderByInternal";
var methodname = (isDesc) ? "OrderByDescendingInternal" : "OrderByInternal";
var memberProp = typeof(T).GetProperty(propertyName);

View file

@ -28,14 +28,14 @@
}
this.version = version.RemovePrefix('v');
string[] parts = this.version.Split('.');
var parts = this.version.Split('.');
if (parts.Length == 2)
{
this.major = int.Parse(parts[0]);
this.minor = int.Parse(parts[1]);
this.patch = 0;
}
else if (parts.Length == 3 || parts.Length == 4)
else if (parts.Length is 3 or 4)
{
this.major = int.Parse(parts[0]);
this.minor = int.Parse(parts[1]);

View file

@ -11,7 +11,7 @@ namespace ServiceLib.Common
private SQLiteConnection _db;
private SQLiteAsyncConnection _dbAsync;
private static readonly object objLock = new();
public readonly string _configDB = "guiNDB.db";
private readonly string _configDB = "guiNDB.db";
public SQLiteHelper()
{

View file

@ -25,21 +25,14 @@ namespace ServiceLib.Common
return chars.Contains(s[0]);
}
public static bool IsWhiteSpace(this string value)
private static bool IsWhiteSpace(this string value)
{
foreach (char c in value)
{
if (char.IsWhiteSpace(c)) continue;
return false;
}
return true;
return value.All(char.IsWhiteSpace);
}
public static IEnumerable<string> NonWhiteSpaceLines(this TextReader reader)
{
string? line;
while ((line = reader.ReadLine()) != null)
while (reader.ReadLine() is { } line)
{
if (line.IsWhiteSpace()) continue;
yield return line;
@ -53,26 +46,12 @@ namespace ServiceLib.Common
public static string RemovePrefix(this string value, char prefix)
{
if (value.StartsWith(prefix))
{
return value.Substring(1);
}
else
{
return value;
}
return value.StartsWith(prefix) ? value[1..] : value;
}
public static string RemovePrefix(this string value, string prefix)
{
if (value.StartsWith(prefix))
{
return value.Substring(prefix.Length);
}
else
{
return value;
}
return value.StartsWith(prefix) ? value[prefix.Length..] : value;
}
public static string UpperFirstChar(this string value)
@ -82,17 +61,12 @@ namespace ServiceLib.Common
return string.Empty;
}
return char.ToUpper(value[0]) + value.Substring(1);
return char.ToUpper(value[0]) + value[1..];
}
public static string AppendQuotes(this string value)
{
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}
return $"\"{value}\"";
return string.IsNullOrEmpty(value) ? string.Empty : $"\"{value}\"";
}
}
}

View file

@ -2,7 +2,6 @@
using CliWrap.Buffered;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO.Compression;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
@ -11,13 +10,12 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Security.Principal;
using System.Text;
using System.Text.RegularExpressions;
namespace ServiceLib.Common
{
public class Utils
{
#region Json操
#region
/// <summary>
/// 获取嵌入文本资源
@ -26,12 +24,12 @@ namespace ServiceLib.Common
/// <returns></returns>
public static string GetEmbedText(string res)
{
string result = string.Empty;
var result = string.Empty;
try
{
Assembly assembly = Assembly.GetExecutingAssembly();
using Stream? stream = assembly.GetManifestResourceStream(res);
var assembly = Assembly.GetExecutingAssembly();
using var stream = assembly.GetManifestResourceStream(res);
ArgumentNullException.ThrowIfNull(stream);
using StreamReader reader = new(stream);
result = reader.ReadToEnd();
@ -51,12 +49,11 @@ namespace ServiceLib.Common
{
try
{
if (!File.Exists(res))
if (File.Exists(res))
{
return null;
}
return File.ReadAllText(res);
}
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
@ -64,14 +61,15 @@ namespace ServiceLib.Common
return null;
}
#endregion Json操
#endregion
#region
/// <summary>
/// List<string>转逗号分隔的字符串
/// 转逗号分隔的字符串
/// </summary>
/// <param name="lst"></param>
/// <param name="wrap"></param>
/// <returns></returns>
public static string List2String(List<string>? lst, bool wrap = false)
{
@ -93,35 +91,40 @@ namespace ServiceLib.Common
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
return string.Empty;
}
return string.Empty;
}
/// <summary>
/// 逗号分隔的字符串,转List<string>
/// 逗号分隔的字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static List<string> String2List(string str)
public static List<string>? String2List(string? str)
{
try
{
if (str == null)
{
return null;
}
str = str.Replace(Environment.NewLine, "");
return new List<string>(str.Split(',', StringSplitOptions.RemoveEmptyEntries));
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
return [];
}
return null;
}
/// <summary>
/// 逗号分隔的字符串,先排序后转List<string>
/// 逗号分隔的字符串,先排序后转List
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static List<string> String2ListSorted(string str)
public static List<string>? String2ListSorted(string str)
{
try
{
@ -133,8 +136,8 @@ namespace ServiceLib.Common
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
return [];
}
return null;
}
/// <summary>
@ -146,14 +149,14 @@ namespace ServiceLib.Common
{
try
{
byte[] plainTextBytes = Encoding.UTF8.GetBytes(plainText);
var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
return Convert.ToBase64String(plainTextBytes);
}
catch (Exception ex)
{
Logging.SaveLog("Base64Encode", ex);
return string.Empty;
}
return string.Empty;
}
/// <summary>
@ -179,30 +182,24 @@ namespace ServiceLib.Common
plainText = plainText.PadRight(plainText.Length + 4 - plainText.Length % 4, '=');
}
byte[] data = Convert.FromBase64String(plainText);
var data = Convert.FromBase64String(plainText);
return Encoding.UTF8.GetString(data);
}
catch (Exception ex)
{
Logging.SaveLog("Base64Decode", ex);
}
return string.Empty;
}
}
/// <summary>
/// 转Int
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static int ToInt(object? obj)
{
try
{
return Convert.ToInt32(obj ?? string.Empty);
}
catch //(Exception ex)
catch
{
//SaveLog(ex.Message, ex);
return 0;
}
}
@ -213,50 +210,47 @@ namespace ServiceLib.Common
{
return Convert.ToBoolean(obj);
}
catch //(Exception ex)
catch
{
//SaveLog(ex.Message, ex);
return false;
}
}
public static string ToString(object obj)
public static string ToString(object? obj)
{
try
{
return obj?.ToString() ?? string.Empty;
}
catch// (Exception ex)
catch
{
//SaveLog(ex.Message, ex);
return string.Empty;
}
}
/// <summary>
/// byte 转成 有两位小数点的 方便阅读的数据
/// 比如 2.50 MB
/// byte 转成 有两位小数点的 方便阅读的数据 比如 2.50 MB
/// </summary>
/// <param name="amount">bytes</param>
/// <param name="result">转换之后的数据</param>
/// <param name="unit">单位</param>
public static void ToHumanReadable(long amount, out double result, out string unit)
private static void ToHumanReadable(long amount, out double result, out string unit)
{
uint factor = 1024u;
var factor = 1024u;
//long KBs = amount / factor;
long KBs = amount;
var KBs = amount;
if (KBs > 0)
{
// multi KB
long MBs = KBs / factor;
var MBs = KBs / factor;
if (MBs > 0)
{
// multi MB
long GBs = MBs / factor;
var GBs = MBs / factor;
if (GBs > 0)
{
// multi GB
long TBs = GBs / factor;
var TBs = GBs / factor;
if (TBs > 0)
{
result = TBs + ((GBs % factor) / (factor + 0.0));
@ -284,20 +278,18 @@ namespace ServiceLib.Common
public static string HumanFy(long amount)
{
ToHumanReadable(amount, out double result, out string unit);
return $"{string.Format("{0:f1}", result)} {unit}";
ToHumanReadable(amount, out var result, out var unit);
return $"{result:f1} {unit}";
}
public static string UrlEncode(string url)
{
return Uri.EscapeDataString(url);
//return HttpUtility.UrlEncode(url);
}
public static string UrlDecode(string url)
{
return Uri.UnescapeDataString(url);
//return HttpUtility.UrlDecode(url);
}
public static NameValueCollection ParseQueryString(string query)
@ -308,10 +300,10 @@ namespace ServiceLib.Common
return result;
}
var parts = query[1..].Split(new[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
var parts = query[1..].Split('&', StringSplitOptions.RemoveEmptyEntries);
foreach (var part in parts)
{
var keyValue = part.Split(['=']);
var keyValue = part.Split('=');
if (keyValue.Length != 2)
{
continue;
@ -328,12 +320,12 @@ namespace ServiceLib.Common
return result;
}
public static string GetMD5(string str)
public static string GetMd5(string str)
{
byte[] byteOld = Encoding.UTF8.GetBytes(str);
byte[] byteNew = MD5.HashData(byteOld);
var byteOld = Encoding.UTF8.GetBytes(str);
var byteNew = MD5.HashData(byteOld);
StringBuilder sb = new(32);
foreach (byte b in byteNew)
foreach (var b in byteNew)
{
sb.Append(b.ToString("x2"));
}
@ -373,12 +365,12 @@ namespace ServiceLib.Common
{
if (plainText.IsNullOrEmpty()) return false;
var buffer = new Span<byte>(new byte[plainText.Length]);
return Convert.TryFromBase64String(plainText, buffer, out int _);
return Convert.TryFromBase64String(plainText, buffer, out var _);
}
public static string Convert2Comma(string text)
{
if (Utils.IsNullOrEmpty(text))
if (IsNullOrEmpty(text))
{
return text;
}
@ -396,16 +388,7 @@ namespace ServiceLib.Common
/// <returns></returns>
public static bool IsNumeric(string oText)
{
try
{
int var1 = ToInt(oText);
return true;
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
return false;
}
return oText.All(char.IsNumber);
}
public static bool IsNullOrEmpty(string? text)
@ -414,11 +397,7 @@ namespace ServiceLib.Common
{
return true;
}
if (text == "null")
{
return true;
}
return false;
return text == "null";
}
public static bool IsNotEmpty(string? text)
@ -426,41 +405,6 @@ namespace ServiceLib.Common
return !string.IsNullOrEmpty(text);
}
/// <summary>
/// 验证IP地址是否合法
/// </summary>
/// <param name="ip"></param>
public static bool IsIP(string ip)
{
//如果为空
if (IsNullOrEmpty(ip))
{
return false;
}
//清除要验证字符串中的空格
//ip = ip.TrimEx();
//可能是CIDR
if (ip.IndexOf(@"/") > 0)
{
string[] cidr = ip.Split('/');
if (cidr.Length == 2)
{
if (!IsNumeric(cidr[0]))
{
return false;
}
ip = cidr[0];
}
}
//模式字符串
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
//验证
return IsMatch(ip, pattern);
}
/// <summary>
/// 验证Domain地址是否合法
/// </summary>
@ -476,19 +420,9 @@ namespace ServiceLib.Common
return Uri.CheckHostName(domain) == UriHostNameType.Dns;
}
/// <summary>
/// 验证输入字符串是否与模式字符串匹配匹配返回true
/// </summary>
/// <param name="input">输入字符串</param>
/// <param name="pattern">模式字符串</param>
public static bool IsMatch(string input, string pattern)
{
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
}
public static bool IsIpv6(string ip)
{
if (IPAddress.TryParse(ip, out IPAddress? address))
if (IPAddress.TryParse(ip, out var address))
{
return address.AddressFamily switch
{
@ -504,43 +438,20 @@ namespace ServiceLib.Common
#region
public static void SetSecurityProtocol(bool enableSecurityProtocolTls13)
private static bool PortInUse(int port)
{
if (enableSecurityProtocolTls13)
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
}
else
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
}
ServicePointManager.DefaultConnectionLimit = 256;
}
public static bool PortInUse(int port)
{
bool inUse = false;
try
{
IPGlobalProperties ipProperties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] ipEndPoints = ipProperties.GetActiveTcpListeners();
var lstIpEndPoints = new List<IPEndPoint>(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
foreach (IPEndPoint endPoint in ipEndPoints)
{
if (endPoint.Port == port)
{
inUse = true;
break;
}
}
var ipProperties = IPGlobalProperties.GetIPGlobalProperties();
var ipEndPoints = ipProperties.GetActiveTcpListeners();
//var lstIpEndPoints = new List<IPEndPoint>(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
return ipEndPoints.Any(endPoint => endPoint.Port == port);
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
}
return inUse;
return false;
}
public static int GetFreePort(int defaultPort = 9090)
@ -554,7 +465,7 @@ namespace ServiceLib.Common
TcpListener l = new(IPAddress.Loopback, 0);
l.Start();
int port = ((IPEndPoint)l.LocalEndpoint).Port;
var port = ((IPEndPoint)l.LocalEndpoint).Port;
l.Stop();
return port;
}
@ -578,23 +489,18 @@ namespace ServiceLib.Common
{
if (blFull)
{
return string.Format("{0} - V{1} - {2}",
Global.AppName,
GetVersionInfo(),
File.GetLastWriteTime(GetExePath()).ToString("yyyy/MM/dd"));
return $"{Global.AppName} - V{GetVersionInfo()} - {File.GetLastWriteTime(GetExePath()):yyyy/MM/dd}";
}
else
{
return string.Format("{0}/{1}",
Global.AppName,
GetVersionInfo());
return $"{Global.AppName}/{GetVersionInfo()}";
}
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
return Global.AppName;
}
return Global.AppName;
}
public static string GetVersionInfo()
@ -614,7 +520,7 @@ namespace ServiceLib.Common
/// 取得GUID
/// </summary>
/// <returns></returns>
public static string GetGUID(bool full = true)
public static string GetGuid(bool full = true)
{
try
{
@ -634,14 +540,6 @@ namespace ServiceLib.Common
return string.Empty;
}
public static string GetDownloadFileName(string url)
{
var fileName = Path.GetFileName(url);
fileName += "_temp";
return fileName;
}
public static bool IsGuidByParse(string strSrc)
{
return Guid.TryParse(strSrc, out _);
@ -667,12 +565,12 @@ namespace ServiceLib.Common
public static Dictionary<string, string> GetSystemHosts()
{
var systemHosts = new Dictionary<string, string>();
var hostfile = @"C:\Windows\System32\drivers\etc\hosts";
var hostFile = @"C:\Windows\System32\drivers\etc\hosts";
try
{
if (File.Exists(hostfile))
if (File.Exists(hostFile))
{
var hosts = File.ReadAllText(hostfile).Replace("\r", "");
var hosts = File.ReadAllText(hostFile).Replace("\r", "");
var hostsList = hosts.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var host in hostsList)
@ -693,10 +591,10 @@ namespace ServiceLib.Common
public static async Task<string?> GetCliWrapOutput(string filePath, string? arg)
{
return await GetCliWrapOutput(filePath, arg != null ? [arg] : null);
return await GetCliWrapOutput(filePath, arg != null ? new List<string>() { arg } : null);
}
public static async Task<string?> GetCliWrapOutput(string filePath, IEnumerable<string>? args)
private static async Task<string?> GetCliWrapOutput(string filePath, IEnumerable<string>? args)
{
try
{
@ -736,7 +634,7 @@ namespace ServiceLib.Common
/// <returns></returns>
public static string GetPath(string fileName)
{
string startupPath = StartupPath();
var startupPath = StartupPath();
if (IsNullOrEmpty(fileName))
{
return startupPath;
@ -760,113 +658,104 @@ namespace ServiceLib.Common
public static string GetTempPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiTemps");
if (!Directory.Exists(_tempPath))
var tempPath = Path.Combine(StartupPath(), "guiTemps");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
if (IsNullOrEmpty(filename))
{
return _tempPath;
return tempPath;
}
else
{
return Path.Combine(_tempPath, filename);
return Path.Combine(tempPath, filename);
}
}
public static string UnGzip(byte[] buf)
{
using MemoryStream sb = new();
using GZipStream input = new(new MemoryStream(buf), CompressionMode.Decompress, false);
input.CopyTo(sb);
sb.Position = 0;
return new StreamReader(sb, Encoding.UTF8).ReadToEnd();
}
public static string GetBackupPath(string filename)
{
string _tempPath = Path.Combine(StartupPath(), "guiBackups");
if (!Directory.Exists(_tempPath))
var tempPath = Path.Combine(StartupPath(), "guiBackups");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
return Path.Combine(_tempPath, filename);
return Path.Combine(tempPath, filename);
}
public static string GetConfigPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiConfigs");
if (!Directory.Exists(_tempPath))
var tempPath = Path.Combine(StartupPath(), "guiConfigs");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
{
return _tempPath;
return tempPath;
}
else
{
return Path.Combine(_tempPath, filename);
return Path.Combine(tempPath, filename);
}
}
public static string GetBinPath(string filename, string? coreType = null)
{
string _tempPath = Path.Combine(StartupPath(), "bin");
if (!Directory.Exists(_tempPath))
var tempPath = Path.Combine(StartupPath(), "bin");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
if (coreType != null)
{
_tempPath = Path.Combine(_tempPath, coreType.ToString());
if (!Directory.Exists(_tempPath))
tempPath = Path.Combine(tempPath, coreType.ToString());
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
}
if (Utils.IsNullOrEmpty(filename))
if (IsNullOrEmpty(filename))
{
return _tempPath;
return tempPath;
}
else
{
return Path.Combine(_tempPath, filename);
return Path.Combine(tempPath, filename);
}
}
public static string GetLogPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiLogs");
if (!Directory.Exists(_tempPath))
var tempPath = Path.Combine(StartupPath(), "guiLogs");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
{
return _tempPath;
return tempPath;
}
else
{
return Path.Combine(_tempPath, filename);
return Path.Combine(tempPath, filename);
}
}
public static string GetFontsPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiFonts");
if (!Directory.Exists(_tempPath))
var tempPath = Path.Combine(StartupPath(), "guiFonts");
if (!Directory.Exists(tempPath))
{
Directory.CreateDirectory(_tempPath);
Directory.CreateDirectory(tempPath);
}
if (Utils.IsNullOrEmpty(filename))
{
return _tempPath;
return tempPath;
}
else
{
return Path.Combine(_tempPath, filename);
return Path.Combine(tempPath, filename);
}
}
@ -882,14 +771,7 @@ namespace ServiceLib.Common
public static string GetExeName(string name)
{
if (IsWindows())
{
return $"{name}.exe";
}
else
{
return name;
}
return IsWindows() ? $"{name}.exe" : name;
}
public static bool IsAdministrator()
@ -901,7 +783,7 @@ namespace ServiceLib.Common
else
{
var id = GetLinuxUserId().Result ?? "1000";
if (int.TryParse(id, out int userId))
if (int.TryParse(id, out var userId))
{
return userId == 0;
}
@ -914,7 +796,8 @@ namespace ServiceLib.Common
private static async Task<string?> GetLinuxUserId()
{
return await GetCliWrapOutput("/bin/bash", ["-c", "id -u"]);
var arg = new List<string>() { "-c", "id -u" };
return await GetCliWrapOutput("/bin/bash", arg);
}
#endregion Platform

View file

@ -21,7 +21,7 @@ namespace ServiceLib.Common
.Build();
try
{
T obj = deserializer.Deserialize<T>(str);
var obj = deserializer.Deserialize<T>(str);
return obj;
}
catch (Exception ex)
@ -36,9 +36,9 @@ namespace ServiceLib.Common
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public static string ToYaml(Object? obj)
public static string ToYaml(object? obj)
{
string result = string.Empty;
var result = string.Empty;
if (obj == null)
{
return result;

View file

@ -2,11 +2,14 @@
{
public sealed class AppHandler
{
#region Property
private static readonly Lazy<AppHandler> _instance = new(() => new());
private Config _config;
private int? _statePort;
private int? _statePort2;
private Job? _processJob;
private bool? _isAdministrator;
public static AppHandler Instance => _instance.Value;
public Config Config => _config;
@ -28,6 +31,17 @@
}
}
public bool IsAdministrator
{
get
{
_isAdministrator ??= Utils.IsAdministrator();
return _isAdministrator.Value;
}
}
#endregion Property
#region Init
public AppHandler()

View file

@ -1,6 +1,5 @@
using System.Data;
using System.Text.RegularExpressions;
using System.Web;
namespace ServiceLib.Handler
{
@ -494,7 +493,7 @@ namespace ServiceLib.Handler
return -1;
}
var ext = Path.GetExtension(fileName);
string newFileName = $"{Utils.GetGUID()}{ext}";
string newFileName = $"{Utils.GetGuid()}{ext}";
//newFileName = Path.Combine(Utile.GetTempPath(), newFileName);
try
@ -934,7 +933,7 @@ namespace ServiceLib.Handler
var maxSort = -1;
if (Utils.IsNullOrEmpty(profileItem.indexId))
{
profileItem.indexId = Utils.GetGUID(false);
profileItem.indexId = Utils.GetGuid(false);
maxSort = ProfileExHandler.Instance.GetMaxSort();
}
if (!toFile && maxSort < 0)
@ -1002,7 +1001,7 @@ namespace ServiceLib.Handler
public static int AddCustomServer4Multiple(Config config, List<ProfileItem> selecteds, ECoreType coreType, out string indexId)
{
indexId = Utils.GetMD5(Global.CoreMultipleLoadConfigFileName);
indexId = Utils.GetMd5(Global.CoreMultipleLoadConfigFileName);
string configPath = Utils.GetConfigPath(Global.CoreMultipleLoadConfigFileName);
if (CoreConfigHandler.GenerateClientMultipleLoadConfig(config, configPath, selecteds, coreType, out string msg) != 0)
{
@ -1341,7 +1340,7 @@ namespace ServiceLib.Handler
try
{
var uri = new Uri(url);
var queryVars = HttpUtility.ParseQueryString(uri.Query);
var queryVars = Utils.ParseQueryString(uri.Query);
subItem.remarks = queryVars["remarks"] ?? "import_sub";
}
catch (UriFormatException)
@ -1378,7 +1377,7 @@ namespace ServiceLib.Handler
if (Utils.IsNullOrEmpty(item.id))
{
item.id = Utils.GetGUID(false);
item.id = Utils.GetGuid(false);
if (item.sort <= 0)
{
@ -1461,7 +1460,7 @@ namespace ServiceLib.Handler
{
if (Utils.IsNullOrEmpty(item.id))
{
item.id = Utils.GetGUID(false);
item.id = Utils.GetGuid(false);
}
if (SQLiteHelper.Instance.Replace(item) > 0)
@ -1495,14 +1494,14 @@ namespace ServiceLib.Handler
foreach (var item in lstRules)
{
item.id = Utils.GetGUID(false);
item.id = Utils.GetGuid(false);
}
routingItem.ruleNum = lstRules.Count;
routingItem.ruleSet = JsonUtils.Serialize(lstRules, false);
if (Utils.IsNullOrEmpty(routingItem.id))
{
routingItem.id = Utils.GetGUID(false);
routingItem.id = Utils.GetGuid(false);
}
if (SQLiteHelper.Instance.Replace(routingItem) > 0)
@ -1711,7 +1710,7 @@ namespace ServiceLib.Handler
{
if (Utils.IsNullOrEmpty(item.id))
{
item.id = Utils.GetGUID(false);
item.id = Utils.GetGuid(false);
}
if (SQLiteHelper.Instance.Replace(item) > 0)

View file

@ -197,7 +197,7 @@ namespace ServiceLib.Handler.Fmt
protected static string WriteAllText(string strData, string ext = "json")
{
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.{ext}");
var fileName = Utils.GetTempPath($"{Utils.GetGuid(false)}.{ext}");
File.WriteAllText(fileName, strData);
return fileName;
}

View file

@ -70,12 +70,12 @@
item.network = Global.DefaultNetwork;
item.headerType = Global.None;
item.configVersion = Utils.ToInt(vmessQRCode.v);
item.configVersion = vmessQRCode.v;
item.remarks = Utils.ToString(vmessQRCode.ps);
item.address = Utils.ToString(vmessQRCode.add);
item.port = Utils.ToInt(vmessQRCode.port);
item.port = vmessQRCode.port;
item.id = Utils.ToString(vmessQRCode.id);
item.alterId = Utils.ToInt(vmessQRCode.aid);
item.alterId = vmessQRCode.aid;
item.security = Utils.ToString(vmessQRCode.scy);
item.security = Utils.IsNotEmpty(vmessQRCode.scy) ? vmessQRCode.scy : Global.DefaultSecurity;

View file

@ -58,7 +58,7 @@ namespace ServiceLib.Models
return summary;
}
public List<string> GetAlpn()
public List<string>? GetAlpn()
{
if (Utils.IsNullOrEmpty(alpn))
{

View file

@ -120,10 +120,10 @@
public string? version { get; set; }
public string? network { get; set; }
public string? packet_encoding { get; set; }
public string[]? local_address { get; set; }
public List<string>? local_address { get; set; }
public string? private_key { get; set; }
public string? peer_public_key { get; set; }
public int[]? reserved { get; set; }
public List<int>? reserved { get; set; }
public int? mtu { get; set; }
public string? plugin { get; set; }
public string? plugin_opts { get; set; }
@ -138,11 +138,11 @@
public class Tls4Sbox
{
public bool enabled { get; set; }
public string server_name { get; set; }
public string? server_name { get; set; }
public bool? insecure { get; set; }
public List<string> alpn { get; set; }
public Utls4Sbox utls { get; set; }
public Reality4Sbox reality { get; set; }
public List<string>? alpn { get; set; }
public Utls4Sbox? utls { get; set; }
public Reality4Sbox? reality { get; set; }
}
public class Multiplex4Sbox

View file

@ -647,12 +647,12 @@ namespace ServiceLib.Models
/// <summary>
///
/// </summary>
public string path { get; set; }
public string? path { get; set; }
/// <summary>
///
/// </summary>
public List<string> host { get; set; }
public List<string>? host { get; set; }
}
public class QuicSettings4Ray

View file

@ -678,8 +678,8 @@ namespace ServiceLib.Services.CoreConfig
{
outbound.private_key = node.id;
outbound.peer_public_key = node.publicKey;
outbound.reserved = Utils.String2List(node.path).Select(int.Parse).ToArray();
outbound.local_address = [.. Utils.String2List(node.requestHost)];
outbound.reserved = Utils.String2List(node.path)?.Select(int.Parse).ToList();
outbound.local_address = Utils.String2List(node.requestHost);
outbound.mtu = Utils.ToInt(node.shortId.IsNullOrEmpty() ? Global.TunMtus.FirstOrDefault() : node.shortId);
break;
}
@ -732,7 +732,7 @@ namespace ServiceLib.Services.CoreConfig
}
else if (Utils.IsNotEmpty(node.requestHost))
{
server_name = Utils.String2List(node.requestHost)[0];
server_name = Utils.String2List(node.requestHost)?.First();
}
var tls = new Tls4Sbox()
{

View file

@ -829,7 +829,7 @@ namespace ServiceLib.Services.CoreConfig
}
else if (Utils.IsNotEmpty(host))
{
tlsSettings.serverName = Utils.String2List(host)[0];
tlsSettings.serverName = Utils.String2List(host)?.First();
}
streamSettings.tlsSettings = tlsSettings;
}

View file

@ -30,7 +30,7 @@ namespace ServiceLib.Services
{
try
{
Utils.SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
var progress = new Progress<string>();
progress.ProgressChanged += (sender, value) =>
@ -62,7 +62,7 @@ namespace ServiceLib.Services
{
try
{
Utils.SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, $"{ResUI.Downloading} {url}"));
var progress = new Progress<double>();
@ -92,7 +92,7 @@ namespace ServiceLib.Services
public async Task<string?> UrlRedirectAsync(string url, bool blProxy)
{
Utils.SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
var webRequestHandler = new SocketsHttpHandler
{
AllowAutoRedirect = false,
@ -181,7 +181,7 @@ namespace ServiceLib.Services
{
try
{
Utils.SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
var webProxy = GetWebProxy(blProxy);
var client = new HttpClient(new SocketsHttpHandler()
{
@ -226,7 +226,7 @@ namespace ServiceLib.Services
{
try
{
Utils.SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
SetSecurityProtocol(AppHandler.Instance.Config.guiItem.enableSecurityProtocolTls13);
var webProxy = GetWebProxy(blProxy);
@ -337,5 +337,18 @@ namespace ServiceLib.Services
return false;
}
}
private static void SetSecurityProtocol(bool enableSecurityProtocolTls13)
{
if (enableSecurityProtocolTls13)
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
}
else
{
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;
}
ServicePointManager.DefaultConnectionLimit = 256;
}
}
}

View file

@ -56,7 +56,7 @@ namespace ServiceLib.Services
_updateFunc?.Invoke(false, args.Msg);
url = args.Url;
fileName = Utils.GetTempPath(Utils.GetGUID());
fileName = Utils.GetTempPath(Utils.GetGuid());
await downloadHandle.DownloadFileAsync(url, fileName, true, _timeout);
}
else
@ -108,7 +108,7 @@ namespace ServiceLib.Services
url = args.Url;
var ext = Path.GetExtension(url);
fileName = Utils.GetTempPath(Utils.GetGUID() + ext);
fileName = Utils.GetTempPath(Utils.GetGuid() + ext);
await downloadHandle.DownloadFileAsync(url, fileName, true, _timeout);
}
else
@ -450,9 +450,10 @@ namespace ServiceLib.Services
{
_config = config;
_updateFunc = updateFunc;
var geoUrl = !String.IsNullOrEmpty(config?.guiItem.geoSourceUrl) ? config.guiItem.geoSourceUrl : Global.GeoUrl;
var url = string.Format(geoUrl, geoName);
var fileName = Utils.GetTempPath(Utils.GetGUID());
var url = string.Format(Global.GeoUrl, geoName);
var fileName = Utils.GetTempPath(Utils.GetGuid());
DownloadService downloadHandle = new();
downloadHandle.UpdateCompleted += (sender2, args) =>

View file

@ -85,7 +85,7 @@ namespace ServiceLib.ViewModels
private async Task RemoteRestore()
{
DisplayOperationMsg();
var fileName = Utils.GetTempPath(Utils.GetGUID());
var fileName = Utils.GetTempPath(Utils.GetGuid());
var result = await WebDavHandler.Instance.GetRawFile(fileName);
if (result)
{

View file

@ -414,7 +414,7 @@ namespace ServiceLib.ViewModels
var ret = await _updateView?.Invoke(EViewAction.OptionSettingWindow, null);
if (ret == true)
{
Locator.Current.GetService<StatusBarViewModel>()?.InboundDisplayStaus();
Locator.Current.GetService<StatusBarViewModel>()?.InboundDisplayStatus();
Reload();
}
}

View file

@ -34,7 +34,7 @@ namespace ServiceLib.ViewModels
if (rulesItem.id.IsNullOrEmpty())
{
rulesItem.id = Utils.GetGUID(false);
rulesItem.id = Utils.GetGuid(false);
rulesItem.outboundTag = Global.ProxyTag;
rulesItem.enabled = true;
SelectedSource = rulesItem;

View file

@ -232,7 +232,7 @@ namespace ServiceLib.ViewModels
var item = SelectedRouting;
foreach (var it in _rules)
{
it.id = Utils.GetGUID(false);
it.id = Utils.GetGuid(false);
}
item.ruleNum = _rules.Count;
item.ruleSet = JsonUtils.Serialize(_rules, false);
@ -322,7 +322,7 @@ namespace ServiceLib.ViewModels
}
foreach (var rule in lstRules)
{
rule.id = Utils.GetGUID(false);
rule.id = Utils.GetGuid(false);
}
if (blReplace)

View file

@ -10,8 +10,6 @@ namespace ServiceLib.ViewModels
{
public class StatusBarViewModel : MyReactiveObject
{
private bool _isAdministrator { get; set; }
#region ObservableCollection
private IObservableCollection<RoutingItem> _routingItems = new ObservableCollectionExtended<RoutingItem>();
@ -108,19 +106,16 @@ namespace ServiceLib.ViewModels
public StatusBarViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
{
_config = AppHandler.Instance.Config;
_updateView = updateView;
if (_updateView != null)
if (updateView != null)
{
MessageBus.Current.Listen<string>(EMsgCommand.RefreshProfiles.ToString())
.Subscribe(async x => await _updateView?.Invoke(EViewAction.DispatcherRefreshServersBiz, null));
Init(updateView);
}
SelectedRouting = new();
SelectedServer = new();
_isAdministrator = Utils.IsAdministrator();
if (_config.tunModeItem.enableTun && _isAdministrator)
if (_config.tunModeItem.enableTun && AppHandler.Instance.IsAdministrator)
{
EnableTun = true;
}
@ -130,7 +125,7 @@ namespace ServiceLib.ViewModels
}
RefreshRoutingsMenu();
InboundDisplayStaus();
InboundDisplayStatus();
ChangeSystemProxyAsync(_config.systemProxyItem.sysProxyType, true);
#region WhenAnyValue && ReactiveCommand
@ -414,7 +409,7 @@ namespace ServiceLib.ViewModels
{
_config.tunModeItem.enableTun = EnableTun;
// When running as a non-administrator, reboot to administrator mode
if (EnableTun && !_isAdministrator)
if (EnableTun && !AppHandler.Instance.IsAdministrator)
{
_config.tunModeItem.enableTun = false;
Locator.Current.GetService<MainWindowViewModel>()?.RebootAsAdmin();
@ -429,19 +424,12 @@ namespace ServiceLib.ViewModels
#region UI
public void InboundDisplayStaus()
public void InboundDisplayStatus()
{
StringBuilder sb = new();
sb.Append($"[{EInboundProtocol.socks}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]");
sb.Append(" | ");
//if (_config.systemProxyItem.sysProxyType == ESysProxyType.ForcedChange)
//{
// sb.Append($"[{Global.InboundHttp}({ResUI.SystemProxy}):{LazyConfig.Instance.GetLocalPort(Global.InboundHttp)}]");
//}
//else
//{
sb.Append($"[{EInboundProtocol.http}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.http)}]");
//}
InboundDisplay = $"{ResUI.LabLocal}:{sb}";
if (_config.inbound[0].allowLANConn)

View file

@ -43,7 +43,7 @@ public partial class App : Application
private void OnStartup(string[]? Args)
{
var exePathKey = Utils.GetMD5(Utils.GetExePath());
var exePathKey = Utils.GetMd5(Utils.GetExePath());
var rebootas = (Args ?? new string[] { }).Any(t => t == Global.RebootAs);
//ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, exePathKey, out bool bCreatedNew);

View file

@ -272,7 +272,7 @@ namespace v2rayN.Desktop.Views
private void btnGUID_Click(object? sender, RoutedEventArgs e)
{
txtId.Text =
txtId5.Text = Utils.GetGUID();
txtId5.Text = Utils.GetGuid();
}
private void SetHeaderType()

View file

@ -80,30 +80,35 @@ namespace v2rayN.Desktop.Views
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
switch (_config.uiItem.mainGirdOrientation)
{
case EGirdOrientation.Horizontal:
gridMain.IsVisible = true;
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView.IsVisible).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.IsVisible).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.IsVisible).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
}
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
{
break;
case EGirdOrientation.Vertical:
gridMain1.IsVisible = true;
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView1.IsVisible).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies1.IsVisible).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections1.IsVisible).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain1.SelectedIndex).DisposeWith(disposables);
}
else
{
break;
case EGirdOrientation.Tab:
default:
gridMain2.IsVisible = true;
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies2.IsVisible).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections2.IsVisible).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain2.SelectedIndex).DisposeWith(disposables);
break;
}
});
this.Title = $"{Utils.GetVersion()} - {(Utils.IsAdministrator() ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
this.Title = $"{Utils.GetVersion()} - {(AppHandler.Instance.IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
if (Utils.IsWindows())
{
menuGlobalHotkeySetting.IsVisible = false;
@ -115,26 +120,29 @@ namespace v2rayN.Desktop.Views
menuGlobalHotkeySetting.IsVisible = false;
}
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
switch (_config.uiItem.mainGirdOrientation)
{
case EGirdOrientation.Horizontal:
tabProfiles.Content ??= new ProfilesView(this);
tabMsgView.Content ??= new MsgView();
tabClashProxies.Content ??= new ClashProxiesView();
tabClashConnections.Content ??= new ClashConnectionsView();
}
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
{
break;
case EGirdOrientation.Vertical:
tabProfiles1.Content ??= new ProfilesView(this);
tabMsgView1.Content ??= new MsgView();
tabClashProxies1.Content ??= new ClashProxiesView();
tabClashConnections1.Content ??= new ClashConnectionsView();
}
else
{
break;
case EGirdOrientation.Tab:
default:
tabProfiles2.Content ??= new ProfilesView(this);
tabMsgView2.Content ??= new MsgView();
tabClashProxies2.Content ??= new ClashProxiesView();
tabClashConnections2.Content ??= new ClashConnectionsView();
break;
}
conTheme.Content ??= new ThemeSettingView();

View file

@ -24,23 +24,47 @@
<conv:InverseBooleanConverter x:Key="InverseBooleanConverter" />
<Thickness
x:Key="ServerItemMargin"
x:Key="Margin4"
Bottom="4"
Left="4"
Right="4"
Top="4" />
<Thickness
x:Key="SettingItemMargin"
x:Key="Margin8"
Bottom="8"
Left="8"
Right="8"
Top="8" />
<Thickness
x:Key="OutlinedTextBoxDefaultPadding"
Bottom="12"
Left="16"
Right="12"
Top="12" />
Bottom="8"
Left="8"
Right="8"
Top="8" />
<Thickness
x:Key="MarginLeftRight4"
Bottom="0"
Left="4"
Right="4"
Top="0" />
<Thickness
x:Key="MarginLeftRight8"
Bottom="0"
Left="8"
Right="8"
Top="0" />
<Thickness
x:Key="MarginLeft8"
Bottom="0"
Left="8"
Right="0"
Top="0" />
<Thickness
x:Key="MarginRight8"
Bottom="0"
Left="0"
Right="8"
Top="0" />
<Style
x:Key="ModuleTitle"
BasedOn="{StaticResource MaterialDesignTextBlock}"

View file

@ -26,7 +26,7 @@ namespace v2rayN
/// <param name="e"></param>
protected override void OnStartup(StartupEventArgs e)
{
var exePathKey = Utils.GetMD5(Utils.GetExePath());
var exePathKey = Utils.GetMd5(Utils.GetExePath());
var rebootas = (e.Args ?? new string[] { }).Any(t => t == Global.RebootAs);
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, exePathKey, out bool bCreatedNew);

View file

@ -218,7 +218,7 @@ namespace v2rayN
{
try
{
var autoRunName = $"{AutoRunName}_{Utils.GetMD5(Utils.StartupPath())}";
var autoRunName = $"{AutoRunName}_{Utils.GetMd5(Utils.StartupPath())}";
//delete first
RegWriteValue(AutoRunRegPath, autoRunName, "");
if (Utils.IsAdministrator())

View file

@ -22,9 +22,9 @@
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -37,7 +37,7 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
@ -72,14 +72,14 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.menuServers}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRemarks}" />
@ -89,7 +89,7 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@ -97,7 +97,7 @@
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAddress}" />
@ -106,7 +106,7 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
@ -118,12 +118,12 @@
Orientation="Horizontal">
<Button
x:Name="btnBrowse"
Margin="2,0"
Margin="{StaticResource MarginLeftRight4}"
Content="{x:Static resx:ResUI.TbBrowse}"
Style="{StaticResource DefButton}" />
<Button
x:Name="btnEdit"
Margin="2,0"
Margin="{StaticResource MarginLeftRight4}"
Content="{x:Static resx:ResUI.TbEdit}"
Style="{StaticResource DefButton}" />
</StackPanel>
@ -131,7 +131,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbCoreType}" />
@ -140,7 +140,7 @@
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
MaxDropDownHeight="1000"
Style="{StaticResource MyOutlinedTextComboBox}" />
@ -148,18 +148,18 @@
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbDisplayLog}" />
<StackPanel
Grid.Row="4"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
Orientation="Horizontal">
<ToggleButton x:Name="togDisplayLog" HorizontalAlignment="Left" />
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TipDisplayLog}" />
@ -168,7 +168,7 @@
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPreSocksPort}" />
@ -177,7 +177,7 @@
Grid.Row="5"
Grid.Column="1"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@ -193,7 +193,7 @@
TextWrapping="Wrap" />
<TextBlock
Width="500"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.CustomServerTips}"

View file

@ -22,9 +22,9 @@
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -37,7 +37,7 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
@ -76,7 +76,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.menuServers}" />
<StackPanel
@ -86,7 +86,7 @@
<ComboBox
x:Name="cmbCoreType"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.TbCoreType}"
Style="{StaticResource DefComboBox}" />
</StackPanel>
@ -94,7 +94,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRemarks}" />
@ -103,13 +103,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAddress}" />
@ -118,13 +118,13 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPort}" />
@ -133,7 +133,7 @@
Grid.Row="3"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
</Grid>
@ -162,7 +162,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId}" />
@ -171,20 +171,20 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<Button
x:Name="btnGUID"
Grid.Row="1"
Grid.Column="2"
Margin="4,0"
Margin="{StaticResource MarginLeftRight4}"
Content="{x:Static resx:ResUI.TbGUID}"
Style="{StaticResource DefButton}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAlterId}" />
@ -193,14 +193,14 @@
Grid.Row="2"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSecurity}" />
@ -209,7 +209,7 @@
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
@ -230,7 +230,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId3}" />
@ -239,13 +239,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSecurity3}" />
@ -254,7 +254,7 @@
Grid.Row="2"
Grid.Column="1"
Width="300"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
@ -275,7 +275,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSecurity4}" />
@ -284,13 +284,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId4}" />
@ -299,7 +299,7 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
</Grid>
<Grid
@ -321,7 +321,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId5}" />
@ -330,20 +330,20 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<Button
x:Name="btnGUID5"
Grid.Row="1"
Grid.Column="2"
Margin="4,0"
Margin="{StaticResource MarginLeftRight4}"
Content="{x:Static resx:ResUI.TbGUID}"
Style="{StaticResource DefButton}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbFlow5}" />
@ -352,13 +352,13 @@
Grid.Row="2"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSecurity5}" />
@ -367,7 +367,7 @@
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
</Grid>
@ -389,7 +389,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId3}" />
@ -398,13 +398,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbFlow5}" />
@ -413,7 +413,7 @@
Grid.Row="2"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
@ -434,7 +434,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId3}" />
@ -443,13 +443,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPath7}" />
@ -458,7 +458,7 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
</Grid>
<Grid
@ -479,7 +479,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId}" />
@ -488,13 +488,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbId3}" />
@ -503,13 +503,13 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbHeaderType8}" />
@ -518,7 +518,7 @@
Grid.Row="3"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
@ -541,7 +541,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPrivateKey}" />
@ -550,13 +550,13 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPublicKey}" />
@ -565,14 +565,14 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbReserved}" />
@ -581,13 +581,13 @@
Grid.Row="3"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbLocalAddress}" />
@ -596,13 +596,13 @@
Grid.Row="4"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="Mtu" />
@ -611,7 +611,7 @@
Grid.Row="5"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
</Grid>
@ -642,14 +642,14 @@
<TextBlock
Grid.Row="0"
Grid.ColumnSpan="2"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.GbTransport}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbNetwork}" />
@ -658,12 +658,12 @@
Grid.Row="1"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="1"
Grid.Column="2"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TipNetwork}" />
@ -672,7 +672,7 @@
x:Name="labHeaderType"
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbHeaderType}" />
@ -681,13 +681,13 @@
Grid.Row="2"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
x:Name="tipHeaderType"
Grid.Row="2"
Grid.Column="2"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbHeaderType}" />
@ -695,7 +695,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRequestHost}" />
@ -704,13 +704,13 @@
Grid.Row="3"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
x:Name="tipRequestHost"
Grid.Row="3"
Grid.Column="2"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRequestHost}" />
@ -718,7 +718,7 @@
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPath}" />
@ -727,13 +727,13 @@
Grid.Row="4"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefTextBox}" />
<TextBlock
x:Name="tipPath"
Grid.Row="4"
Grid.Column="2"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPath}" />
@ -760,7 +760,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbStreamSecurity}" />
@ -769,7 +769,7 @@
Grid.Row="0"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
@ -791,7 +791,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSNI}" />
@ -800,14 +800,14 @@
Grid.Row="1"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbFingerprint}" />
@ -816,14 +816,14 @@
Grid.Row="2"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
IsEditable="True"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAlpn}" />
@ -832,13 +832,13 @@
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAllowInsecure}" />
@ -847,7 +847,7 @@
Grid.Row="4"
Grid.Column="1"
Width="100"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
@ -869,7 +869,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSNI}" />
@ -878,14 +878,14 @@
Grid.Row="0"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbFingerprint}" />
@ -894,14 +894,14 @@
Grid.Row="1"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
IsEditable="True"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPublicKey}" />
@ -910,14 +910,14 @@
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbShortId}" />
@ -926,14 +926,14 @@
Grid.Row="3"
Grid.Column="1"
Width="200"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSpiderX}" />
@ -942,7 +942,7 @@
Grid.Row="4"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
</Grid>

View file

@ -267,7 +267,7 @@ namespace v2rayN.Views
private void btnGUID_Click(object sender, RoutedEventArgs e)
{
txtId.Text =
txtId5.Text = Utils.GetGUID();
txtId5.Text = Utils.GetGuid();
}
private void SetHeaderType()

View file

@ -21,11 +21,11 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<DockPanel Margin="16">
<DockPanel Margin="8" DockPanel.Dock="Bottom">
<DockPanel Margin="{StaticResource Margin8}">
<DockPanel Margin="{StaticResource Margin8}" DockPanel.Dock="Bottom">
<Button
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Content="{x:Static resx:ResUI.menuClose}"
DockPanel.Dock="Right"
@ -35,14 +35,14 @@
<TextBlock
x:Name="txtMsg"
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left"
Style="{StaticResource ToolbarTextBlock}" />
</DockPanel>
<StackPanel>
<materialDesign:Card Width="Auto" Margin="8">
<Grid Margin="8">
<materialDesign:Card Width="Auto" Margin="{StaticResource Margin8}">
<Grid Margin="{StaticResource Margin8}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -56,14 +56,14 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.menuLocalBackupAndRestore}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.menuLocalBackup}" />
@ -71,7 +71,7 @@
x:Name="menuLocalBackup"
Grid.Row="1"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuLocalBackup}"
Style="{StaticResource DefButton}" />
@ -84,7 +84,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.menuLocalRestore}" />
@ -92,14 +92,14 @@
x:Name="menuLocalRestore"
Grid.Row="3"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuLocalRestore}"
Style="{StaticResource DefButton}" />
</Grid>
</materialDesign:Card>
<materialDesign:Card Width="Auto" Margin="8">
<Grid Margin="8">
<materialDesign:Card Width="Auto" Margin="{StaticResource Margin8}">
<Grid Margin="{StaticResource Margin8}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -115,7 +115,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.menuRemoteBackupAndRestore}" />
@ -124,7 +124,7 @@
HorizontalAlignment="Right"
StaysOpen="True"
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
<StackPanel Margin="16">
<StackPanel Margin="{StaticResource Margin8}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -140,7 +140,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvWebDavUrl}" />
@ -149,7 +149,7 @@
x:Name="txtWebDavUrl"
Grid.Row="0"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource DefTextBox}"
TextWrapping="Wrap" />
@ -157,7 +157,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvWebDavUserName}" />
@ -166,14 +166,14 @@
x:Name="txtWebDavUserName"
Grid.Row="1"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvWebDavPassword}" />
@ -182,14 +182,14 @@
x:Name="txtWebDavPassword"
Grid.Row="2"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvWebDavDirName}" />
@ -198,7 +198,7 @@
x:Name="txtWebDavDirName"
Grid.Row="3"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource DefTextBox}" />
@ -206,7 +206,7 @@
x:Name="menuWebDavCheck"
Grid.Row="4"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.LvWebDavCheck}"
Style="{StaticResource DefButton}" />
@ -218,7 +218,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.menuRemoteBackup}" />
@ -226,7 +226,7 @@
x:Name="menuRemoteBackup"
Grid.Row="1"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuRemoteBackup}"
Style="{StaticResource DefButton}" />
@ -238,7 +238,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.menuRemoteRestore}" />
@ -246,7 +246,7 @@
x:Name="menuRemoteRestore"
Grid.Row="3"
Grid.Column="1"
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Content="{x:Static resx:ResUI.menuRemoteRestore}"
Style="{StaticResource DefButton}" />

View file

@ -15,27 +15,27 @@
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<DockPanel Margin="16">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableCheckPreReleaseUpdate}" />
<ToggleButton
x:Name="togEnableCheckPreReleaseUpdate"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" />
<Button
x:Name="btnCheckUpdate"
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
Content="{x:Static resx:ResUI.menuCheckUpdate}"
IsCancel="True"
IsDefault="True"
@ -43,7 +43,7 @@
<Button
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Right"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Content="{x:Static resx:ResUI.menuClose}"
@ -67,7 +67,7 @@
<Border
Width="500"
Height="50"
Margin="8"
Margin="{StaticResource Margin8}"
Padding="0"
VerticalAlignment="Center">
<Grid>
@ -82,7 +82,7 @@
<ToggleButton
x:Name="togAutoRefresh"
Grid.Column="0"
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left"
IsChecked="{Binding IsSelected}" />
<TextBlock

View file

@ -13,9 +13,9 @@
x:TypeArguments="vms:ClashConnectionsViewModel"
mc:Ignorable="d">
<DockPanel Margin="2">
<DockPanel Margin="{StaticResource Margin4}">
<WrapPanel
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
DockPanel.Dock="Top"
Orientation="Horizontal">
@ -23,21 +23,21 @@
<TextBox
x:Name="txtHostFilter"
Width="200"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalContentAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.ConnectionsHostFilterTitle}"
materialDesign:TextFieldAssist.HasClearButton="True"
Style="{StaticResource DefTextBox}" />
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSorting}" />
<ComboBox
x:Name="cmbSorting"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource DefComboBox}">
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingUpSpeed}" />
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDownSpeed}" />
@ -51,20 +51,20 @@
x:Name="btnConnectionCloseAll"
Width="24"
Height="24"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Close" />
</Button>
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAutoRefresh}" />
<ToggleButton
x:Name="togAutoRefresh"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
HorizontalAlignment="Left" />
</WrapPanel>

View file

@ -20,22 +20,22 @@
<converters:DelayColorConverter x:Key="DelayColorConverter" />
</UserControl.Resources>
<DockPanel Margin="2">
<DockPanel Margin="{StaticResource Margin4}">
<WrapPanel
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
DockPanel.Dock="Top"
Orientation="Horizontal">
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.menuRulemode}" />
<ComboBox
x:Name="cmbRulemode"
Width="80"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource DefComboBox}">
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" />
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeGlobal}" />
@ -43,14 +43,14 @@
</ComboBox>
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSorting}" />
<ComboBox
x:Name="cmbSorting"
Width="60"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource DefComboBox}">
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" />
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingName}" />
@ -61,7 +61,7 @@
x:Name="menuProxiesReload"
Width="24"
Height="24"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuProxiesReload}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Reload" />
@ -71,26 +71,26 @@
x:Name="menuProxiesDelaytest"
Width="24"
Height="24"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuProxiesDelaytest}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="LightningBolt" />
</Button>
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAutoRefresh}" />
<ToggleButton
x:Name="togAutoRefresh"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
HorizontalAlignment="Left" />
</WrapPanel>
<DockPanel>
<ListView
x:Name="lstProxyGroups"
Margin="0,0,5,0"
Margin="{StaticResource MarginRight8}"
BorderThickness="0"
DockPanel.Dock="Left"
ItemContainerStyle="{StaticResource lvItemSelected}"
@ -106,10 +106,10 @@
<DataTemplate>
<Border
Width="160"
Margin="4,0"
Margin="{StaticResource MarginLeftRight4}"
Padding="0">
<DockPanel>
<Grid Grid.Column="0" Margin="4">
<Grid Grid.Column="0" Margin="{StaticResource Margin4}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
@ -162,7 +162,7 @@
CornerRadius="4"
DockPanel.Dock="Left"
Visibility="{Binding Path=isActive, Converter={StaticResource BoolToVisConverter}}" />
<Grid Margin="4">
<Grid Margin="{StaticResource Margin4}">
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="1*" />

View file

@ -22,9 +22,9 @@
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -37,7 +37,7 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
@ -47,15 +47,15 @@
<TabControl HorizontalContentAlignment="Left">
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreDns}">
<DockPanel Margin="{StaticResource SettingItemMargin}">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsRemoteDNS}" />
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}">
<Hyperlink Click="linkDnsObjectDoc_Click">
@ -65,7 +65,7 @@
</TextBlock>
<Button
x:Name="btnImportDefConfig4V2ray"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
Content="{x:Static resx:ResUI.TbSettingDnsImportDefConfig}"
Cursor="Hand"
Style="{StaticResource DefButton}" />
@ -74,39 +74,39 @@
<WrapPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsUseSystemHosts}" />
<ToggleButton
x:Name="togUseSystemHosts"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsDomainStrategy4Freedom}" />
<ComboBox
x:Name="cmbdomainStrategy4Freedom"
Width="150"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsDomainDNSAddress}" />
<ComboBox
x:Name="cmbdomainDNSAddress"
Width="150"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
IsEditable="True"
Style="{StaticResource DefComboBox}" />
</StackPanel>
@ -114,7 +114,7 @@
<TextBox
x:Name="txtnormalDNS"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Stretch"
materialDesign:HintAssist.Hint="HTTP/SOCKS"
AcceptsReturn="True"
@ -126,10 +126,10 @@
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreDnsSingbox}">
<DockPanel Margin="{StaticResource SettingItemMargin}">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}">
<Hyperlink Click="linkDnsSingboxObjectDoc_Click">
@ -139,7 +139,7 @@
</TextBlock>
<Button
x:Name="btnImportDefConfig4Singbox"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
Content="{x:Static resx:ResUI.TbSettingDnsImportDefConfig}"
Cursor="Hand"
Style="{StaticResource DefButton}" />
@ -148,33 +148,33 @@
<WrapPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsDomainStrategy4Out}" />
<ComboBox
x:Name="cmbdomainStrategy4Out"
Width="150"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsDomainDNSAddress}" />
<ComboBox
x:Name="cmbdomainDNSAddress2"
Width="150"
Margin="{StaticResource SettingItemMargin}"
Margin="{StaticResource Margin8}"
IsEditable="True"
Style="{StaticResource DefComboBox}" />
</StackPanel>
</WrapPanel>
<Grid Margin="{StaticResource SettingItemMargin}">
<Grid Margin="{StaticResource Margin8}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="10" />

View file

@ -23,16 +23,16 @@
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel Margin="8">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
<Button
x:Name="btnReset"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbReset}"
Style="{StaticResource DefButton}" />
<Button
@ -44,7 +44,7 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
@ -77,14 +77,14 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.TbGlobalHotkeySetting}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbDisplayGUI}" />
@ -93,7 +93,7 @@
x:Name="txtGlobalHotkey0"
Grid.Row="1"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
@ -103,7 +103,7 @@
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbClearSystemProxy}" />
@ -111,7 +111,7 @@
x:Name="txtGlobalHotkey1"
Grid.Row="2"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
@ -121,7 +121,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSetSystemProxy}" />
@ -129,7 +129,7 @@
x:Name="txtGlobalHotkey2"
Grid.Row="3"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
@ -138,7 +138,7 @@
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbNotChangeSystemProxy}" />
@ -146,7 +146,7 @@
x:Name="txtGlobalHotkey3"
Grid.Row="4"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
@ -155,7 +155,7 @@
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSystemProxyPac}" />
@ -163,7 +163,7 @@
x:Name="txtGlobalHotkey4"
Grid.Row="5"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
IsReadOnly="True"
@ -173,7 +173,7 @@
<TextBlock
Grid.Row="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbGlobalHotkeySettingTip}" />

View file

@ -50,7 +50,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Server" />
<TextBlock Text="{x:Static resx:ResUI.menuServers}" />
@ -114,7 +114,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="BookClockOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuSubscription}" />
@ -149,7 +149,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="SettingsOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuSetting}" />
@ -201,7 +201,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Reload" />
<TextBlock Text="{x:Static resx:ResUI.menuReload}" />
@ -215,7 +215,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Update" />
<TextBlock Text="{x:Static resx:ResUI.menuCheckUpdate}" />
@ -229,7 +229,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="HelpCircleOutline" />
<TextBlock Text="{x:Static resx:ResUI.menuHelp}" />
@ -243,7 +243,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="VolumeHigh" />
<TextBlock Text="{x:Static resx:ResUI.menuPromotion}" />
@ -257,7 +257,7 @@
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Minimize" />
<TextBlock Text="{x:Static resx:ResUI.menuClose}" />
@ -313,11 +313,7 @@
<TabItem x:Name="tabMsgView1">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="MessageTextOutline" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="MessageTextOutline" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -328,11 +324,7 @@
<TabItem x:Name="tabClashProxies1">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="ArrowDecisionOutline" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="ArrowDecisionOutline" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -343,11 +335,7 @@
<TabItem x:Name="tabClashConnections1">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="LanConnect" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="LanConnect" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -366,11 +354,7 @@
<TabItem x:Name="tabProfiles2">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="Server" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="Server" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -381,11 +365,7 @@
<TabItem x:Name="tabMsgView2">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="MessageTextOutline" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="MessageTextOutline" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -396,11 +376,7 @@
<TabItem x:Name="tabClashProxies2">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="ArrowDecisionOutline" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="ArrowDecisionOutline" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -411,11 +387,7 @@
<TabItem x:Name="tabClashConnections2">
<TabItem.Header>
<StackPanel>
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="LanConnect" />
<materialDesign:PackIcon HorizontalAlignment="Center" Kind="LanConnect" />
<TextBlock
HorizontalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"

View file

@ -41,26 +41,29 @@ namespace v2rayN.Views
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(MainWindowViewModel));
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
switch (_config.uiItem.mainGirdOrientation)
{
case EGirdOrientation.Horizontal:
tabProfiles.Content ??= new ProfilesView();
tabMsgView.Content ??= new MsgView();
tabClashProxies.Content ??= new ClashProxiesView();
tabClashConnections.Content ??= new ClashConnectionsView();
}
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
{
break;
case EGirdOrientation.Vertical:
tabProfiles1.Content ??= new ProfilesView();
tabMsgView1.Content ??= new MsgView();
tabClashProxies1.Content ??= new ClashProxiesView();
tabClashConnections1.Content ??= new ClashConnectionsView();
}
else
{
break;
case EGirdOrientation.Tab:
default:
tabProfiles2.Content ??= new ProfilesView();
tabMsgView2.Content ??= new MsgView();
tabClashProxies2.Content ??= new ClashProxiesView();
tabClashConnections2.Content ??= new ClashConnectionsView();
break;
}
pbTheme.Content ??= new ThemeSettingView();
@ -99,30 +102,35 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Horizontal)
switch (_config.uiItem.mainGirdOrientation)
{
case EGirdOrientation.Horizontal:
gridMain.Visibility = Visibility.Visible;
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections.Visibility).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain.SelectedIndex).DisposeWith(disposables);
}
else if (_config.uiItem.mainGirdOrientation == EGirdOrientation.Vertical)
{
break;
case EGirdOrientation.Vertical:
gridMain1.Visibility = Visibility.Visible;
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabMsgView1.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies1.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections1.Visibility).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain1.SelectedIndex).DisposeWith(disposables);
}
else
{
break;
case EGirdOrientation.Tab:
default:
gridMain2.Visibility = Visibility.Visible;
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashProxies2.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.ShowClashUI, v => v.tabClashConnections2.Visibility).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TabMainSelectedIndex, v => v.tabMain2.SelectedIndex).DisposeWith(disposables);
break;
}
});
this.Title = $"{Utils.GetVersion()} - {(Utils.IsAdministrator() ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
this.Title = $"{Utils.GetVersion()} - {(AppHandler.Instance.IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
if (!_config.guiItem.enableHWA)
{

View file

@ -13,9 +13,9 @@
x:TypeArguments="vms:MsgViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<DockPanel Margin="2">
<DockPanel Margin="{StaticResource Margin4}">
<WrapPanel
Margin="8"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
DockPanel.Dock="Top"
Orientation="Horizontal">
@ -23,7 +23,7 @@
<ComboBox
x:Name="cmbMsgFilter"
Width="200"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.MsgFilterTitle}"
materialDesign:TextFieldAssist.HasClearButton="True"
IsEditable="True"
@ -32,7 +32,7 @@
x:Name="btnCopy"
Width="24"
Height="24"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuMsgViewCopyAll}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="ContentCopy" />
@ -41,29 +41,29 @@
x:Name="btnClear"
Width="24"
Height="24"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuMsgViewClear}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Delete" />
</Button>
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAutoRefresh}" />
<ToggleButton
x:Name="togAutoRefresh"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
HorizontalAlignment="Left"
IsChecked="True" />
<TextBlock
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbAutoScrollToEnd}" />
<ToggleButton
x:Name="togScrollToEnd"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
HorizontalAlignment="Left"
IsChecked="True" />
</WrapPanel>

File diff suppressed because it is too large Load diff

View file

@ -21,7 +21,7 @@
</UserControl.Resources>
<Grid>
<DockPanel>
<WrapPanel Margin="2" DockPanel.Dock="Top">
<WrapPanel Margin="{StaticResource Margin4}" DockPanel.Dock="Top">
<ListBox
x:Name="lstGroup"
MaxHeight="200"
@ -39,7 +39,7 @@
x:Name="btnEditSub"
Width="30"
Height="30"
Margin="4,0"
Margin="{StaticResource MarginLeftRight4}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuSubEdit}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Edit" />
@ -48,7 +48,7 @@
x:Name="btnAddSub"
Width="30"
Height="30"
Margin="4,0"
Margin="{StaticResource MarginLeftRight4}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuSubAdd}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="Plus" />
@ -58,7 +58,7 @@
x:Name="btnAutofitColumnWidth"
Width="30"
Height="30"
Margin="20,0"
Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource MaterialDesignFloatingActionMiniLightButton}"
ToolTip="{x:Static resx:ResUI.menuProfileAutofitColumnWidth}">
<materialDesign:PackIcon VerticalAlignment="Center" Kind="ArrowSplitVertical" />
@ -66,7 +66,7 @@
<TextBox
x:Name="txtServerFilter"
Width="200"
Margin="4,0"
Margin="{StaticResource MarginLeftRight4}"
VerticalContentAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.MsgServerTitle}"
materialDesign:TextFieldAssist.HasClearButton="True"

View file

@ -10,7 +10,7 @@
d:DesignWidth="300"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<Grid Margin="30">
<Grid Margin="32">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -38,7 +38,7 @@
<Button
Grid.Row="2"
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Right"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Content="{x:Static resx:ResUI.TbConfirm}"

View file

@ -23,7 +23,7 @@
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<DockPanel>
<Grid Margin="8" DockPanel.Dock="Top">
<Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -41,7 +41,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvRemarks}" />
@ -50,20 +50,20 @@
Grid.Row="0"
Grid.Column="1"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<ToggleButton
x:Name="togEnabled"
Grid.Row="0"
Grid.Column="2"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="outboundTag" />
@ -72,13 +72,13 @@
Grid.Row="1"
Grid.Column="1"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
MaxDropDownHeight="1000"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="1"
Grid.Column="2"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRuleMatchingTips}" />
@ -86,7 +86,7 @@
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="port" />
@ -95,13 +95,13 @@
Grid.Row="2"
Grid.Column="1"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="2"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}">
<Hyperlink Click="linkRuleobjectDoc_Click">
@ -113,7 +113,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="protocol" />
@ -121,7 +121,7 @@
x:Name="clbProtocol"
Grid.Row="3"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
FontSize="{DynamicResource StdFontSize}"
Style="{StaticResource MaterialDesignFilterChipPrimaryListBox}" />
@ -129,7 +129,7 @@
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="inboundTag" />
@ -137,14 +137,14 @@
x:Name="clbInboundTag"
Grid.Row="4"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
FontSize="{DynamicResource StdFontSize}"
Style="{StaticResource MaterialDesignFilterChipPrimaryListBox}" />
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="network" />
@ -153,21 +153,21 @@
Grid.Row="5"
Grid.Column="1"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
MaxDropDownHeight="1000"
Style="{StaticResource DefComboBox}" />
<TextBlock
Grid.Row="5"
Grid.Column="2"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRoutingTips}" />
</Grid>
<StackPanel
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -188,14 +188,14 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
Style="{StaticResource DefButton}" />
</StackPanel>
<Grid Margin="{StaticResource SettingItemMargin}">
<Grid Margin="{StaticResource Margin8}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="10" />

View file

@ -32,7 +32,7 @@
<Button x:Name="menuRuleAdd">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Plus" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuRuleAdd}" />
@ -42,7 +42,7 @@
<Button x:Name="menuImportRulesFromFile">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Import" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromFile}" />
@ -52,7 +52,7 @@
<Button x:Name="menuImportRulesFromClipboard">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Import" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromClipboard}" />
@ -62,7 +62,7 @@
<Button x:Name="menuImportRulesFromUrl">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Import" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuImportRulesFromUrl}" />
@ -72,7 +72,7 @@
</ToolBarTray>
<StackPanel
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -85,14 +85,14 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
Style="{StaticResource DefButton}" />
</StackPanel>
<Grid Margin="8" DockPanel.Dock="Top">
<Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@ -109,7 +109,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvRemarks}" />
@ -123,7 +123,7 @@
Grid.Row="0"
Grid.Column="1"
Width="300"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
AcceptsReturn="True"
@ -131,14 +131,14 @@
TextWrapping="Wrap" />
<TextBlock
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvSort}" />
<TextBox
x:Name="txtSort"
Width="100"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}" />
@ -147,7 +147,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbdomainStrategy}" />
@ -158,24 +158,24 @@
<ComboBox
x:Name="cmbdomainStrategy"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
<TextBlock
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
<ComboBox
x:Name="cmbdomainStrategy4Singbox"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
Style="{StaticResource DefComboBox}" />
</StackPanel>
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvUrl}" />
@ -184,7 +184,7 @@
Grid.Row="2"
Grid.Column="1"
Width="600"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
@ -193,7 +193,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvCustomIcon}" />
@ -202,7 +202,7 @@
Grid.Row="3"
Grid.Column="1"
Width="600"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
@ -211,14 +211,14 @@
x:Name="btnBrowseCustomIcon"
Grid.Row="3"
Grid.Column="2"
Margin="2,0,8,0"
Margin="{StaticResource MarginLeftRight4}"
Content="{x:Static resx:ResUI.TbBrowse}"
Style="{StaticResource DefButton}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}">
<Hyperlink Click="linkCustomRulesetPath4Singbox">
@ -231,7 +231,7 @@
Grid.Row="4"
Grid.Column="1"
Width="600"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
@ -240,7 +240,7 @@
x:Name="btnBrowseCustomRulesetPath4Singbox"
Grid.Row="4"
Grid.Column="2"
Margin="2,0,8,0"
Margin="{StaticResource MarginLeftRight4}"
Content="{x:Static resx:ResUI.TbBrowse}"
Style="{StaticResource DefButton}" />
</Grid>

View file

@ -34,12 +34,12 @@
VerticalAlignment="Center"
ClipToBounds="True"
Style="{StaticResource MaterialDesignToolBar}">
<Menu Margin="0,8" Style="{StaticResource ToolbarMenu}">
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
<MenuItem x:Name="menuRoutingBasic" Padding="8,0">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Server" />
<TextBlock Text="{x:Static resx:ResUI.menuRoutingBasic}" />
@ -51,12 +51,12 @@
Header="{x:Static resx:ResUI.menuRoutingBasicImportRules}" />
</MenuItem>
</Menu>
<Menu Margin="0,8" Style="{StaticResource ToolbarMenu}">
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
<MenuItem x:Name="menuRoutingAdvanced" Padding="8,0">
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Routes" />
<TextBlock Text="{x:Static resx:ResUI.menuRoutingAdvanced}" />
@ -74,17 +74,17 @@
</Menu>
<Separator />
<TextBlock
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbenableRoutingAdvanced}" />
<ToggleButton
x:Name="togenableRoutingAdvanced"
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
HorizontalAlignment="Left" />
<Separator />
<TextBlock
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}">
<Hyperlink Click="linkdomainStrategy_Click">
@ -95,22 +95,22 @@
<ComboBox
x:Name="cmbdomainStrategy"
Width="110"
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
Style="{StaticResource DefComboBox}" />
<Separator />
<TextBlock
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbdomainMatcher}" />
<ComboBox
x:Name="cmbdomainMatcher"
Width="60"
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
Style="{StaticResource DefComboBox}" />
<Separator />
<TextBlock
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}">
<Hyperlink Click="linkdomainStrategy4Singbox_Click">
@ -121,13 +121,13 @@
<ComboBox
x:Name="cmbdomainStrategy4Singbox"
Width="100"
Margin="8,0,0,0"
Margin="{StaticResource MarginLeft8}"
Style="{StaticResource DefComboBox}" />
</ToolBar>
</ToolBarTray>
<StackPanel
Margin="8"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -146,7 +146,7 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
@ -158,7 +158,6 @@
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRoutingTabRuleList}">
<DataGrid
x:Name="lstRoutings"
Margin="2,0"
AutoGenerateColumns="False"
BorderThickness="1"
CanUserAddRows="False"
@ -233,7 +232,7 @@
<TabControl x:Name="tabBasic">
<TabItem Header="{x:Static resx:ResUI.TbRoutingTabProxy}">
<Grid Margin="{StaticResource SettingItemMargin}">
<Grid Margin="{StaticResource Margin8}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="10" />
@ -266,7 +265,7 @@
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbRoutingTabDirect}">
<Grid Margin="{StaticResource SettingItemMargin}">
<Grid Margin="{StaticResource Margin8}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="10" />
@ -299,7 +298,7 @@
</TabItem>
<TabItem Header="{x:Static resx:ResUI.TbRoutingTabBlock}">
<Grid Margin="{StaticResource SettingItemMargin}">
<Grid Margin="{StaticResource Margin8}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="10" />

View file

@ -18,46 +18,46 @@
<materialDesign:ColorZone Height="50" Mode="Standard">
<DockPanel>
<StackPanel
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
DockPanel.Dock="Right">
<TextBlock x:Name="txtSpeedProxyDisplay" Style="{StaticResource StatusbarItem}" />
<Border Margin="2" />
<Border Margin="{StaticResource Margin4}" />
<TextBlock x:Name="txtSpeedDirectDisplay" Style="{StaticResource StatusbarItem}" />
</StackPanel>
<StackPanel
Width="240"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
DockPanel.Dock="Left">
<TextBlock x:Name="txtInboundDisplay" Style="{StaticResource StatusbarItem}" />
<Border Margin="2" />
<Border Margin="{StaticResource Margin4}" />
<TextBlock x:Name="txtInboundLanDisplay" Style="{StaticResource StatusbarItem}" />
</StackPanel>
<StackPanel
x:Name="spEnableTun"
Width="auto"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
DockPanel.Dock="Left">
<TextBlock Text="{x:Static resx:ResUI.TbEnableTunAs}" />
<ToggleButton
x:Name="togEnableTun"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
</StackPanel>
<StackPanel
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
VerticalAlignment="Center"
DockPanel.Dock="Left"
Orientation="Horizontal">
<ComboBox
x:Name="cmbSystemProxy"
Width="120"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.menuSystemproxy}"
FontSize="{DynamicResource StdFontSize}"
Style="{StaticResource MaterialDesignFloatingHintComboBox}">
@ -70,16 +70,16 @@
<ComboBox
x:Name="cmbRoutings2"
Width="150"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.menuRouting}"
DisplayMemberPath="remarks"
FontSize="{DynamicResource StdFontSize}"
Style="{StaticResource MaterialDesignFloatingHintComboBox}" />
</StackPanel>
<StackPanel Margin="8,0" VerticalAlignment="Center">
<StackPanel Margin="{StaticResource MarginLeftRight8}" VerticalAlignment="Center">
<TextBlock x:Name="txtRunningServerDisplay" Style="{StaticResource StatusbarItem}" />
<Border Margin="2" />
<Border Margin="{StaticResource Margin4}" />
<TextBlock x:Name="txtRunningInfoDisplay" Style="{StaticResource StatusbarItem}" />
</StackPanel>
</DockPanel>
@ -99,7 +99,7 @@
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
x:Name="menuSystemProxyClear2"
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Check" />
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxyClear}" />
@ -111,7 +111,7 @@
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
x:Name="menuSystemProxySet2"
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Check" />
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxySet}" />
@ -123,7 +123,7 @@
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
x:Name="menuSystemProxyNothing2"
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Check" />
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxyNothing}" />
@ -135,7 +135,7 @@
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
x:Name="menuSystemProxyPac2"
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Check" />
<TextBlock Text="{x:Static resx:ResUI.menuSystemProxyPac}" />

View file

@ -29,9 +29,9 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<DockPanel Margin="8">
<DockPanel Margin="{StaticResource Margin8}">
<StackPanel
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Center"
DockPanel.Dock="Bottom"
Orientation="Horizontal">
@ -44,7 +44,7 @@
<Button
x:Name="btnCancel"
Width="100"
Margin="8,0"
Margin="{StaticResource MarginLeftRight8}"
Content="{x:Static resx:ResUI.TbCancel}"
Cursor="Hand"
IsCancel="true"
@ -79,14 +79,14 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
Style="{StaticResource ModuleTitle}"
Text="{x:Static resx:ResUI.menuSubscription}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvRemarks}" />
@ -95,7 +95,7 @@
x:Name="txtRemarks"
Grid.Row="1"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}"
@ -104,7 +104,7 @@
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvUrl}" />
@ -112,7 +112,7 @@
x:Name="txtUrl"
Grid.Row="2"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
@ -127,14 +127,14 @@
Style="{StaticResource MaterialDesignToolForegroundPopupBox}">
<StackPanel>
<TextBlock
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvMoreUrl}" />
<TextBox
x:Name="txtMoreUrl"
Width="400"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
@ -147,7 +147,7 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvEnabled}" />
@ -155,17 +155,17 @@
<DockPanel
Grid.Row="3"
Grid.Column="1"
Margin="4">
Margin="{StaticResource Margin4}">
<ToggleButton
x:Name="togEnable"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
DockPanel.Dock="Left" />
<TextBox
x:Name="txtAutoUpdateInterval"
Width="200"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
@ -173,7 +173,7 @@
Style="{StaticResource MyOutlinedTextBox}" />
<TextBlock
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
@ -183,7 +183,7 @@
<TextBlock
Grid.Row="5"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvFilter}" />
@ -191,7 +191,7 @@
x:Name="txtFilter"
Grid.Row="5"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
@ -200,7 +200,7 @@
<TextBlock
Grid.Row="6"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvConvertTarget}" />
@ -208,7 +208,7 @@
x:Name="cmbConvertTarget"
Grid.Row="6"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvConvertTargetTip}"
MaxDropDownHeight="1000"
Style="{StaticResource MyOutlinedTextComboBox}" />
@ -216,14 +216,14 @@
<TextBlock
Grid.Row="7"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.LvUserAgent}" />
<TextBox
x:Name="txtUserAgent"
Grid.Row="7"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
@ -233,7 +233,7 @@
<TextBlock
Grid.Row="8"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvSort}" />
@ -242,7 +242,7 @@
Grid.Row="8"
Grid.Column="1"
Width="100"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
AcceptsReturn="True"
@ -251,7 +251,7 @@
<TextBlock
Grid.Row="9"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvPrevProfile}" />
@ -259,7 +259,7 @@
x:Name="txtPrevProfile"
Grid.Row="9"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
AcceptsReturn="True"
@ -268,7 +268,7 @@
<TextBlock
Grid.Row="10"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.LvNextProfile}" />
@ -276,7 +276,7 @@
x:Name="txtNextProfile"
Grid.Row="10"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
AcceptsReturn="True"
@ -285,7 +285,7 @@
<TextBlock
Grid.Row="11"
Grid.Column="0"
Margin="4"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPreSocksPort4Sub}" />
@ -293,7 +293,7 @@
x:Name="txtPreSocksPort"
Grid.Row="11"
Grid.Column="1"
Margin="4"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.TipPreSocksPort}"
AcceptsReturn="True"

View file

@ -36,7 +36,7 @@
<Button x:Name="menuSubAdd">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Plus" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubAdd}" />
@ -46,7 +46,7 @@
<Button x:Name="menuSubDelete">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Delete" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubDelete}" />
@ -56,7 +56,7 @@
<Button x:Name="menuSubEdit">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Edit" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubEdit}" />
@ -66,7 +66,7 @@
<Button x:Name="menuSubShare">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="QrcodePlus" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuSubShare}" />
@ -75,7 +75,7 @@
<Button x:Name="menuClose" IsCancel="True">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
Margin="{StaticResource MarginRight8}"
VerticalAlignment="Center"
Kind="Close" />
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuClose}" />

View file

@ -12,7 +12,7 @@
x:TypeArguments="vms:ThemeSettingViewModel"
Style="{StaticResource ViewGlobal}"
mc:Ignorable="d">
<StackPanel Margin="8">
<StackPanel Margin="{StaticResource Margin8}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
@ -35,7 +35,7 @@
x:Name="togDarkMode"
Grid.Row="0"
Grid.Column="1"
Margin="8" />
Margin="{StaticResource Margin8}" />
<TextBlock
Grid.Row="1"
@ -47,7 +47,7 @@
x:Name="followSystemTheme"
Grid.Row="1"
Grid.Column="1"
Margin="8" />
Margin="{StaticResource Margin8}" />
<TextBlock
Grid.Row="2"
@ -60,7 +60,7 @@
Grid.Row="2"
Grid.Column="1"
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
DisplayMemberPath="Name"
Style="{StaticResource DefComboBox}" />
@ -75,7 +75,7 @@
Grid.Row="3"
Grid.Column="1"
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" />
<TextBlock
@ -89,7 +89,7 @@
Grid.Row="4"
Grid.Column="1"
Width="100"
Margin="8"
Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" />
</Grid>
</StackPanel>