Ejemplo n.º 1
0
 private void okButton_Click(object sender, EventArgs e)
 {
     _value.Data       = ByteConverterHelper.GetBytes(valueDataTxtBox.Text);
     this.Tag          = _value;
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
 private void okButton_Click(object sender, EventArgs e)
 {
     _value.Data       = ByteConverterHelper.GetBytes(valueDataTxtBox.Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries));
     this.Tag          = _value;
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Ejemplo n.º 3
0
        private void okButton_Click(object sender, EventArgs e)
        {
            if (valueDataTxtBox.IsConversionValid() || IsOverridePossible())
            {
                _value.Data = _value.Kind == RegistryValueKind.DWord
                    ? ByteConverterHelper.GetBytes(valueDataTxtBox.UIntValue)
                    : ByteConverterHelper.GetBytes(valueDataTxtBox.ULongValue);
                this.Tag          = _value;
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                this.DialogResult = DialogResult.None;
            }

            this.Close();
        }
        public static RegValueData CreateRegValueData(string name, RegistryValueKind kind, object value = null)
        {
            var newRegValue = new RegValueData {
                Name = name, Kind = kind
            };

            if (value == null)
            {
                newRegValue.Data = new byte[] { }
            }
            ;
            else
            {
                switch (newRegValue.Kind)
                {
                case RegistryValueKind.Binary:
                    newRegValue.Data = (byte[])value;
                    break;

                case RegistryValueKind.MultiString:
                    newRegValue.Data = ByteConverterHelper.GetBytes((string[])value);
                    break;

                case RegistryValueKind.DWord:
                    newRegValue.Data = ByteConverterHelper.GetBytes((uint)(int)value);
                    break;

                case RegistryValueKind.QWord:
                    newRegValue.Data = ByteConverterHelper.GetBytes((ulong)(long)value);
                    break;

                case RegistryValueKind.String:
                case RegistryValueKind.ExpandString:
                    newRegValue.Data = ByteConverterHelper.GetBytes((string)value);
                    break;
                }
            }

            return(newRegValue);
        }