public GetPrefixInfoFromDB(string prefix, OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture, string mode)
        {
            InitializeComponent();
            //
            this.prefix          = prefix.Split('/')[0];
            this.pflen           = short.Parse(prefix.Split('/')[1]);
            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo;
            this.culture         = culture;
            this.currentMode     = mode;

            int r = this.MySQLquery();

            if (r < 0)
            {
                MessageBox.Show("Error: MySQLquery()", "MySQL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }
            else if (r == 99)
            {
                MessageBox.Show("Cancelled", "Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }
Esempio n. 2
0
        public ListAssignedfromDB(string prefix, string end, short parentpflen, short pflen, CheckState chks,
                                  OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture, string mode)
        {
            InitializeComponent();

            this.currentMode     = mode;
            this.parentpflen     = parentpflen;
            this.pflen           = pflen;
            this.chks            = chks;
            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo.ShallowCopy();
            this.culture         = culture;
            this.SwitchLanguage(culture);

            if (this.currentMode == "v6")
            {
                this.prefix = v6ST.CompressAddress(prefix.Split('/')[0]);
                this.end    = v6ST.CompressAddress(end.Split('/')[0]);

                this.toolStripStatusLabel1.Text = "Database: " + this.ServerInfo.DBname;
            }
            else // v4
            {
                this.prefix = prefix.Split('/')[0];
                this.end    = end.Split('/')[0];

                this.toolStripStatusLabel1.Text = "Database: " + this.ServerInfo.DBname_v4;
            }

            this.label2.ForeColor = Color.RoyalBlue;
            this.label2.Text      = prefix + " - " + "/" + pflen;

            this.groupBox1.Text = "/" + pflen
                                  + StringsDictionary.KeyValue("StatsUsageForm_groupBox2.Text", this.culture);

            if (this.MySQLconnection == null)
            {
                this.toolStripStatusLabel2.Text = "db=Down";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.toolStripStatusLabel2.Text = "db=Up";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.toolStripStatusLabel2.Text = "db=Down";
                }
            }

            this.PreCalc();
            this.FirstAndLastInDB();
            this.button1_Click(null, null);
            this.label4.Text = "[" + this.page_records
                               + StringsDictionary.KeyValue("ListAssignedfromDBForm_label4.Text", this.culture);
        }
        private void CopyServerInfoValues()
        {
            this.inputServerInfo.ServerIP = this.ServerInfo.ServerIP;
            ScreenShotValues.ServerIP     = this.ServerInfo.ServerIP;

            this.inputServerInfo.PortNum = this.ServerInfo.PortNum;
            ScreenShotValues.PortNum     = this.ServerInfo.PortNum;

            this.inputServerInfo.Trytoconnect = this.ServerInfo.Trytoconnect;
            this.inputServerInfo.launchDBUI   = this.ServerInfo.launchDBUI;

            if (this.ServerInfo.DriverName != "")
            {
                this.inputServerInfo.DriverName = this.ServerInfo.DriverName;
                ScreenShotValues.DriverName     = this.ServerInfo.DriverName;
            }
            if (this.ServerInfo.ConnectionString != "")
            {
                this.inputServerInfo.ConnectionString = this.ServerInfo.ConnectionString;
            }
            if (this.ServerInfo.DBname != "")
            {
                this.inputServerInfo.DBname = this.ServerInfo.DBname;
                ScreenShotValues.DBname     = this.ServerInfo.DBname;
            }
            if (this.ServerInfo.Tablename != "")
            {
                this.inputServerInfo.Tablename = this.ServerInfo.Tablename;
                ScreenShotValues.Tablename     = this.ServerInfo.Tablename;
            }
            if (this.ServerInfo.DBname_v4 != "")
            {
                this.inputServerInfo.DBname_v4 = this.ServerInfo.DBname_v4;
                ScreenShotValues.DBname_v4     = this.ServerInfo.DBname_v4;
            }
            if (this.ServerInfo.Tablename_v4 != "")
            {
                this.inputServerInfo.Tablename_v4 = this.ServerInfo.Tablename_v4;
                ScreenShotValues.Tablename_v4     = this.ServerInfo.Tablename_v4;
            }
            if (this.ServerInfo.Username != "")
            {
                this.inputServerInfo.Username = this.ServerInfo.Username;
                ScreenShotValues.Username     = this.ServerInfo.Username;
            }
            if (this.ServerInfo.Password != "")
            {
                this.inputServerInfo.Password = this.ServerInfo.Password;
            }

            this.ServerInfo = this.inputServerInfo;  // callers will use 'this.ServerInfo'
        }
        public StatsUsage(string prefix, string end, short parentpflen, short pflen, CheckState chks,
                          OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture, string mode)
        {
            InitializeComponent();

            this.currentMode     = mode;
            this.prefix          = prefix;
            this.end             = end;
            this.pflen           = pflen;
            this.parentpflen     = parentpflen;
            this.chks            = chks;
            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo.ShallowCopy();
            this.culture         = culture;
            this.SwitchLanguage(culture);
            this.graph = this.CreateGraphics();

            this.label2.Text    = prefix + " - " + "/" + pflen;
            this.groupBox2.Text = "/" + pflen
                                  + StringsDictionary.KeyValue("StatsUsageForm_groupBox2.Text", this.culture);

            if (this.currentMode == "v6")
            {
                this.toolStripStatusLabel1.Text = "Database: " + this.ServerInfo.DBname;
            }
            else // v4
            {
                this.toolStripStatusLabel1.Text = "Database: " + this.ServerInfo.DBname_v4;
            }

            if (this.MySQLconnection == null)
            {
                this.toolStripStatusLabel2.Text = "db=Down";

                this.toolStripStatusLabel1.Text = "Database: null";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.toolStripStatusLabel2.Text = "db=Up";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.toolStripStatusLabel2.Text = "db=Down";
                }
            }

            this.Calculate();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            this.ServerInfo.Trytoconnect = false;

            this.DialogResult = DialogResult.Cancel;
            this.ServerInfo   = this.inputServerInfo;

            if (this is IDisposable)
            {
                this.Dispose();
            }
            else
            {
                this.Close();
            }
        }
        public FormDB(string prefix, short pflen, short parentpflen, OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture)
        {
            InitializeComponent();

            this.culture = culture;
            this.SwitchLanguage(this.culture);

            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo;
            this.pflen           = pflen;
            this.parentpflen     = parentpflen;

            if (prefix != null)
            {
                this.prefix = this.v6st.CompressAddress(prefix);
            }

            this.toolStripStatusLabel1.ForeColor = Color.FromKnownColor(KnownColor.RoyalBlue);
            this.textBox9.ForeColor = Color.FromKnownColor(KnownColor.RoyalBlue);
            this.textBox9.BackColor = Color.FromKnownColor(KnownColor.Control);
            this.textBox9.ReadOnly  = true;

            if (pflen != 0)
            {
                this.textBox7.Text = this.textBox8.Text = this.prefix + "/" + this.pflen;
            }

            this.comboBox1.SelectedIndex = 0;

            if (this.MySQLconnection == null)
            {
                toolStripStatusLabel2.Text = "db=DOWN";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    toolStripStatusLabel2.Text = "db=UP";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    toolStripStatusLabel2.Text = "db=DOWN";
                }
            }
        }
        private void DBinfo_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.ServerInfo.Trytoconnect = false;
                this.DialogResult            = DialogResult.Cancel;
                this.ServerInfo = this.inputServerInfo;

                if (this is IDisposable)
                {
                    this.Dispose();
                }
                else
                {
                    this.Close();
                }
            }
        }
        private void DBinfo_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                this.ServerInfo.Trytoconnect = false;
                this.DialogResult            = DialogResult.Cancel;
                this.ServerInfo = this.inputServerInfo;

                if (this is IDisposable)
                {
                    this.Dispose();
                }
                else
                {
                    this.Close();
                }
            }
        }
Esempio n. 9
0
        public PrefixSubLevelsForm(string prefix, short pflen, string parentprefix, CheckState chks,
                                   int t1, int t2, OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture)
        {
            InitializeComponent();

            this.prefix          = this.v6st.CompressAddress(prefix);
            this.parentprefix    = parentprefix;
            this.pflen           = pflen;
            this.parentpflen     = pflen;
            this.chks            = chks;
            this.t1              = t1; this.t2 = t2;
            this.end             = this.FindEnd(this.prefix, this.pflen, this.chks);
            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo;
            this.culture         = culture;
            this.SwitchLanguage(this.culture);

            this.textBox2.ForeColor = Color.FromKnownColor(KnownColor.RoyalBlue);
            this.textBox2.BackColor = Color.FromKnownColor(KnownColor.Control);

            this.textBox1.Text = this.parentprefix;
            this.textBox2.Text = "└ " + this.prefix + "/" + this.pflen;

            this.treeView1.Nodes.Clear();
            this.root = this.treeView1.Nodes.Add(this.prefix + "/" + this.pflen);
            this.treeView1.Nodes[0].Nodes.Add(plus);


            if (this.MySQLconnection == null)
            {
                this.label4.Text = "db=DOWN";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.label4.Text = "db=UP";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.label4.Text = "db=DOWN";
                }
            }
        }
        public ListAssignedfromDB(string prefix, string end, short parentpflen, short pflen, CheckState chks,
                                  OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture)
        {
            InitializeComponent();

            this.prefix          = this.v6st.CompressAddress(prefix.Split('/')[0]);
            this.end             = this.v6st.CompressAddress(end.Split('/')[0]);
            this.parentpflen     = parentpflen;
            this.pflen           = pflen;
            this.chks            = chks;
            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo;
            this.culture         = culture;
            this.SwitchLanguage(culture);

            this.label2.ForeColor = Color.RoyalBlue;
            this.label2.Text      = prefix + " - " + "/" + pflen;

            this.groupBox1.Text = "/" + pflen
                                  + StringsDictionary.KeyValue("StatsUsageForm_groupBox2.Text", this.culture);

            if (this.MySQLconnection == null)
            {
                this.label3.Text = "db=DOWN";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.label3.Text = "db=UP";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.label3.Text = "db=DOWN";
                }
            }

            this.PreCalc();
            this.FirstAndLastInDB();
            this.button1_Click(null, null);
            this.label4.Text = "[" + this.page_records
                               + StringsDictionary.KeyValue("ListAssignedfromDBForm_label4.Text", this.culture);
        }
Esempio n. 11
0
        public void DBStateChange(OdbcConnection dbconn, DBServerInfo servinfo)
        {
            this.MySQLconnection = dbconn;
            this.ServerInfo      = servinfo;

            if (this.MySQLconnection == null)
            {
                this.label4.Text = "db=DOWN";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.label4.Text = "db=UP";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.label4.Text = "db=DOWN";
                }
            }

            this.changeDBstate.Invoke(this.MySQLconnection, this.ServerInfo);

            if (this.MySQLconnection != null)
            {
                return;
            }
            else
            {
                IPv6SubnettingTool.Form1.RemoveForm(this.GetHashCode());

                if (this is IDisposable)
                {
                    this.Dispose();
                }
                else
                {
                    this.Close();
                }
            }
        }
Esempio n. 12
0
        public StatsUsage(string prefix, string end, short parentpflen, short pflen, CheckState chks,
                          OdbcConnection sqlcon, DBServerInfo servinfo, CultureInfo culture)
        {
            InitializeComponent();

            this.prefix          = prefix;
            this.end             = end;
            this.pflen           = pflen;
            this.parentpflen     = parentpflen;
            this.chks            = chks;
            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo;
            this.culture         = culture;
            this.SwitchLanguage(culture);
            this.graph = this.CreateGraphics();

            this.label2.Text    = prefix + " - " + "/" + pflen;
            this.groupBox2.Text = "/" + pflen
                                  + StringsDictionary.KeyValue("StatsUsageForm_groupBox2.Text", this.culture);

            if (this.MySQLconnection == null)
            {
                this.label4.Text = "db=DOWN";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.label4.Text = "db=UP";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.label4.Text = "db=DOWN";
                }
            }

            this.Calculate();
        }
        public void DBStateChange(OdbcConnection dbconn, DBServerInfo servinfo)
        {
            this.MySQLconnection = dbconn;
            this.ServerInfo      = servinfo;

            if (this.MySQLconnection == null)
            {
                toolStripStatusLabel2.Text = "db=DOWN";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    toolStripStatusLabel2.Text = "db=UP";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    toolStripStatusLabel2.Text = "db=DOWN";
                }
            }

            if (this.MySQLconnection != null)
            {
                return;
            }
            else
            {
                if (this is IDisposable)
                {
                    this.Dispose();
                }
                else
                {
                    this.Close();
                }
            }
        }
Esempio n. 14
0
        public PrefixSubLevels(string snet, short plen,
                               CheckState chks, int t1, int t2, OdbcConnection sqlcon,
                               DBServerInfo servinfo, CultureInfo culture, string mode, Font font)
        {
            InitializeComponent();

            this.currentMode = mode;
            this.ServerInfo  = servinfo.ShallowCopy();
            this.culture     = culture;
            this.SwitchLanguage(this.culture);
            this.chks = chks;
            this.t1   = t1; this.t2 = t2;

            this.treeView1.Font = font;
            this.textBox1.Font  = font;
            this.textBox2.Font  = font;

            this.MySQLconnection = sqlcon;

            short ppflen = QuerySelectedPrefix(snet, plen);

            if (ppflen == 0 || ppflen == -1)
            {
                this.Close();
                return;
            }

            this.pflen       = plen;
            this.parentpflen = plen;
            string parentprefix = "";

            if (this.currentMode == "v6")
            {
                parentprefix = v6ST.FindParentNet(snet, ppflen, chks);
                this.prefix  = v6ST.CompressAddress(snet);
                this.end     = this.FindEnd(this.prefix, this.pflen, this.chks);

                this.toolStripStatusLabel1.Text = "Database: " + this.ServerInfo.DBname;
            }
            else // v4
            {
                parentprefix = v6ST.FindParentNet_v4(snet, ppflen);
                this.prefix  = snet;
                this.end     = this.FindEnd_v4(this.prefix, this.pflen);

                this.toolStripStatusLabel1.Text = "Database: " + this.ServerInfo.DBname_v4;
            }

            this.parentprefix = parentprefix;

            this.textBox2.ForeColor = Color.FromKnownColor(KnownColor.RoyalBlue);
            this.textBox2.BackColor = Color.FromKnownColor(KnownColor.Control);

            this.textBox1.Text = this.parentprefix;
            this.textBox2.Text = "└ " + this.prefix + "/" + this.pflen;

            this.treeView1.Nodes.Clear();
            this.root = this.treeView1.Nodes.Add(this.prefix + "/" + this.pflen);
            this.treeView1.Nodes[0].Nodes.Add(plus);

            if (this.MySQLconnection == null)
            {
                this.toolStripStatusLabel2.Text = "db=Down";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    this.toolStripStatusLabel2.Text = "db=Up";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    this.toolStripStatusLabel2.Text = "db=Down";
                }
            }
        }
        public ListSubnetRange(SEaddress input, string sin, int slash, int subnetslash, CheckState is128Checked, CultureInfo culture, OdbcConnection sqlcon, DBServerInfo servinfo)
        {
            InitializeComponent();
            this.graph = this.CreateGraphics();
            this.graph.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;

            this.MySQLconnection = sqlcon;
            this.ServerInfo      = servinfo;
            this.parentpflen     = (short)input.slash;
            this.StartEnd.ID     = ID;
            this.incomingID      = input.ID;
            this.culture         = culture;

            this.SwitchLanguage(this.culture);

            this.is128Checked     = is128Checked;
            this.Forwd.Enabled    = false;
            this.Backwd.Enabled   = false;
            this.LastPage.Enabled = false;

            string[] sa = sin.Split(' ');
            sa = sa[1].Split('/');

            string s = this.v6st.FormalizeAddr(sa[0]);

            s  = this.v6st.Kolonlar(s, this.is128Checked);
            sa = s.Split(':');
            s  = "";

            if (this.is128Checked == CheckState.Checked)
            {
                s = "0" + sa[0] + sa[1] + sa[2] + sa[3] + sa[4] + sa[5] + sa[6] + sa[7];
                StartEnd.Resultv6 = BigInteger.Parse(s, NumberStyles.AllowHexSpecifier);
                if (s.Length > 32)
                {
                    s = s.Substring(1, 32);
                }

                this.label3.Text = StringsDictionary.KeyValue("ListSubnetRange_label3.Text", this.culture);
            }
            else if (this.is128Checked == CheckState.Unchecked)
            {
                s = "0" + sa[0] + sa[1] + sa[2] + sa[3];
                StartEnd.Resultv6 = BigInteger.Parse(s, NumberStyles.AllowHexSpecifier);
                if (s.Length > 16)
                {
                    s = s.Substring(1, 16);
                }

                this.label3.Text = StringsDictionary.KeyValue("ListSubnetRange_label3.Text", this.culture);
            }

            StartEnd.slash       = subnetslash;
            StartEnd.subnetslash = subnetslash;

            StartEnd        = v6st.StartEndAddresses(StartEnd, this.is128Checked);
            NumberOfSubnets = StartEnd.End - StartEnd.Start + BigInteger.One;

            String s1 = "", s2 = "";

            if (this.is128Checked == CheckState.Unchecked)
            {
                this.DefaultView();

                s1 = String.Format("{0:x}", StartEnd.Start);
                if (s1.Length > 16)
                {
                    s1 = s1.Substring(1, 16);
                }
                s1 = v6st.Kolonlar(s1, this.is128Checked);
                s1 = v6st.CompressAddress(s1);

                s2 = String.Format("{0:x}", StartEnd.End);
                if (s2.Length > 16)
                {
                    s2 = s2.Substring(1, 16);
                }
                s2 = v6st.Kolonlar(s2, this.is128Checked);
                s2 = v6st.CompressAddress(s2);
            }
            else if (this.is128Checked == CheckState.Checked)
            {
                this.ExpandView();

                s1 = String.Format("{0:x}", StartEnd.Start);
                if (s1.Length > 32)
                {
                    s1 = s1.Substring(1, 32);
                }
                s1 = v6st.Kolonlar(s1, this.is128Checked);
                s1 = v6st.CompressAddress(s1);

                s2 = String.Format("{0:x}", StartEnd.End);
                if (s2.Length > 32)
                {
                    s2 = s2.Substring(1, 32);
                }
                s2 = v6st.Kolonlar(s2, this.is128Checked);
                s2 = v6st.CompressAddress(s2);
            }

            this.textBox1.Text = String.Format("{0}", NumberOfSubnets);
            this.label5.Text   = s1 + "/" + StartEnd.subnetslash;
            this.label6.Text   = s2 + "/" + StartEnd.subnetslash;

            this.FirstPage_Click(null, null);
        }
        public DBinfo(CultureInfo culture, DBServerInfo servinfo, OdbcConnection sqlcon, string mode)
        {
            InitializeComponent();

            this.culture = culture;
            this.SwitchLanguage(this.culture);

            this.inputServerInfo = servinfo;
            this.ServerInfo      = servinfo.ShallowCopy();
            this.currentMode     = mode;

            this.MySQLconnection = sqlcon;

            if (sqlcon != null)
            {
                this.label16.Text = "Yes";
                this.label14.Text = sqlcon.Database;
            }
            else
            {
                this.label16.Text = "null";
                this.label14.Text = "null";
            }

            this.label10.Text = this.label11.Text = this.label12.Text = this.currentMode;

            if (this.inputServerInfo.DriverName != "" || this.inputServerInfo.DriverName != null)
            {
                this.comboBox1.Items.Add(this.inputServerInfo.DriverName);
                this.comboBox1.SelectedItem = this.comboBox1.Items[0];
            }
            if (this.inputServerInfo.ServerIP != null)
            {
                this.textBox1.Text = this.inputServerInfo.ServerIP.ToString();
            }
            if (this.inputServerInfo.PortNum.ToString() != null)
            {
                this.textBox7.Text = this.inputServerInfo.PortNum.ToString();
            }

            if (this.currentMode == "v6")
            {
                if (this.inputServerInfo.DBname != "" || this.inputServerInfo.DBname != null)
                {
                    this.textBox2.Text = this.inputServerInfo.DBname;
                }
                if (this.inputServerInfo.Tablename != "" || this.inputServerInfo.Tablename != null)
                {
                    this.textBox5.Text = this.inputServerInfo.Tablename;
                }
            }
            else // v4
            {
                if (this.inputServerInfo.DBname_v4 != "" || this.inputServerInfo.DBname_v4 != null)
                {
                    this.textBox2.Text = this.inputServerInfo.DBname_v4;
                }
                if (this.inputServerInfo.Tablename_v4 != "" || this.inputServerInfo.Tablename_v4 != null)
                {
                    this.textBox5.Text = this.inputServerInfo.Tablename_v4;
                }
            }

            if (this.inputServerInfo.Username != null || this.inputServerInfo.Username != "")
            {
                this.textBox3.Text = this.inputServerInfo.Username;
            }

            if (this.inputServerInfo.Password != null || this.inputServerInfo.Password != "")
            {
                this.textBox4.Text = this.inputServerInfo.Password;
            }

            if (this.MySQLconnection != null)
            {
                if (this.MySQLconnection.State == System.Data.ConnectionState.Open)
                {
                    this.button3.Enabled   = false;
                    this.comboBox1.Enabled = false;
                    this.textBox1.Enabled  = false;
                    this.textBox7.Enabled  = false;
                    this.textBox3.Enabled  = false;
                    this.textBox4.Enabled  = false;
                }
            }
            else
            {
                this.button3.Enabled   = true;
                this.comboBox1.Enabled = true;
                this.textBox1.Enabled  = true;
                this.textBox7.Enabled  = true;
                this.textBox3.Enabled  = true;
                this.textBox4.Enabled  = true;
            }
        }
        public DatabaseUI(string prefix, short pflen, short parentpflen, OdbcConnection sqlcon,
                          DBServerInfo servinfo, CultureInfo culture, string mode, Font font)
        {
            InitializeComponent();

            this.culture = culture;
            this.SwitchLanguage(this.culture);

            this.textBox1.Font  = font;
            this.textBox2.Font  = font;
            this.textBox3.Font  = font;
            this.textBox4.Font  = font;
            this.textBox5.Font  = font;
            this.textBox6.Font  = font;
            this.textBox7.Font  = font;
            this.textBox8.Font  = font;
            this.textBox10.Font = font;

            this.currentMode = mode;
            this.ServerInfo  = servinfo.ShallowCopy();

            this.pflen           = pflen;
            this.parentpflen     = parentpflen;
            this.MySQLconnection = sqlcon;

            this.toolStripStatusLabel1.ForeColor = Color.FromKnownColor(KnownColor.RoyalBlue);
            this.textBox9.ForeColor = Color.FromKnownColor(KnownColor.RoyalBlue);
            this.textBox9.BackColor = Color.FromKnownColor(KnownColor.Control);
            this.textBox9.ReadOnly  = true;

            this.comboBox1.SelectedIndex = 0;

            if (prefix != null)
            {
                if (this.currentMode == "v6")
                {
                    this.prefix = v6ST.CompressAddress(prefix);

                    this.textBox10.Text = this.ServerInfo.DBname;
                }
                else // v4
                {
                    this.prefix = prefix;

                    this.textBox10.Text = this.ServerInfo.DBname_v4;
                }
            }

            if (pflen != 0)
            {
                this.textBox7.Text = this.textBox8.Text = this.prefix + "/" + this.pflen;
            }

            if (this.MySQLconnection == null)
            {
                toolStripStatusLabel2.Text = "db=Down";
            }
            else
            {
                if (this.MySQLconnection.State == ConnectionState.Open)
                {
                    toolStripStatusLabel2.Text = "db=Up";
                }
                else if (this.MySQLconnection.State == ConnectionState.Closed)
                {
                    toolStripStatusLabel2.Text = "db=Down";
                }
            }
        }