Ejemplo n.º 1
0
 /**
  * Returns the most specific Java instance for a given INode.
  * If the node is an aggregation, it will be returned as instance of
  * Aggregation.
  * If the node is a function call, it will be returned as instance of
  * FunctionCall.
  * If it's a Variable, the Variable will be returned.
  * Otherwise the node itself will be returned.
  * @param node  the node to cast
  * @return node or node as a Function or Variable
  */
 public static IResource asExpression(IResource resource)
 {
     if (resource == null)
     {
         return(null);
     }
     if (resource is INode)
     {
         IVariable var = SPINFactory.asVariable(resource);
         if (var != null)
         {
             return(var);
         }
         IAggregation aggr = SPINFactory.asAggregation((IResource)resource);
         if (aggr != null)
         {
             return(aggr);
         }
         IFunctionCall functionCall = SPINFactory.asFunctionCall((IResource)resource);
         if (functionCall != null)
         {
             return(functionCall);
         }
     }
     return(resource);
 }
Ejemplo n.º 2
0
        public void Generate(IFunctionCall call)
        {
            // если функция - бинарная операция
            if (call.function.isBinOperation)
            {
                Spit("(");
                Generate(call.arguments.First());
                Spit(call.function.name);
                Generate(call.arguments[1]);
                Spit(")");
                return;
            }

            Spit(call.function.name, "(");

            var args = call.arguments.EmptyIfNull().ToList();

            if (!args.Empty())
            {
                Generate(args.FirstOrDefault());

                foreach (var arg in args.Skip(1))
                {
                    Spit(",");
                    Generate(arg);
                }
            }
            Spit(")");
        }
Ejemplo n.º 3
0
 public VBinaryOp(IFunctionCall functionCall) : this(functionCall.function)
 {
     firstArg = VElementBuilder.Create(functionCall.arguments.FirstOrDefault());
     SetFirstArg(firstArg);
     secondArg = VElementBuilder.Create(functionCall.arguments.Skip(1).FirstOrDefault());
     SetSecondArg(secondArg);
     UpdateSize();
 }
Ejemplo n.º 4
0
        private void printOrderByExpression(ISparqlPrinter sb, IResource node)
        {
            // TODO check for real test
            if (node is INode)
            {
                IResource     resource = (IResource)node;
                IFunctionCall call     = SPINFactory.asFunctionCall(resource);
                if (call != null)
                {
                    sb.print("(");
                    ISparqlPrinter pc = sb.clone();
                    pc.setNested(true);
                    call.Print(pc);
                    sb.print(")");
                    return;
                }
            }

            printNestedExpressionString(sb, node, true);
        }
Ejemplo n.º 5
0
        internal ProcessManager(Process process, InjectionMethod injectionMethod)
        {
            Process = process;

            EnableDebuggerPrivileges();

            IsWow64 = GetProcessArchitecture();

            Memory = new Memory(process.SafeHandle);

            Peb = ReadPeb();

            Modules = GetModules();

            if (injectionMethod == InjectionMethod.CreateThread)
            {
                _functionCall = new CreateThread(Memory, process);
            }

            else
            {
                _functionCall = new HijackThread(Memory, process);
            }
        }
Ejemplo n.º 6
0
 public FunCall(IFunctionCall fun)
 {
     this._function = fun;
 }