/// <summary> /// Compiles quotation mark table into binary stream. /// </summary> /// <param name="quoteTable">The instance of quotation mark table.</param> /// <param name="outputStream">The instance of output binary stream.</param> /// <returns>Any error found during the compilation.</returns> public static ErrorSet Compile(QuotationMarkTable quoteTable, Stream outputStream) { if (quoteTable == null) { throw new ArgumentNullException("quoteTable"); } if (outputStream == null) { throw new ArgumentNullException("outputStream"); } ErrorSet errorSet = new ErrorSet(); BinaryWriter writer = new BinaryWriter(outputStream); writer.Write((uint)quoteTable.Language); writer.Write((uint)quoteTable.Items.Count); foreach (var item in quoteTable.Items) { writer.Write((ushort)item.Left); writer.Write((ushort)item.Right); writer.Write((uint)item.Direct); } return errorSet; }
/// <summary> /// Creates a quotation mark table with given file path. /// </summary> /// <param name="filePath">The location of the quotation mark file to load left.</param> /// <returns>A new instance of Quotation Mark Table loaded from file.</returns> public static QuotationMarkTable Read(string filePath) { QuotationMarkTable table = new QuotationMarkTable(); table.Load(filePath); return table; }