/// <summary> /// 分割数を指定して初期化。 /// </summary> /// <param name="variable">変数</param> /// <param name="min">最小値</param> /// <param name="max">最大値</param> /// <param name="n">分割数</param> public Range(Variable variable, ValueType min, ValueType max, int n) { this.variable = variable; this.min = min; this.max = max; this.step = (max - min) / (ValueType)n; }
/// <summary> /// 最大値、最小値と、刻み幅を指定して初期化。 /// </summary> /// <param name="variable">変数</param> /// <param name="min">最小値</param> /// <param name="max">最大値</param> /// <param name="step">刻み幅</param> public Range(Variable variable, ValueType min, ValueType max, ValueType step) { this.variable = variable; this.min = min; this.max = max; this.step = step; }
public void TypeLayoutCanBeControlledUsingStructLayoutAttribute() { ValueType value = new ValueType(1, 2); value.X.ShouldBe(1); value.Y.ShouldBe(2); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="name"></param> /// <param name="dataType"></param> public DataTypeCheck(string name, string dataType, DecimalCharacter decimalCharacter) { this.appliedTo = ValueType.Number; this.name = name; this.dataType = dataType; this.decimalCharacter = decimalCharacter; }
internal TimeCondition(ValueType valueType, CounterType counter, uint value, DayOfWeek dayOfWeek) { ValueType = valueType; CounterType = counter; Value = value; DayOfWeek = dayOfWeek; }
public static void TestUseCase(Assert assert) { assert.Expect(7); var t1 = new Type(); assert.Ok(t1 != null, "#565 t1"); var t2 = new ValueType(); assert.Ok(t2 != null, "#565 t2"); var t3 = new IntPtr(); assert.Ok(t3.GetType() == typeof(IntPtr) , "#565 t3"); var t4 = new UIntPtr(); assert.Ok(t4.GetType() == typeof(UIntPtr), "#565 t4"); var t5 = new ParamArrayAttribute(); assert.Ok(t5 != null, "#565 t5"); var t6 = new RuntimeTypeHandle(); assert.Ok(t6.GetType() == typeof(RuntimeTypeHandle), "#565 t6"); var t7 = new RuntimeFieldHandle(); assert.Ok(t7.GetType() == typeof(RuntimeFieldHandle), "#565 t7"); }
static void PatternMatchingSwitch(System.ValueType val) { switch (val) { case int number: Console.WriteLine(number); break; case long number: Console.WriteLine(number); break; case decimal number: Console.WriteLine(number); break; case float number: Console.WriteLine(number); break; case double number: Console.WriteLine(number); break; case null: Console.WriteLine("val is a nullable type with the null value"); break; default: Console.WriteLine("Could not convert " + val.ToString()); break; } }
public ParameterDefintion(string ParameterName, ParamAllowType AllowType, ValueType ValueType, string ParameterHelp) { this.Parameter = ParameterName; this.AllowType = AllowType; this.ValueType = ValueType; this.Help = ParameterHelp; }
internal Property(object name, Type valueType, object defaultValue, bool readOnly, PaintDotNet.PropertySystem.ValueValidationFailureResult vvfResult) { this.sync = new object(); this.eventAddAllowed = true; if (defaultValue != null) { Type c = defaultValue.GetType(); if (!valueType.IsAssignableFrom(c)) { throw new ArgumentOutOfRangeException("valueType", $"defaultValue is not of type specified in constructor. valueType.Name = {valueType.Name}, defaultValue.GetType().Name = {defaultValue.GetType().Name}"); } } if (name.GetType().IsValueType) { this.originalNameValue = (System.ValueType)name; } this.name = name.ToString(); this.valueType = valueType; this.ourValue = defaultValue; this.defaultValue = defaultValue; this.readOnly = readOnly; switch (vvfResult) { case PaintDotNet.PropertySystem.ValueValidationFailureResult.Ignore: case PaintDotNet.PropertySystem.ValueValidationFailureResult.Clamp: case PaintDotNet.PropertySystem.ValueValidationFailureResult.ThrowException: this.vvfResult = vvfResult; return; } throw ExceptionUtil.InvalidEnumArgumentException <PaintDotNet.PropertySystem.ValueValidationFailureResult>(vvfResult, "vvfResult"); }
public static void ReadYieldFile(string Filename, System.ValueType ReadData) { int Filenumber = 0; try { PVar.YieldOfMonth.NgCount = new int[30]; PVar.YieldOfMonth.ProductCount = new int[30]; PVar.YieldOfMonth.RecordTime = new DateTime[30]; if (System.IO.File.Exists(Filename) == false) { for (var i = 0; i <= 29; i++) { PVar.YieldOfMonth.NgCount[(int)i] = 0; PVar.YieldOfMonth.ProductCount[(int)i] = 1; PVar.YieldOfMonth.RecordTime[(int)i] = DateTime.Now; } WriteYieldFile(Filename, PVar.YieldOfMonth); } Filenumber = FileSystem.FreeFile(); //获取空闲可用的文件号 FileSystem.FileOpen(Filenumber, Filename, OpenMode.Binary); //以二进制的形式打开文件 FileSystem.FileGet(Filenumber, ref ReadData); PVar.YieldOfMonth = (PVar.YieldOfMonthData)ReadData; FileSystem.FileClose(Filenumber); //写入完成关闭当前打开的文件 } catch (Exception ex) { Interaction.MsgBox("文件读取失败:" + ex.Message, (int)MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "错误"); FileSystem.FileClose(Filenumber); //写入完成关闭当前打开的文件 } }
public ImmediateValue(ValueType value) { if (value == null) throw new ArgumentNullException("value"); else Value = value; }
/// <summary> /// 设置通用输出:[卡号],[0,15],[1:打开输出,0:关闭输出] /// </summary> /// <param name="CardNum"></param> /// <param name="doIndex"></param> /// <param name="i"></param> /// <returns></returns> /// <remarks></remarks> public static bool SetDo(short CardNum, System.ValueType doIndex, short i) //'''''''''''''''''''''''''''''''''' { short di = Convert.ToInt16(doIndex); gts.GT_SetDoBit(CardNum, gts.MC_GPO, (short)(di + 1), (short)(1 - i)); return(true); }
public static bool testMethod() { BoxingTestClassStruct_to_ValTypeTest_struct src = new BoxingTestClassStruct_to_ValTypeTest_struct(); System.ValueType dst = src; return(true); }
/// <summary> /// Сериализует значение (Mpower или ushort (mmmm кВт*ч)) в массив /// из 2 байт в BCD формате /// </summary> /// <param name="value"></param> /// <returns></returns> public static byte[] ToArray(ValueType value) { if (value is Menerg) { var bcd = (Menerg)value; return BitConverter.GetBytes(bcd._powerLimitBcd); } else if (value is ushort) { var x = (ushort)value; if (x >= 10000) { throw new ArgumentOutOfRangeException( "Значение лимта мощьности не можеть быть больше или равно 100"); } var bcd = BcdConverter.ToBcdUInt16(x); return BitConverter.GetBytes(bcd); } else { throw new InvalidCastException("Невозможно сериализовать значение"); } }
public static int GetHashCode(ValueType aThis) { if (aThis is byte) return (int)aThis; return -1; }
private void btnExportPinRelation_Click(object sender, System.EventArgs e) { try { string orfn = Application.StartupPath; FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog(); this.folderBrowserDialog1 = folderBrowserDialog; folderBrowserDialog.Description = "目录选择"; if (DialogResult.OK == this.folderBrowserDialog1.ShowDialog()) { orfn = this.folderBrowserDialog1.SelectedPath; System.ValueType dt = System.DateTime.Now; string tt = System.Convert.ToString(((System.DateTime)dt).Year); tt += System.Convert.ToString(((System.DateTime)dt).Month); tt += System.Convert.ToString(((System.DateTime)dt).Day); string ttms = System.Convert.ToString(((System.DateTime)dt).Hour); ttms += System.Convert.ToString(((System.DateTime)dt).Minute); ttms += System.Convert.ToString(((System.DateTime)dt).Second); string xlsxFn = orfn + "\\短路连接关系_" + tt + "_" + ttms + ".xlsx"; if (this.SaveToExcelFileFunc(xlsxFn)) { MessageBox.Show("导出成功!", "提示", MessageBoxButtons.OK); } else { MessageBox.Show("导出失败!", "提示", MessageBoxButtons.OK); } } } catch (System.Exception arg_126_0) { KLineTestProcessor.ExceptionRecordFunc(arg_126_0.StackTrace); } }
private StructureId(ValueType value, Type dataType, StructureIdTypes idType) { _value = value; _hasValue = value != null; _dataType = dataType; _idType = idType; }
/// <seealso cref="NVelocity.Runtime.Paser.Node.SimpleNode.Init(org.apache.velocity.context.InternalContextAdapter, java.lang.Object)"> /// </seealso> public override object Init(IInternalContextAdapter context, object data) { /* * Init the tree correctly */ base.Init(context, data); /** * Determine the size of the item and make it an Integer, Long, or BigInteger as appropriate. */ string str = FirstToken.Image; try { value = System.Int32.Parse(str); } catch (FormatException) { try { value = System.Int64.Parse(str); } catch (FormatException) { value = System.Decimal.Parse(str, System.Globalization.NumberStyles.Any); } } return(data); }
internal static object EnumerateUDT(ValueType oStruct, IRecordEnum intfRecEnum, bool fGet) { Type typ = oStruct.GetType(); if ((Information.VarTypeFromComType(typ) != VariantType.UserDefinedType) || typ.IsPrimitive) { throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "oStruct" })); } FieldInfo[] fields = typ.GetFields(BindingFlags.Public | BindingFlags.Instance); int num2 = 0; int num4 = fields.GetUpperBound(0); for (int i = num2; i <= num4; i++) { FieldInfo fieldInfo = fields[i]; Type fieldType = fieldInfo.FieldType; object obj3 = fieldInfo.GetValue(oStruct); if (Information.VarTypeFromComType(fieldType) == VariantType.UserDefinedType) { if (fieldType.IsPrimitive) { throw ExceptionUtils.VbMakeException(new ArgumentException(Utils.GetResourceString("Argument_UnsupportedFieldType2", new string[] { fieldInfo.Name, fieldType.Name })), 5); } EnumerateUDT((ValueType) obj3, intfRecEnum, fGet); } else { intfRecEnum.Callback(fieldInfo, ref obj3); } if (fGet) { fieldInfo.SetValue(oStruct, obj3); } } return null; }
/// <summary> /// 设置扩展输出:[板卡号],[IO模块(0开始)], [端口号(0开始)],[输出值:1打开,0关闭)] /// </summary> /// <param name="CardNum"></param> /// <param name="Mdl"></param> /// <param name="Index"></param> /// <param name="i"></param> /// <returns></returns> /// <remarks></remarks> public static bool SetExDo(short CardNum, short Mdl, System.ValueType Index, short i) //'''''''''''''''设置扩展模块输出IO的电平 { short di = Convert.ToInt16(Index); gts.GT_SetExtIoBitGts(CardNum, Mdl, di, (ushort)(1 - i)); return(true); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="name"></param> /// <param name="dataType"></param> /// <param name="optional"></param> public OptionalCheck(string name, string dataType, bool optional) { this.appliedTo = ValueType.All; this.optional = optional; this.name = name; this.dataType = dataType; }
static InstanceMethods() { DateTime dateTime = new DateTime(); ValueType valueType = dateTime; //new DateTime(0x270f, 12, 31, 23, 59, 59, 0x3e7, DateTimeKind.Utc) InstanceMethods.maxValidCimTimestamp = valueType; }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="name"></param> /// <param name="dataType"></param> /// <param name="min"></param> /// <param name="max"></param> public RangeValidation(string name, string dataType , double min, double max) { this.appliedTo = ValueType.All; this.min = min; this.max = max; this.name = name; this.dataType = dataType; }
public BasicBinaryOperator(string @operator, ValueType operandsAndReturnType, Func<object, object, object> evaluator) { _evaluator = evaluator; Operator = @operator; ReturnType = operandsAndReturnType; LHS = operandsAndReturnType; RHS = operandsAndReturnType; }
/// <summary> /// flag that an error has occured /// </summary> /// <param name="index">specifies which error has occured</param> public void SetError(System.ValueType index) { if ((int)index < capacity) { switches[(int)index] = true; empty = false; } }
public CheckControlParams(string name,string value,string errormsg, ValueType valueType,bool isRequired) { Name = name; Value = value; Type = valueType; Errormsg = errormsg; IsRequired = isRequired; }
public void ConvertToString_GivenType_ShouldConvert(Type type, ValueType value, string expectedValue) { var converter = CreateValueTypeConverter(type); converter .ConvertToString(value) .Should() .Be(expectedValue); }
public BasicBinaryOperator(string @operator, ValueType returnType, ValueType lhs, ValueType rhs, Func<object, object, object> evaluator) { _evaluator = evaluator; Operator = @operator; ReturnType = returnType; LHS = lhs; RHS = rhs; }
public virtual ValueType FromDescription(string v, ValueType d) { if(v==null) return d; IDictionaryEnumerator ie = _descToValue.GetEnumerator(); while(ie.MoveNext()) { if(v==LoadString((string)ie.Key)) return (ValueType)ie.Value; } return d; }
public MxeWord( int position, string header ) : base(position) { _header = header; if (header.Length > 0 && Enum.IsDefined(typeof(ValueType), (int)header[0])) { _valueType = (ValueType)header[0]; } }
public void ConvertFromString_GivenType_ShouldConvert(Type type, string stringValue, ValueType expectedValue) { var converter = CreateValueTypeConverter(type); var value = converter.ConvertFromString(stringValue); value .Should() .Be(expectedValue); }
internal Operator AddFunction(ValueType type1, ValueType returnType, OperatorDelegate fkt) { Functions.Add((uint)type1, new OperatorProc() { ReturnType = returnType, Function = fkt }); return this; }
internal Operator AddFunction(ValueType type1, ValueType type2, ValueType returnType, OperatorDelegate fkt) { _is2ArgOp = true; Functions.Add((uint)((ushort)type1 + ((ushort)type2 << 16)), new OperatorProc() { ReturnType = returnType, Function = fkt }); return this; }
public PhTextEdit(float left, float top, float width, float height, string text, string caption, ValueType type, GUIAction onChange, GUIAction onExit) : base(left, top, width, height) { this.Text = text; this.Caption = caption; this.onChange = onChange; this.onExit = onExit; this.keyMap = new Konsoul.KeyMap(); this.Type =type; cursor = text.Length; }
public MemoryAddress(Memory memory, Structs.MemoryBasicInformation memoryRegion, ulong offset, ValueType type, uint length, bool isUnicode) { Memory = memory; MemoryRegion = memoryRegion; Offset = offset; Type = type; Length = length; IsUnicode = isUnicode; MemoryType = memoryRegion.Protect.ToString(); _value = ReadValueFromProcessMemory(); }
public static void checkGetTypeValueType(System.ValueType x) { if (x.GetType() == typeof(D)) { (new D()).incCount(); } if (x.GetType() == typeof(C)) { (new C()).incCount(); } }
public static void checkIsValueType(System.ValueType x) { if (x is C) { (new C()).incCount(); } if (x is D) { (new D()).incCount(); } }
public static void checkGetTypeValueTypeCast(System.ValueType x) { if (x.GetType() == typeof(D)) { ((D)x).incCount(); } if (x.GetType() == typeof(C)) { ((C)x).incCount(); } }
public static void checkIsValueTypeCast(System.ValueType x) { if (x is C) { ((C)x).incCount(); } if (x is D) { ((D)x).incCount(); } }
/// <summary> /// Creates a new Variable of a specific type. /// </summary> /// <param name="name"> /// The name of the Variable. /// </param> /// <param name="context"> /// The context that this Variable will store data in. /// </param> public Variable(ValueType type, string name, ExecutionContext context) : base(type) { if (context.HasVariable(name)) { var msg = "Variable already instantiated"; throw new InvalidOperationException(msg); } Name = name; m_context = context; m_context.Instantiate(this); }
private void CopyList(ValueType from, ValueType to) { if (to.KeyValueList == null) { to.KeyValueList = new List<Tuple<string, Expression>>(); } if (from.KeyValueList != null) { to.KeyValueList.AddRange(from.KeyValueList); } }
void Start() { if ((!string.IsNullOrEmpty(fieldName1) || !string.IsNullOrEmpty(functionName1))) { if (getterNum == 1) { DebugInfo <System.ValueType> INFO = new DebugInfo <System.ValueType>(infoId, infoDescription, () => { if (!string.IsNullOrEmpty(fieldName1)) { value1 = (System.ValueType)script1.GetType().GetField(fieldName1)?.GetValue(script1); } else if (!string.IsNullOrEmpty(functionName1)) { value1 = (System.ValueType)script1.GetType().GetMethod(functionName1)?.Invoke(script1, null); } return(value1); }); DebugPanel.Instance.AddInfo(INFO); } else { if ((!string.IsNullOrEmpty(fieldName2) || !string.IsNullOrEmpty(functionName2))) { DebugInfo <System.ValueType, System.ValueType> INFO = new DebugInfo <System.ValueType, System.ValueType>(infoId, infoDescription, () => { if (!string.IsNullOrEmpty(fieldName1)) { value1 = (System.ValueType)script1.GetType().GetField(fieldName1)?.GetValue(script1); } else if (!string.IsNullOrEmpty(functionName1)) { value1 = (System.ValueType)script1.GetType().GetMethod(functionName1)?.Invoke(script1, null); } return(value1); }, () => { if (!string.IsNullOrEmpty(fieldName2)) { value2 = (System.ValueType)script1.GetType().GetField(fieldName2)?.GetValue(script1); } else if (!string.IsNullOrEmpty(functionName2)) { value2 = (System.ValueType)script1.GetType().GetMethod(functionName2)?.Invoke(script1, null); } return(value2); }); DebugPanel.Instance.AddInfo(INFO); } } } }
public override uint ConvertToBasis(ValueType totalValue) { String msg; if (totalValue is ProductVersion) { return Convert.ToUInt32(((ProductVersion)totalValue).TotalVersion); } msg = String.Format("Преобразование невозможно. Передан тип {0}, ожидается {1}", totalValue.GetType().ToString(), typeof(ProductVersion).ToString()); throw new InvalidCastException(msg); }
void UseAsWithNullable(System.ValueType val) { int?j = val as int?; if (j != null) { Console.WriteLine(j); } else { Console.WriteLine("Could not convert " + val.ToString()); } }
internal Property(Property cloneMe, Property sentinelNotUsed) { this.sync = new object(); this.eventAddAllowed = true; sentinelNotUsed.NoOp(); this.name = cloneMe.name; this.originalNameValue = cloneMe.originalNameValue; this.valueType = cloneMe.valueType; this.ourValue = cloneMe.ourValue; this.defaultValue = cloneMe.defaultValue; this.readOnly = cloneMe.readOnly; this.vvfResult = cloneMe.vvfResult; }
public string this[ValueType val] { get { int idx = pool.IndexOf(val); if (idx == -1) { pool.Add(val); idx = pool.Count - 1; } return "l" + idx.ToString(); } }
public ctFormActiveProduct(string licFilePath, System.ValueType currentEndTime) { try { this.InitializeComponent(); this.licFilePathStr = licFilePath; this.endTime = currentEndTime; } catch { base.Dispose(true); throw; } }
/// <summary> /// Sets the text message for an error /// </summary> /// <param name="index">specifies which error to set</param> /// <param name="message">the textual message to set</param> public void SetMessage(System.ValueType index, String message) { if ((int)index >= capacity) { capacity += 5; String[] newMessages = new String[capacity]; bool[] newSwitches = new bool[capacity]; messages.CopyTo(newMessages, 0); switches.CopyTo(newSwitches, 0); messages = newMessages; switches = newSwitches; } messages[(int)index] = message; }
static StackObject *ToString_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.ValueType instance_of_this_method = (System.ValueType) typeof(System.ValueType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.ToString(); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
private void ctFormProjectTestDataView_Load(object sender, System.EventArgs e) { try { this.dbpath = Application.StartupPath + "\\ctsdb.mdb"; this.mddbpath = Application.StartupPath + "\\ctsmddb.mdb"; System.ValueType dt = System.DateTime.Now; System.DateTime value = new System.DateTime(((System.DateTime)dt).Year, ((System.DateTime)dt).Month, ((System.DateTime)dt).Day, 0, 0, 0); this.dateTimePicker_start.Value = value; System.DateTime value2 = new System.DateTime(((System.DateTime)dt).Year, ((System.DateTime)dt).Month, ((System.DateTime)dt).Day, 23, 59, 59); this.dateTimePicker_stop.Value = value2; for (int i = 0; i < this.dataGridView1.Columns.Count; i++) { this.dataGridView1.Columns[i].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; this.dataGridView1.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } for (int j = 0; j < this.dataGridView1.Columns.Count; j++) { this.dataGridView1.Columns[j].SortMode = DataGridViewColumnSortMode.NotSortable; } } catch (System.Exception arg_136_0) { KLineTestProcessor.ExceptionRecordFunc(arg_136_0.StackTrace); } this.RefreshDataGridView(); int k = 0; if (0 < this.dataGridView1.Rows.Count) { do { this.dataGridView1.Rows[k].Selected = false; k++; }while (k < this.dataGridView1.Rows.Count); } try { if (this.gLineTestProcessor.iUIDisplayMode == 0) { base.WindowState = FormWindowState.Normal; } } catch (System.Exception arg_1A2_0) { KLineTestProcessor.ExceptionRecordFunc(arg_1A2_0.StackTrace); } this.SetDGVWidthSizeFunc(); }
/// <summary> /// 读取驱动报警:[卡号0-4],[轴号1-8] /// </summary> /// <param name="CardNum"></param> /// <param name="Axis"></param> /// <returns></returns> /// <remarks></remarks> public static short Get_AlarmDi(int CardNum, System.ValueType Axis) //读取驱动报警 { int CarAxisAlarm = 0; short di = Convert.ToInt16(Axis); gts.GT_GetDi((short)CardNum, gts.MC_ALARM, out CarAxisAlarm); if ((CarAxisAlarm & (1 << (di - 1))) == 0) { return((short)0); } else { return((short)1); } }
/// <summary> /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { int i = 42; System.Type type = i.GetType(); System.ValueType vtype = i.GetTypeCode(); System.Console.WriteLine(type); System.Console.WriteLine(vtype); Persona per = new Persona(); type = per.GetType(); System.Console.WriteLine(type); Console.ReadKey(); }
static void PatternMatchingNullable(System.ValueType val) { if (val is int j) // Nullable types are not allowed in patterns { Console.WriteLine(j); } else if (val is null) // If val is a nullable type with no value, this expression is true { Console.WriteLine("val is a nullable type with the null value"); } else { Console.WriteLine("Could not convert " + val.ToString()); } }
/// <summary> /// 读取扩展输出 /// </summary> /// <param name="CardNum"></param> 第几张卡上的扩展卡 /// <param name="mdl"></param>主卡上的第几张扩扎卡 /// <param name="i"></param>读取的IO号 /// <returns></returns> /// <remarks></remarks> public static short GetExDo(short CardNum, short mdl, System.ValueType i) //'''''''''''''''''''''''''''' { ushort CardExO = 0; short di = Convert.ToInt16(i); gts.GT_GetExtDoValueGts(CardNum, mdl, ref CardExO); if ((CardExO & (1 << di)) == 0) { return((short)1); } else { return((short)0); } }
/// <summary> /// 读取通用输出:1卡号[0,1],2索引[0,15]; 返回值:1输出打开,0输出关闭 /// </summary> /// <param name="CardNum"></param> /// <param name="i"></param> /// <returns></returns> /// <remarks></remarks> public static short GetDo(short CardNum, System.ValueType i) { short di = Convert.ToInt16(i); int CardExO = 0; gts.GT_GetDo(CardNum, gts.MC_GPO, out CardExO); if ((CardExO & (1 << di)) == 0) { return((short)1); } else { return((short)0); } }
public static void WriteParData(string FileName, System.ValueType WriteData) { int Filenumber = 0; try { Filenumber = FileSystem.FreeFile(); //获取空闲可用的文件号 FileSystem.FileOpen(Filenumber, FileName, OpenMode.Binary); //以二进制的形式打开文件 FileSystem.FilePut(Filenumber, WriteData); FileSystem.FileClose(Filenumber); //写入完成关闭当前打开的文件 } catch { FileSystem.FileClose(Filenumber); //写入出错关闭当前打开的文件 } }
/// <summary> /// 读取扩展输入:GetExDi(模块[0,255],IO口[0,15])返回值:0没有输入,1有输入 /// </summary> /// <param name="mdl"></param> /// <param name="i"></param> /// <returns></returns> /// <remarks></remarks> public static short GetExDi(short mdl, System.ValueType i) { ushort CardExI = 0; short CardNum = 0; short di = Convert.ToInt16(i); gts.GT_GetExtIoValueGts(CardNum, mdl, ref CardExI); if ((CardExI & (1 << di)) == 0) { return((short)1); } else { return((short)0); } }
/// <summary> /// 获取板卡IO[卡号][0-15][1:有输入,0无] /// </summary> /// <param name="CardNum"></param> /// <param name="i"></param> /// <returns></returns> /// <remarks></remarks> public static short GetDi(int CardNum, System.ValueType i) { short di = Convert.ToInt16(i); int CardExI = 0; lock (LockMotion) gts.GT_GetDi((short)CardNum, gts.MC_GPI, out CardExI); if ((CardExI & (1 << di)) == 0) { return((short)0); } else { return((short)1); } }
static StackObject *GetHashCode_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.ValueType instance_of_this_method = (System.ValueType) typeof(System.ValueType).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.GetHashCode(); __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method; return(__ret + 1); }
/// <summary> /// 获取 SQL 语句常量表示串 /// </summary> /// <param name="sdt">已支持类型受限于下级方法实现</param> /// <param name="val"></param> /// <returns></returns> public static string ConvertToSqlON(System.Data.SqlDbType sdt, System.ValueType val) { #region bool || byte if (val is bool || val is byte) { int n = System.Convert.ToInt32(val); string rtn = ConvertToSqlON(sdt, n); return(rtn.ToString()); } #endregion #region 默认处理方式 if (sdt == System.Data.SqlDbType.BigInt || sdt == System.Data.SqlDbType.Bit || sdt == System.Data.SqlDbType.Decimal || sdt == System.Data.SqlDbType.Float || sdt == System.Data.SqlDbType.Int || sdt == System.Data.SqlDbType.Money || sdt == System.Data.SqlDbType.Real || sdt == System.Data.SqlDbType.SmallInt || sdt == System.Data.SqlDbType.TinyInt ) { string rtn = val.ToString(); return(rtn); } if (sdt == System.Data.SqlDbType.Char || sdt == System.Data.SqlDbType.DateTime || sdt == System.Data.SqlDbType.NChar || sdt == System.Data.SqlDbType.NText || sdt == System.Data.SqlDbType.NVarChar || sdt == System.Data.SqlDbType.SmallDateTime || sdt == System.Data.SqlDbType.Text || sdt == System.Data.SqlDbType.UniqueIdentifier || sdt == System.Data.SqlDbType.VarChar ) { string str = val.ToString(); string rtn = ConvertToSqlON(sdt, str); return(rtn); } #endregion return(NonSupportedOutType); }