protected Settings(SerializationInfo info, StreamingContext context) : this() { try { User = (User)info.GetValue("User", typeof(User)); } catch { } //try { RememberPassword = info.GetBoolean("RememberPassword"); } //catch { } //try { AutoLogOnNextTime = info.GetBoolean("AutoLogOnNextTime"); } //catch { } //try { RememberLastChannel = info.GetBoolean("RememberLastChannel"); } //catch { } try { LastChannel = (Channel)info.GetValue("LastChannel", typeof(Channel)); } catch { } try { IsMuted = info.GetBoolean("IsMuted"); } catch { } try { Volume = info.GetDouble("Volume"); } catch { } try { SlideCoverWhenMouseMove = info.GetBoolean("SlideCoverWhenMouseMove"); } catch { } try { AlwaysShowNotifyIcon = info.GetBoolean("AlwaysShowNotifyIcon"); } catch { } try { AutoUpdate = info.GetBoolean("AutoUpdate"); } catch { } try { LastTimeCheckUpdate = info.GetDateTime("LastTimeCheckUpdate"); } catch { } try { OpenAlbumInfoWhenClickCover = info.GetBoolean("OpenAlbumInfoWhenClickCover"); } catch { } try { IsSearchFilterEnabled = info.GetBoolean("IsSearchFilterEnabled"); } catch { } try { ShowLyrics = info.GetBoolean("ShowLyrics"); } catch { } try { TopMost = info.GetBoolean("TopMost"); } catch { } try { ScaleTransform = info.GetDouble("ScaleTransform"); } catch { } try { ProxyKind = info.GetBoolean("EnableProxy") ? ProxyKinds.Custom : ProxyKinds.Default; } catch { try { ProxyKind = (ProxyKinds)info.GetValue("ProxyKind", typeof(ProxyKinds)); } catch { ProxyKind = ProxyKinds.Default; } } try { ProxyHost = info.GetString("ProxyHost"); } catch { } try { ProxyPort = info.GetInt32("ProxyPort"); } catch { } try { ProxyUsername = info.GetString("ProxyUsername"); } catch { } try { ProxyPassword = Encryption.Decrypt(info.GetString("ProxyPassword")); } catch { } try { AutoBackground = info.GetBoolean("AutoBackground"); } catch { } try { Background = (Color)ColorConverter.ConvertFromString(info.GetString("Background")); } catch { } try { FirstTime = info.GetBoolean("FirstTime"); } catch { } try { MainWindowFont = new FontFamily(info.GetString("MainWindowFont")); } catch { } try { ShowBalloonWhenSongChanged = info.GetBoolean("ShowBalloonWhenSongChanged"); } catch { } try { BackgroundTransparency = info.GetDouble("BackgroundTransparency"); } catch { } try { DownloadSite = (DownloadSite)info.GetValue("DownloadSite", typeof(DownloadSite)); } catch { } try { TrimBrackets = info.GetBoolean("TrimBrackets"); } catch { } try { SearchAlbum = info.GetBoolean("SearchAlbum"); } catch { } try { LocationLeft = info.GetDouble("LocationLeft"); } catch { } try { LocationTop = info.GetDouble("LocationTop"); } catch { } try { SpectrumColor = (Color)ColorConverter.ConvertFromString(info.GetString("SpectrumColor")); } catch { } try { SpectrumTransparency = info.GetDouble("SpectrumTransparency"); } catch { } try { ShowSpectrum = info.GetBoolean("ShowSpectrum"); } catch { } try { AdjustVolumeWithMouseWheel = info.GetBoolean("AdjustVolumeWithMouseWheel"); } catch { } try { UserKey = info.GetString("UserKey"); } catch { } try { FavoriteChannels = (List <Channel>)info.GetValue("FavoriteChannels", typeof(List <Channel>)); } catch { } //try { LastTimeLoggedOn = info.GetBoolean("LastTimeLoggedOn"); } //catch { } try { Device = (DeviceInfo?)info.GetValue("Device", typeof(DeviceInfo?)); } catch { } try { CultureInfo = (CultureInfo)info.GetValue("CultureInfo", typeof(CultureInfo)); } catch { } try { EnableDownloadRateRestriction = info.GetBoolean("EnableDownloadRateRestriction"); } catch { } //向下兼容 if (!AutoBackground && Background.A != 255) { BackgroundTransparency = 1 - (double)Background.A / 255; Background = Color.FromRgb(Background.R, Background.G, Background.B); } }
protected User(SerializationInfo info, StreamingContext context) { try { Username = info.GetString("Username"); } catch { } try { Password = Encryption.Decrypt(info.GetString("Password")); } catch { } try { UserID = info.GetString("UserID"); } catch { } try { Nickname = info.GetString("Nickname"); } catch { } try { Email = info.GetString("Email"); } catch { } try { Token = info.GetString("Token"); } catch { } try { Expire = info.GetString("Expire"); } catch { } try { Played = info.GetInt32("Played"); } catch { } try { Liked = info.GetInt32("Liked"); } catch { } try { Banned = info.GetInt32("Banned"); } catch { } try { IsPro = info.GetBoolean("IsPro"); } catch {} try { ProRate = (ProRate)info.GetValue("ProRate", typeof(ProRate)); } catch { } }