bug fixes

This commit is contained in:
2dust 2023-02-15 20:37:51 +08:00
parent c3e00ba31b
commit ca334104d7
2 changed files with 14 additions and 2 deletions

View file

@ -72,6 +72,10 @@ namespace v2rayN
try try
{ {
if (!File.Exists(res))
{
return result;
}
using (StreamReader reader = new StreamReader(res)) using (StreamReader reader = new StreamReader(res))
{ {
result = reader.ReadToEnd(); result = reader.ReadToEnd();

View file

@ -801,7 +801,14 @@ namespace v2rayN.ViewModels
{ {
_subItems.Add(item); _subItems.Add(item);
} }
SelectedSub = _subItems[0]; if (_subId != null && _subItems.FirstOrDefault(t => t.id == _subId) != null)
{
SelectedSub = _subItems.FirstOrDefault(t => t.id == _subId);
}
else
{
SelectedSub = _subItems[0];
}
} }
#endregion #endregion
@ -834,7 +841,6 @@ namespace v2rayN.ViewModels
{ {
subid = _subId, subid = _subId,
configType = eConfigType, configType = eConfigType,
displayLog = false
}; };
} }
else else
@ -876,6 +882,7 @@ namespace v2rayN.ViewModels
int ret = ConfigHandler.AddBatchServers(ref _config, clipboardData, _subId, false); int ret = ConfigHandler.AddBatchServers(ref _config, clipboardData, _subId, false);
if (ret > 0) if (ret > 0)
{ {
InitSubscriptionView();
RefreshServers(); RefreshServers();
_noticeHandler?.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret)); _noticeHandler?.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
} }
@ -900,6 +907,7 @@ namespace v2rayN.ViewModels
int ret = ConfigHandler.AddBatchServers(ref _config, result, _subId, false); int ret = ConfigHandler.AddBatchServers(ref _config, result, _subId, false);
if (ret > 0) if (ret > 0)
{ {
InitSubscriptionView();
RefreshServers(); RefreshServers();
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedServerViaScan); _noticeHandler?.Enqueue(ResUI.SuccessfullyImportedServerViaScan);
} }