• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# DType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中DType的典型用法代码示例。如果您正苦于以下问题:C# DType类的具体用法?C# DType怎么用?C# DType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DType类属于命名空间,在下文中一共展示了DType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DTypeToType

        public static Type DTypeToType(DType type)
        {
            Type temp = null;
            if (!fundamentalTypes.TryGetValue(type, out temp))
                temp = null;

            return temp;
        }
开发者ID:garuma,项目名称:dbus-explorer,代码行数:8,代码来源:Mapper.cs


示例2: DigitsArray

 static DigitsArray()
 {
     unchecked
     {
         AllBits = (DType)~((DType)0);
         HiBitSet = (DType)(((DType)1) << (DataSizeBits) - 1);
     }
 }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:8,代码来源:BigInteger.cs


示例3: ReadValue

		//helper method, should not be used generally
		public object ReadValue (DType dtype)
		{
			switch (dtype)
			{
				case DType.Byte:
					return ReadByte ();

				case DType.Boolean:
					return ReadBoolean ();

				case DType.Int16:
					return ReadInt16 ();

				case DType.UInt16:
					return ReadUInt16 ();

				case DType.Int32:
					return ReadInt32 ();

				case DType.UInt32:
					return ReadUInt32 ();

				case DType.Int64:
					return ReadInt64 ();

				case DType.UInt64:
					return ReadUInt64 ();

#if !DISABLE_SINGLE
				case DType.Single:
					return ReadSingle ();
#endif

				case DType.Double:
					return ReadDouble ();

				case DType.String:
					return ReadString ();

				case DType.ObjectPath:
					return ReadObjectPath ();

				case DType.Signature:
					return ReadSignature ();

				case DType.Variant:
					return ReadVariant ();

				default:
					throw new Exception ("Unhandled D-Bus type: " + dtype);
			}
		}
开发者ID:0x0mar,项目名称:aircrack-ng,代码行数:53,代码来源:MessageReader.cs


示例4: SetType

        public DVar[] Fields = new DVar[12]; //This is explicityly left unprotected to reduce access overhead

        public DType SetType(DType type)
        {
            if (!DType.IsParentOf(type))
                throw new Exception(string.Format("Type {0} is not a parent of tyoe {1} and so cannot be extended", DType, type));
            DType = type;
            var maxFieldIndex = DType.FieldIndex;
            if (maxFieldIndex >= Fields.Length)
            {
                var newFields = new DVar[Fields.Length + 10];
                Array.Copy(Fields, newFields, Fields.Length);
                Fields = newFields;
            }
            return type;
        }
开发者ID:reshadi2,项目名称:mcjs,代码行数:16,代码来源:DClass.cs


示例5: PropertyInvokeDialog

        public PropertyInvokeDialog(Window parent, Bus bus, string busName, ObjectPath path, IElement element)
            : base(element.Name, parent, DialogFlags.DestroyWithParent | DialogFlags.Modal)
        {
            this.Build ();
            this.parent = parent;
            this.setAlign.HideAll ();
            this.WidthRequest = 250;
            this.HeightRequest = 150;
            this.propertyName.Text = element.Name;
            this.propertyType = Mapper.DTypeFromString (element.Data.ReturnType);

            try {
                this.caller = new PropertyCaller (bus, busName, path, element.Parent.Name, element.Name, element.Data);
            } catch (Exception e) {
                Logging.Error ("Error while creating the invocation proxy", e, parent);
                buttonExecute.Sensitive = false;
            }
        }
开发者ID:garuma,项目名称:dbus-explorer,代码行数:18,代码来源:PropertyInvokeDialog.cs


示例6: GetAlignment

 public static int GetAlignment(DType dtype)
 {
     switch (dtype) {
         case DType.Byte:
             return 1;
         case DType.Boolean:
             return 4;
         case DType.Int16:
         case DType.UInt16:
             return 2;
         case DType.Int32:
         case DType.UInt32:
             return 4;
         case DType.Int64:
         case DType.UInt64:
             return 8;
     #if !DISABLE_SINGLE
         case DType.Single: //Not yet supported!
             return 4;
     #endif
         case DType.Double:
             return 8;
         case DType.String:
             return 4;
         case DType.ObjectPath:
             return 4;
         case DType.Signature:
             return 1;
         case DType.Array:
             return 4;
         case DType.Struct:
         case DType.StructBegin:
             return 8;
         case DType.Variant:
             return 1;
         case DType.DictEntry:
         case DType.DictEntryBegin:
             return 8;
         case DType.Invalid:
         default:
             throw new Exception ("Cannot determine alignment of " + dtype);
     }
 }
开发者ID:rcaelers,项目名称:dbus-sharp,代码行数:43,代码来源:Protocol.cs


示例7: GetAlignment

		public static int GetAlignment (DType dtype)
		{
			switch (dtype) {
				case DType.Byte:
					return 1;
				case DType.Boolean:
					return 4;
				case DType.Int16:
				case DType.UInt16:
					return 2;
				case DType.Int32:
				case DType.UInt32:
					return 4;
				case DType.Int64:
				case DType.UInt64:
					return 8;
#if !DISABLE_SINGLE
				case DType.Single: //Not yet supported!
					return 4;
#endif
				case DType.Double:
					return 8;
				case DType.String:
					return 4;
				case DType.ObjectPath:
					return 4;
				case DType.Signature:
					return 1;
				case DType.Array:
					return 4;
				case DType.StructBegin:
					return 8;
				case DType.Variant:
					return 1;
				case DType.DictEntryBegin:
					return 8;
				case DType.UnixFileDescriptor:
					return 4;//note that this refers to the length of the INDEX to the FD, not the FD itself
				case DType.Invalid:
				default:
					throw new Exception ("Cannot determine alignment of " + dtype);
			}
		}
开发者ID:brookpatten,项目名称:dbus-sharp,代码行数:43,代码来源:ProtocolInformation.cs


示例8: Signature

        internal Signature(DType[] value)
        {
            if (value == null)
                throw new ArgumentNullException ("value");

            if (value.Length == 0) {
                this.data = Empty.data;
                return;
            }

            if (value.Length == 1) {
                this.data = DataForDType (value[0]);
                return;
            }

            this.data = new byte[value.Length];

            for (int i = 0 ; i != value.Length ; i++)
                this.data[i] = (byte)value[i];
        }
开发者ID:acklinr,项目名称:dbus-sharp,代码行数:20,代码来源:Signature.cs


示例9: Convert

 public static object Convert(DType type, string value)
 {
     switch (type) {
     case DType.Boolean:
         return bool.Parse (value);
     case DType.Byte:
         return byte.Parse (value);
     case DType.Int16:
         return short.Parse (value);
     case DType.Int32:
         return int.Parse (value);
     case DType.Int64:
         return long.Parse (value);
     case DType.UInt32:
         return uint.Parse (value);
     case DType.UInt64:
         return ulong.Parse (value);
     case DType.UInt16:
         return ushort.Parse (value);
     default:
         return value;
     }
 }
开发者ID:garuma,项目名称:dbus-explorer,代码行数:23,代码来源:Mapper.cs


示例10: SingleDivide

		private static void SingleDivide(BigInteger leftSide, BigInteger rightSide, out BigInteger quotient, out BigInteger remainder)
		{
			if (rightSide.IsZero)
			{
				throw new DivideByZeroException();
			}

			DigitsArray remainderDigits = new DigitsArray(leftSide.m_digits);
			remainderDigits.ResetDataUsed();

			int pos = remainderDigits.DataUsed - 1;
			ulong divisor = (ulong)rightSide.m_digits[0];
			ulong dividend = (ulong)remainderDigits[pos];

			DType[] result = new DType[leftSide.m_digits.Count];
			leftSide.m_digits.CopyTo(result, 0, result.Length);
			int resultPos = 0;

			if (dividend >= divisor)
			{
				result[resultPos++] = (DType)(dividend / divisor);
				remainderDigits[pos] = (DType)(dividend % divisor);
			}
			pos--;

			while (pos >= 0)
			{
				dividend = ((ulong)(remainderDigits[pos + 1]) << DigitsArray.DataSizeBits) + (ulong)remainderDigits[pos];
				result[resultPos++] = (DType)(dividend / divisor);
				remainderDigits[pos + 1] = 0;
				remainderDigits[pos--] = (DType)(dividend % divisor);
			}
			remainder = new BigInteger(remainderDigits);

			DigitsArray quotientDigits = new DigitsArray(resultPos + 1, resultPos);
			int j = 0;
			for (int i = quotientDigits.DataUsed - 1; i >= 0; i--, j++)
			{
				quotientDigits[j] = result[i];
			}
			quotient = new BigInteger(quotientDigits);
		}
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:42,代码来源:BigInteger.cs


示例11: MultiDivide

		private static void MultiDivide(BigInteger leftSide, BigInteger rightSide, out BigInteger quotient, out BigInteger remainder)
		{
			if (rightSide.IsZero)
			{
				throw new DivideByZeroException();
			}

			DType val = rightSide.m_digits[rightSide.m_digits.DataUsed - 1];
			int d = 0;
			for (uint mask = DigitsArray.HiBitSet; mask != 0 && (val & mask) == 0; mask >>= 1)
			{
				d++;
			}

			int remainderLen = leftSide.m_digits.DataUsed + 1;
			DType[] remainderDat = new DType[remainderLen];
			leftSide.m_digits.CopyTo(remainderDat, 0, leftSide.m_digits.DataUsed);

			DigitsArray.ShiftLeft(remainderDat, d);
			rightSide = rightSide << d;

			ulong firstDivisor = rightSide.m_digits[rightSide.m_digits.DataUsed - 1];
			ulong secondDivisor = (rightSide.m_digits.DataUsed < 2 ? (DType)0 : rightSide.m_digits[rightSide.m_digits.DataUsed - 2]);

			int divisorLen = rightSide.m_digits.DataUsed + 1;
			DigitsArray dividendPart = new DigitsArray(divisorLen, divisorLen);
			DType[] result = new DType[leftSide.m_digits.Count + 1];
			int resultPos = 0;

			ulong carryBit = (ulong)0x1 << DigitsArray.DataSizeBits; // 0x100000000
			for (int j = remainderLen - rightSide.m_digits.DataUsed, pos = remainderLen - 1; j > 0; j--, pos--)
			{
				ulong dividend = ((ulong)remainderDat[pos] << DigitsArray.DataSizeBits) + (ulong)remainderDat[pos - 1];
				ulong qHat = (dividend / firstDivisor);
				ulong rHat = (dividend % firstDivisor);

				while (pos >= 2)
				{
					if (qHat == carryBit || (qHat * secondDivisor) > ((rHat << DigitsArray.DataSizeBits) + remainderDat[pos - 2]))
					{
						qHat--;
						rHat += firstDivisor;
						if (rHat < carryBit)
						{
							continue;
						}
					}
					break;
				}

				for (int h = 0; h < divisorLen; h++)
				{
					dividendPart[divisorLen - h - 1] = remainderDat[pos - h];
				}

				BigInteger dTemp = new BigInteger(dividendPart);
				BigInteger rTemp = rightSide * (long)qHat;
				while (rTemp > dTemp)
				{
					qHat--;
					rTemp -= rightSide;
				}

				rTemp = dTemp - rTemp;
				for (int h = 0; h < divisorLen; h++)
				{
					remainderDat[pos - h] = rTemp.m_digits[rightSide.m_digits.DataUsed - h];
				}

				result[resultPos++] = (DType)qHat;
			}

			Array.Reverse(result, 0, resultPos);
			quotient = new BigInteger(new DigitsArray(result));

			int n = DigitsArray.ShiftRight(remainderDat, d);
			DigitsArray rDA = new DigitsArray(n, n);
			rDA.CopyFrom(remainderDat, 0, 0, rDA.DataUsed);
			remainder = new BigInteger(rDA);
		}
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:80,代码来源:BigInteger.cs


示例12: CopyTo

 internal void CopyTo(DType[] array, int offset, int length)
 {
     Array.Copy(m_data, 0, array, offset, length);
 }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:4,代码来源:BigInteger.cs


示例13: CopyFrom

 internal void CopyFrom(DType[] source, int sourceOffset, int offset, int length)
 {
     Array.Copy(source, sourceOffset, m_data, 0, length);
 }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:4,代码来源:BigInteger.cs


示例14: ReportAbstractNotImplemented

		internal override void ReportAbstractNotImplemented(ErrorSink/*!*/ errors, DType/*!*/ declaringType, PhpType/*!*/ referringType)
		{
			errors.Add(Errors.AbstractPropertyNotImplemented, referringType.Declaration.SourceUnit,
				referringType.Declaration.Position, referringType.FullName, declaringType.MakeFullGenericName(), this.FullName);

			ReportError(errors, Errors.RelatedLocation);
		}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:7,代码来源:Properties.cs


示例15: GetAttributeUsageCount

		public override int GetAttributeUsageCount(DType/*!*/ type, AST.CustomAttribute.TargetSelectors selector)
		{
			return attributes.Count(type, selector);
		}
开发者ID:hansdude,项目名称:Phalanger,代码行数:4,代码来源:AssemblyBuilders.CLR.cs


示例16: DMemberRef

		public DMemberRef(DMember/*!*/ member, DType/*!*/ type)
		{
			Debug.Assert(member != null && type != null);

			this.member = member;
			this.type = type;
		}
开发者ID:jdluzen,项目名称:Phalanger,代码行数:7,代码来源:Members.cs


示例17: ShiftRight

        internal static int ShiftRight(DType[] buffer, int shiftCount)
        {
            int shiftAmount = DigitsArray.DataSizeBits;
            int invShift = 0;
            int bufLen = buffer.Length;

            while (bufLen > 1 && buffer[bufLen - 1] == 0)
            {
                bufLen--;
            }

            for (int count = shiftCount; count > 0; count -= shiftAmount)
            {
                if (count < shiftAmount)
                {
                    shiftAmount = count;
                    invShift = DigitsArray.DataSizeBits - shiftAmount;
                }

                ulong carry = 0;
                for (int i = bufLen - 1; i >= 0; i--)
                {
                    ulong val = ((ulong)buffer[i]) >> shiftAmount;
                    val |= carry;

                    carry = ((ulong)buffer[i]) << invShift;
                    buffer[i] = (DType)(val);
                }
            }

            while (bufLen > 1 && buffer[bufLen - 1] == 0)
            {
                bufLen--;
            }

            return bufLen;
        }
开发者ID:colombmo,项目名称:itsi-gamification,代码行数:37,代码来源:BigInteger.cs


示例18: Signature

		internal Signature (DType[] value)
		{
			this.data = new byte[value.Length];

			/*
			MemoryStream ms = new MemoryStream (this.data);

			foreach (DType t in value)
				ms.WriteByte ((byte)t);
			*/

			for (int i = 0 ; i != value.Length ; i++)
				this.data[i] = (byte)value[i];
		}
开发者ID:0x0mar,项目名称:aircrack-ng,代码行数:14,代码来源:Signature.cs


示例19: UnknownProperty

		/// <summary>
		/// Used by the compiler for unresolved properties.
		/// </summary>
		public UnknownProperty(DType/*!*/ declaringType, string/*!*/ name)
			: base(name)
		{
			Debug.Assert(declaringType != null && name != null);

			this.declaringType = declaringType;
		}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:10,代码来源:Properties.cs


示例20: GetImplementationInSuperTypes

		internal override DMemberRef GetImplementationInSuperTypes(DType/*!*/ type, bool searchSupertypes, ref bool inSupertype)
		{
			while (type != null && !type.IsUnknown)
			{
				KnownProperty result = type.GetDeclaredProperty<KnownProperty>(this.Name);
				if (result != null)
				{
					// private members are not visible from subtype:
					if (result.IsPrivate && inSupertype) break;

					return new DMemberRef(result, type);
				}

				if (!searchSupertypes) break;
				inSupertype = true;
				type = type.Base;
			}

			inSupertype = false;
			return null;
		}
开发者ID:tiaohai,项目名称:Phalanger,代码行数:21,代码来源:Properties.cs



注:本文中的DType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DTypeDesc类代码示例发布时间:2022-05-24
下一篇:
C# DTcms类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap