public HttpAccount GetHttpAccount(ConversionProfile profile) { var httpAccountId = profile.HttpSettings.AccountId; if (string.IsNullOrWhiteSpace(httpAccountId)) { return(null); } return(HttpAccounts.FirstOrDefault(x => x.AccountId == httpAccountId)); }
public override string ToString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < DropboxAccounts.Count; i++) { sb.AppendLine(DropboxAccounts.ToString()); } for (int i = 0; i < FtpAccounts.Count; i++) { sb.AppendLine(FtpAccounts.ToString()); } for (int i = 0; i < HttpAccounts.Count; i++) { sb.AppendLine(HttpAccounts.ToString()); } for (int i = 0; i < SmtpAccounts.Count; i++) { sb.AppendLine(SmtpAccounts.ToString()); } for (int i = 0; i < TimeServerAccounts.Count; i++) { sb.AppendLine(TimeServerAccounts.ToString()); } return(sb.ToString()); }
public void ReplaceWith(Accounts source) { DropboxAccounts.Clear(); for (int i = 0; i < source.DropboxAccounts.Count; i++) { DropboxAccounts.Add(source.DropboxAccounts[i].Copy()); } FtpAccounts.Clear(); for (int i = 0; i < source.FtpAccounts.Count; i++) { FtpAccounts.Add(source.FtpAccounts[i].Copy()); } HttpAccounts.Clear(); for (int i = 0; i < source.HttpAccounts.Count; i++) { HttpAccounts.Add(source.HttpAccounts[i].Copy()); } SmtpAccounts.Clear(); for (int i = 0; i < source.SmtpAccounts.Count; i++) { SmtpAccounts.Add(source.SmtpAccounts[i].Copy()); } TimeServerAccounts.Clear(); for (int i = 0; i < source.TimeServerAccounts.Count; i++) { TimeServerAccounts.Add(source.TimeServerAccounts[i].Copy()); } }
public void ReadValues(Data data, string path) { try { int numClasses = int.Parse(data.GetValue(@"" + path + @"DropboxAccounts\numClasses")); for (int i = 0; i < numClasses; i++) { DropboxAccount tmp = new DropboxAccount(); tmp.ReadValues(data, @"" + path + @"DropboxAccounts\" + i + @"\"); DropboxAccounts.Add(tmp); } } catch {} try { int numClasses = int.Parse(data.GetValue(@"" + path + @"FtpAccounts\numClasses")); for (int i = 0; i < numClasses; i++) { FtpAccount tmp = new FtpAccount(); tmp.ReadValues(data, @"" + path + @"FtpAccounts\" + i + @"\"); FtpAccounts.Add(tmp); } } catch {} try { int numClasses = int.Parse(data.GetValue(@"" + path + @"HttpAccounts\numClasses")); for (int i = 0; i < numClasses; i++) { HttpAccount tmp = new HttpAccount(); tmp.ReadValues(data, @"" + path + @"HttpAccounts\" + i + @"\"); HttpAccounts.Add(tmp); } } catch {} try { int numClasses = int.Parse(data.GetValue(@"" + path + @"SmtpAccounts\numClasses")); for (int i = 0; i < numClasses; i++) { SmtpAccount tmp = new SmtpAccount(); tmp.ReadValues(data, @"" + path + @"SmtpAccounts\" + i + @"\"); SmtpAccounts.Add(tmp); } } catch {} try { int numClasses = int.Parse(data.GetValue(@"" + path + @"TimeServerAccounts\numClasses")); for (int i = 0; i < numClasses; i++) { TimeServerAccount tmp = new TimeServerAccount(); tmp.ReadValues(data, @"" + path + @"TimeServerAccounts\" + i + @"\"); TimeServerAccounts.Add(tmp); } } catch {} }