public void Save(string directoryPath) { if (_disposed) { throw new ObjectDisposedException(this.GetType().FullName); } if (!_isLoaded) { throw new OutoposManagerException("OutoposManager is not loaded."); } lock (this.ThisLock) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); List <Task> tasks = new List <Task>(); tasks.Add(Task.Factory.StartNew(() => _uploadManager.Save(System.IO.Path.Combine(directoryPath, "UploadManager")))); tasks.Add(Task.Factory.StartNew(() => _downloadManager.Save(System.IO.Path.Combine(directoryPath, "DownloadManager")))); Task.WaitAll(tasks.ToArray()); _connectionsManager.Save(System.IO.Path.Combine(directoryPath, "ConnectionManager")); _cacheManager.Save(System.IO.Path.Combine(directoryPath, "CacheManager")); _serverManager.Save(System.IO.Path.Combine(directoryPath, "ServerManager")); _clientManager.Save(System.IO.Path.Combine(directoryPath, "ClientManager")); stopwatch.Stop(); Debug.WriteLine("Settings Save {0} {1}", Path.GetFileName(directoryPath), stopwatch.ElapsedMilliseconds); } }