public static string SetImagePresetType(OtherImages.RLMediaType rlmediaType) { string rlmediaTypestring = string.Empty; if (rlmediaType == OtherImages.RLMediaType.Fade1) rlmediaTypestring = "Layer 1"; else if (rlmediaType == OtherImages.RLMediaType.Fade2) rlmediaTypestring = "Layer 2"; else if (rlmediaType == OtherImages.RLMediaType.Fade3) rlmediaTypestring = "Layer 3"; else if (rlmediaType == OtherImages.RLMediaType.FadeExit) rlmediaTypestring = "Layer -1"; else if (rlmediaType == OtherImages.RLMediaType.PauseBG) rlmediaTypestring = "Background"; else if (rlmediaType == OtherImages.RLMediaType.BezelBG) rlmediaTypestring = "Bezel Background"; return rlmediaTypestring; }
/// <summary> /// Save Preset from given parameters. /// </summary> /// <param name="presetName"></param> /// <param name="rlmedia"></param> /// <param name="author"></param> /// <param name="prefix"></param> /// <param name="outW"></param> /// <param name="outH"></param> /// <param name="resize"></param> /// <param name="stretch"></param> /// <param name="ratio"></param> /// <param name="tile"></param> /// <param name="tileW"></param> /// <param name="tileH"></param> /// <param name="FlipL"></param> /// <param name="FlipR"></param> /// <param name="JPG"></param> public static void saveXMLPresetImages(string presetName, OtherImages.RLMediaType rlmedia, string author,string prefix,string outW,string outH,string resize,string stretch,string ratio, string tile,string tileW,string tileH,string FlipL,string FlipR,string JPG) { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); settings.CloseOutput = true; settings.OmitXmlDeclaration = true; //Change the enum into string for fade names etc. string type = SetImagePresetType(rlmedia); if (Directory.Exists("presets\\images")) { using (XmlWriter write = XmlWriter.Create(@"presets\images\" + presetName + ".xml", settings)) { write.WriteStartElement("preset"); write.WriteElementString("author", author); write.WriteElementString("prefix", prefix); write.WriteElementString("mediaType", type); write.WriteElementString("outWidth", outW); write.WriteElementString("outHeight", outH); write.WriteElementString("resize", resize); write.WriteElementString("stretch", stretch); write.WriteElementString("ratio", ratio); write.WriteElementString("tile", tile); write.WriteElementString("tileWidth", tileW); write.WriteElementString("tileHeight", tileH); write.WriteElementString("flipL", FlipL); write.WriteElementString("flipR", FlipR); write.WriteElementString("jpg", JPG); write.WriteEndElement(); write.Flush(); write.Close(); } } }