Esempio n. 1
0
        public KeyValuePair <StorageInformation, Addon> ConnectToStorage(AddonManager mgr, AddonType type)
        {
            foreach (var item in mgr.Addons)
            {
                if (item.Type != type)
                {
                    continue;
                }
                comboBoxType.Items.Add(item);
            }
            if (comboBoxType.Items.Count > 0)
            {
                comboBoxType.SelectedIndex = 0;
            }
            if (this.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(new KeyValuePair <StorageInformation, Addon>(null, null));
            }
            if (comboBoxType.SelectedIndex < 0)
            {
                return(new KeyValuePair <StorageInformation, Addon>(null, null));
            }

            Addon addon             = comboBoxType.SelectedItem as Addon;
            StorageInformation info = new StorageInformation(addon.StorageType);

            info.Server   = textBoxServer.Text;
            info.Database = textBoxDatabase.Text;
            info.User     = textBoxUser.Text;
            info.Password = textBoxPassword.Text;
            info.Port     = Convert.ToInt32(numericUpDownPort.Value);

            return(new KeyValuePair <StorageInformation, Addon>(info, addon));
        }
Esempio n. 2
0
        public StorageInformation Clone()
        {
            StorageInformation info = new StorageInformation(Type);

            foreach (var item in this)
            {
                info[item.Key] = item.Value;
            }
            info.Server   = Server;
            info.Port     = Port;
            info.Database = Database;
            info.User     = User;
            info.Password = Password;
            return(info);
        }