/// <summary> /// Get this fragment's offset in the buffer. Previous fragments must finish downloading though to make their /// content length known (in chunked encoding) though /// </summary> /// <param name="fragment"></param> /// <returns>The offset in memory to which this fragment should be copied to</returns> public int GetFileFragmentMemoryOffset(RemoteFileFragmentMetadata fragment) { int offset = 0; for (int i = 0; i < GetFileFragments().Count; i++) { RemoteFileFragmentMetadata currentFragment = GetFileFragments()[i]; if (currentFragment != fragment) { offset += (int)currentFragment.GetSize(); } else { break; } } return(offset); }