-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Several little improvements and minor functionality extending #50
Conversation
… == "" with String.IsNullOrEmpty(str) sealed StringAttribute because it is only contains text as attribute sealed SpotifyWebAPI class as it implements IDisposable Changed Exception catching where the Exception is not used to ignore the Exception object Removed Console.WriteLine("Exception: " + e.Message) int HttpProcessor.Process as it is a library function which might not be used in a console application
Organised using statements alphabetically
Changed Mute and UnMute function to work with both x86 and x64 processes on Windows 7 or newer Added functions to manipulate the Volume Control of Spotify
Wow, thanks for this PR, nice changes! 🌟 |
Imporved spelling in new commits
if (File.Exists("nircmd.dll")) | ||
DoNirCmd("muteappvolume spotify.exe 1"); | ||
//Windows < Windows Vista Check | ||
Contract.Requires(Environment.OSVersion.Version.Major >= 6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, after reading a bit about Contracts, I'm unsure if it's worth using here while we still have some normal "if-throw-else"-statements. So why did you chose this over "if-throw-else"-statements? Any particular reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh, I actually like the idea, but I wonder if it's good to put it in a library. ("if-throw-else" seems to be a more general solution, let me think and research a bit about it before changing 👍 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wikipedia article describes DbC really well, here is the link: https://en.wikipedia.org/wiki/Design_by_contract
Changed use of nullable return types to throw exceptions instead of returning null
So, any idea when this will be merged? I am currently working on a separate implementation of JSON.net, which could possibly remove the dependency, thus making the library a standalone module. I would like to create a new branch for that, but I will only start implementing it here once the existing pull request is merged. |
Will do shortly. Regarding json.Net: |
Several little improvements and minor functionality extending
@@ -207,6 +203,7 @@ public void Dispose() | |||
{ | |||
IsActive = false; | |||
_listener.Stop(); | |||
GC.SuppressFinalize(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for this call? @Mrnikbobjeff
When implementing the dispose pattern you might also add a finalizer to your class that calls Dispose(). This is to make sure that Dispose() always gets called, even if a client forgets to call it. To prevent the dispose method from running twice (in case the object already has been disposed) you add GC.SuppressFinalize(this);. The documentation provides a sample: class MyResource : IDisposable
} |
added the necessary code to check whether Spotify.exe and SpotifyWebHelper.exe actually exist and code which checks the location of SpotifyWebHelper.exe as mentioned in #48
replaced all occurances of checking whether a string is empty via str == ""; with String.IsNullOrEmpty(str);
sealed StringAttribute because it is only contains Text as an attribute
sealed SpotifyWebAPI class because it implements IDisposable
changed Exception catching where the Exception is not used to ignore the Exception object
removed Console.WriteLine("Exception: " + e.Message) in HttpProcessor.Process as it is a library function which might not be used in a console application
added capital letters for the first word in 3 Exception constructors
changed ruleset back to Microsoft Managed Recommended Rules
removed nircmd.dll and replaced internal mute function calls with the IAudioSession interface which works on Windows 7 or newer, #26 is solved by this
Added advanced volume control for spotify's volume mixer
beautified the code via codemaid to improve readability