C# (CSharp) Класс System. UInt32 Code Examples

C# (CSharp) System.UInt32 - 30 примеров найдено. Это лучшие примеры C# (CSharp) кода для класса System.UInt32, полученные из open source проектов. Вы можете ставить оценку каждому примеру, чтобы помочь нам улучшить качество примеров.
Пример #1
0
        /// <summary>
        /// Creates a new miner instance.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="extraNonce"></param>
        /// <param name="connection"></param>
        /// <param name="pool"></param>
        /// <param name="minerManager"></param>
        /// <param name="storageLayer"></param>
        public StratumMiner(int id, UInt32 extraNonce, IConnection connection, IPool pool, IMinerManager minerManager, IStorageLayer storageLayer)
        {
            Id = id; // the id of the miner.
            ExtraNonce = extraNonce;
            Connection = connection; // the underlying connection.
            Pool = pool;
            _minerManager = minerManager;
            _storageLayer = storageLayer;

            Subscribed = false; // miner has to subscribe.
            Authenticated = false; // miner has to authenticate.

            _logger = Log.ForContext<StratumMiner>().ForContext("Component", pool.Config.Coin.Name);
            _packetLogger = LogManager.PacketLogger.ForContext<StratumMiner>().ForContext("Component", pool.Config.Coin.Name);

            _rpcResultHandler = callback =>
            {
                var asyncData = ((JsonRpcStateAsync)callback); // get the async data.
                var result = asyncData.Result + "\n"; // read the result.
                var response = Encoding.UTF8.GetBytes(result); // set the response.

                Connection.Send(response); // send the response.

                _packetLogger.Verbose("tx: {0}", result.PrettifyJson());
            };
        }
Пример #2
0
 public BmpReader(string fileName)
 {
     byte[] buffer = System.IO.File.ReadAllBytes(fileName);
     HeaderId = System.Text.Encoding.UTF8.GetString(buffer, 0, 2);
     HeaderFileSize = BitConverter.ToUInt32(buffer, 2);
     OffsetToPixelArray = BitConverter.ToUInt32(buffer, 0xa);
 }
Пример #3
0
        public static INode AddNode(this IGraph myIGraph, UInt32 myUInt32Id)
        {
            if (myIGraph == null)
                throw new ArgumentNullException("myIGraph must not be null!");

            return myIGraph.AddNode(myUInt32Id.ToString());
        }
Пример #4
0
        public static Byte[] bin2CArray(Byte[] inputData, UInt32 memberSizeInBytes)
        {
            StringBuilder cArraySB;
              UInt32 sizeSB = (((UInt32)inputData.Length)/memberSizeInBytes +1) * (memberSizeInBytes*2 + 4) + 30;

              cArraySB = new StringBuilder((Int32)sizeSB);

              switch(memberSizeInBytes)
              {
            case 1:
              bin2charArray(inputData,cArraySB);
              break;
            case 2:
              break;
            case 4:
              bin2uintArray(inputData,cArraySB);
              break;
            case 8:
              break;
            default:
              break;
              }

              return (new ASCIIEncoding()).GetBytes(cArraySB.ToString());
        }
Пример #5
0
 public static extern bool ReadFile(
     IntPtr hFile,
     IntPtr lpBuffer,
     UInt32 nNumberOfBytesToRead,
     out UInt32 lpNumberOfBytesRead,
     IntPtr lpOverlapped
     );
Пример #6
0
 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");
 }
Пример #7
0
 private static extern Boolean SetupDiEnumDeviceInterfaces(
     IntPtr hDevInfo,
     [MarshalAs(UnmanagedType.AsAny)] Object devInfo,
     ref Guid interfaceClassGuid,
     UInt32 memberIndex,
     ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData
     );
Пример #8
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="country">地域</param>
 /// <param name="family_line_num">系統番号</param>
 /// <param name="parent_family_line_num">大元の親系統番号</param>
 /// <param name="data">系統データ</param>
 public FamilyLineInfo( Horse.Area country, UInt32 family_line_num, UInt32 parent_family_line_num, ref HFamilyLineData data )
 {
     this.Coutry = country;
     this.FamilyLineNum = family_line_num;
     this.ParentFamilyLuneNum = parent_family_line_num;
     this.Data = data;
 }
Пример #9
0
 public void GetContent(CompilerContext context, ParseTreeNode parseNode)
 {
     if (parseNode.HasChildNodes())
     {
         ParallelTasks = Convert.ToUInt32(parseNode.ChildNodes[1].Token.Value);
     }
 }
Пример #10
0
        public static bool IsSignatureVerified(AKEKeys ake_keys, DHKeyPair key_pair, byte[] their_public_key_mpi_byte_array, byte[] encrypted_signature_byte_array,
            byte[] hashed_encrypted_signature_byte_array, bool is_top_half_keys, ref UInt32 public_key_id, ref byte[] dsa_public_key_byte_array_encoded)
        {
            if (encrypted_signature_byte_array == null || encrypted_signature_byte_array.Length < 1)
                throw new ArgumentException("IsSignatureVerified: Encrypted signature byte array cannot be null/empty");

            if (hashed_encrypted_signature_byte_array == null || hashed_encrypted_signature_byte_array.Length < 1)
             throw new ArgumentException("IsSignatureVerified: The hashed encrypted byte array cannot be null/empty");

            if (ake_keys == null)
             throw new ArgumentException("IsSignatureVerified: The AKE keys cannot be null");

            bool _is_hash_verified = false;

            if (is_top_half_keys == true)
                _is_hash_verified = IsHashSignatureVerified(ake_keys.GetMACKey2(), encrypted_signature_byte_array, hashed_encrypted_signature_byte_array);
            else
                _is_hash_verified = IsHashSignatureVerified(ake_keys.GetMACKey4(), encrypted_signature_byte_array, hashed_encrypted_signature_byte_array);

            if (_is_hash_verified == false)
             return false;

             if (IsEncryptedSignatureVerified(ake_keys, key_pair, their_public_key_mpi_byte_array,
                 encrypted_signature_byte_array, 0, is_top_half_keys, ref public_key_id, ref dsa_public_key_byte_array_encoded) == false)
              return false;

               return true;
        }
Пример #11
0
 public override void Decode()
 {
     MemoryStream stream = new MemoryStream(Data);
     BinaryReader reader = new BinaryReader(stream);
     this.FirstRowOffset = reader.ReadUInt32();
     reader.ReadUInt16();
 }
Пример #12
0
 private static UInt32 CalculateHash(UInt32[] table, UInt32 seed, IList<byte> buffer, int start, int size)
 {
     var crc = seed;
     for (var i = start; i < size - start; i++)
         crc = (crc >> 8) ^ table[buffer[i] ^ crc & 0xff];
     return crc;
 }
Пример #13
0
Файл: Item.cs Проект: habb0/Bfly
        internal Item(UInt32 Id, int Sprite, string PublicName, string Name, string Type, int Width, int Length, double Height, bool Stackable, bool Walkable, bool IsSeat, bool AllowRecycle, bool AllowTrade, bool AllowMarketplaceSell, bool AllowGift, bool AllowInventoryStack, InteractionType InteractionType, int Modes, string VendingIds)
        {
            this.Id = Id;
            this.SpriteId = Sprite;
            this.PublicName = PublicName;
            this.Name = Name;
            this.Type = char.Parse(Type);
            this.Width = Width;
            this.Length = Length;
            this.Height = Height;
            this.Stackable = Stackable;
            this.Walkable = Walkable;
            this.IsSeat = IsSeat;
            this.AllowRecycle = AllowRecycle;
            this.AllowTrade = AllowTrade;
            this.AllowMarketplaceSell = AllowMarketplaceSell;
            this.AllowGift = AllowGift;
            this.AllowInventoryStack = AllowInventoryStack;
            this.InteractionType = InteractionType;
            this.Modes = Modes;
            this.VendingIds = new List<int>();

            foreach (string VendingId in VendingIds.Split(','))
            {
                this.VendingIds.Add(int.Parse(VendingId));
            }
        }
Пример #14
0
 public Order(Customer customer)
 {
   m_orderId = 0;
   m_customer = customer;
   m_customer.Orders.Add(this);
   m_payments = new VelocityDbList<Payment>();
 }
Пример #15
0
 VmAfdRpcEnumCertificates (
     UInt32 hBinding,
     UInt32 hStore,
     UInt32 dwStartIndex,
     UInt32 dwNumCertificates,
     VMAFD_CERT_CONTAINER ppCertContainer
 );
Пример #16
0
        public void TestCase1()
        {
            scriptName = appDirectory + @"\scripts\val_test_ranges.ds";
            FileInfo info = new FileInfo(scriptName);
            nrOfErrors = 22;
            nrOfWarnings = 23;
            if (scriptSession != null)
            {
                string resultFile = scriptSession.SessionId.ToString("000") + '_' + info.Name + "_res.xml";
                scriptSession.StartResultsGathering(resultFile);

                // Perform the actual execution of the script.
                scriptSession.BeginExecuteScript(scriptName, false, theAsyncCallback);
            }

            lock (this)
            {
                wait = true;

                while (wait)
                {
                    if (wait)
                    {
                        System.Threading.Thread.Sleep(500);
                    }
                }
            }

            Assert.That(scriptSession.NrOfValidationErrors, Is.EqualTo(nrOfErrors), "Validation Error:");
            Assert.That(scriptSession.NrOfValidationWarnings, Is.EqualTo(nrOfWarnings), "Validation Warning:");
        }
Пример #17
0
 VmAfdAddCertificate (
     string pszServerName,
     UInt32 hStore,
     string pszAlias,
     string pszCertificate,
     string pszPrivateKey,
     UInt32 uAutoRefresh);
Пример #18
0
 private static UInt32[] Encrypt(UInt32[] v, UInt32[] k)
 {
     Int32 n = v.Length - 1;
     if (n < 1)
     {
         return v;
     }
     if (k.Length < 4)
     {
         UInt32[] Key = new UInt32[4];
         k.CopyTo(Key, 0);
         k = Key;
     }
     UInt32 z = v[n], y = v[0], delta = 0x9E3779B9, sum = 0, e;
     Int32 p, q = 6 + 52 / (n + 1);
     while (q-- > 0)
     {
         sum = unchecked(sum + delta);
         e = sum >> 2 & 3;
         for (p = 0; p < n; p++)
         {
             y = v[p + 1];
             z = unchecked(v[p] += (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z));
         }
         y = v[0];
         z = unchecked(v[n] += (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z));
     }
     return v;
 }
Пример #19
0
 private static extern Boolean SetupDiEnumDeviceInterfaces(
     IntPtr hDevInfo,
     ref SP_DEVINFO_DATA devInfo,
     ref Guid interfaceClassGuid,
     UInt32 memberIndex,
     ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData
     );
Пример #20
0
 public Item(string productCodeIn, double singlePriceIn, double volumePriceIn, UInt32 volumeQuantityIn)
 {
     _productCode = productCodeIn;
     _singleUnitPrice = singlePriceIn;
     _volumePrice = volumePriceIn;
     _volumeQuantity = volumeQuantityIn;
 }
Пример #21
0
        public void AddFrame(Bitmap bmp)
        {
            bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);

            BitmapData bmpDat = bmp.LockBits(
                new Rectangle(0, 0, bmp.Width, bmp.Height),
                ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);

            if (countFrames == 0)
            {
                this.stride = (UInt32)bmpDat.Stride;
                this.width = bmp.Width;
                this.height = bmp.Height;
                CreateStream();
            }

            int result = AviReadingMethods.AVIStreamWrite(aviStream,
                countFrames, 1,
                bmpDat.Scan0,
                (Int32)(stride * height),
                0, 0, 0);

            if (result != 0)
            {
                throw new Exception("Problem podczas otwierania pliku AVI" + result.ToString());
            }

            bmp.UnlockBits(bmpDat);
            countFrames++;
        }
	public static void StencilClearTagEXT(Int32 stencilTagBits, UInt32 stencilClearTag)
	{
		Debug.Assert(Delegates.pglStencilClearTagEXT != null, "pglStencilClearTagEXT not implemented");
		Delegates.pglStencilClearTagEXT(stencilTagBits, stencilClearTag);
		CallLog("glStencilClearTagEXT({0}, {1})", stencilTagBits, stencilClearTag);
		DebugCheckErrors();
	}
Пример #23
0
 public static extern bool WriteFile(
     IntPtr hFile,
     IntPtr lpBuffer,
     UInt32 nNumberOfBytesToWrite,
     out UInt32 lpNumberOfBytesWritten,
     IntPtr lpOverlapped
     );
	public static void QueryObjectParameterAMD(Int32 target, UInt32 id, Int32 pname, OcclusionQueryEventMaskAMD param)
	{
		Debug.Assert(Delegates.pglQueryObjectParameteruiAMD != null, "pglQueryObjectParameteruiAMD not implemented");
		Delegates.pglQueryObjectParameteruiAMD(target, id, pname, (UInt32)param);
		CallLog("glQueryObjectParameteruiAMD({0}, {1}, {2}, {3})", target, id, pname, param);
		DebugCheckErrors();
	}
Пример #25
0
 /// <summary>
 ///     A class that represents a file within an RAF archive. Creates an entry that only exists in memory.
 /// </summary>
 /// <param name="raf">Pointer to the owning RAFArchive</param>
 /// <param name="fileName">Full path of the file, ie. DATA/Characters/Ahri/Ahri.skn</param>
 /// <param name="offsetDatFile">Offset to the entry data offsets</param>
 /// <param name="fileSize">Length of the file in bytes</param>
 public RAFFileListEntry(RAFArchive raf, string fileName, UInt32 offsetDatFile, UInt32 fileSize)
 {
     m_raf = raf;
     FileName = fileName;
     m_fileOffset = offsetDatFile;
     m_fileSize = fileSize;
 }
		void nsIEmbeddingSiteWindow.GetDimensions(UInt32 flags, out Int32 x, out Int32 y, out Int32 cx, out Int32 cy)
		{
			Trace.TraceInformation("nsIEmbeddingSiteWindow.GetDimensions(flags = 0x{0:X8})", flags);

			x = y = cx = cy = 0;

			if (flags.HasFlag(nsIEmbeddingSiteWindowConstants.DIM_FLAGS_POSITION))
			{
				Point outerPosition = Container.GetOuterPosition();
				x = outerPosition.X;
				y = outerPosition.Y;
			}

			if (flags.HasFlag(nsIEmbeddingSiteWindowConstants.DIM_FLAGS_SIZE_INNER))
			{
				Size innerSize = Container.GetInnerSize();
				cx = innerSize.Width;
				cy = innerSize.Height;
			}
			else if (flags.HasFlag(nsIEmbeddingSiteWindowConstants.DIM_FLAGS_SIZE_OUTER))
			{
				Size outerSize = Container.GetOuterSize();
				cx = outerSize.Width;
				cy = outerSize.Height;
			}
		}
Пример #27
0
        protected StreamContent(Byte[] contentBytes)
        {
            Debug.Assert(contentBytes != null);

            ContentBytes = contentBytes;
            ContentLength = (UInt32)contentBytes.Length;
        }
Пример #28
0
		public Contact getContactById( UInt32 id )
		{
			string sql = "SELECT " +
			             "`contacts`.`id`, " +
			             "`contacts`.`telephoneNumber`, " +
			             "`contacts`.`alias`, " +
			             "`contacts`.`firstName`, " +
			             "`contacts`.`lastName`, " +
			             "`contacts`.`emailAddress` " +
			             "FROM `SmsApplicatie`.`contacts` WHERE id=:id ";
			MySqlCommand statement = this.databaseConnection.CreateCommand ();
			statement.CommandText = sql;
			statement.Parameters.AddWithValue ("id", id);
			MySqlDataReader reader = statement.ExecuteReader ();

			if (reader.Read ()) 
			{
				Contact contact = new Contact (
					                  Convert.ToUInt32 (reader ["id"]),
					                  Convert.ToString (reader ["telephoneNumber"]),
					                  Convert.ToString (reader ["alias"]),
					                  Convert.ToString (reader ["firstName"]),
					                  Convert.ToString (reader ["lastName"]),
					                  Convert.ToString (reader ["emailAddress"])
				                  );
				return contact;
			} 
			else 
			{
				return null;
			}

		}
Пример #29
0
 private static UInt32[] Decrypt(UInt32[] v, UInt32[] k)
 {
     Int32 n = v.Length - 1;
     if (n < 1) {
         return v;
     }
     if (k.Length < 4) {
         UInt32[] Key = new UInt32[4];
         k.CopyTo(Key, 0);
         k = Key;
     }
     UInt32 z = v[n], y = v[0], sum, e;
     Int32 p, q = 6 + 52 / (n + 1);
     unchecked {
         sum = (UInt32)(q * delta);
         while (sum != 0) {
             e = sum >> 2 & 3;
             for (p = n; p > 0; p--) {
                 z = v[p - 1];
                 y = v[p] -= (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z);
             }
             z = v[n];
             y = v[0] -= (z >> 5 ^ y << 2) + (y >> 3 ^ z << 4) ^ (sum ^ y) + (k[p & 3 ^ e] ^ z);
             sum -= delta;
         }
     }
     return v;
 }
Пример #30
0
 /// <summary>
 /// Constructor
 /// </summary>
 public QueryResult(int pRows, UInt32 pID)
 {
     Rows = pRows;
     ID = pID;
     Records = new Records();
     _success = true;
 }