/// <summary> /// Gets all the tiles from the tagContent's parent node. /// </summary> /// <param name="tagContent"></param> /// <param name="parentTile"></param> /// <returns>"Dictionary<string, RippleDictionary.Tile>"</returns> /// <exception cref="System.ArgumentNullException /// RippleDictionary.UnparseableXMLException /// RippleDictionary.TileTypeNotKnownException /// RippleDictionary.InvalidStyleException /// RippleDictionary.InvalidCoordinateException /// RippleDictionary.TypeNotKnownException /// RippleDictionary.ActionNotKnownException" /> private static Dictionary<string, Tile> GetTilesDictionaryFromTag(XElement tagContent) { Dictionary<string, Tile> tiles = new Dictionary<string, Tile>(); foreach (var tileTag in tagContent.Elements()) { Tile tile = GetTile(tileTag); tiles.Add(tile.Id, tile); } return tiles; }
/// <summary> /// Gets the Screen tag from the Ripple XML. /// </summary> /// <param name="xml"></param> /// <returns>RippleDictionary.Screen</returns> /// <exception cref="System.NullReferenceException /// System.ArgumentNullException /// RippleDictionary.TypeNotKnownException /// RippleDictionary.UnparseableXMLException" /> public static Screen GetScreenFromXML(string xml) { Screen screen = null; XDocument xdoc = XDocument.Load(GenerateRippleDictionaryStreamFromXML(xml)); foreach (var xel in xdoc.Root.Elements()) { if (xel.Name == XMLElementsAndAttributes.Screen) { string type, id, header, content; Dictionary<string, ScreenContent> screenContents = new Dictionary<string, ScreenContent>(); ScreenContent screenContent; foreach (var tagContent in xel.Elements()) { if (tagContent.Name == XMLElementsAndAttributes.ScreenContent) { type = tagContent.Attribute(XMLElementsAndAttributes.Type).Value; id = tagContent.Attribute(XMLElementsAndAttributes.Id).Value; header = tagContent.Attribute(XMLElementsAndAttributes.Header).Value; content = tagContent.Attribute(XMLElementsAndAttributes.Content).Value; var loopVideoObj = tagContent.Attribute(XMLElementsAndAttributes.LoopVideo); bool loopVideo = loopVideoObj != null ? (loopVideoObj.Value.ToLower() == "true" ? (bool)true : (loopVideoObj.Value.ToLower() == "false" ? (bool)false : false)) : false; screenContent = new ScreenContent(GetType(type), id, header, content, loopVideo); screenContents.Add(screenContent.Id, screenContent); } } screen = new Screen(screenContents); } else { continue; } } return screen; }