/// <summary> /// Deserializes xml markup from file into an LicenceType object /// </summary> /// <param name="fileName">string xml file to load and deserialize</param> /// <param name="obj">Output LicenceType object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool LoadFromFile(string fileName, out LicenceType obj, out System.Exception exception) { exception = null; obj = default(LicenceType); try { obj = LoadFromFile(fileName); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
/// <summary> /// Deserializes workflow markup into an LicenceType object /// </summary> /// <param name="xml">string workflow markup to deserialize</param> /// <param name="obj">Output LicenceType object</param> /// <param name="exception">output Exception value if deserialize failed</param> /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns> public static bool Deserialize(string xml, out LicenceType obj, out System.Exception exception) { exception = null; obj = default(LicenceType); try { obj = Deserialize(xml); return(true); } catch (System.Exception ex) { exception = ex; return(false); } }
public string DisplayFooter() { StringBuilder builder = new StringBuilder(); string auteurs = DisplayAuteurs(this.Auteurs.Where(x => x.Role == AuteurRoleEnum.Auteur).ToList()); string traducteurs = DisplayAuteurs(this.Auteurs.Where(x => x.Role == AuteurRoleEnum.Traducteur).ToList()); string nomAuteursEtTraducteurs; XElement xLicAuteur = this.XDocument.XPathSelectElement("/document/entete/licauteur"); XElement xLicAnnee = this.XDocument.XPathSelectElement("/document/entete/licannee"); XElement xLicType = this.XDocument.XPathSelectElement("/document/entete/lictype"); string licAuteur = xLicAuteur?.Value ?? String.Empty; string licAnnee = xLicAnnee?.Value ?? String.Empty; int? licType = xLicType != null?int.Parse(xLicType?.Value) : (int?)null; if (!String.IsNullOrEmpty(traducteurs)) { nomAuteursEtTraducteurs = String.Format("{0} et traduit par {1}", auteurs, traducteurs); } else { nomAuteursEtTraducteurs = auteurs; } builder.AppendLine(@"\begin{center}"); builder.Append(@"\emph{"); switch (this.Source) { case SourceEnum.Actualite: { if (this.Complet == false) { builder.Append(String.Format("Retrouvez l'actualité complète de {0} en ligne : ", nomAuteursEtTraducteurs)); } else { builder.Append(String.Format("Retrouvez l'actualité de {0} en ligne : ", nomAuteursEtTraducteurs)); } break; } case SourceEnum.Article: { if (this.Complet == false) { builder.Append(String.Format("Retrouvez l'intégralité de l'article de {0} en ligne : ", nomAuteursEtTraducteurs)); } else { builder.Append(String.Format("Retrouvez l'article de {0} en ligne : ", nomAuteursEtTraducteurs)); } break; } case SourceEnum.BilletBlog: { builder.Append(String.Format("Retrouvez le billet de blog de {0} en ligne : ", nomAuteursEtTraducteurs)); break; } } builder.AppendLine(String.Format(@"\href{{{0}}}{{{0}}}", this.URL.Replace("#", @"\#"))); //builder.Append(String.Format(@"\footnote{{\lien : \texttt{{{0}}}}}", this.URL)); builder.AppendLine("}"); builder.AppendLine(@"\end{center}"); if (licType.HasValue) { LicenceType licenceType = ConfigurationType.GetLicenceByType(licType.Value); string licence = licenceType.Description; licence = licence .Replace("[LICENCE_ANNEE]", licAnnee) .Replace("[LICENCE_AUTEUR]", licAuteur) .Replace("&", @"\&"); builder.AppendLine(); builder.AppendLine(); if (!String.IsNullOrEmpty(licenceType.Logo)) { builder.AppendLine(@"\begin{wrapfigure}{L}{0.15\textwidth}"); builder.AppendLine(@"\center"); builder.AppendLine(@"\vspace*{-0.7cm}"); builder.AppendLine(String.Format(@"\includegraphics[scale=0.7]{{input/logos_images/{0}}}", licenceType.Logo)); builder.AppendLine(@"\end{wrapfigure}"); } builder.AppendLine(String.Format(@"{{\scriptsize {0} \par}}", licence)); } return(builder.ToString()); }
public static bool LoadFromFile(string fileName, out LicenceType obj) { System.Exception exception = null; return(LoadFromFile(fileName, out obj, out exception)); }
public static bool Deserialize(string xml, out LicenceType obj) { System.Exception exception = null; return(Deserialize(xml, out obj, out exception)); }