@@ -294,7 +294,7 @@ public static async Task<int> AddVMessServer(Config config, ProfileItem profileI
294
294
/// <param name="config"></param>
295
295
/// <param name="indexes"></param>
296
296
/// <returns></returns>
297
- public static async Task < int > RemoveServer ( Config config , List < ProfileItem > indexes )
297
+ public static async Task < int > RemoveServers ( Config config , List < ProfileItem > indexes )
298
298
{
299
299
var subid = "TempRemoveSubId" ;
300
300
foreach ( var item in indexes )
@@ -303,7 +303,7 @@ public static async Task<int> RemoveServer(Config config, List<ProfileItem> inde
303
303
}
304
304
305
305
await SQLiteHelper . Instance . UpdateAllAsync ( indexes ) ;
306
- await RemoveServerViaSubid ( config , subid , false ) ;
306
+ await RemoveServersViaSubid ( config , subid , false ) ;
307
307
308
308
return 0 ;
309
309
}
@@ -886,7 +886,7 @@ public static async Task<Tuple<int, int>> DedupServerList(Config config, string
886
886
lstRemove . Add ( item ) ;
887
887
}
888
888
}
889
- await RemoveServer ( config , lstRemove ) ;
889
+ await RemoveServers ( config , lstRemove ) ;
890
890
891
891
return new Tuple < int , int > ( lstProfile . Count , lstKeep . Count ) ;
892
892
}
@@ -1062,12 +1062,9 @@ public static async Task<int> RemoveInvalidServerResult(Config config, string su
1062
1062
var lstProfile = ( from t in lstModel
1063
1063
join t2 in lstProfileExs on t . IndexId equals t2 . IndexId
1064
1064
where t2 . Delay == - 1
1065
- select t . IndexId ) . ToList ( ) ;
1065
+ select t ) . ToList ( ) ;
1066
1066
1067
- foreach ( var item in lstProfile )
1068
- {
1069
- await RemoveProfileItem ( config , item ) ;
1070
- }
1067
+ await RemoveServers ( config , JsonUtils . Deserialize < List < ProfileItem > > ( JsonUtils . Serialize ( lstProfile ) ) ) ;
1071
1068
1072
1069
return lstProfile . Count ;
1073
1070
}
@@ -1094,7 +1091,7 @@ private static async Task<int> AddBatchServersCommon(Config config, string strDa
1094
1091
//remove sub items
1095
1092
if ( isSub && Utils . IsNotEmpty ( subid ) )
1096
1093
{
1097
- await RemoveServerViaSubid ( config , subid , isSub ) ;
1094
+ await RemoveServersViaSubid ( config , subid , isSub ) ;
1098
1095
subFilter = ( await AppHandler . Instance . GetSubItem ( subid ) ) ? . Filter ?? "" ;
1099
1096
}
1100
1097
@@ -1188,7 +1185,7 @@ private static async Task<int> AddBatchServers4Custom(Config config, string strD
1188
1185
{
1189
1186
if ( isSub && Utils . IsNotEmpty ( subid ) )
1190
1187
{
1191
- await RemoveServerViaSubid ( config , subid , isSub ) ;
1188
+ await RemoveServersViaSubid ( config , subid , isSub ) ;
1192
1189
}
1193
1190
int count = 0 ;
1194
1191
foreach ( var it in lstProfiles )
@@ -1244,7 +1241,7 @@ private static async Task<int> AddBatchServers4Custom(Config config, string strD
1244
1241
1245
1242
if ( isSub && Utils . IsNotEmpty ( subid ) )
1246
1243
{
1247
- await RemoveServerViaSubid ( config , subid , isSub ) ;
1244
+ await RemoveServersViaSubid ( config , subid , isSub ) ;
1248
1245
}
1249
1246
1250
1247
profileItem . Subid = subid ;
@@ -1269,7 +1266,7 @@ private static async Task<int> AddBatchServers4SsSIP008(Config config, string st
1269
1266
1270
1267
if ( isSub && Utils . IsNotEmpty ( subid ) )
1271
1268
{
1272
- await RemoveServerViaSubid ( config , subid , isSub ) ;
1269
+ await RemoveServersViaSubid ( config , subid , isSub ) ;
1273
1270
}
1274
1271
1275
1272
var lstSsServer = ShadowsocksFmt . ResolveSip008 ( strData ) ;
@@ -1456,7 +1453,7 @@ public static async Task<int> AddSubItem(Config config, SubItem subItem)
1456
1453
/// <param name="config"></param>
1457
1454
/// <param name="subid"></param>
1458
1455
/// <returns></returns>
1459
- public static async Task < int > RemoveServerViaSubid ( Config config , string subid , bool isSub )
1456
+ public static async Task < int > RemoveServersViaSubid ( Config config , string subid , bool isSub )
1460
1457
{
1461
1458
if ( Utils . IsNullOrEmpty ( subid ) )
1462
1459
{
@@ -1487,7 +1484,7 @@ public static async Task<int> DeleteSubItem(Config config, string id)
1487
1484
return 0 ;
1488
1485
}
1489
1486
await SQLiteHelper . Instance . DeleteAsync ( item ) ;
1490
- await RemoveServerViaSubid ( config , id , false ) ;
1487
+ await RemoveServersViaSubid ( config , id , false ) ;
1491
1488
1492
1489
return 0 ;
1493
1490
}
0 commit comments