public ArtworkFormat(ArtworkUsage usage, short width, short height, short correlationId, int size, PixelFormat pformat, short rotation) { this.usage = usage; this.width = width; this.height = height; this.correlationId = correlationId; this.size = size; this.pformat = pformat; this.rotation = rotation; }
public ReadOnlyCollection <ArtworkFormat> LookupArtworkFormats(ArtworkUsage usage) { List <ArtworkFormat> list = new List <ArtworkFormat> (); foreach (ArtworkFormat format in artwork_formats.Values) { if (format.Usage == usage) { list.Add(format); } } return(new ReadOnlyCollection <ArtworkFormat> (list)); }
private void ParseArtwork(XmlNodeList photoNodes, ArtworkUsage artworkUsage) { foreach (XmlNode formatNode in photoNodes) { ArtworkUsage usage = artworkUsage; short width = 0; short height = 0; short correlationId = 0; int size = 0; PixelFormat pformat = PixelFormat.Unknown; short rotation = 0; string key = null; for (XmlNode child = formatNode.FirstChild; child != null; child = child.NextSibling) { if (child.Name == "key") { key = child.InnerText; continue; } if (key != null) switch (key) { case "FormatId": correlationId = short.Parse (child.InnerText); break; case "RenderWidth": width = short.Parse (child.InnerText); break; case "RenderHeight": height = short.Parse (child.InnerText); break; case "PixelFormat": switch (child.InnerText) { case "4C353635": pformat = PixelFormat.Rgb565; break; case "42353635": pformat = PixelFormat.Rgb565BE; break; case "32767579": pformat = PixelFormat.IYUV; break; default: pformat = PixelFormat.Unknown; break; } break; case "Rotation": rotation = short.Parse (child.InnerText); break; } } size = width * height * 2; if (!(correlationId == 0 || width == 0 || height == 0 || size == 0)) formats.Add (correlationId, new ArtworkFormat (usage, width, height, correlationId, size, pformat, rotation)); } }
public ReadOnlyCollection<ArtworkFormat> LookupArtworkFormats(ArtworkUsage usage) { List<ArtworkFormat> list = new List<ArtworkFormat> (); foreach (ArtworkFormat format in artwork_formats.Values) { if (format.Usage == usage) { list.Add (format); } } return new ReadOnlyCollection<ArtworkFormat> (list); }
private void ParseArtwork(XmlNodeList photoNodes, ArtworkUsage artworkUsage) { foreach (XmlNode formatNode in photoNodes) { ArtworkUsage usage = artworkUsage; short width = 0; short height = 0; short correlationId = 0; int size = 0; PixelFormat pformat = PixelFormat.Unknown; short rotation = 0; string key = null; for (XmlNode child = formatNode.FirstChild; child != null; child = child.NextSibling) { if (child.Name == "key") { key = child.InnerText; continue; } if (key != null) { switch (key) { case "FormatId": correlationId = short.Parse(child.InnerText); break; case "RenderWidth": width = short.Parse(child.InnerText); break; case "RenderHeight": height = short.Parse(child.InnerText); break; case "PixelFormat": switch (child.InnerText) { case "4C353635": pformat = PixelFormat.Rgb565; break; case "42353635": pformat = PixelFormat.Rgb565BE; break; case "32767579": pformat = PixelFormat.IYUV; break; default: pformat = PixelFormat.Unknown; break; } break; case "Rotation": rotation = short.Parse(child.InnerText); break; } } } size = width * height * 2; if (!(correlationId == 0 || width == 0 || height == 0 || size == 0)) { formats.Add(correlationId, new ArtworkFormat(usage, width, height, correlationId, size, pformat, rotation)); } } }