public void AddResultsToDb() { OutputSet outSet = FemapModel.feOutputSet; Output output = FemapModel.feOutput; Output output2 = FemapModel.feOutput; var db = new DBController(); for (int i = 0; i < outSet.CountSet(); i++) { outSet.Next(); Set select = FemapModel.feSet; select.Select(zDataType.FT_NODE, true, "Выберите узлы"); output.Get(60031); output.FindMaxMin(select.ID, true, out sMinID, out sMin, out sMaxID, out sMax); output2.Get(1); output2.FindMaxMin(select.ID, true, out tMinID, out tMin, out tMaxID, out tMax); db.AddResultMaxMin(sMinID, sMin, sMaxID, sMax, tMinID, tMin, tMaxID, tMax); for (int index = 0; index < select.Count(); index++) { select.Next(); db.AddResult("Результат", select.CurrentID, output2.Value[select.CurrentID], output.Value[select.CurrentID], index); } } db.SaveResult(); }
public override void VisitNativeAnalyzer(NativeAnalyzerPoint p) { string functionName = p.OwningPPGraph.FunctionName; if (nativeSanitizers.Contains(p.OwningPPGraph.FunctionName)) { FunctionResolverBase.SetReturn(OutputSet, new MemoryEntry(Output.CreateInfo(false))); return; } // If a native function is not sanitizer, propagates taint status from arguments to return value // 1. Get values of arguments of the function // TODO: code duplication: the following code, code in SimpleFunctionResolver, and NativeFunctionAnalyzer. Move the code to some API (? FlowInputSet) Input.SetMode(SnapshotMode.MemoryLevel); MemoryEntry argc = InputSet.ReadVariable(new VariableIdentifier(".argument_count")).ReadMemory(Input); Input.SetMode(SnapshotMode.InfoLevel); int argumentCount = ((IntegerValue)argc.PossibleValues.ElementAt(0)).Value; List <MemoryEntry> arguments = new List <MemoryEntry>(); List <Value> argumentValues = new List <Value>(); for (int i = 0; i < argumentCount; i++) { arguments.Add(OutputSet.ReadVariable(Argument(i)).ReadMemory(OutputSet.Snapshot)); argumentValues.AddRange(arguments.Last().PossibleValues); } // 2. Propagate arguments to the return value. FunctionResolverBase.SetReturn(OutputSet, new MemoryEntry(Output.CreateInfo(mergeTaint(argumentValues)))); }
public override void VisitExtensionSink(ExtensionSinkPoint p) { var ends = p.OwningExtension.Branches.Select(c => c.Graph.End.OutSet).ToArray(); OutputSet.MergeWithCallLevel(p.OwningExtension.Owner, ends); p.ResolveReturnValue(); }
/// <summary> /// Visits a native analyzer program point. If function is a sanitizer, the output is sanitized, /// if it is a reporting function, a warning is created. /// </summary> /// <param name="p">program point to visit</param> public override void VisitNativeAnalyzer(NativeAnalyzerPoint p) { _currentPoint = p; string functionName = p.OwningPPGraph.FunctionName; // 1. Get values of arguments of the function // TODO: code duplication: the following code, code in SimpleFunctionResolver, and NativeFunctionAnalyzer. Move the code to some API (? FlowInputSet) Input.SetMode(SnapshotMode.MemoryLevel); MemoryEntry argc = InputSet.ReadVariable(new VariableIdentifier(".argument_count")).ReadMemory(Input); Input.SetMode(SnapshotMode.InfoLevel); int argumentCount = ((IntegerValue)argc.PossibleValues.ElementAt(0)).Value; List <MemoryEntry> arguments = new List <MemoryEntry>(); List <ValueInfo> values = new List <ValueInfo>(); bool nullValue = false; for (int i = 0; i < argumentCount; i++) { arguments.Add(OutputSet.ReadVariable(Argument(i)).ReadMemory(OutputSet.Snapshot)); List <Value> argumentValues = new List <Value>(arguments.Last().PossibleValues); if (hasPossibleNullValue(OutputSet.ReadVariable(Argument(i)))) { nullValue = true; } VariableIdentifier varID = null; Value toRemove = null; foreach (Value val in argumentValues) { if (val is InfoValue <VariableIdentifier> ) { varID = (val as InfoValue <VariableIdentifier>).Data; toRemove = val; } } if (toRemove != null) { argumentValues.Remove(toRemove); } values.Add(new ValueInfo(argumentValues, varID)); } TaintInfo outputTaint = mergeTaint(values, nullValue); // try to sanitize the taint info if (outputTaint != null) { sanitize(p, ref outputTaint); warningsReportingFunct(p, outputTaint); } // 2. Propagate arguments to the return value. // TODO: quick fix if (outputTaint.tainted || outputTaint.nullValue) { FunctionResolverBase.SetReturn(OutputSet, new MemoryEntry(Output.CreateInfo(outputTaint))); } }
/// <summary> /// Process response text. /// </summary> /// <param name="input">The input set passed into the <see cref="IConversationSystem"/>.</param> /// <param name="output">The output set being returned from the <see cref="IConversationSystem"/>.</param> public void Process(InputSet input, OutputSet output) { var parameters = new PatternProcessingParameters(output.Response) { CapitalizationScheme = CapitalizationScheme.BY_SENTENCE, Variables = input.Variables, Context = input.Variables.Keys.ToArray() }; output.Response = _nameParser.Process(parameters); }
/// <summary> /// Default ctor /// </summary> public Module() { blocks = new BlockSet(this); blockGroups = new BlockGroupSet(this); junctions = new JunctionSet(this); routes = new RouteSet(this); edges = new EdgeSet(this); sensors = new SensorSet(this); signals = new SignalSet(this); outputs = new OutputSet(this); }
/// <summary> /// Process an input set, and return the result. /// </summary> /// <param name="input">The inputs for the conversation.</param> /// <returns>The result of the conversation.</returns> public OutputSet Process(InputSet input) { var topic = _topicSources .SelectMany(ts => ts.GetTopics()) .FirstOrDefault(ts => ts.Name == input.Topic); Response chosenResponse = null; if (topic != null) { foreach (var response in topic.Responses) { var matches = _expressionEvaluators .Any(e => e.Evaluate(response.AvailabilityExpression, input.Variables)); if (matches) { chosenResponse = response; break; } } } var output = new OutputSet(); if (chosenResponse != null) { output.Response = chosenResponse.Body; foreach (var postProcessor in _postProcessors) { postProcessor.Process(input, output); } foreach (var processor in _actionProcessors) { processor.Process(input, output, chosenResponse.ResponseActionScript); } } else { output.Response = UnmatchedResponse; } return(output); }
/// <summary> /// Default ctor /// </summary> internal OutputSetImpl(OutputSet impl) : base(impl) { }
public OutputImageScaleOptional10(OutputSet owner, double scale) : base(owner, scale) { }