File tree Expand file tree Collapse file tree 1 file changed +5
-28
lines changed Expand file tree Collapse file tree 1 file changed +5
-28
lines changed Original file line number Diff line number Diff line change @@ -237,39 +237,16 @@ public bool FavModify(CodeBoxModel code)
237
237
}
238
238
return true ;
239
239
}
240
-
241
240
public async Task < ObservableCollection < CodeBoxModel > > SearchCode ( string text , string from )
242
241
{
243
242
var currentCode = from == "Home" ? AllCodes : FavCodes ;
244
-
245
- var lst = new ObservableCollection < CodeBoxModel > ( ) ;
246
- var lst2 = new ObservableCollection < CodeBoxModel > ( ) ;
247
- foreach ( var code in currentCode )
243
+ var newCodesList = currentCode . Where ( x => x . title . ToLower ( ) . Contains ( text . ToLower ( ) ) ) . ToList ( ) ;
244
+ var newCodes = new ObservableCollection < CodeBoxModel > ( ) ;
245
+ foreach ( var code in newCodesList )
248
246
{
249
- int f = 0 ;
250
- if ( code . title . Length >= text . Length )
251
- {
252
- foreach ( var i in code . title )
253
- {
254
- if ( text . Contains ( i ) )
255
- {
256
- text . Remove ( text . IndexOf ( i ) ) ;
257
- f ++ ;
258
- }
259
- }
260
- }
261
- else continue ;
262
-
263
- if ( code . title == text ) lst . Add ( code ) ;
264
- else if ( code . title . Length < 3 )
265
- {
266
- if ( f >= 1 ) lst2 . Add ( code ) ;
267
- }
268
- else if ( f >= 3 ) lst2 . Add ( code ) ;
247
+ newCodes . Add ( code ) ;
269
248
}
270
-
271
- lst . Concat ( lst2 ) ;
272
- return lst ;
249
+ return newCodes ;
273
250
}
274
251
}
275
252
}
You can’t perform that action at this time.
0 commit comments