99 lines
2.2 KiB
C#
99 lines
2.2 KiB
C#
// Decompiled with JetBrains decompiler
|
|||
|
|
// Type: DarkModeForms.KeyValue
|
||
|
|
// Assembly: Raton, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null
|
||
|
|
// MVID: 36C4E416-7F8D-4D23-930F-B5CCB0D810E7
|
||
|
|
// Assembly location: C:\Users\user\Desktop\v3.8.0 Deluxe Plugins (v4.0.0) cracked\Raton.exe
|
||
|
|
|
||
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
|
||
|
|
#nullable disable
|
||
|
|
namespace DarkModeForms;
|
||
|
|
|
||
|
|
public class KeyValue
|
||
|
|
{
|
||
|
|
private string _value;
|
||
|
|
|
||
|
|
public KeyValue()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public KeyValue(string pKey, string pValue, KeyValue.ValueTypes pType = KeyValue.ValueTypes.String, List<KeyValue> pDataSet = null)
|
||
|
|
{
|
||
|
|
this.Key = pKey;
|
||
|
|
this.Value = pValue;
|
||
|
|
this.ValueType = pType;
|
||
|
|
this.DataSet = pDataSet;
|
||
|
|
}
|
||
|
|
|
||
|
|
public string Key { get; set; }
|
||
|
|
|
||
|
|
public string Value
|
||
|
|
{
|
||
|
|
get => this._value;
|
||
|
|
set
|
||
|
|
{
|
||
|
|
string newValue = value;
|
||
|
|
this.OnValidate(ref newValue);
|
||
|
|
if (!(this._value != newValue))
|
||
|
|
return;
|
||
|
|
this._value = newValue;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public KeyValue.ValueTypes ValueType { get; set; }
|
||
|
|
|
||
|
|
public List<KeyValue> DataSet { get; set; }
|
||
|
|
|
||
|
|
public string ErrorText { get; set; } = string.Empty;
|
||
|
|
|
||
|
|
public event EventHandler<KeyValue.ValidateEventArgs> Validate;
|
||
|
|
|
||
|
|
protected virtual void OnValidate(ref string newValue)
|
||
|
|
{
|
||
|
|
EventHandler<KeyValue.ValidateEventArgs> validate = this.Validate;
|
||
|
|
if (validate == null)
|
||
|
|
return;
|
||
|
|
KeyValue.ValidateEventArgs e = new KeyValue.ValidateEventArgs(newValue)
|
||
|
|
{
|
||
|
|
OldValue = this._value
|
||
|
|
};
|
||
|
|
validate((object) this, e);
|
||
|
|
if (e.Cancel)
|
||
|
|
newValue = this._value;
|
||
|
|
this.ErrorText = e.ErrorText;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override string ToString() => $"{this.Key} - {this.Value}";
|
||
|
|
|
||
|
|
public enum ValueTypes
|
||
|
|
{
|
||
|
|
String,
|
||
|
|
Integer,
|
||
|
|
Decimal,
|
||
|
|
Date,
|
||
|
|
Time,
|
||
|
|
Boolean,
|
||
|
|
Dynamic,
|
||
|
|
Password,
|
||
|
|
Multiline,
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ValidateEventArgs : EventArgs
|
||
|
|
{
|
||
|
|
public ValidateEventArgs(string newValue)
|
||
|
|
{
|
||
|
|
this.NewValue = newValue;
|
||
|
|
this.Cancel = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public string NewValue { get; }
|
||
|
|
|
||
|
|
public string OldValue { get; set; }
|
||
|
|
|
||
|
|
public bool Cancel { get; set; }
|
||
|
|
|
||
|
|
public string ErrorText { get; set; } = string.Empty;
|
||
|
|
}
|
||
|
|
}
|