当前位置: 首页>>代码示例>>C#>>正文


C# System.UInt16类代码示例

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


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

示例1: WithRefsWithReturn

 public object WithRefsWithReturn(
     ref string param1,
     ref int param2,
     ref short param3,
     ref long param4,
     ref uint param5,
     ref ushort param6,
     ref ulong param7,
     ref bool param8,
     ref double param9,
     ref decimal param10,
     ref int? param11,
     ref object param12,
     ref char param13,
     ref DateTime param14,
     ref Single param15,
     ref IntPtr param16,
     ref UInt16 param17,
     ref UInt32 param18,
     ref UInt64 param19,
     ref UIntPtr param20
     )
 {
     throw new Exception("Foo");
 }
开发者ID:vlaci,项目名称:Anotar,代码行数:25,代码来源:OnException.cs

示例2: Person

 public Person(string firstName, string lastName, UInt16 age, Person bestFriend = null)
 {
   this.firstName = firstName;
   this.lastName = lastName;
   this.age = age;
   this.bestFriend = bestFriend;
 }
开发者ID:VelocityDB,项目名称:VelocityDB,代码行数:7,代码来源:Person.cs

示例3: SendMessage

        public bool SendMessage(UInt16 ip, byte code, string body = null)
        {
            if (!IsConnected())
                return false;

            var hasBody = !string.IsNullOrEmpty(body);

            var msg = new byte[hasBody ? 5 + body.Length : 3];

            var ipbs = BitConverter.GetBytes(ip);
            msg[0] = ipbs[0];
            msg[1] = ipbs[1];

            if (hasBody)
                code |= 1 << 7;
            msg[2] = (byte)code;

            if (hasBody)
            {
                var lbodybs = BitConverter.GetBytes(body.Length);
                msg[3] = lbodybs[0];
                msg[4] = lbodybs[1];

                var bodybs = System.Text.Encoding.ASCII.GetBytes(body);

                Array.Copy(bodybs, 0, msg, 5, body.Length);
            }

            return _device.Write(msg) > 0;
        }
开发者ID:Cliveburr,项目名称:AutoHome,代码行数:30,代码来源:Device.cs

示例4: StartWebDAV

        /// <summary>
        /// Start the WebDAV interface using the given ip address, port and HTTPSecurity parameters.
        /// </summary>
        /// <param name="myIPAddress">The IPAddress for binding the interface at</param>
        /// <param name="myPort">The port for binding the interface at</param>
        /// <param name="myHttpWebSecurity">A HTTPSecurity class for checking security parameters like user credentials</param>
        public static Exceptional<HTTPServer<GraphDSWebDAV_Service>> StartWebDAV(this AGraphDSSharp myAGraphDSSharp, IPAddress myIPAddress, UInt16 myPort, HTTPSecurity myHttpWebSecurity = null)
        {
            try
            {
                // Initialize WebDAV service
                var _HttpWebServer = new HTTPServer<GraphDSWebDAV_Service>(
                    myIPAddress,
                    myPort,
                    new GraphDSWebDAV_Service(myAGraphDSSharp),
                    myAutoStart: true)
                {
                    HTTPSecurity = myHttpWebSecurity,
                };

                // Register the WebDAV service within the list of services
                // to stop before shutting down the GraphDSSharp instance
                myAGraphDSSharp.ShutdownEvent += new GraphDSSharp.ShutdownEventHandler((o, e) =>
                {
                    _HttpWebServer.StopAndWait();
                });

                return new Exceptional<HTTPServer<GraphDSWebDAV_Service>>(_HttpWebServer);

            }
            catch (Exception e)
            {
                return new Exceptional<HTTPServer<GraphDSWebDAV_Service>>(new GeneralError(e.Message, new System.Diagnostics.StackTrace(e)));
            }
        }
开发者ID:Vadi,项目名称:sones,代码行数:35,代码来源:GraphDSExtensionsWebDAV.cs

示例5: GroupFoundEventArgs

		public GroupFoundEventArgs (Byte connection, UInt16 start, UInt16 end, Byte[] uuid)
		{
			this.connection = connection;
			this.start = start;
			this.end = end;
			this.uuid = uuid;
		}
开发者ID:jedinja,项目名称:monomyo,代码行数:7,代码来源:GroupFoundEventArgs.cs

示例6: IndexBuffer

			public IndexBuffer(IDataStream stream, ulong vcn, FolderNTFS folder) {
				_folder = folder;
				_clusterStart = vcn * (ulong)(_folder._record.SectorsPerCluster * _folder._record.BytesPerSector);
				String magic = Util.GetASCIIString(stream, _clusterStart + 0x0, 4);

				if (!magic.Equals("INDX")) {
					throw new Exception("Magic INDX value not present");
				}

				_entriesStart = (ushort)(Util.GetUInt16(stream, _clusterStart + 0x18) + 0x18);
				_entriesEnd = (ushort)(Util.GetUInt16(stream, _clusterStart + 0x1c) + _entriesStart);

				ushort updateSequenceOffset = Util.GetUInt16(stream, _clusterStart + 0x04);
				ushort updateSequenceLength = Util.GetUInt16(stream, _clusterStart + 0x06);

				ushort updateSequenceNumber = Util.GetUInt16(stream, _clusterStart + updateSequenceOffset);
				ushort[] updateSequenceArray = new ushort[updateSequenceLength - 1];
				ushort read = 1;
				while (read < updateSequenceLength) {
					updateSequenceArray[read - 1] = Util.GetUInt16(stream, _clusterStart + updateSequenceOffset + (ushort)(read * 2));
					read++;
				}

				_stream = new FixupStream(stream, _clusterStart, _entriesEnd, updateSequenceNumber, updateSequenceArray, (ulong)folder.BytesPerSector);

				if (_entriesEnd == _entriesStart) {
					throw new Exception("Entry size was 0");
				}
			}
开发者ID:Alex-Jaeger,项目名称:BitcoinFindAndRecover,代码行数:29,代码来源:FolderNTFS.cs

示例7: ReadRegister

 public byte ReadRegister(UInt16 adr)
 {
     switch (adr)
     {
         case 0x00:
             return (byte)((pra | ~ddra) & 0x3f | IECLines & the_cpu_1541.IECLines);
         case 0x01: return (byte)(prb | ~ddrb);
         case 0x02: return ddra;
         case 0x03: return ddrb;
         case 0x04: return (byte)ta;
         case 0x05: return (byte)(ta >> 8);
         case 0x06: return (byte)tb;
         case 0x07: return (byte)(tb >> 8);
         case 0x08: tod_halt = false; return tod_10ths;
         case 0x09: return tod_sec;
         case 0x0a: return tod_min;
         case 0x0b: tod_halt = true; return tod_hr;
         case 0x0c: return sdr;
         case 0x0d:
             {
                 byte ret = icr; // Read and clear ICR
                 icr = 0;
                 the_cpu.ClearNMI();
                 return ret;
             }
         case 0x0e: return cra;
         case 0x0f: return crb;
     }
     return 0;	// Can't happen
 }
开发者ID:akirti,项目名称:PeteBrown.SilverlightC64,代码行数:30,代码来源:MOS6526_2.cs

示例8: DoPosTest

    public bool DoPosTest(string testDesc, string id, UInt16 uintA, string format, String expectedValue, NumberFormatInfo _NFI)
    {
        bool retVal = true;
        string errorDesc;

        string actualValue;

        TestLibrary.TestFramework.BeginScenario(testDesc);
        try
        {
            actualValue = uintA.ToString(format, _NFI);

            if (actualValue != expectedValue)
            {
                errorDesc =
                    string.Format("The string representation of {0} is not the value {1} as expected: actual({2})",
                    uintA, expectedValue, actualValue);
                errorDesc += "\nThe format info is \"" + ((format == null) ? "null" : format) + "\" speicifed";
                TestLibrary.TestFramework.LogError(id + "_001", errorDesc);
                retVal = false;
            }
        }
        catch (Exception e)
        {
            errorDesc = "Unexpect exception:" + e;
            errorDesc += "\nThe UInt16 integer is " + uintA + ", format info is \"" + format + "\" speicifed.";
            TestLibrary.TestFramework.LogError(id + "_002", errorDesc);
            retVal = false;
        }
        return retVal;
    }
开发者ID:CheneyWu,项目名称:coreclr,代码行数:31,代码来源:uint16tostring4.cs

示例9: wnd1

 public wnd1(EndianBinaryReader er)
     : base(er)
 {
     long basepos = er.BaseStream.Position - 0x4C;
     InflationLeft = er.ReadUInt16() / 16f;
     InflationRight = er.ReadUInt16() / 16f;
     InflationTop = er.ReadUInt16() / 16f;
     InflationBottom = er.ReadUInt16() / 16f;
     FrameSizeLeft = er.ReadUInt16();
     FrameSizeRight = er.ReadUInt16();
     FrameSizeTop = er.ReadUInt16();
     FrameSizeBottom = er.ReadUInt16();
     NrFrames = er.ReadByte();
     byte tmp = er.ReadByte();
     UseLTMaterial = (tmp & 1) == 1;
     UseVtxColorForAllWindow = (tmp & 2) == 2;
     Kind = (WindowKind)((tmp >> 2) & 3);
     DontDrawContent = (tmp & 8) == 16;
     Padding = er.ReadUInt16();
     ContentOffset = er.ReadUInt32();
     FrameOffsetTableOffset = er.ReadUInt32();
     er.BaseStream.Position = basepos + ContentOffset;
     Content = new WindowContent(er);
     er.BaseStream.Position = basepos + FrameOffsetTableOffset;
     WindowFrameOffsets = er.ReadUInt32s(NrFrames);
     WindowFrames = new WindowFrame[NrFrames];
     for (int i = 0; i < NrFrames; i++)
     {
         er.BaseStream.Position = basepos + WindowFrameOffsets[i];
         WindowFrames[i] = new WindowFrame(er);
     }
     er.BaseStream.Position = basepos + SectionSize;
 }
开发者ID:Ermelber,项目名称:EveryFileExplorer,代码行数:33,代码来源:wnd1.cs

示例10: CheckCRC

        public static byte[] CheckCRC(List<byte> listdata)
        {
            byte[] data = ASCIItoHEX(listdata);

            UInt16[] testPtr = new UInt16[data.Length];

            for (int i = 0; i < data.Length; i++)
            {
                testPtr[i] = (UInt16)data[i];
            }

            UInt16 index;
            UInt16 crc = 0xFFFF;

            for (int i = 0; i < testPtr.Length; i++)
            {
                index = (UInt16)((crc ^ testPtr[i]) & 0x00FF);
                crc = (UInt16)(((crc >> 8) & 0x00FF) ^ CRC_TABLE[index]);
            }

            if (testPtr.Length != 0)
            {
                crc = (UInt16)(((crc & 0x00FF) << 8) | ((crc & 0xFF00) >> 8));
            }

            if (crc != 0)
                return null;
            else
                return data.Take(data.Length - 2).ToArray();
        }
开发者ID:liroyma,项目名称:SpeedDetector,代码行数:30,代码来源:CRCManager.cs

示例11: AddCRC

        public static byte[] AddCRC(byte[] data)
        {
            UInt16[] testPtr = new UInt16[data.Length];

            for (int i = 0; i < testPtr.Length; i++)
            {
                testPtr[i] = (UInt16)data[i];
            }

            UInt16 index;
            UInt16 crc = 0xffff;

            for (int i = 0; i < testPtr.Length; i++)
            {
                index = (UInt16)((crc ^ testPtr[i]) & 0x00ff);
                crc = (UInt16)(((crc >> 8) & 0x00ff) ^ CRC_TABLE[index]);
            }

            if (testPtr.Length != 0)
            {
                crc = (UInt16)(((crc & 0x00ff) << 8) | ((crc & 0xff00) >> 8));
            }

            byte[] tmp = new byte[2];
            tmp[0] = (byte)(((crc) >> 8) & 0x00ff);
            tmp[1] = (byte)((crc) & 0x00ff);

            List<byte> newdata = new List<byte>();
            newdata.AddRange(data);
            newdata.AddRange(tmp);

            return HEXtoASCII(newdata.ToArray());
        }
开发者ID:liroyma,项目名称:SpeedDetector,代码行数:33,代码来源:CRCManager.cs

示例12: Readin

        /// <summary>  
        /// 图像信息读入(+2重载)
        /// </summary>  
        /// <param name="_fileName">文件名</param>  
        /// <param name="_width">图像的宽</param>  
        /// <param name="_height">图像的高</param> 
        /// <param name="_useless">无用字符消除</param>
        /// <param name="_front">首行缩进</param>  
        /// <param name="_behind">尾行缩进</param>  
        /// <param name="_needDecode">需要解码</param>
        /// <returns>得到的byte数组</returns>   
        public static byte[] Readin(String _fileName, UInt16 _width, UInt16 _height, UInt16 _useless, UInt16 _front, UInt16 _behind, Boolean _needDecode)
        {
            try
            {
                // Create an instance of StreamReader to read from a file.
                // The using statement also closes the StreamReader.
                using (StreamReader sr = new StreamReader(_fileName))
                {
                    String line, info = "";
                    // Read and display lines from the file until the end of
                    // the file is reached.
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (_useless != 0)
                        {
                            _useless--;
                        }
                        else
                        {
                            info += UsefulReadout(line, _front, _behind) + " ";
                        }

                    }
                    return ConvertInfo(info, _width, _height, _needDecode);
                }
            }
            catch (Exception e)
            {
                // Let the user know what went wrong.
                MessageSender.e = e;
                return new byte[1];
            }
        }
开发者ID:vsnicarevs,项目名称:peninsula,代码行数:44,代码来源:TextWorker.cs

示例13: ProcessFrame

        public CalibratedThermalFrame ProcessFrame(ThermalFrame calibrationFrame)
        {
            UInt16[] output = new UInt16[Width * Height];

            for(int i=0;i<output.Length;i++)
            {
                int v = BitConverter.ToUInt16(RawData, i * 2);
                int c = BitConverter.ToUInt16(calibrationFrame.RawData, i * 2);

                if (v < 0x800)
                {
                    // Dead pixel, clamp it to zero.
                    v = 0;
                }
                else
                {
                    v = v - c + 0x8000;
                    if (v < 0) v = 0;
                    if (v > 0xFFFF) v = 0xFFFF;
                }
                output[i] = (UInt16)v;
           
            }
            return new CalibratedThermalFrame(output);
        }
开发者ID:apextw,项目名称:winusbdotnet,代码行数:25,代码来源:SeekThermal.cs

示例14: GetBigEndian

 public static UInt16 GetBigEndian(UInt16 value) {
     if (BitConverter.IsLittleEndian) {
         return swapByteOrder(value);
     } else {
         return value;
     }
 }
开发者ID:xclouder,项目名称:godbattle,代码行数:7,代码来源:Converter.cs

示例15: SensorInfo

 public SensorInfo(RiftSharp.Win32Usb.HidCaps caps, UInt16 vendor, UInt16 product, string serial)
 {
     this.Capabilities = caps;
     this.VendorId = vendor;
     this.ProductId = product;
     this.SerialNumber = serial;
 }
开发者ID:CloneDeath,项目名称:VirtualHomeTheatre,代码行数:7,代码来源:SensorInfo.cs


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