Beispiel #1
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Settings storage.</param>
        public void Load(SettingsStorage storage)
        {
            var drives = storage
                         .GetValue <IEnumerable <SettingsStorage> >(nameof(Drives))
                         .Select(s => s.LoadEntire <IMarketDataDrive>())
                         .ToArray();

            lock (_drives.SyncRoot)
            {
                foreach (var drive in drives)
                {
                    _drives.TryAdd2(CreatePair(drive.Path), drive);
                }
            }

            if (storage.ContainsKey(nameof(DefaultDrive)))
            {
                var pair = CreatePair(storage.GetValue <string>(nameof(DefaultDrive)));

                if (_drives.TryGetValue(pair, out var drive))
                {
                    DefaultDrive = drive;
                }
            }
        }