private static string GetSummary(vsCMInfoLocation location, string xmlComment, string inlineComment, string fullName) { if (location != vsCMInfoLocation.vsCMInfoLocationProject || (string.IsNullOrWhiteSpace(xmlComment) && string.IsNullOrWhiteSpace(inlineComment))) { return(null); } try { string summary = ""; if (!string.IsNullOrWhiteSpace(xmlComment)) { summary = XElement.Parse(xmlComment) .Descendants("summary") .Select(x => x.Value) .FirstOrDefault(); } if (!string.IsNullOrEmpty(summary)) { return(summary.Trim()); } if (!string.IsNullOrWhiteSpace(inlineComment)) { return(inlineComment.Trim()); } return(null); } catch (Exception ex) { Telemetry.TrackException("GetSummary", ex); return(null); } }
private static string GetSummary(vsCMInfoLocation location, string xmlComment, string inlineComment, string fullName) { if (location != vsCMInfoLocation.vsCMInfoLocationProject || (string.IsNullOrWhiteSpace(xmlComment) && string.IsNullOrWhiteSpace(inlineComment))) { return(null); } try { string summary = XElement.Parse(xmlComment) .Descendants("summary") .Select(x => x.Value) .FirstOrDefault(); if (!string.IsNullOrEmpty(summary)) { return(summary.Trim()); } if (!string.IsNullOrWhiteSpace(inlineComment)) { return(inlineComment.Trim()); } return(null); } catch (Exception ex) { Logger.Log("Couldn't parse XML Doc Comment for " + fullName + ":\n" + ex); return(null); } }
private static string GetSummary(vsCMInfoLocation location, string xmlComment, string inlineComment, string fullName) { if (location != vsCMInfoLocation.vsCMInfoLocationProject || (string.IsNullOrWhiteSpace(xmlComment) && string.IsNullOrWhiteSpace(inlineComment))) { return(null); } try { var summary = new System.Text.StringBuilder(); if (!string.IsNullOrWhiteSpace(xmlComment)) { var s = XElement.Parse(xmlComment).Descendants("summary").FirstOrDefault(); foreach (var e in s.Nodes()) { switch (e.NodeType) { case System.Xml.XmlNodeType.None: break; case System.Xml.XmlNodeType.Element: if ((e as XElement).Name == "see") { summary.Append("'" + (e as XElement).Attribute("cref").Value + "'"); } break; case System.Xml.XmlNodeType.Text: summary.Append((e as XText).Value); break; default: break; } } } if (summary.Length > 0) { return(summary.ToString().Trim()); } if (!string.IsNullOrWhiteSpace(inlineComment)) { return(inlineComment.Trim()); } return(null); } catch (Exception ex) { Telemetry.TrackException("GetSummary", ex); return(null); } }
public void CodeType_ReturnTypeFromSameProjectContent_CodeTypeLocationIsProject() { helper.CreateReturnType("MyType"); AddUnderlyingClassToReturnType("MyType"); ReturnTypeSameProjectContent(); CreateCodeTypeRef2(); CodeClass2 codeClass = typeRef.CodeType as CodeClass2; vsCMInfoLocation location = codeClass.InfoLocation; Assert.AreEqual(vsCMInfoLocation.vsCMInfoLocationProject, location); }
public void CodeType_ReturnTypeFromDifferentProjectContent_CodeTypeLocationIsExternal() { helper.CreateReturnType("System.String"); AddUnderlyingClassToReturnType("System.String"); ReturnTypeUsesDifferentProjectContent(); CreateCodeTypeRef2(); CodeClass2 codeClass = typeRef.CodeType as CodeClass2; vsCMInfoLocation location = codeClass.InfoLocation; Assert.AreEqual(vsCMInfoLocation.vsCMInfoLocationExternal, location); }
public CodeDomCodeElement(T codeElement) { this._children = codeElement.Children; this._collection = codeElement.Collection; this._dte = codeElement.DTE; this._endPoint = codeElement.EndPoint; this._fullName = codeElement.FullName; this._infoLocation = codeElement.InfoLocation; this._isCodeType = codeElement.IsCodeType; this._kind = codeElement.Kind; this._language = codeElement.Language; this._name = codeElement.Name; this._projectItem = codeElement.ProjectItem; this._startPoint = codeElement.StartPoint; this._codeElement = codeElement; }
public void Type_PropertyTypeExistsInProject_TypeRefTypeInfoLocationIsProject() { helper.CreatePublicProperty("MyProperty"); helper.SetPropertyReturnType("MyType"); helper.CreateProjectForProjectContent(); var classHelper = new ClassHelper(); classHelper.CreateClass("MyType"); classHelper.SetProjectForProjectContent(helper.Project); helper.ReturnTypeHelper.AddUnderlyingClass(classHelper.Class); CreateCodeProperty2(); CodeTypeRef typeRef = property.Type; vsCMInfoLocation location = typeRef.CodeType.InfoLocation; Assert.AreEqual(vsCMInfoLocation.vsCMInfoLocationProject, location); }
public void Type_PropertyTypeIsSystemString_TypeRefTypeInfoLocationIsExternal() { helper.CreatePublicProperty("MyProperty"); helper.SetPropertyReturnType("System.String"); helper.CreateProjectForProjectContent(); var classHelper = new ClassHelper(); classHelper.CreateClass("System.String"); classHelper.SetProjectForProjectContent(null); helper.ReturnTypeHelper.AddUnderlyingClass(classHelper.Class); CreateCodeProperty2(); CodeTypeRef typeRef = property.Type; vsCMInfoLocation location = typeRef.CodeType.InfoLocation; Assert.AreEqual(vsCMInfoLocation.vsCMInfoLocationExternal, location); }
private static string GetSummary(vsCMInfoLocation location, string xmlComment, string inlineComment, string fullName) { if (location != vsCMInfoLocation.vsCMInfoLocationProject || (string.IsNullOrWhiteSpace(xmlComment) && string.IsNullOrWhiteSpace(inlineComment))) return null; try { string summary = XElement.Parse(xmlComment) .Descendants("summary") .Select(x => x.Value) .FirstOrDefault(); if (!string.IsNullOrEmpty(summary)) return summary.Trim(); if (!string.IsNullOrWhiteSpace(inlineComment)) return inlineComment.Trim(); return null; } catch (Exception ex) { Logger.Log("Couldn't parse XML Doc Comment for " + fullName + ":\n" + ex); return null; } }