Пример #1
0
        public void ReplaceWith(SmtpAccount source)
        {
            if (AccountId != source.AccountId)
            {
                AccountId = source.AccountId;
            }

            if (Address != source.Address)
            {
                Address = source.Address;
            }

            Password = source.Password;
            if (Port != source.Port)
            {
                Port = source.Port;
            }

            if (Server != source.Server)
            {
                Server = source.Server;
            }

            if (Ssl != source.Ssl)
            {
                Ssl = source.Ssl;
            }

            if (UserName != source.UserName)
            {
                UserName = source.UserName;
            }
        }
Пример #2
0
        public void CopyTo(SmtpAccount targetAccount)
        {
            var data = Data.CreateDataStorage();

            StoreValues(data, "");
            targetAccount.ReadValues(data, "");
        }
Пример #3
0
        public SmtpAccount Copy()
        {
            SmtpAccount copy = new SmtpAccount();

            copy.AccountId = AccountId;
            copy.Address   = Address;
            copy.Password  = Password;
            copy.Port      = Port;
            copy.Server    = Server;
            copy.Ssl       = Ssl;
            copy.UserName  = UserName;
            return(copy);
        }
Пример #4
0
        public void StoreValues(Data data, string path)
        {
            for (int i = 0; i < DropboxAccounts.Count; i++)
            {
                DropboxAccount tmp = DropboxAccounts[i];
                tmp.StoreValues(data, @"" + path + @"DropboxAccounts\" + i + @"\");
            }
            data.SetValue(@"" + path + @"DropboxAccounts\numClasses", DropboxAccounts.Count.ToString());


            for (int i = 0; i < FtpAccounts.Count; i++)
            {
                FtpAccount tmp = FtpAccounts[i];
                tmp.StoreValues(data, @"" + path + @"FtpAccounts\" + i + @"\");
            }
            data.SetValue(@"" + path + @"FtpAccounts\numClasses", FtpAccounts.Count.ToString());


            for (int i = 0; i < HttpAccounts.Count; i++)
            {
                HttpAccount tmp = HttpAccounts[i];
                tmp.StoreValues(data, @"" + path + @"HttpAccounts\" + i + @"\");
            }
            data.SetValue(@"" + path + @"HttpAccounts\numClasses", HttpAccounts.Count.ToString());


            for (int i = 0; i < SmtpAccounts.Count; i++)
            {
                SmtpAccount tmp = SmtpAccounts[i];
                tmp.StoreValues(data, @"" + path + @"SmtpAccounts\" + i + @"\");
            }
            data.SetValue(@"" + path + @"SmtpAccounts\numClasses", SmtpAccounts.Count.ToString());


            for (int i = 0; i < TimeServerAccounts.Count; i++)
            {
                TimeServerAccount tmp = TimeServerAccounts[i];
                tmp.StoreValues(data, @"" + path + @"TimeServerAccounts\" + i + @"\");
            }
            data.SetValue(@"" + path + @"TimeServerAccounts\numClasses", TimeServerAccounts.Count.ToString());
        }
Пример #5
0
        public override bool Equals(object o)
        {
            if (!(o is SmtpAccount))
            {
                return(false);
            }
            SmtpAccount v = o as SmtpAccount;

            if (!AccountId.Equals(v.AccountId))
            {
                return(false);
            }
            if (!Address.Equals(v.Address))
            {
                return(false);
            }
            if (!Password.Equals(v.Password))
            {
                return(false);
            }
            if (!Port.Equals(v.Port))
            {
                return(false);
            }
            if (!Server.Equals(v.Server))
            {
                return(false);
            }
            if (!Ssl.Equals(v.Ssl))
            {
                return(false);
            }
            if (!UserName.Equals(v.UserName))
            {
                return(false);
            }

            return(true);
        }
Пример #6
0
        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 {}
        }