protected virtual string CompileCondition(WhereCondition condition, SqlCompilerContext context) { return(condition switch { CompareColumnsCondition compareColumnsCondition => CompileCondition(compareColumnsCondition, context), CompareCondition compareCondition => CompileCondition(compareCondition, context), InCondition inCondition => CompileCondition(inCondition, context), NestedCondition nestedCondition => CompileCondition(nestedCondition, context), RawCondition rawCondition => CompileCondition(rawCondition, context), _ => throw new ArgumentOutOfRangeException(nameof(condition)) });
/// <summary> /// Defines a raw <c>JOIN</c> condition. /// </summary> /// <param name="joinCondition">The join condition.</param> /// <param name="parameters">The parameters.</param> /// <param name="from">E.g. LEFT JOIN {join.ChildTableName} AS {join.ChildTableAlias}.</param> public void Raw(string joinCondition, IDictionary <string, object>?parameters, string?from = null) { if (joinCondition == null) { throw new ArgumentNullException(nameof(joinCondition)); } if (@from != null) { From = @from; } Condition = new RawCondition(joinCondition, parameters); }
private RawCondition ParseRewriteCond() { RawCondition rawCondition = new RawCondition { StartPosition = _lex.CurrentToken.Position }; if (_lex.AdvanceIfTokenIs(TokenID.StringLiteral)) { rawCondition.TestString = _lex.CurrentToken.Text; if (_lex.AdvanceIfTokenIs(TokenID.StringLiteral)) { rawCondition.Pattern = _lex.CurrentToken.Text; Token token = _lex.Peek(1); if (token.TokenID == TokenID.StringLiteral && token.Text.StartsWith("[", StringComparison.Ordinal)) { _lex.ReadNextToken(); rawCondition.Flags = token.Text; } } } rawCondition.EndPosition = _lex.CurrentToken.EndPosition; return(rawCondition); }
protected virtual string CompileRawCondition(SqlResult ctx, RawCondition x) { ctx.Bindings.AddRange(x.Bindings); return(WrapIdentifiers(x.Expression)); }
protected virtual string CompileRawCondition(RawCondition x) { return(WrapIdentifiers(x.Expression)); }
protected virtual string CompileRawCondition(RawCondition x) { return(x.Expression); }
public RAWTRIGMBRF(CTrigger cTrigger) { for (int c = 0; c < 16; c++) { RawCondition condition = new RawCondition(); if (cTrigger.conditions.Count > c) { TrigItem trigItem = cTrigger.conditions[c]; if (trigItem.type == 24) { long offset = trigItem.args[0].VALUE; long player = (offset - 0x58A364) / 4; long unitid = 0; long modifier = trigItem.args[1].VALUE; long value = trigItem.args[2].VALUE; long mask = trigItem.args[3].VALUE; long maskuse = trigItem.args[4].VALUE; condition.values[1] = player; condition.values[3] = unitid; condition.values[2] = value; condition.values[4] = modifier; condition.values[0] = mask; condition.values[8] = maskuse; condition.valueSet(); condition.condtype = (byte)15; } else { for (int i = 0; i < trigItem.args.Count; i++) { int pos = trigItem.args[i].argDefine.pos; condition.values[pos] = trigItem.args[i].GetCHKValue; } condition.valueSet(); condition.condtype = (byte)trigItem.type; } condition.flags = (byte)trigItem.triggerDefine.FLAG; if (!trigItem.IsEnable) { condition.flags += 2; } } conditions[c] = condition; } for (int a = 0; a < 64; a++) { RawAction action = new RawAction(); if (cTrigger.actions.Count > a) { TrigItem trigItem = cTrigger.actions[a]; if (trigItem.type == 58) { long offset = trigItem.args[0].VALUE; long player = (offset - 0x58A364) / 4; long unitid = 0; long modifier = trigItem.args[1].VALUE; long value = trigItem.args[2].VALUE; long mask = trigItem.args[3].VALUE; long maskuse = trigItem.args[4].VALUE; action.values[4] = player; action.values[6] = unitid; action.values[5] = value; action.values[8] = modifier; action.values[0] = mask; action.values[10] = maskuse; action.valueSet(); action.acttype = (byte)45; } else { for (int i = 0; i < trigItem.args.Count; i++) { int pos = trigItem.args[i].argDefine.pos; action.values[pos] = trigItem.args[i].GetCHKValue; } action.valueSet(); action.acttype = (byte)trigItem.type; } action.flags = (byte)trigItem.triggerDefine.FLAG; if (!trigItem.IsEnable) { action.flags += 2; } } actions[a] = action; } exeflag = cTrigger.exeflag; playerlist = cTrigger.playerlist; trigindex = 0; }
public RAWTRIGMBRF(BinaryReader br) { for (int c = 0; c < 16; c++) { RawCondition condition = new RawCondition(); condition.locid = br.ReadUInt32(); //u32: Location number for the condition (1 based -- 0 refers to No Location), EUD Bitmask for a Death condition if the MaskFlag is set to "SC" condition.player = br.ReadUInt32(); //u32: Group that the condition applies to condition.amount = br.ReadUInt32(); //u32: Qualified number(how many/resource amount) condition.unitid = br.ReadUInt16(); //u16: Unit ID condition applies to condition.comparison = br.ReadByte(); //u8: Numeric comparison, switch state condition.condtype = br.ReadByte(); //u8: Condition byte condition.restype = br.ReadByte(); //u8: Resource type, score type, Switch number(0-based) condition.flags = br.ReadByte(); //u8: Flags condition.maskflag = br.ReadUInt16(); //u16: MaskFlag: set to "SC" (0x53, 0x43) when using the bitmask for EUDs, 0 otherwise if (condition.condtype > 23) { condition.condtype = 0; } condition.values[0] = condition.locid; condition.values[1] = condition.player; condition.values[2] = condition.amount; condition.values[3] = condition.unitid; condition.values[4] = condition.comparison; condition.values[5] = condition.condtype; condition.values[6] = condition.restype; condition.values[7] = condition.flags; condition.values[8] = condition.maskflag; conditions[c] = condition; } for (int a = 0; a < 64; a++) { RawAction action = new RawAction(); action.locid1 = br.ReadUInt32(); //u32: Location - source location in "Order" and "Move Unit", dest location in "Move Location" (1 based -- 0 refers to No Location), EUD Bitmask for a Death action if the MaskFlag is set to "SC" action.strid = br.ReadUInt32(); //u32: String number for trigger text(0 means no string) action.wavid = br.ReadUInt32(); //u32: WAV string number(0 means no string) action.time = br.ReadUInt32(); //u32: Seconds/milliseconds of time action.player1 = br.ReadUInt32(); //u32: First(or only) Group/Player affected. action.player2 = br.ReadUInt32(); //u32: Second group affected, secondary location (1-based), CUWP #, number, AI script (4-byte string), switch (0-based #) action.unitid = br.ReadUInt16(); //u16: Unit type, score type, resource type, alliance status action.acttype = br.ReadByte(); //u8: Action byte action.amount = br.ReadByte(); //u8: Number of units(0 means All Units), action state, unit order, number modifier action.flags = br.ReadByte(); //u8: Flags action.padding = br.ReadByte(); //u8: Padding action.maskflag = br.ReadUInt16(); //u16 (2 bytes): MaskFlag: set to "SC"(0x53, 0x43) when using the bitmask for EUDs, 0 otherwise if (action.acttype > 57) { action.acttype = 0; } action.values[0] = action.locid1; action.values[1] = action.strid; action.values[2] = action.wavid; action.values[3] = action.time; action.values[4] = action.player1; action.values[5] = action.player2; action.values[6] = action.unitid; action.values[7] = action.acttype; action.values[8] = action.amount; action.values[9] = action.flags; action.values[10] = action.maskflag; actions[a] = action; } exeflag = br.ReadUInt32(); playerlist = br.ReadBytes(27); trigindex = br.ReadByte(); }
protected virtual string CompileRawCondition(SqlResult context, RawCondition x) { context.Bindings.AddRange(x.Bindings); return(wrapper.WrapIdentifiers(x.Expression)); }