public static Saved_MethodStream createMethodStream(this Saved_MethodStream savedMethodStream, O2MappedAstData astData, IMethod iMethod) { savedMethodStream.o2MethodStream = astData.createO2MethodStream(iMethod); savedMethodStream.MethodStream = savedMethodStream.o2MethodStream.csharpCode(); var fileCachePath = "_methodStreams".tempDir(false).pathCombine_MaxSize(savedMethodStream.RootMethod.Signature.safeFileName() + ".cs"); savedMethodStream.MethodStream_FileCache = savedMethodStream.MethodStream.saveAs(fileCachePath); return(savedMethodStream); }
public static string createO2MethodStreamFile(this O2MappedAstData o2MappedAstData, IMethod iMethod, string targetFolder) { var targetFile = targetFolder.pathCombine(iMethod.DotNetName + ".cs"); if (targetFile.fileExists()) { "in O2MappedAstData.createO2MethodStreamFile, target method stream already exists: {0}".debug(iMethod.DotNetName); } else { o2MappedAstData.createO2MethodStream(iMethod).csharpFile(targetFile); } return(targetFile); }
public static string createO2MethodStream_UseCache_ReturnFile(this O2MappedAstData o2MappedAstData, IMethod iMethod, FileCache fileCache, string cacheExtension) { if (iMethod.isNull()) { return(null); } var csharpCodeFile = fileCache.cacheGet_File(iMethod.fullName(), cacheExtension); if (csharpCodeFile.valid().isFalse()) { "Creating MethodStream for iMethod: {0}".debug(iMethod.DotNetName); var methodStream = o2MappedAstData.createO2MethodStream(iMethod); var cSharpCode = methodStream.csharpCode(); csharpCodeFile = cSharpCode.saveWithExtension(cacheExtension); return(fileCache.cachePut(iMethod.fullName(), ".cs", cSharpCode)); } return(csharpCodeFile); }
public static Dictionary <IMethod, string> showMethodStreams(this O2MappedAstData astData, List <IMethod> iMethods, TreeView treeView, ProgressBar progressBar) { treeView.Tag = iMethods; progressBar.maximum(iMethods.size()); progressBar.value(0); var methodStreams = new Dictionary <IMethod, string>(); foreach (var iMethod in iMethods) { var methodStreamCSharpCode = astData.createO2MethodStream(iMethod).csharpCode(); methodStreams.Add(iMethod, methodStreamCSharpCode); var nodeText = "{0} ({1} chars)".format(iMethod.name(), methodStreamCSharpCode.size()); treeView.add_Node(nodeText, methodStreamCSharpCode); progressBar.increment(1); } treeView.selectFirst(); return(methodStreams); }
public static O2MethodStream createO2MethodStream(this O2MappedAstData o2MappedAstData, IMethod iMethod) { return(o2MappedAstData.createO2MethodStream(iMethod, true)); }