Exemple #1
0
        //把TypeName保存一下: 格式..文档名{文件名...;文件名2....}
        public void SaveTypeList(string fn)
        {
            FileStream fp = new FileStream(fn, FileMode.Create);

            if (fp != null)
            {
                StringBuilder sb = new StringBuilder();
                StreamWriter  sw = new StreamWriter(fp);
                //逐个处理...
                for (int i = 0; i < doctypelist.Count; ++i)
                {
                    DocTypeList_t doctype = doctypelist[i];
                    sb.Clear();

                    sb.AppendLine(doctype.Name + ";" + doctype.FilePath);
                    for (int j = 0; j < doctype.typelist.Count; ++j)
                    {
                        TypeDeclaration_t tdt = doctype.typelist[j];
                        SaveTypeDeclaration(sb, tdt, "\t");
                    }
                    sw.WriteLine(sb.ToString());
                }

                sw.Close();
                fp.Close();
            }
        }
        //处理一个文档:
        static async Task handleDocument(Document document, DocTypeList_t dtl)
        {
            SyntaxTree tree = await document.GetSyntaxTreeAsync();

            CompilationUnitSyntax syntax = tree.GetCompilationUnitRoot();

            ClassDeclarationVisitor visitor = new ClassDeclarationVisitor(dtl);
            SyntaxNode node = visitor.Visit(syntax);
        }
Exemple #3
0
 public override bool preCheck(Document document)
 {
     if (document.FilePath != docName)
     {
         return(false);
     }
     m_dtl = new DocTypeList_t(document);
     //solu.doctypelist.Add(dtl);
     return(true);
 }
        //替换SolutionTypeMember
        public static async Task replaceAllSolutionTypeMemberID(CRenameTokenHandler rhandle, bool useInclude)
        {
            int limit = 0;

            CCLog.Info(string.Format("=== replaceAllSolutionTypeMemberID Count: {0} ", rhandle.m_solu.doctypelist.Count));

            int    StartSign = 0;
            string StartDoc  = "ACTAnimConfig.cs";
            string StartType = "ACTAnimConfig";

            int types = 0;

            rhandle.pass_cmd = 1;
            for (int i = 0; i < rhandle.m_solu.doctypelist.Count; ++i)
            {
                DocTypeList_t dtt = rhandle.m_solu.doctypelist[i];
                if (StartSign == 1 && StartDoc != dtt.Name)
                {
                    continue;
                }
                for (int j = 0; j < dtt.typelist.Count; ++j)
                {
                    TypeDeclaration_t tdt = dtt.typelist[j];
                    //判断开始类型..
                    if (StartSign == 1 && StartType != tdt.Identifier)
                    {
                        continue;
                    }
                    StartSign = 0;

                    //CCLog.Debug(string.Format("=== replaceAllSolutionTypeMemberID Type: {0}/{1} ;Doc {2}/{3};{4}/{5}", j, dtt.typelist.Count,i, rhandle.m_solu.doctypelist.Count, tdt.Identifier, dtt.Name));

                    await replaceTypeMemberID(rhandle, dtt.FilePath, tdt, useInclude);

                    types++;
                }
                //if((i%100) == 99)
                //    rhandle.SaveNewSolution();
                if ((i % 20) == 19)
                {
                    rhandle.CheckCompileAndCommit();
                }
            }
            rhandle.CheckCompileAndCommit();
            CCLog.Info(string.Format("=== replaceAllSolutionTypeMemberID types: {0} ;compile_fails: {1}", types, rhandle.compile_fails));
        }
Exemple #5
0
 public virtual bool preCheck(Document document)
 {
     m_dtl = new DocTypeList_t(document);
     m_solu.doctypelist.Add(m_dtl);
     return(true);
 }
Exemple #6
0
 public ClassDeclarationVisitor(DocTypeList_t list)
 {
     doc_typelist = list;
 }