public BGIValue(ITree treein) { baseTree = treein; tree = treein.GetChild(0); switch (treein.Text) { case "TYPEINT": Type = BurikoValueType.Int; break; case "TYPEHEX": Type = BurikoValueType.Int; break; case "TYPESTRING": Type = BurikoValueType.String; break; case "TYPEBOOL": Type = BurikoValueType.Bool; break; case "TYPENULL": Type = BurikoValueType.Null; break; case "TYPEFUNCTION": Type = BurikoValueType.Operation; break; case "TYPEVARIABLE": Type = BurikoValueType.Variable; baseTree = tree; tree = baseTree.GetChild(0); break; case "TYPEUNARY": Type = BurikoValueType.Unary; break; case "VAR": Type = BurikoValueType.Variable; break; } if (Type == BurikoValueType.None && IsMath(treein.Text)) { Type = BurikoValueType.Math; } }
public BurikoVariable(BinaryReader stream) { Type = (BurikoValueType)stream.ReadInt16(); switch (Type) { case BurikoValueType.Null: valueInt = -1; break; case BurikoValueType.Bool: valueInt = stream.ReadByte(); break; case BurikoValueType.Int: valueInt = stream.ReadInt32(); break; case BurikoValueType.String: valueString = stream.ReadString(); break; case BurikoValueType.Variable: stream.BaseStream.Seek(-2L, SeekOrigin.Current); valueReference = ReadReference(stream); break; case BurikoValueType.Math: { BurikoMathType type = (BurikoMathType)stream.ReadInt16(); BurikoVariable a = new BurikoVariable(stream); BurikoVariable b = new BurikoVariable(stream); Type = BurikoValueType.Int; valueInt = PerformMath(type, a, b); break; } case BurikoValueType.Operation: valueVariable = BurikoScriptSystem.Instance.GetCurrentScript().ExecuteOperation((BurikoOperations)stream.ReadInt16()); break; default: throw new NotImplementedException("BurikoVariable: Unhandled BurikoValueType " + Type); } }
public BurikoVariable(BurikoReference reference, BurikoVariable variable) { Type = BurikoValueType.Variable; valueReference = reference; valueVariable = variable; }
public BurikoVariable(int i) { Type = BurikoValueType.Int; valueInt = i; }
public BurikoVariable(string s) { Type = BurikoValueType.String; valueString = s; }
public BurikoVariable() { Type = BurikoValueType.Null; }