public override string ToTexCode() { if (Content.Length == 0) { return(""); } string typestr = type == ClassType.Interface ? "Schnittstelle" : "Klasse"; List <string> lines = new List <string> (); lines.Add(@"\subsubsection{" + typestr + @" " + name + @"}\index{" + Packages.GetPackage(name) + "!" + name + @"}\label{" + name + "}"); // wrapfigure //lines.Add (@"\begin{wrapfigure}{R}{9cm}{0}" + "\n" + @"\centering"); //lines.Add (@"\includegraphics[scale=0.5]{Klassen/" + Name.Clean () + @"}"); //lines.Add (@"\end{wrapfigure}"); // in der mitte lines.Add(@"\begin{figure}[h!]" + "\n" + @"\centering"); lines.Add(@"\includegraphics[scale=1]{Klassen/" + Name.Clean() + @"}"); lines.Add(@"\end{figure}"); lines.Add(@"\paragraph{Beschreibung:}\mbox{}\newline\newline"); foreach (string cmt in Comments.GetComments(commentsKey)) { if (cmt.StartsWith("[") && cmt.EndsWith("]") && cmt.Contains("=")) { continue; } lines.Add(Packages.AddTexCommands(cmt)); } //lines.Add (@"\setlength{\columnsep}{10pt}%"); lines.Add("\n"); IEnumerable <UmlAttribute> attributes = Content.OfType <UmlAttribute> (); IEnumerable <UmlMethod> contructors = Content.OfType <UmlMethod> ().Where((m) => m.Name == Name); IEnumerable <UmlMethod> methods = Content.OfType <UmlMethod> ().Where((m) => m.Name != Name); if (attributes.Count() > 0) { lines.Add(@"\paragraph{Eigenschaften:}\mbox{} \newline\newline"); bool first = true; foreach (UmlAttribute obj in attributes) { if (!first) { lines.Add(@"~\\\\"); } lines.Add(obj.ToTexCode()); first = false; } //lines.Add (@"\end{description}"); } if (contructors.Count() > 0) { // lines.Add (@"\paragraph{Konstruktoren:}\mbox{} \begin{description} "); lines.Add(@"\paragraph{Konstruktoren:}\mbox{} \newline\newline"); bool first = true; foreach (UmlMethod obj in contructors) { if (!first) { lines.Add(@"~\\\\"); } obj.IsContructor = true; lines.Add(obj.ToTexCode()); first = false; } //lines.Add (@"\end{description}"); } if (methods.Count() > 0) { // lines.Add (@"\paragraph{Methoden:}\mbox{} \begin{description} "); lines.Add(@"\paragraph{Methoden:}\mbox{} \newline\newline"); bool first = true; foreach (UmlMethod obj in methods) { if (!first) { lines.Add(@"~\\\\"); } lines.Add(obj.ToTexCode()); first = false; } // lines.Add (@"\end{description}"); } return(string.Join("\n", lines).Replace("<", "$<$").Replace(">", "$>$")); }
public override string ToCSharpCode(int padding = 0) { string paddingStr = String.Concat(Enumerable.Repeat(" ", padding)); List <string> lines = new List <string> (); lines.AddRange(Packages.GetUsingStatements(Packages.GetPackage(name))); if (Packages.IsInPackage(name)) { lines.Add(paddingStr + "namespace " + Packages.GetPackage(name)); lines.Add(paddingStr + "{"); paddingStr += " "; padding += 4; } lines.AddRange(Comments.CSharpComments(commentsKey, paddingStr)); lines.Add( paddingStr + Publicity.ToCode("", " ") + Virtuality.ToCode("", " ") + type.ToCode("", " ") + name + (bases.Length > 0 ? " : " + string.Join(", ", bases).Replace("XNA.", "") : "") ); lines.Add(paddingStr + "{"); lines.Add(""); IEnumerable <UmlAttribute> attributes = Content.OfType <UmlAttribute> (); IEnumerable <UmlMethod> contructors = Content.OfType <UmlMethod> ().Where((m) => m.Name == Name); IEnumerable <UmlMethod> methods = Content.OfType <UmlMethod> ().Where((m) => m.Name != Name); if (attributes.Count() > 0) { lines.Add(paddingStr + " #region Properties"); lines.Add(""); foreach (UmlAttribute obj in attributes) { lines.Add(obj.ToCSharpCode(padding + 4, Virtuality.Virtual, this)); lines.Add(""); } lines.Add(paddingStr + " #endregion"); lines.Add(""); } if (contructors.Count() > 0) { lines.Add(paddingStr + " #region Constructors"); lines.Add(""); foreach (UmlMethod obj in contructors) { obj.IsContructor = true; lines.Add(obj.ToCSharpCode(padding + 4, Virtuality.None, this)); lines.Add(""); } lines.Add(paddingStr + " #endregion"); lines.Add(""); } if (methods.Count() > 0) { lines.Add(paddingStr + " #region Methods"); lines.Add(""); foreach (UmlMethod obj in methods) { lines.Add(obj.ToCSharpCode(padding + 4, Virtuality.Virtual, this)); lines.Add(""); } lines.Add(paddingStr + " #endregion"); lines.Add(""); } lines.Add(paddingStr + "}"); if (Packages.IsInPackage(name)) { padding -= 4; paddingStr = paddingStr.Substring(4); lines.Add(paddingStr + "}"); } return(string.Join("\n", lines)); }