public void GetValueBaseArgumentRValue() { Expression <Func <ActivityContext, object> > expression = (env) => env.GetValue(this.BaseArgument); ArgumentValue <object> expectedActivity = new ArgumentValue <object>("BaseArgument"); ConvertAndValidate(expression, expectedActivity, null); }
public void LinkTo(Neuron TargetNeuron, ArgumentValue Value) { var connection = new NeuronConnection(this, TargetNeuron, Value); Out.Add(connection); TargetNeuron.In.Add(connection); }
private T ConvertArgumentValue <T>(string name, ArgumentValue argumentValue) { if (argumentValue.Value is T value) { return(value); } Type type = typeof(T); if (argumentValue.Value == null) { return(default(T)); } if (TryConvertValue(argumentValue, out value)) { return(value); } throw new QueryException( new FieldError( $"Could not convert argument {name} from " + $"{argumentValue.NativeType.FullName} to " + $"{typeof(T).FullName}.", _fieldResolverTask.FieldSelection.Node)); }
protected void EnsureNoError(ArgumentValue argumentValue) { if (argumentValue.Error != null) { throw new QueryException(argumentValue.Error); } }
protected void SaveOrderInfo(bool update = false) { SampleRegisterTable models = new SampleRegisterTable(); ArgumentValue argu = new ArgumentValue(); models.SamplingDay = sampling; models.SampleStates = (int)EnumSampleStates.NewSample; foreach (var data in DetectionData.DetectionList) { argu.SampleRegisterNumber = data.SampleRegisterNumber; argu.Argument = data.ParameterName; this.IDKLManagerService.InsertArgumentValue(argu); } if (DetectionData.DetectionList.Count > 0) { models.SampleRegisterNumber = DetectionData.DetectionList.First().SampleRegisterNumber; models.Remark = DetectionData.DetectionList.First().Remark; models.SampleName = DetectionData.DetectionList.First().ParameterName; models.SaveCondition = DetectionData.DetectionList.First().SaveCondition; models.AnalyzePeople = DetectionData.DetectionList.First().AnalyzePeople; models.SampleState = DetectionData.DetectionList.First().SampleState; models.SampleNumBer = DetectionData.DetectionList.First().SampleNumBer; models.ProjectNumber = DetectionData.DetectionList.First().ProjectNumber; models.ParameterName = DetectionData.DetectionList.First().ParameterName; this.IDKLManagerService.InsertSampleRegister(models); } }
public void Undo() { if (bvmodel.InstructionName.Equals("CALLM")) { int argcount = (pstring_old.Count() - 2) / 4; ArgumentValue[] _values = new ArgumentValue[argcount]; for (int i = 0; i < argcount; i++) { _values[i] = ArgumentValue.Create( pstring_old[i * 4 + 3], pstring_old[i * 4 + 2], pstring_old[i * 4 + 4], PLCDevice.PLCDeviceManager.GetPLCDeviceManager().SelectDevice); _values[i].Comment = pstring_old[i * 4 + 5]; } ((CALLMViewModel)(bvmodel)).AcceptNewValues( pstring_old[0], pstring_old[1], _values); } else { bvmodel.AcceptNewValues(pstring_old, PLCDevice.PLCDeviceManager.GetPLCDeviceManager().SelectDevice); } //lnvmodel.INVModel.Setup(lnvmodel); // 导航到修改参数的元件 lnvmodel.AcquireSelectRect(); LadderDiagramViewModel ldvmodel = lnvmodel.LDVModel; ldvmodel.SelectionRect.X = bvmodel.X; ldvmodel.SelectionRect.Y = bvmodel.Y; ldvmodel.ProjectModel.IFacade.NavigateToNetwork( new NavigateToNetworkEventArgs( lnvmodel.NetworkNumber, ldvmodel.ProgramName, ldvmodel.SelectionRect.X, ldvmodel.SelectionRect.Y)); }
public static Argument StartUsingResponseFile(string name = null, bool?force = default(bool?)) { return(new Argument( name, new CommandLineValue(ArgumentValue.FromPrimitive(ArgumentKind.StartUsingResponseFile, force.HasValue ? new PrimitiveValue(force.Value.ToString().ToLowerInvariant()) : default(PrimitiveValue))))); }
public CALLMModel() { FunctionName = string.Empty; Value1 = ArgumentValue.Null; Value2 = ArgumentValue.Null; Value3 = ArgumentValue.Null; Value4 = ArgumentValue.Null; }
public ArgumentValue Add(Argument argument, ArgumentEntity argumentEntity) { var argValue = new ArgumentValue(argument, argumentEntity); ArgumentValues.Add(argValue); return(argValue); }
public void RuntimeArgumentRValueGet() { RuntimeArgument ra = new RuntimeArgument("InArgument", typeof(int), ArgumentDirection.In); Expression <Func <ActivityContext, object> > expression = (env) => env.GetValue(ra); ArgumentValue <object> expectedActivity = new ArgumentValue <object>("InArgument"); ConvertAndValidate(expression, expectedActivity, null); }
/// <summary> /// Builds a new ArgumentValue with a random value between -1 and 1, to be used for inbetween nodes. /// </summary> /// <returns>ArgumentValue with a random value between -1 and 1</returns> private ArgumentValue RandomVariableValue() { var i = new ArgumentValue(Counter.ToString()); Counter++; i.Value = (random.NextDouble() - 0.5) * 2; return(i); }
/// <summary>Determines if the specified field argument has been provided in the GraphQL query request.</summary> public static bool HasArgument(this IResolveFieldContext context, string name) { var isIntrospection = context.ParentType == null?context.FieldDefinition.IsIntrospectionField() : context.ParentType.IsIntrospectionType(); var argumentName = isIntrospection ? name : (context.Schema?.NameConverter.NameForArgument(name, context.ParentType, context.FieldDefinition) ?? name); ArgumentValue value = default; return((context.Arguments?.TryGetValue(argumentName, out value) ?? false) && value.Source != ArgumentSource.FieldDefault); }
public void GetValueInOutArgumentRValue() { Expression <Func <ActivityContext, string> > expression = (env) => env.GetValue(this.InOutArgument); Expression <Func <ActivityContext, string> > expression1 = (env) => env.GetValue <string>(this.InOutArgument); ArgumentValue <string> expectedActivity = new ArgumentValue <string>("InOutArgument"); ConvertAndValidate(expression, expectedActivity, null); ConvertAndValidate(expression1, expectedActivity, null); }
public void OutArgumentRValueGet() { Expression <Func <ActivityContext, string> > expression = (env) => this.OutArgument.Get(env); Expression <Func <ActivityContext, string> > expression1 = (env) => this.OutArgument.Get <string>(env); ArgumentValue <string> expectedActivity = new ArgumentValue <string>("OutArgument"); ConvertAndValidate(expression, expectedActivity, null); ConvertAndValidate(expression1, expectedActivity, null); }
public void BaseArgumentRValueGet() { Expression <Func <ActivityContext, object> > expression = (env) => this.BaseArgument.Get(env); Expression <Func <ActivityContext, object> > expression1 = (env) => this.BaseArgument.Get <object>(env); ArgumentValue <object> expectedActivity = new ArgumentValue <object>("BaseArgument"); ConvertAndValidate(expression, expectedActivity, null); ConvertAndValidate(expression, expectedActivity, null); ConvertAndValidate(expression1, expectedActivity, null); }
internal static T UnResolveArgument <T>([NotNull] this ArgumentValue value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } throw new ArgumentsException($"Parameter <{value.ParameterName}> Error: Value is Missing."); }
public bool Equals(ArgumentValue other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Equals(other.part1, part1) && Equals(other.part2, part2)); }
/// <summary> /// Creates a new <see cref="Argument"/>. /// </summary> /// <param name="name">The argument name.</param> /// <param name="argumentValue">The state of the argument's Value property.</param> /// <param name="hasPrefix">True if the <see cref="Argument"/> has a prefix.</param> /// <param name="value">The argument value.</param> public Argument(string name, ArgumentValue argumentValue, bool hasPrefix, string value) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("name is null or empty.", "name"); } ArgumentValue = argumentValue; HasPrefix = hasPrefix; Name = (HasPrefix ? name.ToLower() : name).Trim(); Value = value; }
internal static T InvalidArgument <T>([NotNull] this ArgumentValue value, string requireDetail) { if (value == null) { throw new ArgumentNullException(nameof(value)); } var sb = new StringBuilder(); sb.Append($"Parameter <{value.ParameterProperties.Names[0]}> Value Invalid Error: "); sb.Append(requireDetail); throw new ArgumentsException(sb.ToString()); }
/// <summary> /// Parse a set of string arguments specified on the command-line into a <see cref="CommandLineArguments"/> instance. /// </summary> /// <param name="arguments">Command-line arguments.</param> /// <returns><see cref="CommandLineArguments"/> instance.</returns> public static CommandLineArguments Parse(string[] arguments) { CommandLineArguments Response = new CommandLineArguments(); if (arguments?.Any() != true) { return(Response); } for (int i = 0; i < arguments.Length; i++) { string Argument = arguments[i]; if (!Argument.StartsWith("-", StringComparison.OrdinalIgnoreCase)) { if (string.IsNullOrEmpty(Response.Command)) { Response.Command = Argument; } else { Response.Parameters.Add(arguments[i]); } continue; } Argument = Argument.Substring(1); if (Argument.StartsWith("-", StringComparison.OrdinalIgnoreCase)) // Double-dash case (--ArgName) { Argument = Argument.Substring(1); } string?ArgumentValue; if (Argument.IndexOf("=", StringComparison.OrdinalIgnoreCase) >= 0) // ArgName=ArgValue case { string[] ArgumentComponents = Argument.Split('='); Argument = ArgumentComponents[0].Trim(); ArgumentValue = ArgumentComponents[1].Trim(); // Macross TrimBookendings extension mirrored here to avoid an entire project dependency for a few lines of code. #if NETSTANDARD2_0 if (ArgumentValue.Length >= 2 && ArgumentValue[0] == '\"' && ArgumentValue[ArgumentValue.Length - 1] == '\"') { ArgumentValue = ArgumentValue.Substring(1, ArgumentValue.Length - 2); } #else if (ArgumentValue.Length >= 2 && ArgumentValue[0] == '\"' && ArgumentValue[^ 1] == '\"') { ArgumentValue = ArgumentValue[1..^ 1];
private T CoerceArgumentValue <T>(ArgumentValue argument) { var value = argument.Value; // if the argument is final and has an already coerced // runtime version we can skip over parsing it. if (!argument.IsFinal) { value = _parser.ParseLiteral(argument.ValueLiteral !, argument.Argument, typeof(T)); } if (value is null) { // if there was a non-null violation the exception would already been triggered. return(default !);
public ArgumentValue Add(Argument argument, ArgumentEntity argumentEntity, ValueEntity value) { if (argument == null || argumentEntity == null || value == null || !value.HasValue) { return(null); } var argValue = new ArgumentValue(argument, argumentEntity); argValue.Value = value; ArgumentValues.Add(argValue); return(argValue); }
private static string GetArgumentValueString(Parameter argument, ArgumentValue argumentValue) { // Today, only the first argument value in the array will be used. return(argument.Type switch { DataType.BoolType => GetBoolValueString(argumentValue), DataType.DoubleType => GetDoubleValueString(argumentValue), DataType.IntegerType => GetIntegerValueString(argumentValue), DataType.PauliType => GetPauliValueString(argumentValue), DataType.RangeType => GetRangeValueString(argumentValue), DataType.ResultType => GetResultValueString(argumentValue), DataType.StringType => GetStringValueString(argumentValue), DataType.ArrayType => GetArrayValueString(argument.ArrayType, argumentValue.Array), _ => throw new ArgumentException($"Unsupported data type {argument.Type}") });
private bool TryConvertValue <T>(ArgumentValue argumentValue, out T value) { foreach (IInputValueConverter converter in _converters .Where(t => t.CanConvert(argumentValue.Type))) { if (converter.TryConvert(argumentValue.NativeType, typeof(T), argumentValue.Value, out object cv)) { value = (T)cv; return(true); } } value = default(T); return(false); }
public ProjectWholeInfoViewModel() { projectTime = new ProjectInfo(); projectClosingDate = new ProjectInfo(); projectBasicImgFile = new ProjectFile(); device = new DeviceOrderInfo(); projectBasicinfo = new ProjectInfo(); projectConsultBasicinfo = new ConsultBasicInfo(); projectBasicFile = new ProjectFile(); projectTestBasicinfo = new TestBasicInfo(); projectTestChemicalReport = new TestChemicalReport(); projectTestChemicalReportList = new List <TestChemicalReport>(); projectValueBasicinfo = new ValueBasicInfo(); sampleTable = new SampleRegisterTable(); projectTestBasicinfoList = new List <TestBasicInfo>(); arguments = new ArgumentValue(); }
private InternalSendMessage CreateInternalSend() { InternalSendMessage message2 = new InternalSendMessage { OperationName = this.OperationName }; ArgumentValue <CorrelationHandle> expression = new ArgumentValue <CorrelationHandle> { ArgumentName = "CorrelatesWith" }; message2.CorrelatesWith = new InArgument <CorrelationHandle>(expression); message2.Endpoint = this.Endpoint; message2.EndpointConfigurationName = this.EndpointConfigurationName; message2.IsOneWay = this.isOneWay; message2.IsSendReply = false; message2.TokenImpersonationLevel = this.TokenImpersonationLevel; message2.ServiceContractName = this.ServiceContractName; message2.Action = this.Action; message2.Parent = this; InternalSendMessage message = message2; if (this.correlationInitializers != null) { foreach (CorrelationInitializer initializer in this.correlationInitializers) { message.CorrelationInitializers.Add(initializer.Clone()); } Collection <CorrelationQuery> collection = ContractInferenceHelper.CreateClientCorrelationQueries(null, this.correlationInitializers, this.Action, this.ServiceContractName, this.OperationName, false); if (collection.Count == 1) { message.CorrelationQuery = collection[0]; } } if (this.EndpointAddress != null) { message.EndpointAddress = new InArgument <Uri>(context => this.EndpointAddress.Get(context)); } if (this.lazyCorrelationQueries != null) { foreach (CorrelationQuery query in this.lazyCorrelationQueries) { message.ReplyCorrelationQueries.Add(query); } } return(message); }
public override void ParseValue(IList <string> valueStrings) { FuncName = valueStrings[0]; string[] args = null; ArgumentValue[] values = new ArgumentValue[4]; for (int i = 0; i < valueStrings.Count - 1; i++) { try { values[i] = ArgumentValue.Parse(valueStrings[i + 1]); } catch (ValueParseException) { args = valueStrings[i + 1].Split(' '); switch (args[1]) { case "BIT*": values[i] = new ArgumentValue(args[0], args[1], BitValue.Null); break; case "WORD*": values[i] = new ArgumentValue(args[0], args[1], WordValue.Null); break; case "DWORD*": values[i] = new ArgumentValue(args[0], args[1], DWordValue.Null); break; case "FLOAT*": values[i] = new ArgumentValue(args[0], args[1], FloatValue.Null); break; default: values[i] = ArgumentValue.Null; break; } } } Value1 = values[0]; Value2 = values[1]; Value3 = values[2]; Value4 = values[3]; }
protected void SaveOrderInfo(bool update = false) { SampleRegisterTable models = new SampleRegisterTable(); ArgumentValue argu = new ArgumentValue(); //models.SamplingDay = sampling; models.SamplingDay = DateTime.Now; models.SampleStates = (int)EnumSampleStates.Selec; foreach (var data in DetectionData.DetectionList) { argu.SampleRegisterNumber = data.SampleRegisterNumber; argu.Argument = data.ParameterName; this.IDKLManagerService.InsertArgumentValue(argu); } if (DetectionData.DetectionList.Count > 0) { models.SampleRegisterNumber = DetectionData.DetectionList.First().SampleRegisterNumber; models.Remark = DetectionData.DetectionList.First().Remark; models.SampleName = DetectionData.DetectionList.First().ParameterName; models.SaveCondition = DetectionData.DetectionList.First().SaveCondition; models.AnalyzePeople = DetectionData.DetectionList.First().AnalyzePeople; models.SampleState = DetectionData.DetectionList.First().SampleState; models.SampleNumBer = DetectionData.DetectionList.First().SampleNumBer; models.ProjectNumber = DetectionData.DetectionList.First().ProjectNumber; models.ParameterName = DetectionData.DetectionList.First().ParameterName; models.WorkShop = DetectionData.DetectionList.First().WorkShop; models.Job = DetectionData.DetectionList.First().Job; models.Location = DetectionData.DetectionList.First().Location; models.CSTEL = DetectionData.DetectionList.First().CSTEL; models.CTWA = DetectionData.DetectionList.First().CTWA; models.CMAC = DetectionData.DetectionList.First().CMAC; models.SignTime = DateTime.Now; this.IDKLManagerService.InsertSampleRegister(models); var cookies = this.IDKLManagerService.GetCookies(); cookies.ProjectNumber = models.ProjectNumber; cookies.SampleNumber = models.SampleRegisterNumber; cookies.SampleQuantity = models.SampleNumBer; this.IDKLManagerService.UpdateCookies(cookies); } }
protected string GetArgumentAsString() { string xDest = ""; if ((ArgumentValue.HasValue || ArgumentRef != null) && ArgumentIsIndirect && ArgumentReg != null) { throw new Exception("[Scale*index+base] style addressing not supported at the moment"); } if (ArgumentRef != null) { xDest = ArgumentRef.ToString(); } else { if (ArgumentReg != null) { xDest = Registers.GetRegisterName(ArgumentReg.Value); } else { if (ArgumentValue.HasValue) { xDest = "0x" + ArgumentValue.GetValueOrDefault().ToString("X").ToUpperInvariant(); } } } if (ArgumentDisplacement != 0) { xDest += " + " + ArgumentDisplacement; } if (ArgumentIsIndirect) { return("[" + xDest + "]"); } else { return(xDest); } }
public ArgumentValue Add(Argument argument, ArgumentEntity argumentEntity, IEnumerable <ValueEntity> values) { if (argument == null || argumentEntity == null || values == null || !values.Any()) { return(null); } var argValue = new ArgumentValue(argument, argumentEntity); var valueList = new List <ValueEntity>(values); while (valueList.Count < argumentEntity.ValueCount) { valueList.Add(ValueEntity.Empty); } argValue.Values = valueList; ArgumentValues.Add(argValue); return(argValue); }
private InternalReceiveMessage CreateInternalReceive() { InternalReceiveMessage message2 = new InternalReceiveMessage { OperationName = this.OperationName, ServiceContractName = this.ServiceContractName }; ArgumentValue<CorrelationHandle> expression = new ArgumentValue<CorrelationHandle> { ArgumentName = "CorrelatesWith" }; message2.CorrelatesWith = new InArgument<CorrelationHandle>(expression); message2.IsOneWay = true; InternalReceiveMessage message = message2; if (this.correlationInitializers != null) { foreach (CorrelationInitializer initializer in this.correlationInitializers) { message.CorrelationInitializers.Add(initializer.Clone()); } } return message; }
private InternalSendMessage CreateInternalSend() { InternalSendMessage message2 = new InternalSendMessage { OperationName = this.OperationName }; ArgumentValue<CorrelationHandle> expression = new ArgumentValue<CorrelationHandle> { ArgumentName = "CorrelatesWith" }; message2.CorrelatesWith = new InArgument<CorrelationHandle>(expression); message2.Endpoint = this.Endpoint; message2.EndpointConfigurationName = this.EndpointConfigurationName; message2.IsOneWay = this.isOneWay; message2.IsSendReply = false; message2.TokenImpersonationLevel = this.TokenImpersonationLevel; message2.ServiceContractName = this.ServiceContractName; message2.Action = this.Action; message2.Parent = this; InternalSendMessage message = message2; if (this.correlationInitializers != null) { foreach (CorrelationInitializer initializer in this.correlationInitializers) { message.CorrelationInitializers.Add(initializer.Clone()); } Collection<CorrelationQuery> collection = ContractInferenceHelper.CreateClientCorrelationQueries(null, this.correlationInitializers, this.Action, this.ServiceContractName, this.OperationName, false); if (collection.Count == 1) { message.CorrelationQuery = collection[0]; } } if (this.EndpointAddress != null) { message.EndpointAddress = new InArgument<Uri>(context => this.EndpointAddress.Get(context)); } if (this.lazyCorrelationQueries != null) { foreach (CorrelationQuery query in this.lazyCorrelationQueries) { message.ReplyCorrelationQueries.Add(query); } } return message; }
public ConditionArgument(ICodeByteable gener, ArgumentValue? result) { generator = gener; this.result = result; }
public ArgValueConditionFromArgument(bool invert, ArgumentValue goTo) { this.invert = invert; this.goTo = goTo; }
internal SubstitutedCondition(Condition parent, ArgumentValue JumpTo, ConditionArgument[] arguments) { this.arguments = arguments; this.parent = parent; jumpTo = JumpTo; }
public ArgValueConditionFromArgument(bool invert) { this.invert = invert; goTo = new ArgumentValue(addressMode.constint, substitutionType.conditionDestination, 2, ClassDatabase.integer); }
public SubstitutedCondition toSubstitutedCondition(ArgumentValue JumpTo, ConditionArgument[] parts) { return new SubstitutedCondition(this, JumpTo, parts); }
public BlockSubstitutedPhrase(BlockPhrase f, List<ArgumentValue> values, ArgumentValue? ret, CodeBlock inter) : base(f, values, ret) { par = f; this.inter = inter; }
public override SubstitutedPhrase toSubstituedPhrase(IEnumerable<ArgumentValue> arguments, ArgumentValue? returnValue) { throw new Errors.OpcodeFormatError("trying to call ordinary form of toSubstitutedBytes on a phrase that requires a block"); }