VB Code:
Private Sub CheckIt()
Dim X As Long, i As Long, iLenBuf As Integer, sRetBuf As String, sValue As String
sRetBuf$ = String$(256, 0)
iLenBuf% = Len(sRetBuf$)
For i = 0 To 256 ' The number of entries is actually a byte value, but it won't hurt.
X = GetPrivateProfileString("Game Files", "GameFile" & i, "", sRetBuf$, iLenBuf%, CurDir() & "\Morrowind.ini")
If Left$(sRetBuf$, X) = "MW Photographer_Album1.esp" And optAlbum1.Value = True Then
Exit For
ElseIf Left$(sRetBuf$, X) = "MW Photographer_Album2.esp" And optAlbum2.Value = True Then
Exit For
ElseIf Left$(sRetBuf$, X) = "MW Photographer_Album3.esp" And optAlbum3.Value = True Then
Exit For
ElseIf Left$(sRetBuf$, X) = "MW Photographer_Album4.esp" And optAlbum4.Value = True Then
Exit For
ElseIf optAlbum1.Value = True And (Left$(sRetBuf$, X) = "MW Photographer_Album2.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album3.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album4.esp") Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album1.esp", CurDir() & "\Morrowind.ini")
ElseIf optAlbum2.Value = True And (Left$(sRetBuf$, X) = "MW Photographer_Album1.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album3.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album4.esp") Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album2.esp", CurDir() & "\Morrowind.ini")
ElseIf optAlbum3.Value = True And (Left$(sRetBuf$, X) = "MW Photographer_Album2.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album1.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album4.esp") Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album3.esp", CurDir() & "\Morrowind.ini")
ElseIf optAlbum4.Value = True And (Left$(sRetBuf$, X) = "MW Photographer_Album2.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album3.esp" Or Left$(sRetBuf$, X) = "MW Photographer_Album1.esp") Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album4.esp", CurDir() & "\Morrowind.ini")
ElseIf Left$(sRetBuf$, X) = "" Then
If optAlbum1.Value = True Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album1.esp", CurDir() & "\Morrowind.ini")
ElseIf optAlbum1.Value = True Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album2.esp", CurDir() & "\Morrowind.ini")
ElseIf optAlbum2.Value = True Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album3.esp", CurDir() & "\Morrowind.ini")
ElseIf optAlbum3.Value = True Then
Call WritePrivateProfileString("Game Files", "GameFile" & CStr(i), "MW Photographer_Album4.esp", CurDir() & "\Morrowind.ini")
End If
Exit For
Else
Call MsgBox("There was a problem detecting your Morrowind installation. Please Reinstall.", vbOKOnly, "Error")
Unload frmMain
End
End If
Next
End Sub