public static bool IsExluded(this BaseTypeDeclarationSyntax syntaxItem) { if (syntaxItem == null) { return(true); } if (Pocoyo.IsExcludedType(syntaxItem.Identifier.Text)) { return(true); } return(syntaxItem.AttributeLists.IsExluded()); }
public static string ToTypescript(this QualifiedNameSyntax syntaxItem) { // check for Generic List // TODO: Other known types? if (syntaxItem.ToFullType().StartsWith("System.Collections.Generic.List<")) { return(syntaxItem.Right.ToTypescript()); } var fullType = Pocoyo.MapKnownType(syntaxItem.ToFullType()); if (!string.IsNullOrEmpty(fullType)) { return(fullType); } // Can't get full type so return any return("any"); }
/// <summary> /// Process compulation unit to output file /// </summary> public static bool Process(string inputFile, string outputFile, bool discoverTypes) { var textCode = SharedFile.ReadAllText(inputFile); if (string.IsNullOrEmpty(textCode)) { Log.Error($"empty c# input file: {inputFile}"); return(false); } var tree = CSharpSyntaxTree.ParseText(textCode); var root = (CompilationUnitSyntax)tree.GetRoot(); var info = new Pocoyo { DiscoverTypes = discoverTypes, OutputFile = outputFile, }; if (Log.VerbosMode) { info.AddLine($@"/* ========================================== {inputFile} ========================================== */ "); } info.Process(root.Members); if (Log.VerbosMode) { info.AddLine($@"/* ========================================== ========================================== */ "); } return(true); }
/// <summary> /// Pre-process compulation unit to output file /// </summary> public static bool PreProcess(string inputFile) { var textCode = SharedFile.ReadAllText(inputFile); if (string.IsNullOrEmpty(textCode)) { Log.Error($"empty c# input file: {inputFile}"); return(false); } var tree = CSharpSyntaxTree.ParseText(textCode); var root = (CompilationUnitSyntax)tree.GetRoot(); var info = new Pocoyo { PreprocessMode = true, DiscoverTypes = true, Silent = !Debugger.IsAttached, }; info.Process(root.Members); return(true); }
public static bool IsExcluded(this GenericNameSyntax syntaxItem) { return(Pocoyo.IsExcludedType(syntaxItem.Identifier.Text)); }
public static bool IsExcluded(this BaseTypeDeclarationSyntax syntaxItem) { return(Pocoyo.IsExcludedType(syntaxItem.Identifier.Text)); }
public static bool IsSpecifiedKnownType(this GenericNameSyntax syntaxItem) { return(Pocoyo.IsSpecifiedKnownType(syntaxItem.Identifier.Text)); }
public static bool IsSpecifiedKnownType(this BaseTypeDeclarationSyntax syntaxItem) { return(Pocoyo.IsSpecifiedKnownType(syntaxItem.Identifier.Text)); }
public static bool IsKnownType(this IdentifierNameSyntax syntaxItem) { return(Pocoyo.IsKnownType(syntaxItem.Identifier.Text)); }
public static void Process(CompilationUnitSyntax compilationUnit) { var info = new Pocoyo(); info.Process(compilationUnit.Members); }