Esempio n. 1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (HasTimestamp)
            {
                hash ^= Timestamp.GetHashCode();
            }
            if (HasPositionAsOfTimestamp)
            {
                hash ^= PositionAsOfTimestamp.GetHashCode();
            }
            if (HasPlaybackSpeed)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(PlaybackSpeed);
            }
            if (HasIsPaused)
            {
                hash ^= IsPaused.GetHashCode();
            }
            if (currentTrack_ != null)
            {
                hash ^= CurrentTrack.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Esempio n. 2
0
 public void AddBytes(List <byte> bytes)
 {
     bytes.AddRange(Watermark);
     IsPaused.AddByte(bytes);
     EngineSnapshot.AddSnapshotBytes(bytes);
     MarkupContentLog.AddSnapshotBytes(bytes);
     ContinuationStatus.AddSnapshotBytes(bytes);
     Language.AddTextBytes(bytes);
     InputSpecs.AddSnapshotBytes(bytes);
     true.AddByte(bytes);
 }
Esempio n. 3
0
        public async Task <bool> HandlePause()
        {
            var ret = false;

            while (IsPaused != null && IsPaused.Invoke())
            {
                ret = true;
                await Task.Yield();
            }
            return(ret);
        }
Esempio n. 4
0
 public override string ToString()
 {
     return
         ($"{nameof(HasSong)}: {HasSong.ToString()}, " +
          $"{nameof(IsPaused)}: {IsPaused.ToString()}, " +
          $"{nameof(VolumePercent)}: {VolumePercent.ToString()}, " +
          $"{nameof(SeekbarCurrentPosition)}: {SeekbarCurrentPosition.ToString()}, " +
          $"{nameof(SeekbarCurrentPositionHuman)}: {SeekbarCurrentPositionHuman}, " +
          $"{nameof(StatePercent)}: {StatePercent.ToString()}, " +
          $"{nameof(LikeStatus)}: {LikeStatus}, " +
          $"{nameof(RepeatType)}: {RepeatType}");
 }
        private void buttonStart_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                btnPause.IsEnabled    = true;
                buttonStart.IsEnabled = false;
                IsPaused DelegatePause = this.IsPausedMRE;
                btnCancel.IsEnabled     = true;
                CancelationEnabled      = false;
                progressBaras.Value     = 0;
                cancellationTokenSource = new CancellationTokenSource();
                btnSelectFile.IsEnabled = false;
                //BackEnd.ArffCompiler.find(txtPath.Text,txtPattern.Text);
                string Path = txtPath.Text;
                if (ComboBoxas.Items.Count > 0)
                {
                    string[] AtributesSearchingFor = new string[ComboBoxas.Items.Count];
                    for (int i = 0; i < ComboBoxas.Items.Count; i++)
                    {
                        AtributesSearchingFor[i] = ComboBoxas.Items[i].ToString();
                    }

                    Thread Threadas = new Thread(delegate()
                    {
                        BackEnd.ArffCompiler.ExecuteSearch(AtributesSearchingFor, Path, cancellationTokenSource.Token, DelegatePause);
                    });
                    Threadas.Start();

                    Thread Progresas = new Thread(delegate()
                    {
                        ProgressBar();
                    });
                    Progresas.Start();
                }
                else
                {
                    System.Windows.MessageBox.Show("Prašome įvesti paieškos elementą", "Klaida!", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            catch (Exception exc)
            {
                System.Windows.MessageBox.Show(exc.Message, "Klaida!", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Esempio n. 6
0
        public SpriteEffect(JesterEntity owner, JesterSpriteEffectsConfig config, ParticleService particleService)
            : base(owner)
        {
            _config          = config;
            _particleService = particleService;

            Observable.EveryFixedUpdate()
            .Where(_ => !IsPaused.Value)
            .Subscribe(_ => OnUpdate())
            .AddTo(owner);

            owner.OnKicked
            .Subscribe(_ => OnKicked())
            .AddTo(owner);

            Owner.OnShot
            .Subscribe(_ => OnShot())
            .AddTo(Owner);

            Owner.Collisions.OnGround
            .Where(_ => _listenForImpacts)
            .Subscribe(_ => OnGround())
            .AddTo(Owner);

            Owner.Collisions.OnBoost
            .Subscribe(_ => OnBoost())
            .AddTo(Owner);

            IsPaused
            .Subscribe(OnPause)
            .AddTo(owner);

            owner.OnLanded
            .Subscribe(_ => OnLanded())
            .AddTo(owner);
        }
Esempio n. 7
0
 protected virtual void OnIsPaused(EventArgs e)
 {
     IsPaused?.Invoke(this, isPaused);
 }
Esempio n. 8
0
 public override void Initialize()
 {
     IsPaused.Subscribe(isPaused => { GoBody.simulated = !isPaused; })
     .AddTo(this);
 }
Esempio n. 9
0
        private void btnDecipher_Click(object sender, RoutedEventArgs e)
        {
            if (txtKey.Text != "" && txtKey.Text.Length > 15)
            {
                if (txtPath.Text != "")
                {
                    if (Directory.Exists(txtPath.Text))
                    {
                        BackEnd.Cryptor.Cancel(); //Pasalina aplankalus senus pradedant

                        Paused = false;
                        string path = txtPath.Text;
                        string key  = txtKey.Text;
                        ProgressBar1.Value       = 0;
                        BackEnd.Cryptor.HalfTime = 0;
                        ProgressBar1.Maximum     = 100;
                        encipher = false;

                        btnCipher.IsEnabled       = false;
                        btnDecipher.IsEnabled     = false;
                        btnSelectFolder.IsEnabled = false;

                        btnCancel.IsEnabled    = true;
                        btnStopnPlay.IsEnabled = true;

                        BackEnd.Cryptor.Execution = false;
                        cancellationTokenSource.Dispose();
                        cancellationTokenSource = new CancellationTokenSource();

                        IsPaused DelegatePause = this.IsPausedMRE;

                        ProgressBaras2 = new Thread(delegate()
                        {
                            ProgressBar(false, cancellationTokenSource.Token, DelegatePause);
                        });
                        ProgressBaras2.IsBackground = true;

                        ProgressBaras2.Start();

                        EstimatedTime2 = new Thread(delegate()
                        {
                            BackEnd.Cryptor.TimeMeasurment(path);
                        });
                        EstimatedTime2.IsBackground = true;
                        EstimatedTime2.Start();

                        DecriptionThread2 = new Thread(delegate()
                        {
                            BackEnd.Cryptor.Execution = true;
                            BackEnd.Cryptor.Decrypt(path, key, cancellationTokenSource.Token, DelegatePause);
                            BackEnd.Cryptor.Execution = false;
                        });
                        DecriptionThread2.IsBackground = true;
                        DecriptionThread2.Start();
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Tokia direktorija neegzistuoja", "Klaida", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    System.Windows.MessageBox.Show("Nepasirinkote direktorijos", "klaida", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            else
            {
                System.Windows.MessageBox.Show("Raktas turi buti sudarytas is 16 simbolių", "klaida", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Serialises the notification.
        /// </summary>
        /// <returns>
        /// The notification serialized as a byte array.
        /// </returns>
        public byte[] SerialiseNotification()
        {
            // Due to a Json.Net bug serialising int[] we construct this message manually
            string playlistString = string.Empty;

            if ((Playlist != null) && (Playlist.Length > 0))
            {
                foreach (int audioFileId in Playlist)
                {
                    playlistString += (!string.IsNullOrEmpty(playlistString) ? ", " : string.Empty) + audioFileId;
                }
            }
            string json = "{\"PlaylistPosition\":" + PlaylistPosition + ", \"Playlist\":[" + playlistString + "], \"IsPaused\":" + IsPaused.ToString().ToLower() + ", \"IsPlaying\":" + IsPlaying.ToString().ToLower() + ", \"Position\":" + Position + ", \"Duration\":" + Duration + ", \"IsRepeatAll\":" + IsRepeatAll.ToString().ToLower() + ", \"IsShuffle\":" + IsShuffle.ToString().ToLower() + ", \"CanMoveNext\":" + CanMoveNext.ToString().ToLower() + ", \"CanMovePrevious\":" + CanMovePrevious.ToString().ToLower() + "}";

            return(System.Text.Encoding.UTF8.GetBytes(json));
        }