Пример #1
0
 private void FormCompositeRoles_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!e.Cancel && proxy != null)
     {
         SecureString sString             = EncryptProtectData.ToSecureString(CompositeRoleHelper.SerializeParams(proxy));
         String       encryptedSerialized = EncryptProtectData.EncryptString(sString);
         File.WriteAllText("cache", encryptedSerialized, Encoding.Unicode);
     }
 }
Пример #2
0
        private void FormCompositeRoles_Load(object sender, EventArgs e)
        {
            if (!File.Exists("cache"))
            {
                return;
            }
            String       encryptedString     = File.ReadAllText("cache", Encoding.UTF8);
            SecureString sString             = EncryptProtectData.DecryptString(encryptedString);
            String       decryptedSerialized = EncryptProtectData.ToInsecureString(sString);

            proxy = CompositeRoleHelper.DeSerializeParams(decryptedSerialized);
            if (proxy == null)
            {
                proxy = new ProxyParameter();
            }

            proxy.ProxyID     = Guid.NewGuid().ToString();
            proxy.MaxPoolSize = "10";
            proxy.PoolSize    = "1";
            proxy.IdleTimeout = "10";
            textBox6.Text     = proxy.AppServerHost;
            textBox3.Text     = proxy.SystemNumber;
            textBox5.Text     = proxy.Client;
            textBox4.Text     = proxy.User;
            textBox1.Text     = proxy.Password;
            textBox2.Text     = proxy.Language;
            DataTable dt = new DataTable();

            dt.Columns.AddRange(new DataColumn[] { new DataColumn("Operation"), new DataColumn("Description") });
            Array items = Enum.GetValues(typeof(Operations));

            foreach (Operations item in items)
            {
                dt.LoadDataRow(new object[] { Enum.GetName(typeof(Operations), item), item.ToName() }, true);
            }
            cmbActions.DataSource    = dt;
            cmbActions.DisplayMember = "Description";
        }