[banshee] [Dap.{Ipod & AppleDevice}] Refactoring: throw earlier in UpdateInfo()



commit 783965dff4b8656e9ae27968fccc3e1d83a14d8b
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Sun Sep 19 15:33:30 2010 +0200

    [Dap.{Ipod & AppleDevice}] Refactoring: throw earlier in UpdateInfo()
    
    We move the throwing of ArgumentException to the start of the
    function so it's more readable and so we can remove the else{}
    block.

 .../AppleDeviceTrackInfo.cs                        |   74 ++++++++++----------
 .../Banshee.Dap.Ipod/IpodTrackInfo.cs              |   74 ++++++++++----------
 2 files changed, 74 insertions(+), 74 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs
index 9cd72e9..8956718 100644
--- a/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs
+++ b/src/Dap/Banshee.Dap.AppleDevice/Banshee.Dap.AppleDevice/AppleDeviceTrackInfo.cs
@@ -65,45 +65,45 @@ namespace Banshee.Dap.AppleDevice
 
         public void UpdateInfo (TrackInfo track)
         {
-            if (!(track is AppleDeviceTrackInfo)) {
-                IsCompilation = track.IsCompilation ;
-                AlbumArtist = track.AlbumArtist;
-                AlbumTitle = track.AlbumTitle;
-                ArtistName = track.ArtistName;
-                BitRate = track.BitRate;
-                SampleRate = track.SampleRate;
-                Bpm = track.Bpm;
-                Comment = track.Comment;
-                Composer = track.Composer;
-                Conductor = track.Conductor;
-                Copyright = track.Copyright;
-                DateAdded = track.DateAdded;
-                DiscCount = track.DiscCount;
-                DiscNumber = track.DiscNumber;
-                Duration = track.Duration;
-                FileSize = track.FileSize;
-                Genre = track.Genre;
-                Grouping = track.Grouping;
-                LastPlayed = track.LastPlayed;
-                LastSkipped = track.LastSkipped;
-                PlayCount = track.PlayCount;
-                Rating = track.Rating;
-                ReleaseDate = track.ReleaseDate;
-                SkipCount = track.SkipCount;
-                TrackCount = track.TrackCount;
-                TrackNumber = track.TrackNumber;
-                TrackTitle = track.TrackTitle;
-                Year = track.Year;
-                MediaAttributes = track.MediaAttributes;
-
-                var podcast_info = track.ExternalObject as IPodcastInfo;
-                if (podcast_info != null) {
-                    //description = podcast_info.Description;
-                    ReleaseDate = podcast_info.ReleaseDate;
-                }
-            } else {
+            if (track is AppleDeviceTrackInfo) {
                 throw new ArgumentException ("Shouldn't update an AppleDeviceTrackInfo from an AppleDeviceTrackInfo");
             }
+
+            IsCompilation = track.IsCompilation ;
+            AlbumArtist = track.AlbumArtist;
+            AlbumTitle = track.AlbumTitle;
+            ArtistName = track.ArtistName;
+            BitRate = track.BitRate;
+            SampleRate = track.SampleRate;
+            Bpm = track.Bpm;
+            Comment = track.Comment;
+            Composer = track.Composer;
+            Conductor = track.Conductor;
+            Copyright = track.Copyright;
+            DateAdded = track.DateAdded;
+            DiscCount = track.DiscCount;
+            DiscNumber = track.DiscNumber;
+            Duration = track.Duration;
+            FileSize = track.FileSize;
+            Genre = track.Genre;
+            Grouping = track.Grouping;
+            LastPlayed = track.LastPlayed;
+            LastSkipped = track.LastSkipped;
+            PlayCount = track.PlayCount;
+            Rating = track.Rating;
+            ReleaseDate = track.ReleaseDate;
+            SkipCount = track.SkipCount;
+            TrackCount = track.TrackCount;
+            TrackNumber = track.TrackNumber;
+            TrackTitle = track.TrackTitle;
+            Year = track.Year;
+            MediaAttributes = track.MediaAttributes;
+
+            var podcast_info = track.ExternalObject as IPodcastInfo;
+            if (podcast_info != null) {
+                //description = podcast_info.Description;
+                ReleaseDate = podcast_info.ReleaseDate;
+            }
         }
 
         private void LoadFromIpodTrack ()
diff --git a/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs b/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
index 9d83e30..46edf1a 100644
--- a/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
+++ b/src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
@@ -73,45 +73,45 @@ namespace Banshee.Dap.Ipod
 
         public void UpdateInfo (TrackInfo track)
         {
-            if (!(track is IpodTrackInfo)) {
-                AlbumArtist = track.AlbumArtist;
-                AlbumTitle = track.AlbumTitle;
-                ArtistName = track.ArtistName;
-                BitRate = track.BitRate;
-                SampleRate = track.SampleRate;
-                Bpm = track.Bpm;
-                Comment = track.Comment;
-                Composer = track.Composer;
-                Conductor = track.Conductor;
-                Copyright = track.Copyright;
-                DateAdded = track.DateAdded;
-                DiscCount = track.DiscCount;
-                DiscNumber = track.DiscNumber;
-                Duration = track.Duration;
-                FileSize = track.FileSize;
-                Genre = track.Genre;
-                Grouping = track.Grouping;
-                IsCompilation = track.IsCompilation ;
-                LastPlayed = track.LastPlayed;
-                LastSkipped = track.LastSkipped;
-                PlayCount = track.PlayCount;
-                Rating = track.Rating;
-                ReleaseDate = track.ReleaseDate;
-                SkipCount = track.SkipCount;
-                TrackCount = track.TrackCount;
-                TrackNumber = track.TrackNumber;
-                TrackTitle = track.TrackTitle;
-                Year = track.Year;
-                MediaAttributes = track.MediaAttributes;
-
-                var podcast_info = track.ExternalObject as IPodcastInfo;
-                if (podcast_info != null) {
-                    description = podcast_info.Description;
-                    ReleaseDate = podcast_info.ReleaseDate;
-                }
-            } else {
+            if (track is IpodTrackInfo) {
                 throw new ArgumentException ("Shouldn't update an IpodTrackInfo from an IpodTrackInfo");
             }
+
+            AlbumArtist = track.AlbumArtist;
+            AlbumTitle = track.AlbumTitle;
+            ArtistName = track.ArtistName;
+            BitRate = track.BitRate;
+            SampleRate = track.SampleRate;
+            Bpm = track.Bpm;
+            Comment = track.Comment;
+            Composer = track.Composer;
+            Conductor = track.Conductor;
+            Copyright = track.Copyright;
+            DateAdded = track.DateAdded;
+            DiscCount = track.DiscCount;
+            DiscNumber = track.DiscNumber;
+            Duration = track.Duration;
+            FileSize = track.FileSize;
+            Genre = track.Genre;
+            Grouping = track.Grouping;
+            IsCompilation = track.IsCompilation ;
+            LastPlayed = track.LastPlayed;
+            LastSkipped = track.LastSkipped;
+            PlayCount = track.PlayCount;
+            Rating = track.Rating;
+            ReleaseDate = track.ReleaseDate;
+            SkipCount = track.SkipCount;
+            TrackCount = track.TrackCount;
+            TrackNumber = track.TrackNumber;
+            TrackTitle = track.TrackTitle;
+            Year = track.Year;
+            MediaAttributes = track.MediaAttributes;
+
+            var podcast_info = track.ExternalObject as IPodcastInfo;
+            if (podcast_info != null) {
+                description = podcast_info.Description;
+                ReleaseDate = podcast_info.ReleaseDate;
+            }
         }
 
         private void LoadFromIpodTrack ()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]