public BotVar(string id, IGenericBotVar var) { Identifier = id; Type = BotVarType.Generic; Generic = var.ToJSON(); UInt64 = default; Int64 = default; Float64 = default; String = default; Bool = default; }
public BotVar(string id, JSONContainer var) { Identifier = id; Type = BotVarType.Generic; Generic = var; UInt64 = default; Int64 = default; Float64 = default; String = default; Bool = default; }
public BotVar(string id, bool var) { Identifier = id; Type = BotVarType.Bool; Bool = var; UInt64 = default; Int64 = default; Float64 = default; String = default; Generic = default; }
public BotVar(string id, string var) { Identifier = id; Type = BotVarType.String; String = var; UInt64 = default; Int64 = default; Float64 = default; Bool = default; Generic = default; }
public BotVar(string id, double var) { Identifier = id; Type = BotVarType.Float64; Float64 = var; UInt64 = default; Int64 = default; String = default; Bool = default; Generic = default; }
internal bool FromJSON(JSONContainer json) { if (json.TryGetField(JSON_ID, out Identifier) && json.TryGetField(JSON_TYPE, out int type)) { Type = (BotVarType)type; switch (Type) { case BotVarType.Undefined: return(true); case BotVarType.UInt64: return(json.TryGetField(JSON_VALUE, out UInt64)); case BotVarType.Int64: return(json.TryGetField(JSON_VALUE, out Int64)); case BotVarType.Float64: return(json.TryGetField(JSON_VALUE, out Float64)); case BotVarType.String: return(json.TryGetField(JSON_VALUE, out String)); case BotVarType.Bool: return(json.TryGetField(JSON_VALUE, out Bool)); case BotVarType.Generic: return(json.TryGetField(JSON_VALUE, out Generic)); default: return(false); } } else { return(false); } }