/// <summary> /// private void Open_All_Windows() { /// if (!System.IO.File.ReadAllText("temp_file_HHmmss.txt").Contains("AnotherWindow")) /// new AnotherWindow().Show(); /// .... /// } /// </summary> /// <param name="listWindows"></param> /// <param name="current"></param> /// <returns></returns> public MemberDeclarationSyntax MethodDeclare(List <CsClass> listWindows, CsClass current) { string methodEpx = "private void " + CsFileModifier.METHOD_NAME + "()" + NEW_LINE + "{"; foreach (CsClass screen in listWindows) { methodEpx += NEW_LINE + "if (!System.IO.File.ReadAllText(\"" + tempFileName + "\").Contains(\"" + screen.Name + "\"))" + NEW_LINE + "new " + screen.Name + "().Show();"; } methodEpx += NEW_LINE + "}"; SyntaxTree tree = CSharpSyntaxTree.ParseText(methodEpx); return(((CompilationUnitSyntax)tree.GetRoot()).Members[0]); }
public override void VisitClassDeclaration(ClassDeclarationSyntax node) { string name = node.Identifier.ValueText; CsClass csClass = new CsClass(); csClass.Name = name; if (node.BaseList != null && node.BaseList.Types != null) { foreach (BaseTypeSyntax baseType in node.BaseList.Types) { string baseTypeStr = baseType.Type.ToString(); //logger.Debug("-----Base type: " + baseTypeStr); if (csClass.BaseOnClass == null) { csClass.BaseOnClass = new List <string>(); } csClass.BaseOnClass.Add(baseTypeStr); } } classes.Add(csClass); }