public static string Serialize(ImageSet imageSet) { var str = new StringBuilder(); str.AppendLine(imageSet.Index.ToString()); str.AppendLine(string.Join(",", imageSet.Images)); return(str.ToString()); }
public static RecoveryState Deserialize(string data) { using (var sr = new StringReader(data)) { var selectionIndices = sr.ReadLine().Split(',').Select(s => int.Parse(s)).ToList(); var imageSets = sr.ReadToEnd().Split(';').Select(s => ImageSet.Deserialize(s)).ToArray(); return(new RecoveryState(selectionIndices, imageSets)); } }
public override string ToString() { return(ImageSet.Serialize(this)); }