public override int GetHashCode() { unchecked { int hashCode = IsMuted.GetHashCode(); hashCode = (hashCode * 397) ^ Name.GetHashCode(); hashCode = (hashCode * 397) ^ Id; hashCode = (hashCode * 397) ^ OwnerId; hashCode = (hashCode * 397) ^ CodecSettings.GetHashCode(); return(hashCode); } }
public bool Equals(AudioSource other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(IsMuted.Equals(other.IsMuted) && string.Equals(Name, other.Name) && Id == other.Id && OwnerId == other.OwnerId && CodecSettings.Equals(other.CodecSettings)); }
//----------------------------------------------------------------------------- // Preferences //----------------------------------------------------------------------------- public static void SavePreferences() { try { XmlDocument doc = new XmlDocument(); XmlElement element; XmlElement root = doc.CreateElement("PGPlayer"); doc.AppendChild(root); element = doc.CreateElement("ShowSoundVisualizer"); element.AppendChild(doc.CreateTextNode(ShowSoundVisualizer.ToString())); root.AppendChild(element); element = doc.CreateElement("MediumIncrement"); element.AppendChild(doc.CreateTextNode(MediumIncrement.ToString())); root.AppendChild(element); element = doc.CreateElement("LargeIncrement"); element.AppendChild(doc.CreateTextNode(LargeIncrement.ToString())); root.AppendChild(element); element = doc.CreateElement("VideoScale"); element.AppendChild(doc.CreateTextNode(VideoScale.ToString())); root.AppendChild(element); element = doc.CreateElement("ForceNearestNeighbor"); element.AppendChild(doc.CreateTextNode(ForceNearestNeighbor.ToString())); root.AppendChild(element); element = doc.CreateElement("Volume"); element.AppendChild(doc.CreateTextNode(Volume.ToString())); root.AppendChild(element); element = doc.CreateElement("IsMuted"); element.AppendChild(doc.CreateTextNode(IsMuted.ToString())); root.AppendChild(element); element = doc.CreateElement("AutoPlay"); element.AppendChild(doc.CreateTextNode(AutoPlay.ToString())); root.AppendChild(element); element = doc.CreateElement("ShowBookmarkTimes"); element.AppendChild(doc.CreateTextNode(ShowBookmarkTimes.ToString())); root.AppendChild(element); doc.Save(PreferencesFile); } catch (Exception) { } }
public static void Serialize(StreamWriter SW) { SW.WriteLine("MediaSource"); SW.Write("Volume:\t" + Volume.ToString() + "\n"); SW.Write("IsMuted:\t" + IsMuted.ToString() + "\n"); SW.Write("IsLooping:\t" + IsLooping.ToString() + "\n"); if (Song != null) { SW.Write("Song:\t" + Song.Name + "\n"); } else { SW.Write("Song:\t" + "null\n"); } SW.WriteLine("End Of MediaSource"); }
public LiveVideoPlayerControlViewModel( HohoemaApp hohoemaApp, PageManager pageManager, TextInputDialogService textInputDialogService, ToastNotificationService toast ) : base(hohoemaApp, pageManager, canActivateBackgroundUpdate: true) { _TextInputDialogService = textInputDialogService; _ToastNotificationService = toast; MediaPlayer = HohoemaApp.MediaPlayer; // play CurrentState = new ReactiveProperty <MediaElementState>(); NowPlaying = CurrentState.Select(x => x == MediaElementState.Playing) .ToReactiveProperty(); NowUpdating = new ReactiveProperty <bool>(false); LivePlayerType = new ReactiveProperty <Models.Live.LivePlayerType?>(); CanChangeQuality = new ReactiveProperty <bool>(false); RequestQuality = new ReactiveProperty <string>(); CurrentQuality = new ReactiveProperty <string>(); IsAvailableSuperLowQuality = new ReactiveProperty <bool>(false); IsAvailableLowQuality = new ReactiveProperty <bool>(false); IsAvailableNormalQuality = new ReactiveProperty <bool>(false); IsAvailableHighQuality = new ReactiveProperty <bool>(false); ChangeQualityCommand = new DelegateCommand <string>( (quality) => { NicoLiveVideo.ChangeQualityRequest(quality).ConfigureAwait(false); HohoemaApp.UserSettings.PlayerSettings.DefaultLiveQuality = quality; HohoemaApp.UserSettings.PlayerSettings.Save().ConfigureAwait(false); }, (quality) => NicoLiveVideo.Qualities.Any(x => x == quality) ); IsVisibleComment = new ReactiveProperty <bool>(PlayerWindowUIDispatcherScheduler, true).AddTo(_CompositeDisposable); CommentCanvasHeight = new ReactiveProperty <double>(PlayerWindowUIDispatcherScheduler, 0.0).AddTo(_CompositeDisposable); CommentDefaultColor = new ReactiveProperty <Color>(PlayerWindowUIDispatcherScheduler, Colors.White).AddTo(_CompositeDisposable); CommentOpacity = HohoemaApp.UserSettings.PlayerSettings.ObserveProperty(x => x.CommentOpacity) .Select(x => x.ToOpacity()) .ToReadOnlyReactiveProperty(eventScheduler: PlayerWindowUIDispatcherScheduler); // post comment WritingComment = new ReactiveProperty <string>(PlayerWindowUIDispatcherScheduler, "").AddTo(_CompositeDisposable); NowCommentWriting = new ReactiveProperty <bool>(PlayerWindowUIDispatcherScheduler).AddTo(_CompositeDisposable); NowSubmittingComment = new ReactiveProperty <bool>(PlayerWindowUIDispatcherScheduler).AddTo(_CompositeDisposable); // TODO: ニコ生での匿名コメント設定 CommandString = new ReactiveProperty <string>(PlayerWindowUIDispatcherScheduler, "").AddTo(_CompositeDisposable); CommandEditerVM = new CommentCommandEditerViewModel(true /* isDefaultAnnonymous */); CommandEditerVM.OnCommandChanged += CommandEditerVM_OnCommandChanged; CommandEditerVM.ChangeEnableAnonymity(true); CommandEditerVM.IsAnonymousComment.Value = true; CommandEditerVM_OnCommandChanged(); CommentSubmitCommand = Observable.CombineLatest( WritingComment.Select(x => !string.IsNullOrEmpty(x)), NowSubmittingComment.Select(x => !x) ) .Select(x => x.All(y => y)) .ToReactiveCommand(PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); CommentSubmitCommand.Subscribe(async x => { if (NicoLiveVideo != null) { NowSubmittingComment.Value = true; await NicoLiveVideo.PostComment(WritingComment.Value, CommandString.Value, LiveElapsedTime); } }); // operation command PermanentDisplayText = new ReactiveProperty <string>(PlayerWindowUIDispatcherScheduler, "").AddTo(_CompositeDisposable); // sound IsFullScreen = new ReactiveProperty <bool>(PlayerWindowUIDispatcherScheduler, false).AddTo(_CompositeDisposable); IsFullScreen .Subscribe(isFullScreen => { var appView = ApplicationView.GetForCurrentView(); if (isFullScreen) { if (!appView.TryEnterFullScreenMode()) { IsFullScreen.Value = false; } } else { appView.ExitFullScreenMode(); } }) .AddTo(_CompositeDisposable); IsSmallWindowModeEnable = HohoemaApp.Playlist .ToReactivePropertyAsSynchronized(x => x.IsPlayerFloatingModeEnable); IsAutoHideEnable = Observable.CombineLatest( NowPlaying , NowCommentWriting.Select(x => !x) ) .Select(x => x.All(y => y)) .ToReactiveProperty(PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); Suggestion = new ReactiveProperty <LiveSuggestion>(); HasSuggestion = Suggestion.Select(x => x != null) .ToReactiveProperty(); AutoHideDelayTime = HohoemaApp.UserSettings.PlayerSettings .ToReactivePropertyAsSynchronized(x => x.AutoHidePlayerControlUIPreventTime, PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); IsDisplayControlUI = HohoemaApp.Playlist.ToReactivePropertyAsSynchronized(x => x.IsDisplayPlayerControlUI); IsMuted = HohoemaApp.UserSettings.PlayerSettings .ToReactivePropertyAsSynchronized(x => x.IsMute, PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); IsMuted.Subscribe(isMuted => { MediaPlayer.IsMuted = isMuted; }) .AddTo(_CompositeDisposable); SoundVolume = HohoemaApp.UserSettings.PlayerSettings .ToReactivePropertyAsSynchronized(x => x.SoundVolume, PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); SoundVolume.Subscribe(volume => { MediaPlayer.Volume = volume; }) .AddTo(_CompositeDisposable); CommentUpdateInterval = HohoemaApp.UserSettings.PlayerSettings.ObserveProperty(x => x.CommentRenderingFPS) .Select(x => TimeSpan.FromSeconds(1.0 / x)) .ToReactiveProperty() .AddTo(_CompositeDisposable); RequestCommentDisplayDuration = HohoemaApp.UserSettings.PlayerSettings .ObserveProperty(x => x.CommentDisplayDuration) .ToReactiveProperty(PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); CommentFontScale = HohoemaApp.UserSettings.PlayerSettings .ObserveProperty(x => x.DefaultCommentFontScale) .ToReactiveProperty(PlayerWindowUIDispatcherScheduler) .AddTo(_CompositeDisposable); IsForceLandscape = new ReactiveProperty <bool>(PlayerWindowUIDispatcherScheduler, HohoemaApp.UserSettings.PlayerSettings.IsForceLandscape); IsStillLoggedInTwitter = new ReactiveProperty <bool>(!TwitterHelper.IsLoggedIn) .AddTo(_CompositeDisposable); }