保存自定义路由信息时先排序后输出

pull/2148/head
uniceguy 3 years ago
parent 354fc618b0
commit fd4d712688

@ -48,8 +48,8 @@ namespace v2rayN.Forms
}
rulesItem.inboundTag = inboundTag;
rulesItem.outboundTag = cmbOutboundTag.Text;
rulesItem.domain = Utils.String2List(txtDomain.Text);
rulesItem.ip = Utils.String2List(txtIP.Text);
rulesItem.domain = Utils.String2ListSorted(txtDomain.Text);
rulesItem.ip = Utils.String2ListSorted(txtIP.Text);
var protocol = new List<string>();
for (int i = 0; i < clbProtocol.Items.Count; i++)

@ -219,6 +219,26 @@ namespace v2rayN
}
}
/// <summary>
/// 逗号分隔的字符串,先排序后转List<string>
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static List<string> String2ListSorted(string str)
{
try
{
str = str.Replace(Environment.NewLine, "");
List<string> list = new List<string>(str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
return list.OrderBy(x => x).ToList();
}
catch (Exception ex)
{
SaveLog(ex.Message, ex);
return new List<string>();
}
}
/// <summary>
/// Base64编码
/// </summary>

Loading…
Cancel
Save