internal static void WriteAnnotation(Annotation annotation, EndianBinaryWriter writer) { writer.Write(annotation.TypeIndex); writer.Write((short)annotation.ElementValues.Count()); foreach (var value in annotation.ElementValues) { writer.Write(value.Item1); WriteElementValue(value.Item2, writer); } }
internal static Annotation ReadAnnotation(EndianBinaryReader reader, List<CompileConstant> constants) { var annotation = new Annotation(); annotation.TypeIndex = reader.ReadInt16(); short valueCount = reader.ReadInt16(); for (int i = 0; i < valueCount; i++) { short index = reader.ReadInt16(); ElementValue value = ReadElementValue(reader, constants); annotation.ElementValues.Add(new Tuple<short, ElementValue>(index, value)); } return annotation; }