Exemplo n.º 1
0
        public CsprojFile ParseFileContent(string filePath)
        {
            string        fileContent      = Utils.ReadFileContent(filePath);
            CsprojFile    re               = null;
            List <String> projectTypeGuids = FindProjectTypeGuids(fileContent);

            if (projectTypeGuids != null && projectTypeGuids.Contains(CsprojFile.WPF_PROJECT_TYPE_GUID))
            {
                re = new CsprojWpfFile(filePath);
                ((CsprojWpfFile)re).ProjectTypeGuids = projectTypeGuids;
                //ParseFileContentWpf((CsprojWpfFile)re, fileContent);
            }
            else
            {
                re = new CsprojWfaFile(filePath);
                //ParseFileContentWfa((CsprojWfaFile)re, fileContent);
            }
            return(re);
        }
Exemplo n.º 2
0
        public void ParseFileContentWfa(CsprojWfaFile csProjWfaFile, string fileContent)
        {
            List <FormWfa> listForms = new List <FormWfa>();
            string         regex     = "<Compile\\s+Include\\s*=\\s*\"(.+)?\">\\s*\n+" +
                                       "\\s*<SubType>\\s*Form\\s*</SubType>\\s*";

            foreach (Match match in Regex.Matches(fileContent, regex))
            {
                int    s            = match.Groups.Count;
                string formRelative = match.Groups[s - 1].Value;
                logger.Debug("formRelative: " + formRelative);
                //string formStr = formRelative.Contains("\\") ?
                //formRelative.Substring(formRelative.LastIndexOf("\\") + 1) : formRelative;
                if (csProjWfaFile.ListCsFilesScreen == null)
                {
                    csProjWfaFile.ListCsFilesScreen = new List <string>();
                }
                csProjWfaFile.ListCsFilesScreen.Add(
                    Path.Combine(new FileInfo(csProjWfaFile.Path).Directory.FullName, formRelative));
            }
        }