/// <summary> /// Lists all XLD files in a <paramref name="stream"/>. /// </summary> /// <param name="stream"> /// Input stream. /// </param> /// <returns> /// List of all XLD files. /// </returns> public static List <XLDFile> FindXLDs(Stream stream) { List <XLDFile> entries = new List <XLDFile>(); while (ReadToXLD(stream)) { entries.Add(XLDFile.Parse(stream)); } return(entries); }
/// <summary> /// Finds <paramref name="n"/>-th XLD file in a <paramref name="stream"/> and stores <paramref name="offset"/>. /// </summary> /// <param name="stream"> /// Input stream. /// </param> /// <param name="n"> /// Number of XLD file in <paramref name="stream"/>. /// </param> /// <param name="offset"> /// Offset where the XLD begins. /// </param> /// <returns> /// <paramref name="n"/>-th XLD file in a stream. /// </returns> public static XLDFile FindXLD(Stream stream, int n, out int offset) { int pos = 0; while (ReadToXLD(stream)) { if (pos++ == n) { offset = (int)stream.Position; return(XLDFile.Parse(stream)); } else { stream.ReadByte(); } } offset = -1; return(null); }