Hey all,
I know this is probably easy but I'm going cross eyed looking at my code. When I used
List<string> SOID; //SOID is the database name for the filepath
List<string> filesInDatabase = GetDatabaseFileName(out SOIDs);
List<string> filesOnServer = GetServerFileNames();
foreach ( string fileName in filesOnServer ){
string fileWpath = fileName;
string fileOnly = Path.GetFileNameWithoutExtension(fileName).ToString().ToLower();
if (filesInDatabase.Contains(fileOnly) ){
int index = filesInDatabase.IndexOf(fileOnly);
if (index >= 0){
if ( !File.Exists(SOIDs[index]) ){
everything works fine. When I needed to check those which the database did not contain the fileOnly by changing:
if (filesInDatabase.Contains(fileOnly) ){
to
if (!filesInDatabase.Contains(fileOnly) ){
after adding the ! - the program doesn't work properly. While stepping through it I noticed that the index is -1 every time.