Fix AvoidRepetitiveCastsRule defects

This fixes various AvoidRepetitiveCastsRule that were reported by
Gendarme.

This is for issue flibitijibibo/MonoGame#196.
Avoid use of `var`. Add braces on if statement
No touching Graphics/Shader
No more vars
Merge pull request #217 from Datyedyeguy/196_AvoidRepetitiveCastsRule

Fix AvoidRepetitiveCastsRule defects