/// <summary> /// Generates a document on the server and returns the full url to it. /// </summary> /// <param name="output"></param> /// <returns></returns> public static string GenerateImageOnYumlServer(YumlClassOutput output) { Logger.Log(string.Format("Generating image on yuml server, class diagram: '{0}'", output.ClassDiagram), LogLevel.High); ServicePointManager.Expect100Continue = false; WebRequest req = WebRequest.Create(YumlClassUrl); //req.Proxy = new System.Net.WebProxy(ProxyString, true); //Add these, as we're doing a POST req.ContentType = "application/x-www-form-urlencoded"; req.Method = "POST"; //We need to count how many bytes we're sending. Post'ed Faked Forms should be name=value& byte[] bytes = Encoding.ASCII.GetBytes("dsl_text=" + EncodeForHttpPost(output.ClassDiagram.ToString())); req.ContentLength = bytes.Length; Stream os = req.GetRequestStream(); os.Write(bytes, 0, bytes.Length); //Push it out there os.Close(); WebResponse resp = req.GetResponse(); var sr = new StreamReader(resp.GetResponseStream()); string pngName = sr.ReadToEnd().Trim(); var imageOnYumlServer = YumlClassUrl + pngName; Logger.Log(string.Format("image has been generated on server with url of :'{0}'", imageOnYumlServer), LogLevel.High); return(imageOnYumlServer); }
public YumlClassOutput Translate(ProjectDetail rootProjectDetail, ProjectDetailsCollection parentProjectDetailsCollection, bool newlineForEachRelationship = false) { Logger.Log("Translating ProjectDetail to YumlClassOutput", LogLevel.High); var output = new YumlClassOutput(); output.RootFile = rootProjectDetail.FullPath; output.ClassDiagram = GenerateClassDiagram(rootProjectDetail, parentProjectDetailsCollection, newlineForEachRelationship); return(output); }
public YumlClassOutput Translate(RootNode rootNode, bool newlineForEachRelationship = false) { Logger.Log("Translating rootNode to YumlClassOutput", LogLevel.High); var output = new YumlClassOutput(); output.RootFile = rootNode.File.FullName; output.ClassDiagram = GenerateClassDiagram(rootNode, newlineForEachRelationship); return(output); }
private static void AddReferences(StringBuilder builder, string outputFolder, ProjectDetail projectDetail, YumlClassOutput projectOutput) { if (projectOutput.DependencyDiagram.Relationships.Count > 0) { string projectOutputFileName = MakeOutputImageFileName(outputFolder, projectOutput.RootFile); FetchImage(projectOutput.DependencyDiagram, projectOutputFileName); _ = builder.AppendLine(string.Format(@"<h2>{0} - <a href='{1}' target='_blank'>View Yuml Image</a></h2>", Path.GetFileName(projectOutput.RootFile), projectOutputFileName)); } if (projectDetail.ChildProjects.Any()) { _ = builder.AppendLine(@"<p>This project references:</p>"); _ = builder.AppendLine(@"<ul>"); foreach (var reference in projectDetail.ChildProjects) { _ = builder.AppendLine(string.Format(@"<li><a href='#{0}'>{1}</a></li>", reference.Id, Path.GetFileName(reference.FullPath))); } _ = builder.AppendLine(@"</ul>"); } else { _ = builder.AppendLine("<p>This project does not reference any other projects</p>"); } }
private static void AddReferencedBy(StringBuilder builder, string outputFolder, ProjectDetail projectDetail, YumlClassOutput projectOutput) { if (projectDetail.ParentProjects.Any()) { _ = builder.AppendLine(@"<p>This project is referenced by:</p>"); if (projectOutput.ParentDiagram.Relationships.Count > 0) { string projectOutputFileName = MakeParentOutputImageFileName(outputFolder, projectOutput.RootFile); FetchImage(projectOutput.ParentDiagram, projectOutputFileName); _ = builder.AppendLine(string.Format(@"<a href='{1}' target='_blank'>View Yuml Image</a>", Path.GetFileName(projectOutput.RootFile), projectOutputFileName)); } _ = builder.AppendLine(@"<ul>"); foreach (var reference in projectDetail.ParentProjects.OrderBy(x => Path.GetFileName(x.FullPath))) { _ = builder.AppendLine(string.Format(@"<li><a href='#{0}'>{1}</a></li>", reference.Id, Path.GetFileName(reference.FullPath))); } _ = builder.AppendLine(@"</ul>"); } else { _ = builder.AppendLine("<p>This project is not referenced by any other projects</p>"); } }