Beispiel #1
0
		private static IEnumerable<RdcNeed> GenerateAlternatedNeeds(int numberOfItems)
		{
			for (int i = 0; i < numberOfItems; i++)
			{
				var need = new RdcNeed();
				need.BlockLength = (ulong) i;
				need.BlockType = i%2 == 0 ? RdcNeedType.Seed : RdcNeedType.Source;
				yield return need;
			}
		}
Beispiel #2
0
        private static RdcNeed[] GetRdcNeedList(RdcNeedPointer pointer)
        {
            var result = new RdcNeed[pointer.Used];

            var ptr      = pointer.Data;
            var needSize = Marshal.SizeOf(typeof(RdcNeed));

            // Get our native needs pointer
            // and deserialize to our managed
            // RdcNeed array.
            for (var i = 0; i < result.Length; i++)
            {
                result[i] = (RdcNeed)Marshal.PtrToStructure(ptr, typeof(RdcNeed));

                // Advance the intermediate pointer
                // to our next RdcNeed struct.
                ptr = new IntPtr(ptr.ToInt64() + needSize);
            }
            return(result);
        }
Beispiel #3
0
        private static RdcNeed[] GetRdcNeedList(RdcNeedPointer pointer)
        {
            var result = new RdcNeed[pointer.Used];

            var ptr = pointer.Data;
            var needSize = Marshal.SizeOf(typeof(RdcNeed));

            // Get our native needs pointer 
            // and deserialize to our managed 
            // RdcNeed array.
            for (var i = 0; i < result.Length; i++)
            {
                result[i] = (RdcNeed)Marshal.PtrToStructure(ptr, typeof(RdcNeed));

                // Advance the intermediate pointer
                // to our next RdcNeed struct.
                ptr = new IntPtr(ptr.ToInt64() + needSize);
            }
            return result;
        }