private Dictionary <string, EmailAccountInfo> LoadAccounts() { Dictionary <string, EmailAccountInfo> accounts = new Dictionary <string, EmailAccountInfo>(); if (accountsDataFilePath != null) { List <String[]> ls = CSVUtil.ReadFromFile(this.accountsDataFilePath); //i start from 1, skip title for (int i = 1; i < ls.Count; i++) { if (ls[i].Length != CSVUtil.ColumnCount) { LogManager.SingleInstance.Log("Invalid account record found: {0}, it will be removed", ls[i]); continue; } String[] strArr = ls[i]; Dictionary <string, string> extendedProperties = null; extendedProperties = new Dictionary <string, string>(); extendedProperties[Constants.ExtendedParam_DGs] = strArr[(int)CSVUtil.AccountPropertyIndex.DistributionLists]; extendedProperties[Constants.KeyForwardEmail] = strArr[(int)CSVUtil.AccountPropertyIndex.KeyForwardEmail]; extendedProperties[Constants.KeyActiveSync] = strArr[(int)CSVUtil.AccountPropertyIndex.KeyActiveSync]; EmailAccountInfo info = new EmailAccountInfo(extendedProperties); if (strArr.Length > (int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses) { char[] splitters = { '|' }; if (!string.IsNullOrEmpty(strArr[(int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses])) { string[] emailAddresses = strArr[(int)CSVUtil.AccountPropertyIndex.AdditionalEmailAddresses].Split(splitters); foreach (string emailAddress in emailAddresses) { info.AdditionalEmailAddresses.Add(emailAddress); } } } info.AccountId = strArr[(int)CSVUtil.AccountPropertyIndex.AccountId]; info.DisplayName = strArr[(int)CSVUtil.AccountPropertyIndex.DisplayName]; info.PrimaryEmailAddress = strArr[(int)CSVUtil.AccountPropertyIndex.PrimaryEmailAddress]; bool parseResult = true; if (Boolean.TryParse(strArr[(int)CSVUtil.AccountPropertyIndex.Enabled], out parseResult)) { info.Enabled = parseResult; } info.FirstName = strArr[(int)CSVUtil.AccountPropertyIndex.FirstName]; info.LastName = strArr[(int)CSVUtil.AccountPropertyIndex.LastName]; LogManager.SingleInstance.Log("Account loaded: {0}", info.ToString()); accounts.Add(info.AccountId, info); } } return(accounts); }