From 982c865245706036cabc7974422b1f28f51993bb Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sun, 21 May 2023 16:03:29 +0800 Subject: [PATCH] Fix subscription ordering --- v2rayN/v2rayN/Handler/ConfigHandler.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs index 9584d799..ff836869 100644 --- a/v2rayN/v2rayN/Handler/ConfigHandler.cs +++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs @@ -858,10 +858,18 @@ namespace v2rayN.Handler profileItem.network = Global.DefaultNetwork; } + var maxSort = -1; if (Utils.IsNullOrEmpty(profileItem.indexId)) { profileItem.indexId = Utils.GetGUID(false); - var maxSort = ProfileExHandler.Instance.GetMaxSort(); + maxSort = ProfileExHandler.Instance.GetMaxSort(); + } + if (!toFile && maxSort < 0) + { + maxSort = ProfileExHandler.Instance.GetMaxSort(); + } + if (maxSort > 0) + { ProfileExHandler.Instance.SetSort(profileItem.indexId, maxSort + 1); }