Пример #1
0
        /// <summary>
        /// Führt einen Test für eine Quellgruppe aus.
        /// </summary>
        /// <param name="source">Eine beliebige Quelle auf der Quellgruppe.</param>
        /// <param name="streamIdentifier">Die zu verwendende Datenstromkennung.</param>
        /// <param name="callback">Die Methode zur Auswertung der Programmzeitschrift.</param>
        private void RunDescriptorTest(SourceSelection source, ushort streamIdentifier, Action <EIT> callback)
        {
            // Report it
            Console.WriteLine(source.Source);

            // Tune it
            source.SelectGroup();

            // Attach to the device
            var device = Hardware;

            // Attach EPG consumer
            Guid consumer = device.AddConsumer <EIT>(streamIdentifier, callback);

            try
            {
                // Start it
                device.SetConsumerState(consumer, true);

                // Process a while
                Thread.Sleep(500);
            }
            finally
            {
                // Detach EPG consumer
                device.SetConsumerState(consumer, null);
            }
        }
Пример #2
0
        /// <summary>
        /// Aktiviert eine einzelne Quelle für den <i>Zapping Modus</i>.
        /// </summary>
        /// <param name="selectionKey">Die gewünschte Quelle.</param>
        /// <param name="target">Die Netzwerkadresse, an die alle Daten versendet werden sollen.</param>
        /// <returns>Steuereinheit für diesen Aufruf.</returns>
        /// <exception cref="ArgumentNullException">Ein Parameter wurde nicht angegeben.</exception>
        public IAsyncResult <ServerInformation> BeginSetZappingSource(string selectionKey, string target)
        {
            // Validate
            if (string.IsNullOrEmpty(selectionKey))
            {
                throw new ArgumentNullException("selectionKey");
            }
            if (string.IsNullOrEmpty(target))
            {
                throw new ArgumentNullException("target");
            }

            // Create the selection
            var source = new SourceSelection {
                SelectionKey = selectionKey
            };

            // Check for profile match
            if (string.IsNullOrEmpty(m_Profile) || !string.Equals(m_Profile, source.ProfileName, StringComparison.InvariantCultureIgnoreCase))
            {
                CardServerException.Throw(new ProfileMismatchFault(m_Profile, source.ProfileName));
            }

            // Start action
            return((IAsyncResult <ServerInformation>)Start <ServerInformation>(() => { OnSetZappingSource(source, target); }));
        }
Пример #3
0
 /// <summary>
 /// Aktiviert eine einzelne Quelle für den <i>Zapping Modus</i>.
 /// </summary>
 /// <param name="source">Die gewünschte Quelle.</param>
 /// <param name="target">Die Netzwerkadresse, an die alle Daten versendet werden sollen.</param>
 protected override void OnSetZappingSource(SourceSelection source, string target)
 {
     // Process
     Execute(new SetZappingSourceRequest {
         SelectionKey = source.SelectionKey, Target = target
     });
 }
Пример #4
0
            /// <summary>
            /// Beginnt mit dem Laden von Quellinformationen.
            /// </summary>
            /// <param name="source">Die gewünschte Quelle.</param>
            /// <returns>Die Hintergrundaufgabe zum Laden der Quellinformationen.</returns>
            CancellableTask <SourceInformation> IDevice.GetSourceInformationAsync(SourceSelection source)
            {
                Assert.IsNotNull(m_currentSourceGroup, "not allocated");

                // Make it async
                return(CancellableTask <SourceInformation> .Run(cancel => m_currentSourceGroup.Contains( source )?new SourceInformation { Source = source.Source } : null));
            }
Пример #5
0
 /// <summary>
 /// Wählt eine bestimmte Quellgruppe (Transponder) an.
 /// </summary>
 /// <param name="selection">Die Beschreibung einer Quelle, deren Gruppe aktiviert werden soll.</param>
 /// <exception cref="ArgumentNullException">Es wurde keine Quellgruppe angegeben.</exception>
 /// <exception cref="CardServerException">Es wird bereits eine Anfrage ausgeführt.</exception>
 protected override void OnSelect(SourceSelection selection)
 {
     // Process
     Execute(new SelectRequest {
         SelectionKey = selection.SelectionKey
     });
 }
Пример #6
0
        /// <summary>
        /// Stellt sicher, dass für diesen Auftrag ein Geräteprprofil ausgewählt ist.
        /// </summary>
        internal void SetProfile()
        {
            // No need
            if (!string.IsNullOrEmpty(Source?.ProfileName))
            {
                return;
            }

            // Attach to the default profile
            var defaultProfile = VCRProfiles.DefaultProfile;

            if (defaultProfile == null)
            {
                return;
            }

            // Process
            if (Source == null)
            {
                Source = new SourceSelection {
                    ProfileName = defaultProfile.Name
                }
            }
            ;
            else
            {
                Source.ProfileName = defaultProfile.Name;
            }
        }
Пример #7
0
        /// <summary>
        /// Versucht einen Sender für die primäre Anzeige zu aktivieren.
        /// </summary>
        /// <param name="source">Der gewünschte Sender.</param>
        /// <param name="tx">Die aktuelle Änderungsumgebung.</param>
        /// <returns>Gesetzt, wenn die Aktivierung erfolgreich war.</returns>
        private Device EnsurePrimaryFeed(SourceSelection source, FeedTransaction tx)
        {
            // Make sure we can receive it
            var device = EnsureFeed(source);

            if (device != null)
            {
                return(device);
            }

            // See if there is any device we can free
            var availableDevice =
                m_devices
                .Where(cancidate => cancidate.ReusePossible)
                .Aggregate(default(Device), (best, test) => ((best != null) && (best.SecondaryFeeds.Count() <= test.SecondaryFeeds.Count())) ? best : test);

            // None
            if (availableDevice == null)
            {
                return(null);
            }

            // Stop all secondaries
            foreach (var secondaryFeed in availableDevice.SecondaryFeeds)
            {
                tx.DisableSecondaryView(secondaryFeed);
            }

            // Run test again - can not fail
            return(EnsureFeed(source));
        }
Пример #8
0
        /// <summary>
        /// Stellt den Empfang einer Quelle sicher.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        public void EnsureFeed(SourceSelection source)
        {
            // Unregister all outstanding requests
            ResetFeeds();

            // Stop current reader if active - and wait for cancel to finish
            if (m_groupReader != null)
            {
                m_groupReader.Cancel();
                m_groupReader.Wait();
            }

            // Create new
            m_groupReader = ProviderDevice.Activate(source);
            m_feeds       = _NoFeeds;

            // Start processing
            m_feedAwaiter = m_groupReader.ContinueWith(task =>
            {
                // Load feed data
                var sources = task.Result;
                if (sources != null)
                {
                    if (IsAllocated)
                    {
                        return(m_feeds = sources.Select(sourceOnGroup => new Feed(sourceOnGroup, this)).ToArray());
                    }
                }

                // None
                return(null);
            });
        }
        /// <summary>
        /// Ermittelt den aktuellen Zustand des Servers.
        /// </summary>
        /// <param name="device">Die verwendete DVB.NET Hardware.</param>
        /// <returns>Die gewünschten Daten.</returns>
        private ServerInformation CreateState(Hardware device)
        {
            // Create the current selection
            var selection =
                new SourceSelection
            {
                Location    = device.CurrentLocation,
                Source      = new SourceIdentifier(),
                Group       = device.CurrentGroup,
                ProfileName = Profile.Name
            };

            // Create the full monty
            var info =
                new ServerInformation
            {
                HasGroupInformation  = (device.GetGroupInformation(5000) != null),
                ProgramGuideProgress = EPGProgress,
                Selection            = selection.SelectionKey
            };

            // Finish EPG collection
            if (info.ProgramGuideProgress.HasValue)
            {
                info.CurrentProgramGuideItems = m_EPGItemCount;
            }

            // Read scan progress
            int scan = m_ScanProgress;

            if (scan >= 0)
            {
                // Fill
                info.UpdateSourceCount = m_ScanSources;
                info.UpdateProgress    = scan / 1000.0;
            }

            // All all streams
            info.Streams.AddRange(Streams.Values.Select(stream => stream.CreateInformation()));

            // Attach to NVOD service list
            var services = (m_ServiceParser == null) ? null : m_ServiceParser.ServiceMap;

            if (services != null)
            {
                info.Services = services.Select(service =>
                                                new ServiceInformation
                {
                    Service    = new SourceIdentifier(service.Key),
                    UniqueName = service.Value
                }).ToArray();
            }

            // Report
            return(info);
        }
Пример #10
0
        /// <summary>
        /// Erzeugt einen Schlüssel zu einer Quelle.
        /// </summary>
        /// <param name="source">Die Informationen zur Quelle.</param>
        /// <exception cref="ArgumentNullException">Es wurde keine Quelle angegeben.</exception>
        public GroupKey( SourceSelection source )
        {
            // Validate
            if (null == source)
                throw new ArgumentNullException( "source" );

            // Just remember
            Location = source.Location;
            Group = source.Group;
        }
Пример #11
0
 /// <summary>
 /// Prüft, ob eine bestimmte Quelle zu diesem Geräteprofil gehört.
 /// </summary>
 /// <param name="source">Die zu prüfende Quelle.</param>
 /// <returns>Gesetzt, wenn es sich um eine Quelle dieses Geräteprofil handelt.</returns>
 public bool IsResponsibleFor(SourceSelection source)
 {
     // Process
     if (null == source)
     {
         return(false);
     }
     else
     {
         return(ProfileManager.ProfileNameComparer.Equals(ProfileName, source.ProfileName));
     }
 }
Пример #12
0
        /// <summary>
        /// Validate that the user has specified the required settings
        /// </summary>
        /// <returns>True if everything is set up properly, false otherwise</returns>
        private bool ValidateSettings()
        {
            // Using the local file system for either the source or the target requires access to a cluster where we can make a temporary database
            if ((spcSource.SourceSelection == SourceSelection.FilePath() || spcTarget.SourceSelection == SourceSelection.FilePath()) &&
                !IsTempClusterDefined())
            {
                MessageBox.Show("Cannot compare without cluster setting.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }
Пример #13
0
        /// <summary>
        /// Ändert den aktuellen Sender oder wählt einen NVOD Dienst zum aktuellen
        /// Portal aus.
        /// </summary>
        /// <param name="source">Eine DVB.NET <see cref="SourceSelection"/>.</param>
        /// <param name="portal">Optional ein Portal.</param>
        /// <param name="service">Optional ein Dienst des Portals.</param>
        /// <returns>Name und Tonspur des neuen Senders oder <i>null</i>, wenn kein
        /// Senderwechsel suchgeführt wurde.</returns>
        private string SetStation(SourceSelection source, SourceSelection portal, ServiceItem service)
        {
            // Stop data transmission at once
            Accessor.Stop();

            // Get rid of stream and recording
            StopReceivers(false);

            // Tune
            source.SelectGroup();

            // Check for encryption
            var station = (Station)source.Source;

            if (station.IsEncrypted)
            {
                try
                {
                    // Request clean stream
                    Device.Decrypt(station);
                }
                catch
                {
                    // Ignore any error
                }
            }

            // Retrieve the source information
            var info = source.GetSourceInformationAsync().Result;

            // Remember
            CurrentSourceConfiguration = info;
            CurrentSelection           = source;
            CurrentService             = service;
            CurrentPortal = portal;
            CurrentEntry  = null;
            NextEntry     = null;

            // Reset EPG display
            ShowCurrentEntry();

            // Store to settings if not a service
            if (CurrentPortal == null)
            {
                LocalInfo.LocalStation = source.DisplayName;
            }

            // Load audio
            ResetAudio();

            // Choose
            return(LoadingDefaults ? null : SetAudio(null));
        }
Пример #14
0
        /// <summary>
        /// Erzeugt einen Schlüssel zu einer Quelle.
        /// </summary>
        /// <param name="source">Die Informationen zur Quelle.</param>
        /// <exception cref="ArgumentNullException">Es wurde keine Quelle angegeben.</exception>
        public GroupKey(SourceSelection source)
        {
            // Validate
            if (null == source)
            {
                throw new ArgumentNullException("source");
            }

            // Just remember
            Location = source.Location;
            Group    = source.Group;
        }
Пример #15
0
            /// <summary>
            /// Aktiviert den Empfang einer Quellgruppe.
            /// </summary>
            /// <param name="source">Eine Quelle der Gruppe.</param>
            /// <returns>Die Hintergrundaufgabe zur Aktivierung.</returns>
            CancellableTask <SourceSelection[]> IDevice.Activate(SourceSelection source)
            {
                // Find the source map
                var group = m_provider.AllAvailableSources.SingleOrDefault(g => g.Contains(source));

                Assert.IsNotNull(group, "no such source");

                m_currentSourceGroup = new HashSet <SourceSelection>();

                // Report
                return(CancellableTask <SourceSelection[]> .Run(cancel => (m_currentSourceGroup = group).ToArray()));
            }
 /// <summary>
 /// Erzeugt eine neue Auswahlinstanz abhängig von der jeweiligen Empfangsart.
 /// </summary>
 /// <param name="source">Die zu betrachtende Quelle.</param>
 /// <returns>Eine passende Auswahlinstanz.</returns>
 public static SourceGroupSelector Create( SourceSelection source )
 {
     // Attach to the related profile
     var groupType = source.GetProfile().GetGroupType();
     if (groupType == typeof( SatelliteGroup ))
         return new SatelliteGroupSelector( source );
     else if (groupType == typeof( CableGroup ))
         return new CableGroupSelector( source );
     else if (groupType == typeof( TerrestrialGroup ))
         return new TerrestrialGroupSelector( source );
     else
         throw new ArgumentException( groupType.Name, source.ProfileName );
 }
Пример #17
0
        /// <summary>
        /// Update the target to match the source
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Cursor lastCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            rtbSourceText.Text = "";

            // Figure out which differences were selected in the tree control
            var selectedNodes = new List <TreeNode>();

            foreach (TreeNode n in tvComparison.Nodes)
            {
                selectedNodes.AddRange(GetCheckedNodes(n));
            }

            if (!selectedNodes.Any())
            {
                MessageBox.Show(@"No differences were selected. Nothing to update in the target.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Save the changes either to disk or to Kusto
            if (spcTarget.SourceSelection == SourceSelection.FilePath())
            {
                PersistChanges(selectedNodes);
            }
            else
            {
                if (SettingsWrapper.KustoObjectDropWarning && selectedNodes.Any(n => n.Parent.Text == "Only In Target"))
                {
                    var dialogResult = new DropWarningForm().ShowDialog();
                    if (dialogResult != DialogResult.Yes)
                    {
                        MessageBox.Show("Operation has been canceled", "Canceled", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }

                using (var kustoQueryEngine = new QueryEngine(spcTarget.KustoConnection))
                {
                    PersistChanges(selectedNodes, kustoQueryEngine);
                }
            }

            tvComparison.Nodes.Clear();
            btnUpdate.Enabled = false;
            Cursor.Current    = lastCursor;

            MessageBox.Show(@"Target update is complete.", @"Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #18
0
        public void SetSource(SourceSelection source, bool preserveFilter = false)
        {
            _source = DefDatabase <ThingDef> .AllDefs.Where(x => !x.menuHidden).ToList <ThingDef>();

            _sourceGeneric = DefDatabase <LoadoutGenericDef> .AllDefs.OrderBy(g => g.label).ToList <LoadoutGenericDef>();

            if (!preserveFilter)
            {
                _filter = "";
            }

            switch (source)
            {
            case SourceSelection.Ranged:
                _source     = _source.Where(td => td.IsRangedWeapon).ToList();
                _sourceType = SourceSelection.Ranged;
                break;

            case SourceSelection.Melee:
                _source     = _source.Where(td => td.IsMeleeWeapon).ToList();
                _sourceType = SourceSelection.Melee;
                break;

            case SourceSelection.Ammo:
                _source     = _source.Where(td => td is AmmoDef).ToList();
                _sourceType = SourceSelection.Ammo;
                break;

            case SourceSelection.Minified:
                _source     = _source.Where(td => td.Minifiable).ToList();
                _sourceType = SourceSelection.Minified;
                break;

            case SourceSelection.Generic:
                _sourceType = SourceSelection.Generic;
                initGenericVisibilityDictionary();
                break;

            case SourceSelection.All:
            default:
                _source     = _source.Where(td => td.alwaysHaulable && td.thingClass != typeof(Corpse)).ToList();
                _sourceType = SourceSelection.All;
                break;
            }

            if (!_source.NullOrEmpty())
            {
                _source = _source.OrderBy(td => td.label).ToList();
            }
        }
            /// <summary>
            /// Erzeugt eine Hintergrundaufgabe zum Ermitteln von Quelldaten.
            /// </summary>
            /// <param name="source">Die gewünschte Quelle.</param>
            /// <returns>Eine neue passende Hintergrundaufgabe.</returns>
            public CancellableTask <SourceInformation> GetSourceInformationAsync(SourceSelection source)
            {
                // Make sure this device can map the source
                var localSource = m_profile.FindSource(source.Source).FirstOrDefault();

                if (localSource == null)
                {
                    throw new ArgumentException("bad source", "source");
                }
                else
                {
                    return(SourceInformationReader.GetSourceInformationAsync(localSource));
                }
            }
Пример #20
0
        /// <summary>
        /// Meldet eine vorgenommene Veränderung an der Konfiguration.
        /// </summary>
        /// <param name="source">Die Quelle, deren Konfiguration gerade angepasst wird.</param>
        /// <param name="item">Informationen zur Veränderung.</param>
        /// <param name="count">Die Anzahl der eingesparten Verbraucher.</param>
        private void Report(SourceSelection source, string item, int count)
        {
            // Report
            if (OptimizerTraceSwitch.Enabled)
            {
                Trace.WriteLine(string.Format(Properties.Resources.Trace_Optimizer_Report, source.DisplayName, item, count, source.Source), OptimizerTraceSwitch.DisplayName);
            }

            // Forward
            if (null != OnCorrect)
            {
                OnCorrect(source, item, count);
            }
        }
Пример #21
0
        /// <summary>
        /// Gibt alle verbundenen Ressourcen frei. Insbesondere wird eine laufende
        /// Aufzeichnung beendet.
        /// </summary>
        protected override void OnDispose()
        {
            // Stop data receiption.
            StopReceivers(false);

            // Forget
            CurrentSourceConfiguration = null;
            CurrentSelection           = null;
            CurrentAudio = null;
            CurrentEntry = null;
            NextEntry    = null;

            // Reset EPG display
            ShowCurrentEntry();
        }
            /// <summary>
            /// Erzeugt eine neue Repräsentation.
            /// </summary>
            /// <param name="source">Die zugehörige Quelle.</param>
            /// <exception cref="ArgumentNullException">Es wurde keine Quelle angegeben.</exception>
            public _Source(SourceSelection source)
            {
                // Validate
                if (source == null)
                {
                    throw new ArgumentNullException("source");
                }
                if (!(source.Source is Station))
                {
                    throw new ArgumentNullException("source");
                }

                // Remember
                Source = source;
            }
Пример #23
0
        /// <summary>
        /// Wählt eine bestimmte Quellgruppe (Transponder) an.
        /// </summary>
        /// <param name="server">Die Implementierung einer Geräteansteuerung.</param>
        /// <param name="selection">Die Beschreibung einer Quelle, deren Gruppe aktiviert werden soll.</param>
        /// <returns>Steuereinheit für diesen Aufruf.</returns>
        /// <exception cref="NullReferenceException">Es wurde keine Implementierung angegeben.</exception>
        /// <exception cref="ArgumentNullException">Es wurde keine Quellgruppe angegeben.</exception>
        /// <exception cref="CardServerException">Es wird bereits eine Anfrage ausgeführt.</exception>
        public static IAsyncResult BeginSelect(this ServerImplementation server, SourceSelection selection)
        {
            // Validate
            if (server == null)
            {
                throw new NullReferenceException("server");
            }
            if (selection == null)
            {
                throw new ArgumentNullException("selection");
            }

            // Forward
            return(server.BeginSelect(selection.SelectionKey));
        }
Пример #24
0
 /// <summary>
 /// Stellt sicher, dass für diesen Auftrag ein Geräteprprofil ausgewählt ist.
 /// </summary>
 /// <param name="defaultProfileName">Der Name des bevorzugten Geräteprofils.</param>
 internal void SetProfile(string defaultProfileName)
 {
     // No source at all
     if (Source == null)
     {
         Source = new SourceSelection {
             ProfileName = defaultProfileName
         }
     }
     ;
     else if (string.IsNullOrEmpty(Source.ProfileName))
     {
         Source.ProfileName = defaultProfileName;
     }
 }
Пример #25
0
        /// <summary>
        /// Ermittelt die aktuelle Konfiguration einer Quelle.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <returns>Die aktuelle Auswahl oder <i>null</i>.</returns>
        public static SourceSelection FindSource(SourceSelection source)
        {
            // Never
            if (source == null)
            {
                return(null);
            }
            if (source.Source == null)
            {
                return(null);
            }

            // Find the source
            return(FindSource(source.ProfileName, source.Source));
        }
Пример #26
0
        public void SetSource(SourceSelection source, bool preserveFilter = false)
        {
            _sourceGeneric = _allDefsGeneric;
            if (!preserveFilter)
            {
                _filter = "";
            }

            switch (source)
            {
            case SourceSelection.Ranged:
                _source     = _selectableItems.Where(row => row.thingDef.IsRangedWeapon).ToList();
                _sourceType = SourceSelection.Ranged;
                break;

            case SourceSelection.Melee:
                _source     = _selectableItems.Where(row => row.thingDef.IsMeleeWeapon).ToList();
                _sourceType = SourceSelection.Melee;
                break;

            case SourceSelection.Ammo:
                _source     = _selectableItems.Where(row => row.thingDef is AmmoDef).ToList();
                _sourceType = SourceSelection.Ammo;
                break;

            case SourceSelection.Minified:
                _source     = _selectableItems.Where(row => row.thingDef.Minifiable).ToList();
                _sourceType = SourceSelection.Minified;
                break;

            case SourceSelection.Generic:
                _sourceType = SourceSelection.Generic;
                initGenericVisibilityDictionary();
                break;

            case SourceSelection.All:
            default:
                _source     = _selectableItems;
                _sourceType = SourceSelection.All;
                break;
            }

            if (!_source.NullOrEmpty())
            {
                _source = _source.OrderBy(td => td.thingDef.label).ToList();
            }
        }
Пример #27
0
        /// <summary>
        /// Save the changes denoted by the selected nodes.
        /// </summary>
        /// <param name="selectedNodes">The changes to persist</param>
        /// <param name="kustoQueryEngine">Pass a connection to Kusto if the target is Kusto</param>
        private void PersistChanges(IEnumerable <TreeNode> selectedNodes, QueryEngine kustoQueryEngine = null)
        {
            void WriteToTarget(IKustoSchema schema)
            {
                if (spcTarget.SourceSelection == SourceSelection.FilePath())
                {
                    schema.WriteToFile(spcTarget.SourceFilePath);
                }
                else
                {
                    schema.WriteToKusto(kustoQueryEngine);
                }
            }

            void DeleteFromTarget(IKustoSchema schema)
            {
                if (spcTarget.SourceSelection == SourceSelection.Kusto())
                {
                    schema.DeleteFromKusto(kustoQueryEngine);
                }
                else
                {
                    schema.DeleteFromFolder(spcTarget.SourceFilePath);
                }
            }

            foreach (SchemaDifference difference in selectedNodes.Select(node => (SchemaDifference)node.Tag))
            {
                switch (difference.Schema)
                {
                case IKustoSchema update when
                    difference.Difference is Modified ||
                    difference.Difference is OnlyInSource:
                    WriteToTarget(update);
                    break;

                case IKustoSchema delete when
                    difference.Difference is OnlyInTarget:
                    DeleteFromTarget(delete);
                    break;

                default:
                    throw new InvalidOperationException("Unhandled type supplied.");
                }
            }
        }
Пример #28
0
        /// <summary>
        /// Fügt eine Quelle zur Aufzeichnung hinzu.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <param name="streams">Die Informationen zu den einzuschliessenden
        /// Teildatenströmen (PID).</param>
        /// <exception cref="ArgumentNullException">Ein Parameter wurde nicht angegeben.</exception>
        public void Add(SourceSelection source, StreamSelection streams)
        {
            // Validate
            if (null == source)
            {
                throw new ArgumentNullException("source");
            }
            if (null == streams)
            {
                throw new ArgumentNullException("streams");
            }

            // Remember
            m_Sources.Add(new SelectionInfo {
                Source = source, OriginalStreams = streams.Clone()
            });
        }
        /// <summary>
        /// Erstellt eine alternative Repräsentation einer Quelle.
        /// </summary>
        /// <param name="source">Die volle Beschreibung der Quelle.</param>
        /// <returns>Das Transferformat.</returns>
        public static TReal Create(SourceSelection source)
        {
            // Attach to the station
            var station = (Station)source.Source;

            // Construct
            var info = new TReal
            {
                IsEncrypted = station.IsEncrypted || station.IsService,
                Name        = source.GetUniqueName(),
            };

            // Finish setup
            info.OnCreate(station);

            // Report
            return(info);
        }
Пример #30
0
        /// <summary>
        /// Ermittelt den eindeutigen Namen einer Quelle.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <returns>Der eindeutige Name oder <i>null</i>, wenn die Quelle nicht
        /// bekannt ist..</returns>
        public static string GetUniqueName(SourceSelection source)
        {
            // Map to current
            var active = FindSource(source);

            if (active == null)
            {
                return(null);
            }

            // Find the name
            if (!CurrentState.UniqueNameBySelectionMap.TryGetValue(active.SelectionKey, out string name))
            {
                return(null);
            }

            // Report it
            return(name);
        }
Пример #31
0
        public void SetSource(SourceSelection source, bool preserveFilter = false)
        {
            _source = DefDatabase <ThingDef> .AllDefsListForReading;
            if (!preserveFilter)
            {
                _filter = "";
            }

            switch (source)
            {
            case SourceSelection.Ranged:
                _source     = _source.Where(td => td.IsRangedWeapon && !td.menuHidden).ToList();
                _sourceType = SourceSelection.Ranged;
                break;

            case SourceSelection.Melee:
                _source     = _source.Where(td => td.IsMeleeWeapon).ToList();
                _sourceType = SourceSelection.Melee;
                break;

            case SourceSelection.Ammo:
                _source     = _source.Where(td => td is AmmoDef).ToList();
                _sourceType = SourceSelection.Ammo;
                break;

            case SourceSelection.Minified:
                _source     = _source.Where(td => td.Minifiable).ToList();
                _sourceType = SourceSelection.Minified;
                break;

            case SourceSelection.All:
            default:
                _source     = _source.Where(td => td.alwaysHaulable && td.thingClass != typeof(Corpse)).ToList();
                _sourceType = SourceSelection.All;
                break;
            }

            if (!_source.NullOrEmpty())
            {
                _source = _source.OrderBy(td => td.label).ToList();
            }
        }
Пример #32
0
        /// <summary>
        /// Update the target to match the source
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            Cursor lastCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            rtbSourceText.Text = "";

            // Figure out which differences were selected in the tree control
            var selectedNodes = new List <TreeNode>();

            foreach (TreeNode n in tvComparison.Nodes)
            {
                selectedNodes.AddRange(GetCheckedNodes(n));
            }

            if (!selectedNodes.Any())
            {
                MessageBox.Show(@"No differences were selected. Nothing to update in the target.", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            // Save the changes either to disk or to Kusto
            if (spcTarget.SourceSelection == SourceSelection.FilePath())
            {
                PersistChanges(selectedNodes);
            }
            else
            {
                using (var kustoQueryEngine = new QueryEngine(spcTarget.KustoConnection))
                {
                    PersistChanges(selectedNodes, kustoQueryEngine);
                }
            }

            tvComparison.Nodes.Clear();
            btnUpdate.Enabled = false;
            Cursor.Current    = lastCursor;

            MessageBox.Show(@"Target update is complete.", @"Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Пример #33
0
        /// <summary>
        /// Gibt alle verbundenen Ressourcen frei. Insbesondere wird eine laufende
        /// Aufzeichnung beendet.
        /// </summary>
        protected override void OnDispose()
        {
            // Stop data receiption.
            StopReceivers( false );

            // Forget
            CurrentSourceConfiguration = null;
            CurrentSelection = null;
            CurrentAudio = null;
            CurrentEntry = null;
            NextEntry = null;

            // Reset EPG display
            ShowCurrentEntry();
        }
Пример #34
0
 /// <summary>
 /// Meldet an, dass später eine Quellgruppe auf dieser Anzeige zugeordnet werden soll.
 /// </summary>
 /// <param name="source">Die zugehörige Quelle.</param>
 public void Register( SourceSelection source )
 {
     // Remember
     m_AllRegistered[source.Group] = source;
 }
Пример #35
0
        /// <summary>
        /// Aktiviert die Verbraucherkontrolle für diese Quelle.
        /// </summary>
        /// <param name="source">Eine volle Referenz zur Quelle.</param>
        public void EnableOptimizer( SourceSelection source )
        {
            // Just register
            Manager.BeforeRecreateStream += manager =>
            {
                // Create a brand new optimizer
                var localOpt = new StreamSelectionOptimizer();

                // Add the one stream
                localOpt.Add( source, RequestedStreams );

                // Run the optimization
                if (localOpt.Optimize() == 1)
                    return localOpt.GetStreams( 0 );

                // Failed - activation is not possible
                return null;
            };
        }
 /// <summary>
 /// Erzeugt eine neue Auswahlinstanz.
 /// </summary>
 /// <param name="source">Die zu betrachtende Quelle.</param>
 public CableGroupSelector( SourceSelection source )
 {
     // Remember
     m_Group = (CableGroup) source.Group;
 }
Пример #37
0
 /// <summary>
 /// Führt einen Test für eine Quellgruppe aus.
 /// </summary>
 /// <param name="source">Eine beliebige Quelle auf der Quellgruppe.</param>
 /// <param name="streamIdentifier">Die zu verwendende Datenstromkennung.</param>
 private void RunDescriptorTest( SourceSelection source, ushort streamIdentifier )
 {
     // Forward
     RunDescriptorTest( source, streamIdentifier, TagValidator );
 }
Пример #38
0
        /// <summary>
        /// Führt einen Test für eine Quellgruppe aus.
        /// </summary>
        /// <param name="source">Eine beliebige Quelle auf der Quellgruppe.</param>
        /// <param name="streamIdentifier">Die zu verwendende Datenstromkennung.</param>
        /// <param name="callback">Die Methode zur Auswertung der Programmzeitschrift.</param>
        private void RunDescriptorTest( SourceSelection source, ushort streamIdentifier, Action<EIT> callback )
        {
            // Report it
            Console.WriteLine( source.Source );

            // Tune it
            source.SelectGroup();

            // Attach to the device
            var device = Hardware;

            // Attach EPG consumer
            Guid consumer = device.AddConsumer<EIT>( streamIdentifier, callback );
            try
            {
                // Start it
                device.SetConsumerState( consumer, true );

                // Process a while
                Thread.Sleep( 500 );
            }
            finally
            {
                // Detach EPG consumer
                device.SetConsumerState( consumer, null );
            }
        }
        /// <summary>
        /// Fügt eine Quelle zur Aufzeichnung hinzu.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <param name="streams">Die Informationen zu den einzuschliessenden
        /// Teildatenströmen (PID).</param>
        /// <exception cref="ArgumentNullException">Ein Parameter wurde nicht angegeben.</exception>
        public void Add( SourceSelection source, StreamSelection streams )
        {
            // Validate
            if (null == source)
                throw new ArgumentNullException( "source" );
            if (null == streams)
                throw new ArgumentNullException( "streams" );

            // Remember
            m_Sources.Add( new SelectionInfo { Source = source, OriginalStreams = streams.Clone() } );
        }
        /// <summary>
        /// Meldet eine vorgenommene Veränderung an der Konfiguration.
        /// </summary>
        /// <param name="source">Die Quelle, deren Konfiguration gerade angepasst wird.</param>
        /// <param name="item">Informationen zur Veränderung.</param>
        /// <param name="count">Die Anzahl der eingesparten Verbraucher.</param>
        private void Report( SourceSelection source, string item, int count )
        {
            // Report
            if (OptimizerTraceSwitch.Enabled)
                Trace.WriteLine( string.Format( Properties.Resources.Trace_Optimizer_Report, source.DisplayName, item, count, source.Source ), OptimizerTraceSwitch.DisplayName );

            // Forward
            if (null != OnCorrect)
                OnCorrect( source, item, count );
        }
Пример #41
0
        /// <summary>
        /// Ändert den aktuellen Sender oder wählt einen NVOD Dienst zum aktuellen
        /// Portal aus.
        /// </summary>
        /// <param name="source">Eine DVB.NET <see cref="SourceSelection"/>.</param>
        /// <param name="portal">Optional ein Portal.</param>
        /// <param name="service">Optional ein Dienst des Portals.</param>
        /// <returns>Name und Tonspur des neuen Senders oder <i>null</i>, wenn kein
        /// Senderwechsel suchgeführt wurde.</returns>
        private string SetStation( SourceSelection source, SourceSelection portal, ServiceItem service )
        {
            // Stop data transmission at once
            Accessor.Stop();

            // Get rid of stream and recording
            StopReceivers( false );

            // Tune
            source.SelectGroup();

            // Check for encryption
            var station = (Station) source.Source;
            if (station.IsEncrypted)
                try
                {
                    // Request clean stream
                    Device.Decrypt( station );
                }
                catch
                {
                    // Ignore any error
                }

            // Retrieve the source information
            var info = source.GetSourceInformationAsync().Result;

            // Remember
            CurrentSourceConfiguration = info;
            CurrentSelection = source;
            CurrentService = service;
            CurrentPortal = portal;
            CurrentEntry = null;
            NextEntry = null;

            // Reset EPG display
            ShowCurrentEntry();

            // Store to settings if not a service
            if (CurrentPortal == null)
                LocalInfo.LocalStation = source.DisplayName;

            // Load audio
            ResetAudio();

            // Choose
            return LoadingDefaults ? null : SetAudio( null );
        }
Пример #42
0
 /// <summary>
 /// Erzeugt eine neue Auswahl.
 /// </summary>
 /// <param name="source">Die zu verwaltende Quelle.</param>
 public SourceItem( SourceSelection source )
 {
     // Remember
     Source = source;
 }
 /// <summary>
 /// Erzeugt eine neue Auswahlinstanz.
 /// </summary>
 /// <param name="source">Die zu betrachtende Quelle.</param>
 public TerrestrialGroupSelector( SourceSelection source )
 {
     // Remember
     m_Group = (TerrestrialGroup) source.Group;
 }
Пример #44
0
 /// <summary>
 /// Führt einen Test für eine Quellgruppe aus.
 /// </summary>
 /// <param name="source">Eine beliebige Quelle auf der Quellgruppe.</param>
 private void RunDescriptorTest( SourceSelection source )
 {
     // Forward
     RunDescriptorTest( source, EIT.DefaultStreamIdentifier );
 }
 /// <summary>
 /// Erzeugt eine neue Auswahlinstanz.
 /// </summary>
 /// <param name="source">Die zu betrachtende Quelle.</param>
 public SatelliteGroupSelector( SourceSelection source )
 {
     // Remember
     m_Location = (SatelliteLocation) source.Location;
 }
Пример #46
0
 /// <summary>
 /// Führt einen Test für eine Quellgruppe aus.
 /// </summary>
 /// <param name="source">Eine beliebige Quelle auf der Quellgruppe.</param>
 /// <param name="callback">Die Methode zur Auswertung der Programmzeitschrift.</param>
 private void RunDescriptorTest( SourceSelection source, Action<EIT> callback )
 {
     // Forward
     RunDescriptorTest( source, EIT.DefaultStreamIdentifier, callback );
 }