public StoreOperationUninstallDeployment(IDefinitionAppId appid, StoreApplicationReference AppRef) { this.Size = (uint) Marshal.SizeOf(typeof(StoreOperationUninstallDeployment)); this.Flags = OpFlags.Nothing; this.Application = appid; this.Reference = AppRef.ToIntPtr(); }
public StoreOperationUnpinDeployment(System.Deployment.Internal.Isolation.IDefinitionAppId app, System.Deployment.Internal.Isolation.StoreApplicationReference reference) { this.Size = (uint)Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment)); this.Flags = OpFlags.Nothing; this.Application = app; this.Reference = reference.ToIntPtr(); }
public StoreOperationSetDeploymentMetadata(System.Deployment.Internal.Isolation.IDefinitionAppId Deployment, System.Deployment.Internal.Isolation.StoreApplicationReference Reference, System.Deployment.Internal.Isolation.StoreOperationMetadataProperty[] SetProperties, System.Deployment.Internal.Isolation.StoreOperationMetadataProperty[] TestProperties) { this.Size = (uint)Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata)); this.Flags = OpFlags.Nothing; this.Deployment = Deployment; if (SetProperties != null) { this.PropertiesToSet = MarshalProperties(SetProperties); this.cPropertiesToSet = new IntPtr(SetProperties.Length); } else { this.PropertiesToSet = IntPtr.Zero; this.cPropertiesToSet = IntPtr.Zero; } if (TestProperties != null) { this.PropertiesToTest = MarshalProperties(TestProperties); this.cPropertiesToTest = new IntPtr(TestProperties.Length); } else { this.PropertiesToTest = IntPtr.Zero; this.cPropertiesToTest = IntPtr.Zero; } this.InstallerReference = Reference.ToIntPtr(); }
public StoreOperationSetDeploymentMetadata(System.Deployment.Internal.Isolation.IDefinitionAppId Deployment, System.Deployment.Internal.Isolation.StoreApplicationReference Reference, System.Deployment.Internal.Isolation.StoreOperationMetadataProperty[] SetProperties, System.Deployment.Internal.Isolation.StoreOperationMetadataProperty[] TestProperties) { this.Size = (uint) Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata)); this.Flags = OpFlags.Nothing; this.Deployment = Deployment; if (SetProperties != null) { this.PropertiesToSet = MarshalProperties(SetProperties); this.cPropertiesToSet = new IntPtr(SetProperties.Length); } else { this.PropertiesToSet = IntPtr.Zero; this.cPropertiesToSet = IntPtr.Zero; } if (TestProperties != null) { this.PropertiesToTest = MarshalProperties(TestProperties); this.cPropertiesToTest = new IntPtr(TestProperties.Length); } else { this.PropertiesToTest = IntPtr.Zero; this.cPropertiesToTest = IntPtr.Zero; } this.InstallerReference = Reference.ToIntPtr(); }
public StoreOperationSetCanonicalizationContext(string Bases, string Exports) { this.Size = (uint)Marshal.SizeOf(typeof(StoreOperationSetCanonicalizationContext)); this.Flags = OpFlags.Nothing; this.BaseAddressFilePath = Bases; this.ExportsFilePath = Exports; }
public StoreOperationSetCanonicalizationContext(string Bases, string Exports) { this.Size = (uint) Marshal.SizeOf(typeof(StoreOperationSetCanonicalizationContext)); this.Flags = OpFlags.Nothing; this.BaseAddressFilePath = Bases; this.ExportsFilePath = Exports; }
public StoreOperationUnpinDeployment(System.Deployment.Internal.Isolation.IDefinitionAppId app, System.Deployment.Internal.Isolation.StoreApplicationReference reference) { this.Size = (uint) Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationUnpinDeployment)); this.Flags = OpFlags.Nothing; this.Application = app; this.Reference = reference.ToIntPtr(); }
public StoreOperationStageComponent(System.Deployment.Internal.Isolation.IDefinitionAppId app, System.Deployment.Internal.Isolation.IDefinitionIdentity comp, string Manifest) { this.Size = (uint) Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationStageComponent)); this.Flags = OpFlags.Nothing; this.Application = app; this.Component = comp; this.ManifestPath = Manifest; }
public StoreOperationPinDeployment(System.Deployment.Internal.Isolation.IDefinitionAppId AppId, System.Deployment.Internal.Isolation.StoreApplicationReference Ref) { this.Size = (uint) Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationPinDeployment)); this.Flags = OpFlags.NeverExpires; this.Application = AppId; this.Reference = Ref.ToIntPtr(); this.ExpirationTime = 0L; }
public StoreOperationStageComponent(IDefinitionAppId app, IDefinitionIdentity comp, string Manifest) { this.Size = (uint)Marshal.SizeOf(typeof(StoreOperationStageComponent)); this.Flags = OpFlags.Nothing; this.Application = app; this.Component = comp; this.ManifestPath = Manifest; }
public StoreOperationStageComponent(System.Deployment.Internal.Isolation.IDefinitionAppId app, System.Deployment.Internal.Isolation.IDefinitionIdentity comp, string Manifest) { this.Size = (uint)Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationStageComponent)); this.Flags = OpFlags.Nothing; this.Application = app; this.Component = comp; this.ManifestPath = Manifest; }
public StoreOperationPinDeployment(System.Deployment.Internal.Isolation.IDefinitionAppId AppId, System.Deployment.Internal.Isolation.StoreApplicationReference Ref) { this.Size = (uint)Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationPinDeployment)); this.Flags = OpFlags.NeverExpires; this.Application = AppId; this.Reference = Ref.ToIntPtr(); this.ExpirationTime = 0L; }
public StoreOperationStageComponent(IDefinitionAppId app, IDefinitionIdentity comp, string Manifest) { this.Size = (uint) Marshal.SizeOf(typeof(StoreOperationStageComponent)); this.Flags = OpFlags.Nothing; this.Application = app; this.Component = comp; this.ManifestPath = Manifest; }
public StoreOperationStageComponentFile(System.Deployment.Internal.Isolation.IDefinitionAppId App, System.Deployment.Internal.Isolation.IDefinitionIdentity Component, string CompRelPath, string SrcFile) { this.Size = (uint)Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationStageComponentFile)); this.Flags = OpFlags.Nothing; this.Application = App; this.Component = Component; this.ComponentRelativePath = CompRelPath; this.SourceFilePath = SrcFile; }
public StoreOperationStageComponentFile(IDefinitionAppId App, IDefinitionIdentity Component, string CompRelPath, string SrcFile) { this.Size = (uint) Marshal.SizeOf(typeof(StoreOperationStageComponentFile)); this.Flags = OpFlags.Nothing; this.Application = App; this.Component = Component; this.ComponentRelativePath = CompRelPath; this.SourceFilePath = SrcFile; }
public OperationWithAction(OperationCode opCode, int clientNum) { this.m_opCode = opCode; this.m_authzOpCode = opCode; this.m_clientNum = clientNum; this.m_flags = OpFlags.None; SetIndices(4); this.m_opNum = 0; }
public OperationWithAction(OperationCode opCode, OperationCode deniedOpCode, int clientNum, OpFlags flags, int numOps) { this.m_opCode = opCode; this.m_authzOpCode = deniedOpCode; this.m_clientNum = clientNum; this.m_flags = flags; SetIndices(numOps); this.m_opNum = 0; }
public OperationWithAction(OperationCode opCode, OperationCode authzOpCode, int clientNum, OpFlags flags, int[] indices) { this.m_opCode = opCode; this.m_authzOpCode = authzOpCode; this.m_clientNum = clientNum; this.m_flags = flags; this.m_indices = indices; this.m_opNum = 0; }
public StoreOperationInstallDeployment(IDefinitionAppId App, bool UninstallOthers, StoreApplicationReference reference) { this.Size = (uint)Marshal.SizeOf(typeof(StoreOperationInstallDeployment)); this.Flags = OpFlags.Nothing; this.Application = App; if (UninstallOthers) { this.Flags |= OpFlags.UninstallOthers; } this.Reference = reference.ToIntPtr(); }
public StoreOperationInstallDeployment(IDefinitionAppId App, bool UninstallOthers, StoreApplicationReference reference) { this.Size = (uint) Marshal.SizeOf(typeof(StoreOperationInstallDeployment)); this.Flags = OpFlags.Nothing; this.Application = App; if (UninstallOthers) { this.Flags |= OpFlags.UninstallOthers; } this.Reference = reference.ToIntPtr(); }
private static OpFlags MakeFlags(bool negate, bool ignore, bool reverse, bool lazy) { OpFlags opFlags = OpFlags.None; if (negate) { opFlags |= OpFlags.Negate; } if (ignore) { opFlags |= OpFlags.IgnoreCase; } if (reverse) { opFlags |= OpFlags.RightToLeft; } if (lazy) { opFlags |= OpFlags.Lazy; } return(opFlags); }
public StoreOperationScavenge(bool Light, ulong SizeLimit, ulong RunLimit, uint ComponentLimit) { this.Size = (uint) Marshal.SizeOf(typeof(System.Deployment.Internal.Isolation.StoreOperationScavenge)); this.Flags = OpFlags.Nothing; if (Light) { this.Flags |= OpFlags.Light; } this.SizeReclaimationLimit = SizeLimit; if (SizeLimit != 0L) { this.Flags |= OpFlags.LimitSize; } this.RuntimeLimit = RunLimit; if (RunLimit != 0L) { this.Flags |= OpFlags.LimitTime; } this.ComponentCountLimit = ComponentLimit; if (ComponentLimit != 0) { this.Flags |= OpFlags.LimitCount; } }
public StoreOperationScavenge(bool Light, ulong SizeLimit, ulong RunLimit, uint ComponentLimit) { this.Size = (uint)Marshal.SizeOf(typeof(StoreOperationScavenge)); this.Flags = OpFlags.Nothing; if (Light) { this.Flags |= OpFlags.Light; } this.SizeReclaimationLimit = SizeLimit; if (SizeLimit != 0L) { this.Flags |= OpFlags.LimitSize; } this.RuntimeLimit = RunLimit; if (RunLimit != 0L) { this.Flags |= OpFlags.LimitTime; } this.ComponentCountLimit = ComponentLimit; if (ComponentLimit != 0) { this.Flags |= OpFlags.LimitCount; } }
private bool EvalChar(Mode mode, ref int ptr, ref int pc, bool multi) { bool flag = false; char c = '\0'; bool flag3; do { ushort num = program[pc]; OpCode opCode = (OpCode)(num & 0xFF); OpFlags opFlags = (OpFlags)(num & 0xFF00); pc++; bool flag2 = (opFlags & OpFlags.IgnoreCase) != OpFlags.None; if (!flag) { if ((opFlags & OpFlags.RightToLeft) != 0) { if (ptr <= 0) { return(false); } c = text[--ptr]; } else { if (ptr >= text_end) { return(false); } c = text[ptr++]; } if (flag2) { c = char.ToLower(c); } flag = true; } flag3 = ((opFlags & OpFlags.Negate) != OpFlags.None); switch (opCode) { case OpCode.True: return(true); case OpCode.False: return(false); case OpCode.Character: if (c == program[pc++]) { return(!flag3); } break; case OpCode.Category: if (CategoryUtils.IsCategory((Category)program[pc++], c)) { return(!flag3); } break; case OpCode.NotCategory: if (!CategoryUtils.IsCategory((Category)program[pc++], c)) { return(!flag3); } break; case OpCode.Range: { int num6 = program[pc++]; int num7 = program[pc++]; if (num6 <= c && c <= num7) { return(!flag3); } break; } case OpCode.Set: { int num2 = program[pc++]; int num3 = program[pc++]; int num4 = pc; pc += num3; int num5 = c - num2; if (num5 < 0 || num5 >= num3 << 4 || (program[num4 + (num5 >> 4)] & (1 << (num5 & 0xF))) == 0) { break; } return(!flag3); } } }while (multi); return(flag3); }
public static ushort EncodeOp (OpCode op, OpFlags flags) { return (ushort)((int)op | ((int)flags & 0xff00)); }
private void Emit(OpCode op, OpFlags flags) { Emit(EncodeOp(op, flags)); }
public StoreOperationPinDeployment(System.Deployment.Internal.Isolation.IDefinitionAppId AppId, DateTime Expiry, System.Deployment.Internal.Isolation.StoreApplicationReference Ref) : this(AppId, Ref) { this.Flags |= OpFlags.NeverExpires; }
private bool Eval(Mode mode, ref int ref_ptr, int pc) { int ptr = ref_ptr; Begin: for (;;) { ushort word = program[pc]; OpCode op = (OpCode)(word & 0x00ff); OpFlags flags = (OpFlags)(word & 0xff00); switch (op) { case OpCode.Anchor: { int skip = program[pc + 1]; int anch_offset = program[pc + 2]; bool anch_reverse = (flags & OpFlags.RightToLeft) != 0; int anch_ptr = anch_reverse ? ptr - anch_offset : ptr + anch_offset; int anch_end = text_end - match_min + anch_offset; // maximum anchor position int anch_begin = 0; // the general case for an anchoring expression is at the bottom, however we // do some checks for the common cases before to save processing time. the current // optimizer only outputs three types of anchoring expressions: fixed position, // fixed substring, and no anchor. OpCode anch_op = (OpCode)(program[pc + 3] & 0x00ff); if (anch_op == OpCode.Position && skip == 6) // position anchor // Anchor // Position // True { switch ((Position)program[pc + 4]) { case Position.StartOfString: if (anch_reverse || anch_offset == 0) { if (anch_reverse) { ptr = anch_offset; } if (TryMatch(ref ptr, pc + skip)) { goto Pass; } } break; case Position.StartOfLine: if (anch_ptr == 0) { ptr = 0; if (TryMatch(ref ptr, pc + skip)) { goto Pass; } ++anch_ptr; } while ((anch_reverse && anch_ptr >= 0) || (!anch_reverse && anch_ptr <= anch_end)) { if (anch_ptr == 0 || text[anch_ptr - 1] == '\n') { if (anch_reverse) { ptr = anch_ptr == anch_end ? anch_ptr : anch_ptr + anch_offset; } else { ptr = anch_ptr == 0 ? anch_ptr : anch_ptr - anch_offset; } if (TryMatch(ref ptr, pc + skip)) { goto Pass; } } if (anch_reverse) { --anch_ptr; } else { ++anch_ptr; } } break; case Position.StartOfScan: if (anch_ptr == scan_ptr) { ptr = anch_reverse ? scan_ptr + anch_offset : scan_ptr - anch_offset; if (TryMatch(ref ptr, pc + skip)) { goto Pass; } } break; default: // FIXME break; } } else if (qs != null || (anch_op == OpCode.String && skip == 6 + program[pc + 4])) // substring anchor // Anchor // String // True { bool reverse = ((OpFlags)program[pc + 3] & OpFlags.RightToLeft) != 0; if (qs == null) { bool ignore = ((OpFlags)program[pc + 3] & OpFlags.IgnoreCase) != 0; string substring = GetString(pc + 3); qs = new QuickSearch(substring, ignore, reverse); } while ((anch_reverse && anch_ptr >= anch_begin) || (!anch_reverse && anch_ptr <= anch_end)) { if (reverse) { anch_ptr = qs.Search(text, anch_ptr, anch_begin); if (anch_ptr != -1) { anch_ptr += qs.Length; } } else { anch_ptr = qs.Search(text, anch_ptr, anch_end); } if (anch_ptr < 0) { break; } ptr = reverse ? anch_ptr + anch_offset : anch_ptr - anch_offset; if (TryMatch(ref ptr, pc + skip)) { goto Pass; } if (reverse) { anch_ptr -= 2; } else { ++anch_ptr; } } } else if (anch_op == OpCode.True) // no anchor // Anchor // True { while ((anch_reverse && anch_ptr >= anch_begin) || (!anch_reverse && anch_ptr <= anch_end)) { ptr = anch_ptr; if (TryMatch(ref ptr, pc + skip)) { goto Pass; } if (anch_reverse) { --anch_ptr; } else { ++anch_ptr; } } } else // general case // Anchor // <expr> // True { while ((anch_reverse && anch_ptr >= anch_begin) || (!anch_reverse && anch_ptr <= anch_end)) { ptr = anch_ptr; if (Eval(Mode.Match, ref ptr, pc + 3)) { // anchor expression passed: try real expression at the correct offset ptr = anch_reverse ? anch_ptr + anch_offset : anch_ptr - anch_offset; if (TryMatch(ref ptr, pc + skip)) { goto Pass; } } if (anch_reverse) { --anch_ptr; } else { ++anch_ptr; } } } goto Fail; } case OpCode.False: { goto Fail; } case OpCode.True: { goto Pass; } case OpCode.Position: { if (!IsPosition((Position)program[pc + 1], ptr)) { goto Fail; } pc += 2; break; } case OpCode.String: { bool reverse = (flags & OpFlags.RightToLeft) != 0; bool ignore = (flags & OpFlags.IgnoreCase) != 0; int len = program[pc + 1]; if (reverse) { ptr -= len; if (ptr < 0) { goto Fail; } } else if (ptr + len > text_end) { goto Fail; } pc += 2; for (int i = 0; i < len; ++i) { char c = text[ptr + i]; if (ignore) { c = Char.ToLower(c); } if (c != (char)program[pc++]) { goto Fail; } } if (!reverse) { ptr += len; } break; } case OpCode.Reference: { bool reverse = (flags & OpFlags.RightToLeft) != 0; bool ignore = (flags & OpFlags.IgnoreCase) != 0; int m = GetLastDefined(program [pc + 1]); if (m < 0) { goto Fail; } int str = marks [m].Index; int len = marks [m].Length; if (reverse) { ptr -= len; if (ptr < 0) { goto Fail; } } else if (ptr + len > text_end) { goto Fail; } pc += 2; if (ignore) { for (int i = 0; i < len; ++i) { if (Char.ToLower(text[ptr + i]) != Char.ToLower(text[str + i])) { goto Fail; } } } else { for (int i = 0; i < len; ++i) { if (text[ptr + i] != text[str + i]) { goto Fail; } } } if (!reverse) { ptr += len; } break; } case OpCode.Character: case OpCode.Category: case OpCode.NotCategory: case OpCode.Range: case OpCode.Set: { if (!EvalChar(mode, ref ptr, ref pc, false)) { goto Fail; } break; } case OpCode.In: { int target = pc + program[pc + 1]; pc += 2; if (!EvalChar(mode, ref ptr, ref pc, true)) { goto Fail; } pc = target; break; } case OpCode.Open: { Open(program[pc + 1], ptr); pc += 2; break; } case OpCode.Close: { Close(program[pc + 1], ptr); pc += 2; break; } case OpCode.BalanceStart: { int start = ptr; //point before the balancing group if (!Eval(Mode.Match, ref ptr, pc + 5)) { goto Fail; } if (!Balance(program[pc + 1], program[pc + 2], (program[pc + 3] == 1 ? true : false), start)) { goto Fail; } pc += program[pc + 4]; break; } case OpCode.Balance: { goto Pass; } case OpCode.IfDefined: { int m = GetLastDefined(program [pc + 2]); if (m < 0) { pc += program[pc + 1]; } else { pc += 3; } break; } case OpCode.Sub: { if (!Eval(Mode.Match, ref ptr, pc + 2)) { goto Fail; } pc += program[pc + 1]; break; } case OpCode.Test: { int cp = Checkpoint(); int test_ptr = ptr; if (Eval(Mode.Match, ref test_ptr, pc + 3)) { pc += program[pc + 1]; } else { Backtrack(cp); pc += program[pc + 2]; } break; } case OpCode.Branch: { OpCode branch_op; do { int cp = Checkpoint(); if (Eval(Mode.Match, ref ptr, pc + 2)) { goto Pass; } Backtrack(cp); pc += program[pc + 1]; branch_op = (OpCode)(program[pc] & 0xff); } while (branch_op != OpCode.False); goto Fail; } case OpCode.Jump: { pc += program[pc + 1]; break; } case OpCode.Repeat: { this.repeat = new RepeatContext( this.repeat, // previous context ReadProgramCount(pc + 2), // minimum ReadProgramCount(pc + 4), // maximum (flags & OpFlags.Lazy) != 0, // lazy pc + 6 // subexpression ); if (Eval(Mode.Match, ref ptr, pc + program[pc + 1])) { goto Pass; } else { this.repeat = this.repeat.Previous; goto Fail; } } case OpCode.Until: { RepeatContext current = this.repeat; // // Can we avoid recursion? // // Backtracking can be forced in nested quantifiers from the tail of this quantifier. // Thus, we cannot, in general, use a simple loop on repeat.Expression to handle // quantifiers. // // If 'deep' was unmolested, that implies that there was no nested quantifiers. // Thus, we can safely avoid recursion. // if (deep == current) { goto Pass; } int start = current.Start; int start_count = current.Count; while (!current.IsMinimum) { ++current.Count; current.Start = ptr; deep = current; if (!Eval(Mode.Match, ref ptr, current.Expression)) { current.Start = start; current.Count = start_count; goto Fail; } if (deep != current) // recursive mode { goto Pass; } } if (ptr == current.Start) { // degenerate match ... match tail or fail this.repeat = current.Previous; deep = null; if (Eval(Mode.Match, ref ptr, pc + 1)) { goto Pass; } this.repeat = current; goto Fail; } if (current.IsLazy) { for (;;) { // match tail first ... this.repeat = current.Previous; deep = null; int cp = Checkpoint(); if (Eval(Mode.Match, ref ptr, pc + 1)) { goto Pass; } Backtrack(cp); // ... then match more this.repeat = current; if (current.IsMaximum) { goto Fail; } ++current.Count; current.Start = ptr; deep = current; if (!Eval(Mode.Match, ref ptr, current.Expression)) { current.Start = start; current.Count = start_count; goto Fail; } if (deep != current) // recursive mode { goto Pass; } // Degenerate match: ptr has not moved since the last (failed) tail match. // So, next and subsequent tail matches will fail. if (ptr == current.Start) { goto Fail; } } } else { int stack_size = stack.Count; // match greedily as much as possible while (!current.IsMaximum) { int cp = Checkpoint(); int old_ptr = ptr; int old_start = current.Start; ++current.Count; current.Start = ptr; deep = current; if (!Eval(Mode.Match, ref ptr, current.Expression)) { --current.Count; current.Start = old_start; Backtrack(cp); break; } if (deep != current) { // recursive mode: no more backtracking, truncate the stack stack.Count = stack_size; goto Pass; } stack.Push(cp); stack.Push(old_ptr); // Degenerate match: no point going on if (ptr == current.Start) { break; } } // then, match the tail, backtracking as necessary. this.repeat = current.Previous; for (;;) { deep = null; if (Eval(Mode.Match, ref ptr, pc + 1)) { stack.Count = stack_size; goto Pass; } if (stack.Count == stack_size) { this.repeat = current; goto Fail; } --current.Count; ptr = stack.Pop(); Backtrack(stack.Pop()); } } } case OpCode.FastRepeat: { this.fast = new RepeatContext( fast, ReadProgramCount(pc + 2), // minimum ReadProgramCount(pc + 4), // maximum (flags & OpFlags.Lazy) != 0, // lazy pc + 6 // subexpression ); fast.Start = ptr; int cp = Checkpoint(); pc += program[pc + 1]; // tail expression ushort tail_word = program[pc]; int c1 = -1; // first character of tail operator int c2 = -1; // ... and the same character, in upper case if ignoring case int coff = 0; // 0 or -1 depending on direction OpCode tail_op = (OpCode)(tail_word & 0xff); if (tail_op == OpCode.Character || tail_op == OpCode.String) { OpFlags tail_flags = (OpFlags)(tail_word & 0xff00); if ((tail_flags & OpFlags.Negate) != 0) { goto skip; } if (tail_op == OpCode.String) { int offset = 0; if ((tail_flags & OpFlags.RightToLeft) != 0) { offset = program[pc + 1] - 1; } c1 = program[pc + 2 + offset]; // first char of string } else { c1 = program[pc + 1]; // character } if ((tail_flags & OpFlags.IgnoreCase) != 0) { c2 = Char.ToUpper((char)c1); // ignore case } else { c2 = c1; } if ((tail_flags & OpFlags.RightToLeft) != 0) { coff = -1; // reverse } else { coff = 0; } } skip: if (fast.IsLazy) { if (!fast.IsMinimum && !Eval(Mode.Count, ref ptr, fast.Expression)) { //Console.WriteLine ("lazy fast: failed mininum."); fast = fast.Previous; goto Fail; } while (true) { int p = ptr + coff; if (c1 < 0 || (p >= 0 && p < text_end && (c1 == text[p] || c2 == text[p]))) { deep = null; if (Eval(Mode.Match, ref ptr, pc)) { break; } } if (fast.IsMaximum) { //Console.WriteLine ("lazy fast: failed with maximum."); fast = fast.Previous; goto Fail; } Backtrack(cp); if (!Eval(Mode.Count, ref ptr, fast.Expression)) { //Console.WriteLine ("lazy fast: no more."); fast = fast.Previous; goto Fail; } } fast = fast.Previous; goto Pass; } else { if (!Eval(Mode.Count, ref ptr, fast.Expression)) { fast = fast.Previous; goto Fail; } int width; if (fast.Count > 0) { width = (ptr - fast.Start) / fast.Count; } else { width = 0; } while (true) { int p = ptr + coff; if (c1 < 0 || (p >= 0 && p < text_end && (c1 == text[p] || c2 == text[p]))) { deep = null; if (Eval(Mode.Match, ref ptr, pc)) { break; } } --fast.Count; if (!fast.IsMinimum) { fast = fast.Previous; goto Fail; } ptr -= width; Backtrack(cp); } fast = fast.Previous; goto Pass; } } case OpCode.Info: { Debug.Assert(false, "Regex", "Info block found in pattern"); goto Fail; } } } Pass: ref_ptr = ptr; switch (mode) { case Mode.Match: return(true); case Mode.Count: { ++fast.Count; if (fast.IsMaximum || (fast.IsLazy && fast.IsMinimum)) { return(true); } pc = fast.Expression; goto Begin; } } Fail: switch (mode) { case Mode.Match: return(false); case Mode.Count: { if (!fast.IsLazy && fast.IsMinimum) { return(true); } ref_ptr = fast.Start; return(false); } } return(false); }
[System.Security.SecuritySafeCritical] // auto-generated public StoreOperationUnpinDeployment(IDefinitionAppId app, StoreApplicationReference reference) { Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationUnpinDeployment)); Flags = OpFlags.Nothing; Application = app; Reference = reference.ToIntPtr(); }
[System.Security.SecuritySafeCritical] // auto-generated public StoreOperationSetDeploymentMetadata(IDefinitionAppId Deployment, StoreApplicationReference Reference, StoreOperationMetadataProperty[] SetProperties, StoreOperationMetadataProperty[] TestProperties) { Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationSetDeploymentMetadata)); Flags = OpFlags.Nothing; this.Deployment = Deployment; if (SetProperties != null) { PropertiesToSet = MarshalProperties(SetProperties); cPropertiesToSet = new IntPtr(SetProperties.Length); } else { PropertiesToSet = IntPtr.Zero; cPropertiesToSet = IntPtr.Zero; } if (TestProperties != null) { PropertiesToTest = MarshalProperties(TestProperties); cPropertiesToTest = new IntPtr(TestProperties.Length); } else { PropertiesToTest = IntPtr.Zero; cPropertiesToTest = IntPtr.Zero; } InstallerReference = Reference.ToIntPtr(); }
private bool Eval(Interpreter.Mode mode, ref int ref_ptr, int pc) { int num = ref_ptr; Interpreter.RepeatContext repeatContext; int start; int count; for (;;) { OpFlags opFlags; for (;;) { ushort num2 = this.program[pc]; OpCode opCode = (OpCode)(num2 & 255); opFlags = (OpFlags)(num2 & 65280); switch (opCode) { case OpCode.False: goto IL_4B8; case OpCode.True: goto IL_4BD; case OpCode.Position: if (!this.IsPosition((Position)this.program[pc + 1], num)) { goto Block_44; } pc += 2; break; case OpCode.String: { bool flag = (ushort)(opFlags & OpFlags.RightToLeft) != 0; bool flag2 = (ushort)(opFlags & OpFlags.IgnoreCase) != 0; int num3 = (int)this.program[pc + 1]; if (flag) { num -= num3; if (num < 0) { goto Block_46; } } else if (num + num3 > this.text_end) { goto Block_47; } pc += 2; for (int i = 0; i < num3; i++) { char c = this.text[num + i]; if (flag2) { c = char.ToLower(c); } if (c != (char)this.program[pc++]) { goto Block_49; } } if (!flag) { num += num3; } break; } case OpCode.Reference: { bool flag3 = (ushort)(opFlags & OpFlags.RightToLeft) != 0; bool flag4 = (ushort)(opFlags & OpFlags.IgnoreCase) != 0; int lastDefined = this.GetLastDefined((int)this.program[pc + 1]); if (lastDefined < 0) { goto Block_52; } int index = this.marks[lastDefined].Index; int length = this.marks[lastDefined].Length; if (flag3) { num -= length; if (num < 0) { goto Block_54; } } else if (num + length > this.text_end) { goto Block_55; } pc += 2; if (flag4) { for (int j = 0; j < length; j++) { if (char.ToLower(this.text[num + j]) != char.ToLower(this.text[index + j])) { goto Block_57; } } } else { for (int k = 0; k < length; k++) { if (this.text[num + k] != this.text[index + k]) { goto Block_59; } } } if (!flag3) { num += length; } break; } case OpCode.Character: case OpCode.Category: case OpCode.NotCategory: case OpCode.Range: case OpCode.Set: if (!this.EvalChar(mode, ref num, ref pc, false)) { goto Block_61; } break; case OpCode.In: { int num4 = pc + (int)this.program[pc + 1]; pc += 2; if (!this.EvalChar(mode, ref num, ref pc, true)) { goto Block_62; } pc = num4; break; } case OpCode.Open: this.Open((int)this.program[pc + 1], num); pc += 2; break; case OpCode.Close: this.Close((int)this.program[pc + 1], num); pc += 2; break; case OpCode.Balance: goto IL_7DB; case OpCode.BalanceStart: { int ptr = num; if (!this.Eval(Interpreter.Mode.Match, ref num, pc + 5)) { goto Block_63; } if (!this.Balance((int)this.program[pc + 1], (int)this.program[pc + 2], this.program[pc + 3] == 1, ptr)) { goto Block_65; } pc += (int)this.program[pc + 4]; break; } case OpCode.IfDefined: { int lastDefined2 = this.GetLastDefined((int)this.program[pc + 2]); if (lastDefined2 < 0) { pc += (int)this.program[pc + 1]; } else { pc += 3; } break; } case OpCode.Sub: if (!this.Eval(Interpreter.Mode.Match, ref num, pc + 2)) { goto Block_67; } pc += (int)this.program[pc + 1]; break; case OpCode.Test: { int cp = this.Checkpoint(); int num5 = num; if (this.Eval(Interpreter.Mode.Match, ref num5, pc + 3)) { pc += (int)this.program[pc + 1]; } else { this.Backtrack(cp); pc += (int)this.program[pc + 2]; } break; } case OpCode.Branch: goto IL_88A; case OpCode.Jump: pc += (int)this.program[pc + 1]; break; case OpCode.Repeat: goto IL_8EE; case OpCode.Until: goto IL_957; case OpCode.FastRepeat: goto IL_C6F; case OpCode.Anchor: goto IL_96; case OpCode.Info: goto IL_FE9; } } for (;;) { IL_88A: int cp2 = this.Checkpoint(); if (this.Eval(Interpreter.Mode.Match, ref num, pc + 2)) { break; } this.Backtrack(cp2); pc += (int)this.program[pc + 1]; if ((this.program[pc] & 255) == 0) { goto Block_70; } } IL_FF3: ref_ptr = num; if (mode == Interpreter.Mode.Match) { return(true); } if (mode != Interpreter.Mode.Count) { break; } this.fast.Count++; if (this.fast.IsMaximum || (this.fast.IsLazy && this.fast.IsMinimum)) { return(true); } pc = this.fast.Expression; continue; IL_96: int num6 = (int)this.program[pc + 1]; int num7 = (int)this.program[pc + 2]; bool flag5 = (ushort)(opFlags & OpFlags.RightToLeft) != 0; int num8 = (!flag5) ? (num + num7) : (num - num7); int num9 = this.text_end - this.match_min + num7; int num10 = 0; OpCode opCode2 = (OpCode)(this.program[pc + 3] & 255); if (opCode2 == OpCode.Position && num6 == 6) { switch (this.program[pc + 4]) { case 2: if (flag5 || num7 == 0) { if (flag5) { num = num7; } if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } } break; case 3: if (num8 == 0) { num = 0; if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } num8++; } while ((flag5 && num8 >= 0) || (!flag5 && num8 <= num9)) { if (num8 == 0 || this.text[num8 - 1] == '\n') { if (flag5) { num = ((num8 != num9) ? (num8 + num7) : num8); } else { num = ((num8 != 0) ? (num8 - num7) : num8); } if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } } if (flag5) { num8--; } else { num8++; } } break; case 4: if (num8 == this.scan_ptr) { num = ((!flag5) ? (this.scan_ptr - num7) : (this.scan_ptr + num7)); if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } } break; } break; } if (this.qs != null || (opCode2 == OpCode.String && num6 == (int)(6 + this.program[pc + 4]))) { bool flag6 = (this.program[pc + 3] & 1024) != 0; if (this.qs == null) { bool ignore = (this.program[pc + 3] & 512) != 0; string @string = this.GetString(pc + 3); this.qs = new QuickSearch(@string, ignore, flag6); } while ((flag5 && num8 >= num10) || (!flag5 && num8 <= num9)) { if (flag6) { num8 = this.qs.Search(this.text, num8, num10); if (num8 != -1) { num8 += this.qs.Length; } } else { num8 = this.qs.Search(this.text, num8, num9); } if (num8 < 0) { break; } num = ((!flag6) ? (num8 - num7) : (num8 + num7)); if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } if (flag6) { num8 -= 2; } else { num8++; } } break; } if (opCode2 == OpCode.True) { while ((flag5 && num8 >= num10) || (!flag5 && num8 <= num9)) { num = num8; if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } if (flag5) { num8--; } else { num8++; } } break; } while ((flag5 && num8 >= num10) || (!flag5 && num8 <= num9)) { num = num8; if (this.Eval(Interpreter.Mode.Match, ref num, pc + 3)) { num = ((!flag5) ? (num8 - num7) : (num8 + num7)); if (this.TryMatch(ref num, pc + num6)) { goto IL_FF3; } } if (flag5) { num8--; } else { num8++; } } break; IL_4BD: IL_7DB: goto IL_FF3; IL_8EE: this.repeat = new Interpreter.RepeatContext(this.repeat, this.ReadProgramCount(pc + 2), this.ReadProgramCount(pc + 4), (ushort)(opFlags & OpFlags.Lazy) != 0, pc + 6); if (this.Eval(Interpreter.Mode.Match, ref num, pc + (int)this.program[pc + 1])) { goto IL_FF3; } goto IL_941; IL_957: repeatContext = this.repeat; if (this.deep == repeatContext) { goto IL_FF3; } start = repeatContext.Start; count = repeatContext.Count; while (!repeatContext.IsMinimum) { repeatContext.Count++; repeatContext.Start = num; this.deep = repeatContext; if (!this.Eval(Interpreter.Mode.Match, ref num, repeatContext.Expression)) { goto Block_73; } if (this.deep != repeatContext) { goto IL_FF3; } } if (num == repeatContext.Start) { this.repeat = repeatContext.Previous; this.deep = null; if (this.Eval(Interpreter.Mode.Match, ref num, pc + 1)) { goto IL_FF3; } goto IL_A28; } else { if (repeatContext.IsLazy) { for (;;) { this.repeat = repeatContext.Previous; this.deep = null; int cp3 = this.Checkpoint(); if (this.Eval(Interpreter.Mode.Match, ref num, pc + 1)) { break; } this.Backtrack(cp3); this.repeat = repeatContext; if (repeatContext.IsMaximum) { goto Block_80; } repeatContext.Count++; repeatContext.Start = num; this.deep = repeatContext; if (!this.Eval(Interpreter.Mode.Match, ref num, repeatContext.Expression)) { goto Block_81; } if (this.deep != repeatContext) { break; } if (num == repeatContext.Start) { goto Block_83; } } goto IL_FF3; } int count2 = this.stack.Count; while (!repeatContext.IsMaximum) { int num11 = this.Checkpoint(); int value = num; int start2 = repeatContext.Start; repeatContext.Count++; repeatContext.Start = num; this.deep = repeatContext; if (!this.Eval(Interpreter.Mode.Match, ref num, repeatContext.Expression)) { repeatContext.Count--; repeatContext.Start = start2; this.Backtrack(num11); break; } if (this.deep != repeatContext) { this.stack.Count = count2; goto IL_FF3; } this.stack.Push(num11); this.stack.Push(value); if (num == repeatContext.Start) { break; } } this.repeat = repeatContext.Previous; for (;;) { this.deep = null; if (this.Eval(Interpreter.Mode.Match, ref num, pc + 1)) { break; } if (this.stack.Count == count2) { goto Block_88; } repeatContext.Count--; num = this.stack.Pop(); this.Backtrack(this.stack.Pop()); } this.stack.Count = count2; goto IL_FF3; } IL_C6F: this.fast = new Interpreter.RepeatContext(this.fast, this.ReadProgramCount(pc + 2), this.ReadProgramCount(pc + 4), (ushort)(opFlags & OpFlags.Lazy) != 0, pc + 6); this.fast.Start = num; int cp4 = this.Checkpoint(); pc += (int)this.program[pc + 1]; ushort num12 = this.program[pc]; int num13 = -1; int num14 = -1; int num15 = 0; OpCode opCode3 = (OpCode)(num12 & 255); if (opCode3 == OpCode.Character || opCode3 == OpCode.String) { OpFlags opFlags2 = (OpFlags)(num12 & 65280); if ((ushort)(opFlags2 & OpFlags.Negate) == 0) { if (opCode3 == OpCode.String) { int num16 = 0; if ((ushort)(opFlags2 & OpFlags.RightToLeft) != 0) { num16 = (int)(this.program[pc + 1] - 1); } num13 = (int)this.program[pc + 2 + num16]; } else { num13 = (int)this.program[pc + 1]; } if ((ushort)(opFlags2 & OpFlags.IgnoreCase) != 0) { num14 = (int)char.ToUpper((char)num13); } else { num14 = num13; } if ((ushort)(opFlags2 & OpFlags.RightToLeft) != 0) { num15 = -1; } else { num15 = 0; } } } if (this.fast.IsLazy) { if (!this.fast.IsMinimum && !this.Eval(Interpreter.Mode.Count, ref num, this.fast.Expression)) { goto Block_97; } for (;;) { int num17 = num + num15; if (num13 < 0 || (num17 >= 0 && num17 < this.text_end && (num13 == (int)this.text[num17] || num14 == (int)this.text[num17]))) { this.deep = null; if (this.Eval(Interpreter.Mode.Match, ref num, pc)) { break; } } if (this.fast.IsMaximum) { goto Block_103; } this.Backtrack(cp4); if (!this.Eval(Interpreter.Mode.Count, ref num, this.fast.Expression)) { goto Block_104; } } this.fast = this.fast.Previous; goto IL_FF3; } else { if (!this.Eval(Interpreter.Mode.Count, ref num, this.fast.Expression)) { goto Block_105; } int num18; if (this.fast.Count > 0) { num18 = (num - this.fast.Start) / this.fast.Count; } else { num18 = 0; } for (;;) { int num19 = num + num15; if (num13 < 0 || (num19 >= 0 && num19 < this.text_end && (num13 == (int)this.text[num19] || num14 == (int)this.text[num19]))) { this.deep = null; if (this.Eval(Interpreter.Mode.Match, ref num, pc)) { break; } } this.fast.Count--; if (!this.fast.IsMinimum) { goto Block_112; } num -= num18; this.Backtrack(cp4); } this.fast = this.fast.Previous; goto IL_FF3; } } IL_4B8: Block_44: Block_46: Block_47: Block_49: Block_52: Block_54: Block_55: Block_57: Block_59: Block_61: Block_62: Block_63: Block_65: Block_67: Block_70: goto IL_1067; IL_941: this.repeat = this.repeat.Previous; goto IL_1067; Block_73: repeatContext.Start = start; repeatContext.Count = count; goto IL_1067; IL_A28: this.repeat = repeatContext; Block_80: goto IL_1067; Block_81: repeatContext.Start = start; repeatContext.Count = count; Block_83: goto IL_1067; Block_88: this.repeat = repeatContext; goto IL_1067; Block_97: this.fast = this.fast.Previous; goto IL_1067; Block_103: this.fast = this.fast.Previous; goto IL_1067; Block_104: this.fast = this.fast.Previous; goto IL_1067; Block_105: this.fast = this.fast.Previous; goto IL_1067; Block_112: this.fast = this.fast.Previous; IL_FE9: IL_1067: if (mode == Interpreter.Mode.Match) { return(false); } if (mode != Interpreter.Mode.Count) { return(false); } if (!this.fast.IsLazy && this.fast.IsMinimum) { return(true); } ref_ptr = this.fast.Start; return(false); }
public StoreOperationStageComponent(IDefinitionAppId app, IDefinitionIdentity comp, string Manifest) { Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationStageComponent)); Flags = OpFlags.Nothing; Application = app; Component = comp; ManifestPath = Manifest; }
static void DecodeOp (ushort word, out OpCode op, out OpFlags flags) { op = (OpCode)(word & 0x00ff); flags = (OpFlags)(word & 0xff00); }
public static ushort EncodeOp(OpCode op, OpFlags flags) { return((ushort)((int)op | (int)(flags & (OpFlags)65280))); }
private void Emit (OpCode op, OpFlags flags) { Emit (EncodeOp (op, flags)); }
private bool Eval(Mode mode, ref int ref_ptr, int pc) { int ref_ptr2 = ref_ptr; while (true) { ushort num = program[pc]; OpCode opCode = (OpCode)(num & 0xFF); OpFlags opFlags = (OpFlags)(num & 0xFF00); int num13; int num12; bool flag; int num15; int num11; RepeatContext repeatContext; int start; int count; int count2; switch (opCode) { default: continue; case OpCode.Anchor: { num13 = program[pc + 1]; num12 = program[pc + 2]; flag = ((opFlags & OpFlags.RightToLeft) != OpFlags.None); num11 = ((!flag) ? (ref_ptr2 + num12) : (ref_ptr2 - num12)); num15 = text_end - match_min + num12; int num16 = 0; OpCode opCode3 = (OpCode)(program[pc + 3] & 0xFF); if (opCode3 == OpCode.Position && num13 == 6) { switch (program[pc + 4]) { case 2: break; case 3: goto IL_0165; case 4: goto IL_0234; default: goto end_IL_0028; } if (flag || num12 == 0) { if (flag) { ref_ptr2 = num12; } if (TryMatch(ref ref_ptr2, pc + num13)) { goto case OpCode.True; } break; } break; } if (qs != null || (opCode3 == OpCode.String && num13 == 6 + program[pc + 4])) { bool flag4 = (ushort)(program[pc + 3] & 0x400) != 0; if (qs == null) { bool ignore = (ushort)(program[pc + 3] & 0x200) != 0; string @string = GetString(pc + 3); qs = new QuickSearch(@string, ignore, flag4); } while ((flag && num11 >= num16) || (!flag && num11 <= num15)) { if (flag4) { num11 = qs.Search(text, num11, num16); if (num11 != -1) { num11 += qs.Length; } } else { num11 = qs.Search(text, num11, num15); } if (num11 < 0) { break; } ref_ptr2 = ((!flag4) ? (num11 - num12) : (num11 + num12)); if (TryMatch(ref ref_ptr2, pc + num13)) { goto case OpCode.True; } num11 = ((!flag4) ? (num11 + 1) : (num11 - 2)); } break; } if (opCode3 == OpCode.True) { while ((flag && num11 >= num16) || (!flag && num11 <= num15)) { ref_ptr2 = num11; if (TryMatch(ref ref_ptr2, pc + num13)) { goto case OpCode.True; } num11 = ((!flag) ? (num11 + 1) : (num11 - 1)); } break; } for (; (flag && num11 >= num16) || (!flag && num11 <= num15); num11 = ((!flag) ? (num11 + 1) : (num11 - 1))) { ref_ptr2 = num11; if (!Eval(Mode.Match, ref ref_ptr2, pc + 3)) { continue; } ref_ptr2 = ((!flag) ? (num11 - num12) : (num11 + num12)); if (!TryMatch(ref ref_ptr2, pc + num13)) { continue; } goto case OpCode.True; } break; } case OpCode.Position: if (!IsPosition((Position)program[pc + 1], ref_ptr2)) { break; } pc += 2; continue; case OpCode.String: { bool flag5 = (opFlags & OpFlags.RightToLeft) != OpFlags.None; bool flag6 = (opFlags & OpFlags.IgnoreCase) != OpFlags.None; int num17 = program[pc + 1]; if (flag5) { ref_ptr2 -= num17; if (ref_ptr2 < 0) { break; } } else if (ref_ptr2 + num17 > text_end) { break; } pc += 2; for (int k = 0; k < num17; k++) { char c = text[ref_ptr2 + k]; if (flag6) { c = char.ToLower(c); } if (c != program[pc++]) { goto end_IL_0028; } } if (!flag5) { ref_ptr2 += num17; } continue; } case OpCode.Reference: { bool flag2 = (opFlags & OpFlags.RightToLeft) != OpFlags.None; bool flag3 = (opFlags & OpFlags.IgnoreCase) != OpFlags.None; int lastDefined2 = GetLastDefined(program[pc + 1]); if (lastDefined2 < 0) { break; } int index = marks[lastDefined2].Index; int length = marks[lastDefined2].Length; if (flag2) { ref_ptr2 -= length; if (ref_ptr2 < 0) { break; } } else if (ref_ptr2 + length > text_end) { break; } pc += 2; if (flag3) { for (int i = 0; i < length; i++) { if (char.ToLower(text[ref_ptr2 + i]) != char.ToLower(text[index + i])) { goto end_IL_0028; } } } else { for (int j = 0; j < length; j++) { if (text[ref_ptr2 + j] != text[index + j]) { goto end_IL_0028; } } } if (!flag2) { ref_ptr2 += length; } continue; } case OpCode.Character: case OpCode.Category: case OpCode.NotCategory: case OpCode.Range: case OpCode.Set: if (!EvalChar(mode, ref ref_ptr2, ref pc, multi: false)) { break; } continue; case OpCode.In: { int num10 = pc + program[pc + 1]; pc += 2; if (!EvalChar(mode, ref ref_ptr2, ref pc, multi: true)) { break; } pc = num10; continue; } case OpCode.Open: Open(program[pc + 1], ref_ptr2); pc += 2; continue; case OpCode.Close: Close(program[pc + 1], ref_ptr2); pc += 2; continue; case OpCode.BalanceStart: { int ptr = ref_ptr2; if (!Eval(Mode.Match, ref ref_ptr2, pc + 5) || !Balance(program[pc + 1], program[pc + 2], (program[pc + 3] == 1) ? true : false, ptr)) { break; } pc += program[pc + 4]; continue; } case OpCode.IfDefined: { int lastDefined = GetLastDefined(program[pc + 2]); pc = ((lastDefined >= 0) ? (pc + 3) : (pc + program[pc + 1])); continue; } case OpCode.Sub: if (!Eval(Mode.Match, ref ref_ptr2, pc + 2)) { break; } pc += program[pc + 1]; continue; case OpCode.Test: { int cp4 = Checkpoint(); int ref_ptr3 = ref_ptr2; if (Eval(Mode.Match, ref ref_ptr3, pc + 3)) { pc += program[pc + 1]; continue; } Backtrack(cp4); pc += program[pc + 2]; continue; } case OpCode.Branch: while (true) { int cp2 = Checkpoint(); if (Eval(Mode.Match, ref ref_ptr2, pc + 2)) { break; } Backtrack(cp2); pc += program[pc + 1]; if ((ushort)(program[pc] & 0xFF) == 0) { goto end_IL_0028; } } goto case OpCode.True; case OpCode.Jump: pc += program[pc + 1]; continue; case OpCode.Repeat: repeat = new RepeatContext(repeat, ReadProgramCount(pc + 2), ReadProgramCount(pc + 4), (opFlags & OpFlags.Lazy) != OpFlags.None, pc + 6); if (Eval(Mode.Match, ref ref_ptr2, pc + program[pc + 1])) { goto case OpCode.True; } repeat = repeat.Previous; break; case OpCode.Until: repeatContext = repeat; if (deep != repeatContext) { start = repeatContext.Start; count = repeatContext.Count; while (!repeatContext.IsMinimum) { repeatContext.Count++; repeatContext.Start = ref_ptr2; deep = repeatContext; if (!Eval(Mode.Match, ref ref_ptr2, repeatContext.Expression)) { goto IL_09bc; } if (deep == repeatContext) { continue; } goto case OpCode.True; } if (ref_ptr2 == repeatContext.Start) { repeat = repeatContext.Previous; deep = null; if (!Eval(Mode.Match, ref ref_ptr2, pc + 1)) { repeat = repeatContext; break; } } else if (repeatContext.IsLazy) { while (true) { repeat = repeatContext.Previous; deep = null; int cp3 = Checkpoint(); if (Eval(Mode.Match, ref ref_ptr2, pc + 1)) { break; } Backtrack(cp3); repeat = repeatContext; if (repeatContext.IsMaximum) { goto end_IL_0028; } repeatContext.Count++; repeatContext.Start = ref_ptr2; deep = repeatContext; if (!Eval(Mode.Match, ref ref_ptr2, repeatContext.Expression)) { repeatContext.Start = start; repeatContext.Count = count; goto end_IL_0028; } if (deep != repeatContext) { break; } if (ref_ptr2 == repeatContext.Start) { goto end_IL_0028; } } } else { count2 = stack.Count; while (true) { if (!repeatContext.IsMaximum) { int num14 = Checkpoint(); int value = ref_ptr2; int start2 = repeatContext.Start; repeatContext.Count++; repeatContext.Start = ref_ptr2; deep = repeatContext; if (!Eval(Mode.Match, ref ref_ptr2, repeatContext.Expression)) { repeatContext.Count--; repeatContext.Start = start2; Backtrack(num14); } else { if (deep != repeatContext) { break; } stack.Push(num14); stack.Push(value); if (ref_ptr2 != repeatContext.Start) { continue; } } } repeat = repeatContext.Previous; goto IL_0bf5; } stack.Count = count2; } } goto case OpCode.True; case OpCode.FastRepeat: { fast = new RepeatContext(fast, ReadProgramCount(pc + 2), ReadProgramCount(pc + 4), (opFlags & OpFlags.Lazy) != OpFlags.None, pc + 6); fast.Start = ref_ptr2; int cp = Checkpoint(); pc += program[pc + 1]; ushort num2 = program[pc]; int num3 = -1; int num4 = -1; int num5 = 0; OpCode opCode2 = (OpCode)(num2 & 0xFF); if (opCode2 == OpCode.Character || opCode2 == OpCode.String) { OpFlags opFlags2 = (OpFlags)(num2 & 0xFF00); if ((opFlags2 & OpFlags.Negate) == OpFlags.None) { if (opCode2 == OpCode.String) { int num6 = 0; if ((opFlags2 & OpFlags.RightToLeft) != 0) { num6 = program[pc + 1] - 1; } num3 = program[pc + 2 + num6]; } else { num3 = program[pc + 1]; } num4 = (((opFlags2 & OpFlags.IgnoreCase) == OpFlags.None) ? num3 : char.ToUpper((char)num3)); num5 = (((opFlags2 & OpFlags.RightToLeft) != 0) ? (-1) : 0); } } if (fast.IsLazy) { if (!fast.IsMinimum && !Eval(Mode.Count, ref ref_ptr2, fast.Expression)) { fast = fast.Previous; break; } while (true) { int num7 = ref_ptr2 + num5; if (num3 < 0 || (num7 >= 0 && num7 < text_end && (num3 == text[num7] || num4 == text[num7]))) { deep = null; if (Eval(Mode.Match, ref ref_ptr2, pc)) { break; } } if (fast.IsMaximum) { goto IL_0e57; } Backtrack(cp); if (Eval(Mode.Count, ref ref_ptr2, fast.Expression)) { continue; } goto IL_0e8e; } fast = fast.Previous; } else { if (!Eval(Mode.Count, ref ref_ptr2, fast.Expression)) { fast = fast.Previous; break; } int num8 = (fast.Count > 0) ? ((ref_ptr2 - fast.Start) / fast.Count) : 0; while (true) { int num9 = ref_ptr2 + num5; if (num3 < 0 || (num9 >= 0 && num9 < text_end && (num3 == text[num9] || num4 == text[num9]))) { deep = null; if (Eval(Mode.Match, ref ref_ptr2, pc)) { break; } } fast.Count--; if (fast.IsMinimum) { ref_ptr2 -= num8; Backtrack(cp); continue; } goto IL_0fab; } fast = fast.Previous; } goto case OpCode.True; } case OpCode.True: case OpCode.Balance: ref_ptr = ref_ptr2; switch (mode) { case Mode.Match: return(true); case Mode.Count: fast.Count++; if (!fast.IsMaximum && (!fast.IsLazy || !fast.IsMinimum)) { pc = fast.Expression; continue; } return(true); } break; case OpCode.False: case OpCode.Info: break; IL_0fab: fast = fast.Previous; break; IL_0234: if (num11 == scan_ptr) { ref_ptr2 = ((!flag) ? (scan_ptr - num12) : (scan_ptr + num12)); if (TryMatch(ref ref_ptr2, pc + num13)) { goto case OpCode.True; } break; } break; IL_0165: if (num11 == 0) { ref_ptr2 = 0; if (TryMatch(ref ref_ptr2, pc + num13)) { goto case OpCode.True; } num11++; } for (; (flag && num11 >= 0) || (!flag && num11 <= num15); num11 = ((!flag) ? (num11 + 1) : (num11 - 1))) { if (num11 != 0 && text[num11 - 1] != '\n') { continue; } ref_ptr2 = ((!flag) ? ((num11 != 0) ? (num11 - num12) : num11) : ((num11 != num15) ? (num11 + num12) : num11)); if (!TryMatch(ref ref_ptr2, pc + num13)) { continue; } goto case OpCode.True; } break; IL_0c31: repeat = repeatContext; break; IL_09bc: repeatContext.Start = start; repeatContext.Count = count; break; IL_0e57: fast = fast.Previous; break; IL_0e8e: fast = fast.Previous; break; IL_0bf5: while (true) { deep = null; if (Eval(Mode.Match, ref ref_ptr2, pc + 1)) { break; } if (stack.Count != count2) { repeatContext.Count--; ref_ptr2 = stack.Pop(); Backtrack(stack.Pop()); continue; } goto IL_0c31; } stack.Count = count2; goto case OpCode.True; end_IL_0028: break; } break; } switch (mode) { case Mode.Match: return(false); case Mode.Count: if (!fast.IsLazy && fast.IsMinimum) { return(true); } ref_ptr = fast.Start; return(false); default: return(false); } }
public StoreOperationPinDeployment(IDefinitionAppId AppId, DateTime Expiry, StoreApplicationReference Ref) : this(AppId, Ref) { this.Flags |= OpFlags.NeverExpires; }
private bool EvalChar(Mode mode, ref int ptr, ref int pc, bool multi) { bool consumed = false; char c = '\0'; bool negate; bool ignore; do { ushort word = program[pc]; OpCode op = (OpCode)(word & 0x00ff); OpFlags flags = (OpFlags)(word & 0xff00); ++pc; ignore = (flags & OpFlags.IgnoreCase) != 0; // consume character: the direction of an In construct is // determined by the direction of its first op if (!consumed) { if ((flags & OpFlags.RightToLeft) != 0) { if (ptr <= 0) { return(false); } c = text[--ptr]; } else { if (ptr >= text_end) { return(false); } c = text[ptr++]; } if (ignore) { c = Char.ToLower(c); } consumed = true; } // negate flag negate = (flags & OpFlags.Negate) != 0; // execute op switch (op) { case OpCode.True: return(true); case OpCode.False: return(false); case OpCode.Character: { if (c == (char)program[pc++]) { return(!negate); } break; } case OpCode.Category: { if (CategoryUtils.IsCategory((Category)program[pc++], c)) { return(!negate); } break; } case OpCode.NotCategory: { if (!CategoryUtils.IsCategory((Category)program[pc++], c)) { return(!negate); } break; } case OpCode.Range: { int lo = (char)program[pc++]; int hi = (char)program[pc++]; if (lo <= c && c <= hi) { return(!negate); } break; } case OpCode.Set: { int lo = (char)program[pc++]; int len = (char)program[pc++]; int bits = pc; pc += len; int i = (int)c - lo; if (i < 0 || i >= len << 4) { break; } if ((program[bits + (i >> 4)] & (1 << (i & 0xf))) != 0) { return(!negate); } break; } } } while (multi); return(negate); }
public static ushort EncodeOp(OpCode op, OpFlags flags) { return((ushort)((int)op | ((int)flags & 0xff00))); }
private bool EvalChar(Interpreter.Mode mode, ref int ptr, ref int pc, bool multi) { bool flag = false; char c = '\0'; bool flag3; for (;;) { ushort num = this.program[pc]; OpCode opCode = (OpCode)(num & 255); OpFlags opFlags = (OpFlags)(num & 65280); pc++; bool flag2 = (ushort)(opFlags & OpFlags.IgnoreCase) != 0; if (!flag) { if ((ushort)(opFlags & OpFlags.RightToLeft) != 0) { if (ptr <= 0) { break; } c = this.text[--ptr]; } else { if (ptr >= this.text_end) { return(false); } c = this.text[ptr++]; } if (flag2) { c = char.ToLower(c); } flag = true; } flag3 = ((ushort)(opFlags & OpFlags.Negate) != 0); switch (opCode) { case OpCode.False: return(false); case OpCode.True: return(true); case OpCode.Character: if (c == (char)this.program[pc++]) { goto Block_7; } break; case OpCode.Category: if (CategoryUtils.IsCategory((Category)this.program[pc++], c)) { goto Block_8; } break; case OpCode.NotCategory: if (!CategoryUtils.IsCategory((Category)this.program[pc++], c)) { goto Block_9; } break; case OpCode.Range: { int num2 = (int)this.program[pc++]; int num3 = (int)this.program[pc++]; if (num2 <= (int)c && (int)c <= num3) { goto Block_11; } break; } case OpCode.Set: { int num4 = (int)this.program[pc++]; int num5 = (int)this.program[pc++]; int num6 = pc; pc += num5; int num7 = (int)c - num4; if (num7 >= 0 && num7 < num5 << 4) { if (((int)this.program[num6 + (num7 >> 4)] & 1 << (num7 & 15)) != 0) { goto Block_13; } } break; } } if (!multi) { return(flag3); } } return(false); Block_7: return(!flag3); Block_8: return(!flag3); Block_9: return(!flag3); Block_11: return(!flag3); Block_13: return(!flag3); }
private bool CheckFlags(OpFlags flags, OpFlags checkFlag) { return((flags & checkFlag) == checkFlag); }
public static void DecodeOp(ushort word, out OpCode op, out OpFlags flags) { op = (OpCode)(word & 0x00ff); flags = (OpFlags)(word & 0xff00); }
protected void ExecuteOpBlock(List <OperationWithAction> opBlock, string authInit, Properties <string, string> extraAuthProps, Properties <string, string> extraAuthzProps, TestCredentialGenerator gen, Random rnd, bool isMultiuser, bool ssl, bool withPassword) { foreach (OperationWithAction currentOp in opBlock) { // Start client with valid credentials as specified in // OperationWithAction OperationCode opCode = currentOp.OpCode; OpFlags opFlags = currentOp.Flags; int clientNum = currentOp.ClientNum; if (clientNum > m_clients.Length) { Assert.Fail("ExecuteOpBlock: Unknown client number " + clientNum); } ClientBase client = m_clients[clientNum - 1]; Util.Log("ExecuteOpBlock: performing operation number [" + currentOp.OpNum + "]: " + currentOp); Properties <string, string> clientProps = null; if (!CheckFlags(opFlags, OpFlags.UseOldConn)) { Properties <string, string> opCredentials; int newRnd = rnd.Next(100) + 1; string currentRegionName = '/' + RegionName; if (CheckFlags(opFlags, OpFlags.UseSubRegion)) { currentRegionName += ('/' + SubregionName); } string credentialsTypeStr; OperationCode authOpCode = currentOp.AuthzOperationCode; int[] indices = currentOp.Indices; CredentialGenerator cGen = gen.GetCredentialGenerator(); Properties <string, string> javaProps = null; if (CheckFlags(opFlags, OpFlags.CheckNotAuthz) || CheckFlags(opFlags, OpFlags.UseNotAuthz)) { opCredentials = gen.GetDisallowedCredentials( new OperationCode[] { authOpCode }, new string[] { currentRegionName }, indices, newRnd); credentialsTypeStr = " unauthorized " + authOpCode; } else { opCredentials = gen.GetAllowedCredentials(new OperationCode[] { opCode, authOpCode }, new string[] { currentRegionName }, indices, newRnd); credentialsTypeStr = " authorized " + authOpCode; } if (cGen != null) { javaProps = cGen.JavaProperties; } clientProps = SecurityTestUtil.ConcatProperties( opCredentials, extraAuthProps, extraAuthzProps); // Start the client with valid credentials but allowed or disallowed to // perform an operation Util.Log("ExecuteOpBlock: For client" + clientNum + credentialsTypeStr + " credentials: " + opCredentials); if (!isMultiuser) { client.Call(SecurityTestUtil.CreateClientSSL, RegionName, CacheHelper.Locators, authInit, clientProps, ssl, withPassword); } else { client.Call(SecurityTestUtil.CreateClientMU, RegionName, CacheHelper.Locators, authInit, (Properties <string, string>)null, true); } } ExpectedResult expectedResult; if (CheckFlags(opFlags, OpFlags.CheckNotAuthz)) { expectedResult = ExpectedResult.NotAuthorizedException; } else if (CheckFlags(opFlags, OpFlags.CheckException)) { expectedResult = ExpectedResult.OtherException; } else { expectedResult = ExpectedResult.Success; } // Perform the operation from selected client if (!isMultiuser) { client.Call(DoOp, opCode, currentOp.Indices, opFlags, expectedResult); } else { client.Call(DoOp, opCode, currentOp.Indices, opFlags, expectedResult, clientProps, true); } } }
public StoreOperationScavenge(bool Light, ulong SizeLimit, ulong RunLimit, uint ComponentLimit) { Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationScavenge)); Flags = OpFlags.Nothing; if (Light) Flags |= OpFlags.Light; this.SizeReclaimationLimit = SizeLimit; if (SizeLimit != 0) this.Flags |= OpFlags.LimitSize; this.RuntimeLimit = RunLimit; if (RunLimit != 0) this.Flags |= OpFlags.LimitTime; this.ComponentCountLimit = ComponentLimit; if (ComponentLimit != 0) this.Flags |= OpFlags.LimitCount; }
protected void DoOp(OperationCode op, int[] indices, OpFlags flags, ExpectedResult expectedResult) { DoOp(op, indices, flags, expectedResult, null, false); }
[System.Security.SecuritySafeCritical] // auto-generated public StoreOperationPinDeployment(IDefinitionAppId AppId, StoreApplicationReference Ref) { Size = (UInt32)Marshal.SizeOf(typeof(StoreOperationPinDeployment)); Flags = OpFlags.NeverExpires; Application = AppId; Reference = Ref.ToIntPtr(); ExpirationTime = 0; }
protected void DoOp(OperationCode op, int[] indices, OpFlags flags, ExpectedResult expectedResult, Properties <string, string> creds, bool isMultiuser) { IRegion <object, object> region; if (isMultiuser) { region = CacheHelper.GetRegion <object, object>(RegionName, creds); } else { region = CacheHelper.GetRegion <object, object>(RegionName); } if (CheckFlags(flags, OpFlags.UseSubRegion)) { IRegion <object, object> subregion = null; if (CheckFlags(flags, OpFlags.NoCreateSubRegion)) { subregion = region.GetSubRegion(SubregionName); if (CheckFlags(flags, OpFlags.CheckNoRegion)) { Assert.IsNull(subregion); return; } else { Assert.IsNotNull(subregion); } } else { subregion = CreateSubregion(region); if (isMultiuser) { subregion = region.GetSubRegion(SubregionName); } } Assert.IsNotNull(subregion); region = subregion; } else if (CheckFlags(flags, OpFlags.CheckNoRegion)) { Assert.IsNull(region); return; } else { Assert.IsNotNull(region); } string valPrefix; if (CheckFlags(flags, OpFlags.UseNewVal)) { valPrefix = NValuePrefix; } else { valPrefix = ValuePrefix; } int numOps = indices.Length; Util.Log("Got DoOp for op: " + op + ", numOps: " + numOps + ", indices: " + IndicesToString(indices)); bool exceptionOccured = false; bool breakLoop = false; for (int indexIndex = 0; indexIndex < indices.Length; ++indexIndex) { if (breakLoop) { break; } int index = indices[indexIndex]; string key = KeyPrefix + index; string expectedValue = (valPrefix + index); try { switch (op) { case OperationCode.Get: Object value = null; if (CheckFlags(flags, OpFlags.LocalOp)) { int sleepMillis = 100; int numTries = 30; bool success = false; while (!success && numTries-- > 0) { if (!isMultiuser && region.ContainsValueForKey(key)) { value = region[key]; success = expectedValue.Equals(value.ToString()); if (CheckFlags(flags, OpFlags.CheckFail)) { success = !success; } } else { value = null; success = CheckFlags(flags, OpFlags.CheckFail); } if (!success) { Thread.Sleep(sleepMillis); } } } else { if (!isMultiuser) { if (CheckFlags(flags, OpFlags.CheckNoKey)) { Assert.IsFalse(region.GetLocalView().ContainsKey(key)); } else { Assert.IsTrue(region.GetLocalView().ContainsKey(key)); region.GetLocalView().Invalidate(key); } } try { value = region[key]; } catch (Client.KeyNotFoundException) { Util.Log("KeyNotFoundException while getting key. should be ok as we are just testing auth"); } } if (!isMultiuser && value != null) { if (CheckFlags(flags, OpFlags.CheckFail)) { Assert.AreNotEqual(expectedValue, value.ToString()); } else { Assert.AreEqual(expectedValue, value.ToString()); } } break; case OperationCode.Put: region[key] = expectedValue; break; case OperationCode.Destroy: if (!isMultiuser && !region.GetLocalView().ContainsKey(key)) { // Since DESTROY will fail unless the value is present // in the local cache, this is a workaround for two cases: // 1. When the operation is supposed to succeed then in // the current AuthzCredentialGenerators the clients having // DESTROY permission also has CREATE/UPDATE permission // so that calling region.Put() will work for that case. // 2. When the operation is supposed to fail with // NotAuthorizedException then in the current // AuthzCredentialGenerators the clients not // having DESTROY permission are those with reader role that have // GET permission. // // If either of these assumptions fails, then this has to be // adjusted or reworked accordingly. if (CheckFlags(flags, OpFlags.CheckNotAuthz)) { value = region[key]; Assert.AreEqual(expectedValue, value.ToString()); } else { region[key] = expectedValue; } } if (!isMultiuser && CheckFlags(flags, OpFlags.LocalOp)) { region.GetLocalView().Remove(key); //Destroyed replaced by Remove() API } else { region.Remove(key); //Destroyed replaced by Remove API } break; //TODO: Need to fix Stack overflow exception.. case OperationCode.RegisterInterest: if (CheckFlags(flags, OpFlags.UseList)) { breakLoop = true; // Register interest list in this case List <CacheableKey> keyList = new List <CacheableKey>(numOps); for (int keyNumIndex = 0; keyNumIndex < numOps; ++keyNumIndex) { int keyNum = indices[keyNumIndex]; keyList.Add(KeyPrefix + keyNum); } region.GetSubscriptionService().RegisterKeys(keyList.ToArray()); } else if (CheckFlags(flags, OpFlags.UseRegex)) { breakLoop = true; region.GetSubscriptionService().RegisterRegex(KeyPrefix + "[0-" + (numOps - 1) + ']'); } else if (CheckFlags(flags, OpFlags.UseAllKeys)) { breakLoop = true; region.GetSubscriptionService().RegisterAllKeys(); } break; //TODO: Need to fix Stack overflow exception.. case OperationCode.UnregisterInterest: if (CheckFlags(flags, OpFlags.UseList)) { breakLoop = true; // Register interest list in this case List <CacheableKey> keyList = new List <CacheableKey>(numOps); for (int keyNumIndex = 0; keyNumIndex < numOps; ++keyNumIndex) { int keyNum = indices[keyNumIndex]; keyList.Add(KeyPrefix + keyNum); } region.GetSubscriptionService().UnregisterKeys(keyList.ToArray()); } else if (CheckFlags(flags, OpFlags.UseRegex)) { breakLoop = true; region.GetSubscriptionService().UnregisterRegex(KeyPrefix + "[0-" + (numOps - 1) + ']'); } else if (CheckFlags(flags, OpFlags.UseAllKeys)) { breakLoop = true; region.GetSubscriptionService().UnregisterAllKeys(); } break; case OperationCode.Query: breakLoop = true; ISelectResults <object> queryResults; if (!isMultiuser) { queryResults = (ResultSet <object>)region.Query <object>( "SELECT DISTINCT * FROM " + region.FullPath); } else { queryResults = CacheHelper.getMultiuserCache(creds).GetQueryService().NewQuery <object>("SELECT DISTINCT * FROM " + region.FullPath).Execute(); } Assert.IsNotNull(queryResults); if (!CheckFlags(flags, OpFlags.CheckFail)) { Assert.AreEqual(numOps, queryResults.Size); } //CacheableHashSet querySet = new CacheableHashSet(queryResults.Size); List <string> querySet = new List <string>(queryResults.Size); ResultSet <object> rs = queryResults as ResultSet <object>; foreach (object result in rs) { querySet.Add(result.ToString()); } for (int keyNumIndex = 0; keyNumIndex < numOps; ++keyNumIndex) { int keyNum = indices[keyNumIndex]; string expectedVal = valPrefix + keyNumIndex; if (CheckFlags(flags, OpFlags.CheckFail)) { Assert.IsFalse(querySet.Contains(expectedVal)); } else { Assert.IsTrue(querySet.Contains(expectedVal)); } } break; case OperationCode.RegionDestroy: breakLoop = true; if (!isMultiuser && CheckFlags(flags, OpFlags.LocalOp)) { region.GetLocalView().DestroyRegion(); } else { region.DestroyRegion(); } break; case OperationCode.GetServerKeys: breakLoop = true; ICollection <object> serverKeys = region.Keys; break; //TODO: Need to fix System.ArgumentOutOfRangeException: Index was out of range. Know issue with GetAll() case OperationCode.GetAll: //ICacheableKey[] keymap = new ICacheableKey[5]; List <object> keymap = new List <object>(); for (int i = 0; i < 5; i++) { keymap.Add(i); //CacheableInt32 item = CacheableInt32.Create(i); //Int32 item = i; // NOTE: GetAll should operate right after PutAll //keymap[i] = item; } Dictionary <Object, Object> entrymap = new Dictionary <Object, Object>(); //CacheableHashMap entrymap = CacheableHashMap.Create(); region.GetAll(keymap, entrymap, null, false); if (entrymap.Count < 5) { Assert.Fail("DoOp: Got fewer entries for op " + op); } break; case OperationCode.PutAll: // NOTE: PutAll should operate right before GetAll //CacheableHashMap entrymap2 = CacheableHashMap.Create(); Dictionary <Object, Object> entrymap2 = new Dictionary <object, object>(); for (int i = 0; i < 5; i++) { //CacheableInt32 item = CacheableInt32.Create(i); Int32 item = i; entrymap2.Add(item, item); } region.PutAll(entrymap2); break; case OperationCode.RemoveAll: Dictionary <Object, Object> entrymap3 = new Dictionary <object, object>(); for (int i = 0; i < 5; i++) { //CacheableInt32 item = CacheableInt32.Create(i); Int32 item = i; entrymap3.Add(item, item); } region.PutAll(entrymap3); ICollection <object> keys = new LinkedList <object>(); for (int i = 0; i < 5; i++) { Int32 item = i; keys.Add(item); } region.RemoveAll(keys); break; case OperationCode.ExecuteCQ: Pool /*<object, object>*/ pool = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_"); QueryService qs; if (pool != null) { qs = pool.GetQueryService(); } else { //qs = CacheHelper.DCache.GetQueryService(); qs = null; } CqAttributesFactory <object, object> cqattrsfact = new CqAttributesFactory <object, object>(); CqAttributes <object, object> cqattrs = cqattrsfact.Create(); CqQuery <object, object> cq = qs.NewCq("cq_security", "SELECT * FROM /" + region.Name, cqattrs, false); qs.ExecuteCqs(); qs.StopCqs(); qs.CloseCqs(); break; case OperationCode.ExecuteFunction: if (!isMultiuser) { Pool /*<object, object>*/ pool2 = CacheHelper.DCache.GetPoolManager().Find("__TESTPOOL1_"); if (pool2 != null) { Client.FunctionService <object> .OnServer(pool2).Execute("securityTest"); Client.FunctionService <object> .OnRegion <object, object>(region).Execute("FireNForget"); } else { expectedResult = ExpectedResult.Success; } } else { //FunctionService fs = CacheHelper.getMultiuserCache(creds).GetFunctionService(); //Execution exe = fs.OnServer(); IRegionService userCache = CacheHelper.getMultiuserCache(creds); Apache.Geode.Client.Execution <object> exe = Client.FunctionService <object> .OnServer(userCache); exe.Execute("securityTest"); exe = Client.FunctionService <object> .OnServers(userCache); Client.FunctionService <object> .OnRegion <object, object>(region); Client.FunctionService <object> .OnRegion <object, object>(userCache.GetRegion <object, object>(region.Name)).Execute("FireNForget"); } break; default: Assert.Fail("DoOp: Unhandled operation " + op); break; } if (expectedResult != ExpectedResult.Success) { Assert.Fail("Expected an exception while performing operation"); } } catch (AssertionException ex) { Util.Log("DoOp: failed assertion: {0}", ex); throw; } catch (NotAuthorizedException ex) { exceptionOccured = true; if (expectedResult == ExpectedResult.NotAuthorizedException) { Util.Log( "DoOp: Got expected NotAuthorizedException when doing operation [" + op + "] with flags [" + flags + "]: " + ex.Message); continue; } else { Assert.Fail("DoOp: Got unexpected NotAuthorizedException when " + "doing operation: " + ex.Message); } } catch (Exception ex) { exceptionOccured = true; if (expectedResult == ExpectedResult.OtherException) { Util.Log("DoOp: Got expected exception when doing operation: " + ex.GetType() + "::" + ex.Message); continue; } else { Assert.Fail("DoOp: Got unexpected exception when doing operation: " + ex); } } } if (!exceptionOccured && expectedResult != ExpectedResult.Success) { Assert.Fail("Expected an exception while performing operation"); } Util.Log(" doop done"); }