public SmarterReadCachingBlockStore(IBlockStore backend, uint cacheBlockSize, uint cacheCapacity = SimpleRecentItemCache<byte[]>.DefaultCacheSize)
        {
            if (backend == null)
            {
                throw new ArgumentNullException("backend");
            }

            _backend = backend;
            _cacheBlockSize = cacheBlockSize;
            if (cacheBlockSize % _backend.BlockSize != 0)
            {
                throw new Exception("Wrong CacheBlockSize value. Should be perfect multiple of backend block size");
            }
            _backendBlocksPerCacheBlock=cacheBlockSize/_backend.BlockSize;

            _bufferPool = new ObjectPool<byte[]>(() => new byte[cacheBlockSize]);

            _cache = new SimpleRecentItemCache<byte[]>(cacheCapacity);
            _cache.ItemRemovedFromCache = ItemRemovedFromCache;
            _cache.OnCacheMiss = CacheMiss;
        }
Exemplo n.º 2
0
 public static void TexParameterf(uint target, uint pname, float param)
 {
     gl.Invoke("texParameterf", target, pname, param);
 }
Exemplo n.º 3
0
 public static void TexImage2D(uint target, int level, uint internalformat, int width, int height,
     int border, uint format, uint type, byte[] pixels)
 {
     gl.Invoke("texImage2D", target, level, internalformat, width, height,
         border, format, type, pixels);
 }
Exemplo n.º 4
0
 public static void ActiveTexture(uint textureUnit)
 {
     gl.Invoke("activeTexture", textureUnit);
 }
Exemplo n.º 5
0
 public uint GetHash() {
   uint ret = UsdCsPINVOKE.SdfTimeCode_GetHash(swigCPtr);
   return ret;
 }
 public unsafe partial void MultiDrawArraysIndirectBindlessCount([Flow(FlowDirection.In)] NV mode, [Flow(FlowDirection.In)] void* indirect, [Flow(FlowDirection.In)] uint drawCount, [Flow(FlowDirection.In)] uint maxDrawCount, [Flow(FlowDirection.In)] uint stride, [Flow(FlowDirection.In)] int vertexBufferCount);
        private void ResolveReferences()
        {
            foreach (var reference in asm.References)
            {
                // First, find the symbol and calculate its location in memory.
                var symbol = reference.Symbol;
                
                if (symbol == null)
                    symbol = asm.Symbols.Where(s => s.Name == reference.Name).SingleOrDefault();

                if (symbol == null)
                    throw new Exception("Unresolved reference.");

                if (symbol.IsExternal)
                    throw new NotImplementedException();

                uint symbolOffset = 0;
                uint referenceOffset = 0;

                // There are only 2 secions: .text and .data.
                switch (symbol.Section)
                {
                    case ".text":
                        symbolOffset = TextSection;
                        break;
                    case ".data":
                        symbolOffset = DataSection;
                        break;
                }
                symbolOffset += (uint)symbol.Offset;

                switch (reference.Section)
                {
                    case ".text":
                        referenceOffset = TextSection;
                        break;
                    case ".data":
                        referenceOffset = DataSection;
                        break;
                }
                referenceOffset += (uint)reference.Offset;


                // Now, insert the referenced symbol.
                // First, determine the value we're inserting.
                uint val = 0;
                switch (reference.Type)
                {
                    case SymbolReferenceType.Immediate:
                    case SymbolReferenceType.ImmediateLower:
                    case SymbolReferenceType.Jump:
                    case SymbolReferenceType.Branch:
                        val = symbolOffset;
                        break;
                    case SymbolReferenceType.ImmediateUpper:
                        val = symbolOffset >> 16;
                        break;
                }

                if (reference.Type == SymbolReferenceType.Branch)
                    val -= referenceOffset + 4;

                // Next, determine how to write this to memory.
                if (reference.Type == SymbolReferenceType.Jump)
                {
                    Machine.Memory[(int)referenceOffset >> 2] |= (uint)(val >> 2) & 0x3FFFFFF;
                }
                else if (reference.Type == SymbolReferenceType.Branch)
                {
                    Machine.Memory[(int)referenceOffset >> 2] |= (ushort)(val >> 2);
                }
                else
                {
                    Machine.Memory[(int)referenceOffset >> 2] |= (ushort)val;
                }
            }
        }
Exemplo n.º 8
0
 private void FF(ref uint a, uint b, uint c, uint d, uint x, uint s, uint ac)
 {
     a += (this.F(b, c, d) + x) + ac;
     a = RotateLeft(a, s) + b;
 }
Exemplo n.º 9
0
        private static void WriteDataTableToExcelWorksheet(DataTable dt, WorksheetPart worksheetPart)
        {
            OpenXmlWriter writer = OpenXmlWriter.Create(worksheetPart, Encoding.ASCII);
            writer.WriteStartElement(new Worksheet());
            writer.WriteStartElement(new SheetData());

            string cellValue = "";

            //  Create a Header Row in our Excel file, containing one header for each Column of data in our DataTable.
            //
            //  We'll also create an array, showing which type each column of data is (Text or Numeric), so when we come to write the actual
            //  cells of data, we'll know if to write Text values or Numeric cell values.
            int numberOfColumns = dt.Columns.Count;
            bool[] IsNumericColumn = new bool[numberOfColumns];
            bool[] IsDateColumn = new bool[numberOfColumns];

            string[] excelColumnNames = new string[numberOfColumns];
            for (int n = 0; n < numberOfColumns; n++)
                excelColumnNames[n] = GetExcelColumnName(n);

            //
            //  Create the Header row in our Excel Worksheet
            //
            uint rowIndex = 1;

            writer.WriteStartElement(new Row { RowIndex = rowIndex });
            for (int colInx = 0; colInx < numberOfColumns; colInx++)
            {
                DataColumn col = dt.Columns[colInx];
                AppendTextCell(excelColumnNames[colInx] + "1", col.ColumnName, ref writer);
                IsNumericColumn[colInx] = (col.DataType.FullName == "System.Decimal") || (col.DataType.FullName == "System.Int32") || (col.DataType.FullName == "System.Double") || (col.DataType.FullName == "System.Single");
                IsDateColumn[colInx] = (col.DataType.FullName == "System.DateTime");
            }
            writer.WriteEndElement();   //  End of header "Row"

            //
            //  Now, step through each row of data in our DataTable...
            //
            double cellNumericValue = 0;
            foreach (DataRow dr in dt.Rows)
            {
                // ...create a new row, and append a set of this row's data to it.
                ++rowIndex;

                writer.WriteStartElement(new Row { RowIndex = rowIndex });

                for (int colInx = 0; colInx < numberOfColumns; colInx++)
                {
                    cellValue = dr.ItemArray[colInx].ToString();
                    cellValue = ReplaceHexadecimalSymbols(cellValue);

                    // Create cell with data
                    if (IsNumericColumn[colInx])
                    {
                        //  For numeric cells, make sure our input data IS a number, then write it out to the Excel file.
                        //  If this numeric value is NULL, then don't write anything to the Excel file.
                        cellNumericValue = 0;
                        if (double.TryParse(cellValue, out cellNumericValue))
                        {
                            cellValue = cellNumericValue.ToString();
                            AppendNumericCell(excelColumnNames[colInx] + rowIndex.ToString(), cellValue, ref writer);
                        }
                    }
                    else if (IsDateColumn[colInx])
                    {
                        //  This is a date value.
                        DateTime dtValue;
                        string strValue = "";
                        if (DateTime.TryParse(cellValue, out dtValue))
                            strValue = dtValue.ToShortDateString();
                        AppendTextCell(excelColumnNames[colInx] + rowIndex.ToString(), strValue, ref writer);
                    }
                    else
                    {
                        //  For text cells, just write the input data straight out to the Excel file.
                        AppendTextCell(excelColumnNames[colInx] + rowIndex.ToString(), cellValue, ref writer);
                    }
                }
                writer.WriteEndElement(); //  End of Row
            }
            writer.WriteEndElement(); //  End of SheetData
            writer.WriteEndElement(); //  End of worksheet

            writer.Close();
        }
 static extern IntPtr SetClipboardData(uint uFormat, IntPtr hMem);
Exemplo n.º 11
0
 public static void OpenWindow(Window window, uint data)
 {
         Network.GameServer.Send(GameServerMessage.OpenWindow, IdManager.GetId(Player.Character), (byte) window, data);
 }
Exemplo n.º 12
0
 public ProjectileNetworkObject(NetWorker networker, uint serverId, FrameStream frame) : base(networker, serverId, frame)
 {
     Initialize();
 }
Exemplo n.º 13
0
        protected override void ReadDirtyFields(BMSByte data, ulong timestep)
        {
            if (readDirtyFlags == null)
            {
                Initialize();
            }

            Buffer.BlockCopy(data.byteArr, data.StartIndex(), readDirtyFlags, 0, readDirtyFlags.Length);
            data.MoveStartIndex(readDirtyFlags.Length);

            if ((0x1 & readDirtyFlags[0]) != 0)
            {
                if (positionInterpolation.Enabled)
                {
                    positionInterpolation.target   = UnityObjectMapper.Instance.Map <Vector3>(data);
                    positionInterpolation.Timestep = timestep;
                }
                else
                {
                    _position = UnityObjectMapper.Instance.Map <Vector3>(data);
                    RunChange_position(timestep);
                }
            }
            if ((0x2 & readDirtyFlags[0]) != 0)
            {
                if (rotationInterpolation.Enabled)
                {
                    rotationInterpolation.target   = UnityObjectMapper.Instance.Map <Quaternion>(data);
                    rotationInterpolation.Timestep = timestep;
                }
                else
                {
                    _rotation = UnityObjectMapper.Instance.Map <Quaternion>(data);
                    RunChange_rotation(timestep);
                }
            }
            if ((0x4 & readDirtyFlags[0]) != 0)
            {
                if (ownerNetIdInterpolation.Enabled)
                {
                    ownerNetIdInterpolation.target   = UnityObjectMapper.Instance.Map <uint>(data);
                    ownerNetIdInterpolation.Timestep = timestep;
                }
                else
                {
                    _ownerNetId = UnityObjectMapper.Instance.Map <uint>(data);
                    RunChange_ownerNetId(timestep);
                }
            }
            if ((0x8 & readDirtyFlags[0]) != 0)
            {
                if (playerIDInterpolation.Enabled)
                {
                    playerIDInterpolation.target   = UnityObjectMapper.Instance.Map <int>(data);
                    playerIDInterpolation.Timestep = timestep;
                }
                else
                {
                    _playerID = UnityObjectMapper.Instance.Map <int>(data);
                    RunChange_playerID(timestep);
                }
            }
        }
Exemplo n.º 14
0
 public static uint[] GenTextures(int count)
 {
     uint[] res = new uint[count];
     GenTextures(count, res);
     return res;
 }
Exemplo n.º 15
0
 public static void GenTexture(out uint texture)
 {
     GenTextures(1, out texture);
 }
Exemplo n.º 16
0
 private uint F(uint x, uint y, uint z)
 {
     return ((x & y) | (~x & z));
 }
Exemplo n.º 17
0
        public byte[] GetData()
        {
            uint length = 0;
            int exifIndex = -1;
            int gpsIndex = -1;

            if (this.exifIndexes.Count > 0)
            {
                exifIndex = (int)this.GetIndex(this.ifdIndexes, ExifTag.SubIFDOffset);
            }

            if (this.gpsIndexes.Count > 0)
            {
                gpsIndex = (int)this.GetIndex(this.ifdIndexes, ExifTag.GPSIFDOffset);
            }

            uint ifdLength = 2 + this.GetLength(this.ifdIndexes) + 4;
            uint exifLength = this.GetLength(this.exifIndexes);
            uint gpsLength = this.GetLength(this.gpsIndexes);

            if (exifLength > 0)
            {
                exifLength += 2;
            }

            if (gpsLength > 0)
            {
                gpsLength += 2;
            }

            length = ifdLength + exifLength + gpsLength;

            if (length == 6)
            {
                return null;
            }

            length += 10 + 4 + 2;

            byte[] result = new byte[length];
            result[0] = (byte)'E';
            result[1] = (byte)'x';
            result[2] = (byte)'i';
            result[3] = (byte)'f';
            result[4] = 0x00;
            result[5] = 0x00;
            result[6] = (byte)'I';
            result[7] = (byte)'I';
            result[8] = 0x2A;
            result[9] = 0x00;

            int i = 10;
            uint ifdOffset = ((uint)i - StartIndex) + 4;
            uint thumbnailOffset = ifdOffset + ifdLength + exifLength + gpsLength;

            if (exifLength > 0)
            {
                this.values[exifIndex].Value = ifdOffset + ifdLength;
            }

            if (gpsLength > 0)
            {
                this.values[gpsIndex].Value = ifdOffset + ifdLength + exifLength;
            }

            i = Write(BitConverter.GetBytes(ifdOffset), result, i);
            i = this.WriteHeaders(this.ifdIndexes, result, i);
            i = Write(BitConverter.GetBytes(thumbnailOffset), result, i);
            i = this.WriteData(this.ifdIndexes, result, i);

            if (exifLength > 0)
            {
                i = this.WriteHeaders(this.exifIndexes, result, i);
                i = this.WriteData(this.exifIndexes, result, i);
            }

            if (gpsLength > 0)
            {
                i = this.WriteHeaders(this.gpsIndexes, result, i);
                i = this.WriteData(this.gpsIndexes, result, i);
            }

            Write(BitConverter.GetBytes((ushort)0), result, i);

            return result;
        }
 public DefaultAssemblyWriter(Machine machine, uint textSection, uint dataSection)
 {
     Machine = machine;
     TextSection = textSection;
     DataSection = dataSection;
 }
Exemplo n.º 19
0
 public static void SetServerCurTime(uint timestamp)
 {
     _serverTimeSpan = (TimeSpan)(Miscs.GetDateTimeFromTimeStamp(timestamp) - Now);
 }
Exemplo n.º 20
0
 /// <summary>
 /// Constructor, only factory can instantiates nodes.
 /// </summary>
 /// <param name="nodeId">[in] The id of the node.</param>
 /// <param name="factory">[in] Poiter to the Factory the node belongs to.</param>
 public NullableTypeSyntax(uint nodeId, Factory factory) : base(nodeId, factory) {
     m_ElementType = 0;
 }
Exemplo n.º 21
0
		// Token: 0x060019F5 RID: 6645 RVA: 0x000CD8CC File Offset: 0x000CBACC
		bool IFallback.FallBackChar(char ch, char[] outputBuffer, ref int outputBufferCount, int outputEnd)
		{
			if (this.htmlEscape)
			{
				HtmlEntityIndex htmlEntityIndex = (HtmlEntityIndex)0;
				if (ch <= '>')
				{
					if (ch == '>')
					{
						htmlEntityIndex = HtmlEntityIndex.gt;
					}
					else if (ch == '<')
					{
						htmlEntityIndex = HtmlEntityIndex.lt;
					}
					else if (ch == '&')
					{
						htmlEntityIndex = HtmlEntityIndex.amp;
					}
					else if (ch == '"')
					{
						htmlEntityIndex = HtmlEntityIndex.quot;
					}
				}
				else if ('\u00a0' <= ch && ch <= 'ÿ')
				{
					htmlEntityIndex = HtmlSupport.EntityMap[(int)(ch - '\u00a0')];
				}
				if (htmlEntityIndex != (HtmlEntityIndex)0)
				{
					string name = HtmlNameData.entities[(int)htmlEntityIndex].Name;
					if (outputEnd - outputBufferCount < name.Length + 2)
					{
						return false;
					}
					outputBuffer[outputBufferCount++] = '&';
					name.CopyTo(0, outputBuffer, outputBufferCount, name.Length);
					outputBufferCount += name.Length;
					outputBuffer[outputBufferCount++] = ';';
				}
				else
				{
					uint num = (uint)ch;
					int num2 = (num < 16U) ? 1 : ((num < 256U) ? 2 : ((num < 4096U) ? 3 : 4));
					if (outputEnd - outputBufferCount < num2 + 4)
					{
						return false;
					}
					outputBuffer[outputBufferCount++] = '&';
					outputBuffer[outputBufferCount++] = '#';
					outputBuffer[outputBufferCount++] = 'x';
					int num3 = outputBufferCount + num2;
					while (num != 0U)
					{
						uint num4 = num & 15U;
						outputBuffer[--num3] = (char)((ulong)num4 + (ulong)((num4 < 10U) ? 48L : 55L));
						num >>= 4;
					}
					outputBufferCount += num2;
					outputBuffer[outputBufferCount++] = ';';
				}
			}
			else
			{
				string substitute = TextOutput.GetSubstitute(ch);
				if (substitute != null)
				{
					if (outputEnd - outputBufferCount < substitute.Length)
					{
						return false;
					}
					substitute.CopyTo(0, outputBuffer, outputBufferCount, substitute.Length);
					outputBufferCount += substitute.Length;
				}
				else
				{
					outputBuffer[outputBufferCount++] = ch;
				}
			}
			return true;
		}
Exemplo n.º 22
0
 public static extern bool SetFilePointerEx(IntPtr hFile, long liDistanceToMove,
    IntPtr lpNewFilePointer, uint dwMoveMethod);
Exemplo n.º 23
0
 private uint G(uint x, uint y, uint z)
 {
     return ((x & z) | (y & ~z));
 }
Exemplo n.º 24
0
 public static void BufferData(uint target, float[] srcData, uint usage)
 {
     gl.Invoke("bufferData", target, srcData, usage);
 }
Exemplo n.º 25
0
 private uint H(uint x, uint y, uint z)
 {
     return ((x ^ y) ^ z);
 }
Exemplo n.º 26
0
 public static void BindTexture(uint target, JSObject textureObject)
 {
     gl.Invoke("bindTexture", target, textureObject);
 }
Exemplo n.º 27
0
 private uint I(uint x, uint y, uint z)
 {
     return (y ^ (x | ~z));
 }
Exemplo n.º 28
0
 public static void TexParameteri(uint target, uint pname, int param)
 {
     gl.Invoke("texParameteri", target, pname, param);
 }
Exemplo n.º 29
0
 private static uint RotateLeft(uint x, uint n)
 {
     return x << (int)n | x >> 32 - (int)n;
 }
Exemplo n.º 30
0
 public static object GetTexParameter(uint target, uint pname)
 {
     return gl.Invoke("getTexParameter", target, pname);
 }
Exemplo n.º 31
0
 private void Transform(byte[] data)
 {
     uint a = this.state[0];
     uint b = this.state[1];
     uint c = this.state[2];
     uint d = this.state[3];
     uint[] output = new uint[0x10];
     Decode(ref output, data, 0x40);
     this.FF(ref a, b, c, d, output[0], 7, 0xd76aa478);
     this.FF(ref d, a, b, c, output[1], 12, 0xe8c7b756);
     this.FF(ref c, d, a, b, output[2], 0x11, 0x242070db);
     this.FF(ref b, c, d, a, output[3], 0x16, 0xc1bdceee);
     this.FF(ref a, b, c, d, output[4], 7, 0xf57c0faf);
     this.FF(ref d, a, b, c, output[5], 12, 0x4787c62a);
     this.FF(ref c, d, a, b, output[6], 0x11, 0xa8304613);
     this.FF(ref b, c, d, a, output[7], 0x16, 0xfd469501);
     this.FF(ref a, b, c, d, output[8], 7, 0x698098d8);
     this.FF(ref d, a, b, c, output[9], 12, 0x8b44f7af);
     this.FF(ref c, d, a, b, output[10], 0x11, 0xffff5bb1);
     this.FF(ref b, c, d, a, output[11], 0x16, 0x895cd7be);
     this.FF(ref a, b, c, d, output[12], 7, 0x6b901122);
     this.FF(ref d, a, b, c, output[13], 12, 0xfd987193);
     this.FF(ref c, d, a, b, output[14], 0x11, 0xa679438e);
     this.FF(ref b, c, d, a, output[15], 0x16, 0x49b40821);
     this.GG(ref a, b, c, d, output[1], 5, 0xf61e2562);
     this.GG(ref d, a, b, c, output[6], 9, 0xc040b340);
     this.GG(ref c, d, a, b, output[11], 14, 0x265e5a51);
     this.GG(ref b, c, d, a, output[0], 20, 0xe9b6c7aa);
     this.GG(ref a, b, c, d, output[5], 5, 0xd62f105d);
     this.GG(ref d, a, b, c, output[10], 9, 0x2441453);
     this.GG(ref c, d, a, b, output[15], 14, 0xd8a1e681);
     this.GG(ref b, c, d, a, output[4], 20, 0xe7d3fbc8);
     this.GG(ref a, b, c, d, output[9], 5, 0x21e1cde6);
     this.GG(ref d, a, b, c, output[14], 9, 0xc33707d6);
     this.GG(ref c, d, a, b, output[3], 14, 0xf4d50d87);
     this.GG(ref b, c, d, a, output[8], 20, 0x455a14ed);
     this.GG(ref a, b, c, d, output[13], 5, 0xa9e3e905);
     this.GG(ref d, a, b, c, output[2], 9, 0xfcefa3f8);
     this.GG(ref c, d, a, b, output[7], 14, 0x676f02d9);
     this.GG(ref b, c, d, a, output[12], 20, 0x8d2a4c8a);
     this.HH(ref a, b, c, d, output[5], 4, 0xfffa3942);
     this.HH(ref d, a, b, c, output[8], 11, 0x8771f681);
     this.HH(ref c, d, a, b, output[11], 0x10, 0x6d9d6122);
     this.HH(ref b, c, d, a, output[14], 0x17, 0xfde5380c);
     this.HH(ref a, b, c, d, output[1], 4, 0xa4beea44);
     this.HH(ref d, a, b, c, output[4], 11, 0x4bdecfa9);
     this.HH(ref c, d, a, b, output[7], 0x10, 0xf6bb4b60);
     this.HH(ref b, c, d, a, output[10], 0x17, 0xbebfbc70);
     this.HH(ref a, b, c, d, output[13], 4, 0x289b7ec6);
     this.HH(ref d, a, b, c, output[0], 11, 0xeaa127fa);
     this.HH(ref c, d, a, b, output[3], 0x10, 0xd4ef3085);
     this.HH(ref b, c, d, a, output[6], 0x17, 0x4881d05);
     this.HH(ref a, b, c, d, output[9], 4, 0xd9d4d039);
     this.HH(ref d, a, b, c, output[12], 11, 0xe6db99e5);
     this.HH(ref c, d, a, b, output[15], 0x10, 0x1fa27cf8);
     this.HH(ref b, c, d, a, output[2], 0x17, 0xc4ac5665);
     this.II(ref a, b, c, d, output[0], 6, 0xf4292244);
     this.II(ref d, a, b, c, output[7], 10, 0x432aff97);
     this.II(ref c, d, a, b, output[14], 15, 0xab9423a7);
     this.II(ref b, c, d, a, output[5], 0x15, 0xfc93a039);
     this.II(ref a, b, c, d, output[12], 6, 0x655b59c3);
     this.II(ref d, a, b, c, output[3], 10, 0x8f0ccc92);
     this.II(ref c, d, a, b, output[10], 15, 0xffeff47d);
     this.II(ref b, c, d, a, output[1], 0x15, 0x85845dd1);
     this.II(ref a, b, c, d, output[8], 6, 0x6fa87e4f);
     this.II(ref d, a, b, c, output[15], 10, 0xfe2ce6e0);
     this.II(ref c, d, a, b, output[6], 15, 0xa3014314);
     this.II(ref b, c, d, a, output[13], 0x15, 0x4e0811a1);
     this.II(ref a, b, c, d, output[4], 6, 0xf7537e82);
     this.II(ref d, a, b, c, output[11], 10, 0xbd3af235);
     this.II(ref c, d, a, b, output[2], 15, 0x2ad7d2bb);
     this.II(ref b, c, d, a, output[9], 0x15, 0xeb86d391);
     this.state[0] += a;
     this.state[1] += b;
     this.state[2] += c;
     this.state[3] += d;
     for (int i = 0; i < 0x10; i++)
     {
         output[i] = 0;
     }
 }