public static string ApplyPattern(string source, string patternName, string className, string setting1 = null, string setting2 = null, bool settingA = false, bool settingB = false) { var ws = CreateWorkspace(); var doc = ws.AddDocument(ws.CurrentSolution.Projects.First().Id, "myfile.cs", SourceText.From(source)); //**--compile check here //var comp = ws.CurrentSolution.Projects.First().GetCompilationAsync().Result; var patternOptions = new PatternMaker.PatternOptionsCommon() { Option1 = setting1, Option2 = setting2, OptionA = settingA, OptionB = settingB, }; var newSol = Maker.ApplyPattern(ws.CurrentSolution, patternName, className, patternOptions); var newDoc = newSol.Projects.First().Documents.First(); var newText = newDoc.GetTextAsync().Result; return(newText.ToString()); //**--unit test here //return PatternMaker.Maker.UnitTestForBlazor(ws.CurrentSolution); }
public static IEnumerable <string> GetClassList(string source) { SystemDlls = null;//**-- var ws = CreateWorkspace(); var newDoc = ws.AddDocument(ws.CurrentSolution.Projects.First().Id, "myfile.cs", SourceText.From(source)); return(Maker.GetClassList(ws)); }
public static IEnumerable <string> GetPatternList() { #if DISABLE_ROSLYN_BINARIES return(new List <string>() { "PatternTest" }); #else return(Maker.GetPatternList()); #endif }
public static IEnumerable <string> GetClassList(string source) { #if DISABLE_ROSLYN_BINARIES return(new List <string>() { "ClassTest" }); #else SystemDlls = null;//**-- var ws = CreateWorkspace(); var newDoc = ws.AddDocument(ws.CurrentSolution.Projects.First().Id, "myfile.cs", SourceText.From(source)); return(Maker.GetClassList(ws)); #endif }
public static IEnumerable <string> GetPatternList() { return(Maker.GetPatternList()); }