public T[] Data <T>() { if (typeof(T) == typeof(string)) { T[] output = new T[Length]; for (ulong curr = 0; curr < uLength; ++curr) { IntPtr sliceLengthOffset = (IntPtr)(pData.ToInt64() + (long)curr * 16); ulong sliceLength = (ulong)Marshal.ReadInt64(sliceLengthOffset); IntPtr sliceOffset = (IntPtr)(pData.ToInt64() + (long)curr * 16 + 8); IntPtr slice = Marshal.ReadIntPtr(sliceOffset); SliceData newData = new SliceData { pData = slice, uLength = sliceLength }; output[curr] = (T)Convert.ChangeType(new SliceString(newData).Data, typeof(T)); } return(output); } else { T[] data = new T[Length]; Util.Copy(data, Pointer); return(data); } }
public Slice(SliceData newData) { sliceWrapper = new SliceDataWrapper(); sliceWrapper.Set(newData.Pointer, (ulong)newData.Length, false); }