private void PopulateProfile() { string storeSearchPath = Path.GetFullPath(this.profilePath); storeSearchPath = Path.Combine(storeSearchPath, ThunderbirdConstants.Mail); // Check if the store path exist. If it does not exists, quit. if (!Directory.Exists(storeSearchPath)) { return; } foreach (string storePath in Directory.GetDirectories(storeSearchPath)) { string storeName = Path.GetFileName(storePath); ThunderbirdStore store = new ThunderbirdStore(this, storeName, storeName, storePath); this.stores.Add(store); } }
// Checks whether the mbox file is present in a folder. private bool IsFolderPresentInStore(ThunderbirdStore store, string filePath) { foreach (ThunderbirdFolder folder in store.Folders) { if (this.IsFolderPresentInFolder(folder, filePath)) { return true; } } return false; }
public IStore OpenStore(string filePath) { filePath = Path.GetFullPath(filePath); // Check whether the mbox file has already been added to the list of // stores. if (this.IsStoreAdded(filePath)) { return null; } // Check if the file is being read by any other program. If it is // being read do not add it to the list. try { using (FileStream fileStream = File.OpenRead(filePath)) { // Just checking if the file can be opened. We don't need to do // anything. Using will take care of closing the filestream. } } catch (IOException) { return null; } ThunderbirdStore store = new ThunderbirdStore(filePath, this); this.stores.Add(store); this.storeFileNames.Add(filePath); return store; }