/// <summary> /// Converts the <paramref name="paths"/> list into a byte array containing the amount of paths in the /// <paramref name="paths"/> as a first <c>int</c>, and the unicode-converted list of paths after it. /// </summary> /// <param name="paths">List of paths to convert.</param> /// <returns> /// Byte array suitable to be used as a <c>FETCH_PATHS</c> data. /// </returns> private static byte[] GetWatchPathsData(IEnumerable <string> paths) { if (paths == null) { paths = new string[0]; } // This will replace the Windows path roots with the device names. string[] pathsArray = paths.ToArray(); // See the 'FETCH_PATHS' structure for more details. List <byte> data = new List <byte>(BitConverter.GetBytes(pathsArray.Length)); // Convert strings to byte array. foreach (string path in pathsArray) { data.AddRange(LazyCopyDriverClient.ConvertToDevicePath(path)); } return(data.ToArray()); }