예제 #1
0
        /// <summary>
        /// Sendet eine leere Anfrage zum Wechsel der Quellgruppe. Diese kann von allen Aktionen
        /// verwendet werden, um interne Zustände zu (re-)initialisieren.
        /// </summary>
        /// <param name="disableDecryptionReset">Gesetzt, um die Neuinitialisierung der Entschlüsselung
        /// zu deaktivieren.</param>
        private void SendEmptyTuneRequest(bool disableDecryptionReset = false)
        {
            // Process
            using (var tune = TuneToken.Create(TunePipeline, null, null))
                tune.Execute();
            if (!disableDecryptionReset)
            {
                using (var crypt = DecryptToken.Create(DecryptionPipeline, null))
                    crypt.Execute();
            }
            using (var sig = SignalToken.Create(SignalPipeline))
                sig.Execute();

            // Reset
            m_currentDecryption = s_NoSources;
        }
예제 #2
0
        /// <summary>
        /// Aktiviert die Entschlüsselung.
        /// </summary>
        /// <param name="sources">Die Liste der zu entschlüssenden Quellen.</param>
        public void Decrypt(params SourceIdentifier[] sources)
        {
            // Default it
            if (sources == null)
            {
                sources = s_NoSources;
            }

            // Not possible
            if (DecryptionPipeline.IsEmpty)
            {
                if (sources.Length < 1)
                {
                    return;
                }
                else
                {
                    throw new NotSupportedException();
                }
            }

            // See if we have to do anything - avoind changing decyrption if already active
            if (sources.Length > 0)
            {
                if (sources.Length == m_currentDecryption.Length)
                {
                    if (Enumerable.Range(0, sources.Length).All(index => Equals(sources[index], m_currentDecryption[index])))
                    {
                        return;
                    }
                }
            }

            // Create the token
            using (var token = DecryptToken.Create(DecryptionPipeline, sources))
                token.Execute();

            // Remember new decryption sources
            m_currentDecryption = sources;
        }