@@ -20,6 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
2121using GitAutoUpdateGUI . Properties ;
2222using System ;
23+ using System . Collections ;
2324using System . Collections . Generic ;
2425using System . Diagnostics ;
2526using System . Drawing ;
@@ -684,7 +685,7 @@ private void buttonUpdateVSProjects_Click(object sender, EventArgs e)
684685 return ;
685686 }
686687
687- var gitBinaryPath = "\\ Git\\ bin" ; // valid for x86 and x64 pc because of (x86) directory
688+ const string gitBinaryPath = "\\ Git\\ bin" ; // valid for x86 and x64 pc because of (x86) directory
688689 string pathVariable = Environment . GetEnvironmentVariable ( "Path" ) ;
689690 if ( pathVariable != null && ! ContainsIgnoreCase ( pathVariable , gitBinaryPath ) )
690691 {
@@ -877,6 +878,7 @@ private void buttonLoadVSProjects_Click(object sender, EventArgs e)
877878 }
878879
879880 Logger . Add ( textBoxLog , Translate ( "Searching for Visual Studio projects" ) ) ;
881+
880882 if ( checkBoxUnlistVSSolution . Checked && textBoxUnlistOldSolution . Text == string . Empty )
881883 {
882884 checkBoxUnlistVSSolution . Checked = false ;
@@ -920,7 +922,11 @@ private void buttonLoadVSProjects_Click(object sender, EventArgs e)
920922 if ( subfilteredDirs . Count != 0 )
921923 {
922924 //removing old or bad solution
923- if ( NotHavingWords ( tmpSolNameOnly , textBoxUnlistOldSolution . Text . Split ( ',' ) ) )
925+ if ( ! checkBoxUnlistVSSolution . Checked ||
926+ textBoxUnlistOldSolution . Text == string . Empty ||
927+ ( checkBoxUnlistVSSolution . Checked &&
928+ NotHavingWords ( tmpSolNameOnly , textBoxUnlistOldSolution . Text . Split ( ',' ) ,
929+ checkBoxCaseSensitive . Checked ) ) )
924930 {
925931 ListViewItem item1 = new ListViewItem ( tmpSolNameOnly ) { Checked = false } ;
926932 item1 . SubItems . Add ( tmpSolNameOnly ) ;
@@ -938,9 +944,37 @@ private void buttonLoadVSProjects_Click(object sender, EventArgs e)
938944 buttonUpdateVSProjects . Enabled = true ;
939945 }
940946
941- private static bool NotHavingWords ( string source , IEnumerable < string > badWords )
947+ private static bool NotHavingWords ( string source , IEnumerable < string > badWords , bool caseSensitive = false )
942948 {
943- return badWords . All ( badWord => ! source . Contains ( badWord ) ) ;
949+ bool result = true ;
950+ if ( caseSensitive )
951+ {
952+ // Linq version
953+ // if (badWords.Any(badWord => string.Compare(badWord.Trim(), source.Trim(), StringComparison.CurrentCulture) == 0))
954+ foreach ( string badWord in badWords )
955+ {
956+ if ( string . Compare ( badWord . Trim ( ) , source . Trim ( ) , StringComparison . CurrentCulture ) == 0 )
957+ {
958+ result = false ;
959+ break ;
960+ }
961+ }
962+
963+ return result ;
964+ }
965+
966+ // Linq version
967+ // if (badWords.Any(badWord => string.Compare(badWord.Trim(), source.Trim(), StringComparison.CurrentCultureIgnoreCase) == 0))
968+ foreach ( string badWord in badWords )
969+ {
970+ if ( string . Compare ( badWord . Trim ( ) , source . Trim ( ) , StringComparison . CurrentCultureIgnoreCase ) == 0 )
971+ {
972+ result = false ;
973+ break ;
974+ }
975+ }
976+
977+ return result ;
944978 }
945979
946980 private static string FrenchPlural ( int number , string currentLanguage = "english" )
0 commit comments