private static void Load(string resource) { try { slideShow = new SlideShow(); photos = new Dictionary <int, Photo>(); var example = Properties.Resources.ResourceManager.GetObject(resource) as String; if (example == null) { throw new NotSupportedException(string.Format("resource {0} is not included in assembly", resource)); } string[] lines = example.Split('\n'); // parse header containing number of entities string[] desc = lines[0].Split(' '); numPhotos = int.Parse(desc[0]); for (int i = 1; i < lines.Length; i++) { if (lines[i].Length == 0) { continue; } string[] spec = lines[i].Split(' '); bool isHorizontal = spec[0].Equals("H"); int numTags = int.Parse(spec[1]); photos[i - 1] = new Photo(i - 1, isHorizontal, numTags); for (int t = 0; t < numTags; t++) { photos[i - 1].tags.Add(spec[2 + t]); } } slideShow.GenerateTagsToPhotos(photos.Values.ToList()); } catch (Exception ex) { Console.Error.WriteLine(ex); } }