예제 #1
0
        /// <inheritdoc />
        public void AddSynchronisationSource(ISynchronisationSource source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            if (source.Keys != null)
            {
                foreach (string key in source.Keys)
                {
                    foreach (ISynchronisationSource savedSource in Sources)
                    {
                        if (savedSource.Keys != null)
                        {
                            if (savedSource.Keys.Contains(key))
                            {
                                _logger.Warn($"The key {key} is added to a synchronisation handler by {source.GetType()} but is already provided by {savedSource.GetType()}. It is uncertain which key will be taken (possible performance decrease).");
                            }
                        }
                    }
                }
            }

            Sources.Add(source);
        }
예제 #2
0
 /// <inheritdoc />
 public bool RemoveSynchronisationSource(ISynchronisationSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException(nameof(source));
     }
     return(Sources.Remove(source));
 }
예제 #3
0
 /// <summary>
 /// Check if a source is contained.
 /// </summary>
 /// <param name="source">The source that will be checked.</param>
 /// <returns><c>True</c>, if the handler contains the source - <c>false</c> otherwise</returns>
 public bool ContainsSynchronisationSoruce(ISynchronisationSource source)
 {
     return(Sources.Contains(source));
 }