@@ -162,10 +162,12 @@ public StatusResponse GetStatus()
162162 public void Mute ( )
163163 {
164164 //Windows < Windows Vista Check
165- Contract . Requires ( Environment . OSVersion . Version . Major >= 6 ) ;
165+ if ( Environment . OSVersion . Version . Major < 6 )
166+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
166167 //Windows Vista Check
167168 if ( Environment . OSVersion . Version . Major == 6 )
168- Contract . Requires ( Environment . OSVersion . Version . Minor != 0 ) ;
169+ if ( Environment . OSVersion . Version . Minor == 0 )
170+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
169171 VolumeMixerControl . MuteSpotify ( true ) ;
170172 }
171173
@@ -175,24 +177,28 @@ public void Mute()
175177 public void UnMute ( )
176178 {
177179 //Windows < Windows Vista Check
178- Contract . Requires ( Environment . OSVersion . Version . Major >= 6 ) ;
180+ if ( Environment . OSVersion . Version . Major < 6 )
181+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
179182 //Windows Vista Check
180183 if ( Environment . OSVersion . Version . Major == 6 )
181- Contract . Requires ( Environment . OSVersion . Version . Minor != 0 ) ;
184+ if ( Environment . OSVersion . Version . Minor == 0 )
185+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
182186 VolumeMixerControl . MuteSpotify ( false ) ;
183187 }
184188
185189 /// <summary>
186190 /// Checks whether Spotify is muted in the Volume Mixer control (required Windows 7 or newer)
187191 /// </summary>
188192 /// <returns>Null if an error occured, otherwise the muted state</returns>
189- public bool ? IsSpotifyMuted ( )
193+ public bool IsSpotifyMuted ( )
190194 {
191195 //Windows < Windows Vista Check
192- Contract . Requires ( Environment . OSVersion . Version . Major >= 6 ) ;
196+ if ( Environment . OSVersion . Version . Major < 6 )
197+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
193198 //Windows Vista Check
194199 if ( Environment . OSVersion . Version . Major == 6 )
195- Contract . Requires ( Environment . OSVersion . Version . Minor != 0 ) ;
200+ if ( Environment . OSVersion . Version . Minor == 0 )
201+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
196202 return VolumeMixerControl . IsSpotifyMuted ( ) ;
197203 }
198204
@@ -202,26 +208,31 @@ public void UnMute()
202208 /// <param name="volume">A value between 0 and 100</param>
203209 public void SetSpotifyVolume ( float volume = 100 )
204210 {
205- Contract . Requires ( 0 <= volume && volume <= 100 ) ;
206211 //Windows < Windows Vista Check
207- Contract . Requires ( Environment . OSVersion . Version . Major >= 6 ) ;
212+ if ( Environment . OSVersion . Version . Major < 6 )
213+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
208214 //Windows Vista Check
209215 if ( Environment . OSVersion . Version . Major == 6 )
210- Contract . Requires ( Environment . OSVersion . Version . Minor != 0 ) ;
216+ if ( Environment . OSVersion . Version . Minor == 0 )
217+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
218+ if ( volume < 0 || volume > 100 )
219+ throw new ArgumentOutOfRangeException ( "Volume parameter has to be a value between 0 and 100" ) ;
211220 VolumeMixerControl . SetSpotifyVolume ( volume ) ;
212221 }
213222
214223 /// <summary>
215224 /// Return the Volume Mixer volume of Spotify (requires Windows 7 or newer)
216225 /// </summary>
217226 /// <returns>Null if an error occured, otherwise a float between 0 and 100</returns>
218- public float ? GetSpotifyVolume ( )
227+ public float GetSpotifyVolume ( )
219228 {
220229 //Windows < Windows Vista Check
221- Contract . Requires ( Environment . OSVersion . Version . Major >= 6 ) ;
230+ if ( Environment . OSVersion . Version . Major < 6 )
231+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
222232 //Windows Vista Check
223233 if ( Environment . OSVersion . Version . Major == 6 )
224- Contract . Requires ( Environment . OSVersion . Version . Minor != 0 ) ;
234+ if ( Environment . OSVersion . Version . Minor == 0 )
235+ throw new NotSupportedException ( "This feature is only available on Windows 7 or newer" ) ;
225236 return VolumeMixerControl . GetSpotifyVolume ( ) ;
226237 }
227238
0 commit comments