public override void Initialize(string workingDir, bool createNotFound) { if (String.IsNullOrEmpty(workingDir)) { throw new InvalidOperationException(); } _quickStorage = new MemoryTargetStorage(); if (!Directory.Exists(workingDir)) { Directory.CreateDirectory(workingDir); } // For non-system, we will delete the directory after use... _targetDataDir = workingDir; _isExisted = PersistentDictionaryFile.Exists(_targetDataDir); if (_isExisted) { this.CheckDataIndex(_targetDataDir); _targetStorage = new PersistentDictionary <string, string>(_targetDataDir); if (_targetStorage.ContainsKey("$DataCount$")) { _count = Convert.ToInt32(_targetStorage["$DataCount$"]); if (_count <= 0) { _count = _targetStorage.Count; } } else { _count = _targetStorage.Count; } if (_useQuickTargets) { this.AddQuickTargets(); } } else { _count = 0; if (createNotFound) { _targetStorage = new PersistentDictionary <string, string>(_targetDataDir); } } if (_targetStorage != null) { _targetCache = new DatabaseTargetCache(100); } _isInitialized = true; }
public void Uninitialize() { try { if (_localStorage != null) { _localStorage.Dispose(); _localStorage = null; } if (_msdnStorage != null) { _msdnStorage.Dispose(); _msdnStorage = null; } } catch { } }
public MemoryTargetCollection() { _targetsStorage = new MemoryTargetStorage(); }
private TargetController() { _localStorage = new MemoryTargetStorage(); _msdnStorage = new DatabaseTargetTextStorage(true, false); }