public static void Load(this Issue issue, BinaryReader reader, int fileVersion, ref ObservableCollection<Comment> comments) { issue.Title = reader.ReadString(); issue.Body = reader.ReadString(); issue.User = reader.ReadString(); issue.Number = reader.ReadInt32(); issue.CreatedAt = DateTime.Parse(reader.ReadString()); var hasLabels = reader.ReadBoolean(); if (hasLabels) { var numLabels = reader.ReadInt32(); issue.Labels.Clear(); for (int i = 0; i < numLabels; i++) { var label = new Label(); label.Name = reader.ReadString(); issue.Labels.Add(label); } } issue.GravatarId = reader.ReadString(); issue.State = reader.ReadString(); int numComments = reader.ReadInt32(); issue.Comments = numComments; comments.Clear(); for (int i = 0; i < numComments; i++) { var c = new Comment(); c.Body = reader.ReadString(); c.Id = reader.ReadInt32(); c.GravatarId = reader.ReadString(); c.User = reader.ReadString(); c.Url = reader.ReadString(); c.CreatedAt = DateTime.Parse(reader.ReadString()); c.UpdatedAt = DateTime.Parse(reader.ReadString()); comments.Add(c); } }
public CommentViewModel(Comment comment) { _comment = comment; }