Exemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string path = string.Format("{0}\\License.ini", Application.StartupPath);

            VIZCore3D.NET.Utility.IniFile ini = new Utility.IniFile();
            if (System.IO.File.Exists(path) == true)
            {
                ini.Load(path);
            }

            VIZCore3D.NET.Utility.IniSection section;

            if (ini.ContainsSection("License") == false)
            {
                section = ini.Add("License");
            }
            else
            {
                section = ini["License"];
            }

            if (String.IsNullOrEmpty(txtFile.Text) == false)
            {
                section["File"] = new Utility.IniValue(txtFile.Text);
                section["IP"]   = new Utility.IniValue("");
                section["PORT"] = new Utility.IniValue("");

                ini.Save(path);
            }
            else if (String.IsNullOrEmpty(txtIp.Text) == false && String.IsNullOrEmpty(txtPort.Text) == false)
            {
                section["File"] = new Utility.IniValue("");
                section["IP"]   = new Utility.IniValue(txtIp.Text);
                section["PORT"] = new Utility.IniValue(txtPort.Text);

                ini.Save(path);
            }
            else
            {
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }