Example #1
0
        public override bool Equals(object o)
        {
            if (!(o is HttpAccount))
            {
                return(false);
            }
            HttpAccount v = o as HttpAccount;

            if (!AccountId.Equals(v.AccountId))
            {
                return(false);
            }
            if (!IsBasicAuthentication.Equals(v.IsBasicAuthentication))
            {
                return(false);
            }
            if (!Password.Equals(v.Password))
            {
                return(false);
            }
            if (!Timeout.Equals(v.Timeout))
            {
                return(false);
            }
            if (!Url.Equals(v.Url))
            {
                return(false);
            }
            if (!UserName.Equals(v.UserName))
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public void ReplaceWith(HttpAccount source)
        {
            if (AccountId != source.AccountId)
            {
                AccountId = source.AccountId;
            }

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

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

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

            if (UserName != source.UserName)
            {
                UserName = source.UserName;
            }
        }
        public void CopyTo(HttpAccount targetAccount)
        {
            var data = Data.CreateDataStorage();

            StoreValues(data, "");
            targetAccount.ReadValues(data, "");
        }
Example #4
0
        public HttpAccount Copy()
        {
            HttpAccount copy = new HttpAccount();

            copy.AccountId             = AccountId;
            copy.IsBasicAuthentication = IsBasicAuthentication;
            copy.Password = Password;
            copy.Timeout  = Timeout;
            copy.Url      = Url;
            copy.UserName = UserName;
            return(copy);
        }
Example #5
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());
        }
Example #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 {}
        }