File tree Expand file tree Collapse file tree 3 files changed +19
-44
lines changed Expand file tree Collapse file tree 3 files changed +19
-44
lines changed Original file line number Diff line number Diff line change @@ -476,49 +476,24 @@ private bool insertRowInOptions(string installPathRoute)
476476 }
477477 }
478478
479- bool updated = false ;
479+ string routeName = RouteName ;
480480 int index = 0 ;
481- while ( ! updated )
481+ var sortedFolders = Settings . Folders . Folders . OrderBy ( pair => pair . Key ) . ToDictionary ( pair => pair . Key , pair => pair . Value ) ;
482+ foreach ( KeyValuePair < string , string > folderSetting in sortedFolders )
482483 {
483- string routeName = "" ;
484- bool routeNameFound = false ;
485- foreach ( KeyValuePair < string , string > folderSetting in Settings . Folders . Folders )
484+ if ( folderSetting . Key == routeName )
486485 {
487- if ( index == 0 )
488- {
489- routeName = RouteName ;
490- }
491- else
492- {
493- routeName = string . Format ( "{0} ({1})" , RouteName , index ) ;
494- }
495- if ( folderSetting . Key == routeName )
496- {
497- if ( folderSetting . Value . Equals ( installPathRouteReal , StringComparison . OrdinalIgnoreCase ) )
498- {
499- updated = true ;
500- }
501- else
502- {
503- routeNameFound = true ;
504- }
505- }
506- }
507- if ( ! updated )
508- {
509- if ( routeNameFound )
486+ if ( ! folderSetting . Value . Equals ( installPathRouteReal , StringComparison . OrdinalIgnoreCase ) )
510487 {
511488 index ++ ;
512- }
513- else
514- {
515- Settings . Folders . Folders [ routeName ] = installPathRouteReal ;
516- Routes [ RouteName ] . ContentName = routeName ;
517- Routes [ RouteName ] . ContentDirectory = installPathRouteReal ;
518- updated = true ;
489+ routeName = string . Format ( "{0} ({1})" , RouteName , index ) ;
519490 }
520491 }
521492 }
493+ Settings . Folders . Folders [ routeName ] = installPathRouteReal ;
494+ Routes [ RouteName ] . ContentName = routeName ;
495+ Routes [ RouteName ] . ContentDirectory = installPathRouteReal ;
496+
522497 return true ;
523498 }
524499
Original file line number Diff line number Diff line change @@ -759,7 +759,7 @@ public void LoadFolderList()
759759
760760 if ( ! initialized && Folders . Count == 0 )
761761 {
762- using ( var form = new OptionsForm ( Settings , UpdateManager , true ) )
762+ using ( var form = new DownloadContentForm ( Settings ) )
763763 {
764764 switch ( form . ShowDialog ( this ) )
765765 {
You can’t perform that action at this time.
0 commit comments