Пример #1
0
        private void GetReferences(Roles role, Regex r, ref List <ProjectFile> ref_list, bool allow_duplicates = false,
                                   string[] ignore = null, string[] allow = null, string defaultExt = null)
        {
            var input = !Role.HasFlag(Roles.Description) ? new ScnSyntax.Comment().Replace(Text, "") : Text;

            foreach (Match m in r.Matches(input))
            {
                if (ignore != null && ignore.Contains(m.Value))
                {
                    continue;
                }
                char[] delim = { ' ', '\t', ';', '\r', '\n' };
                var    list  = m.Value.Split(delim, 2);
                string file  = list[0];

                var path = ((role == Roles.Description ? BaseDirectory : SceneryDirectory) + "\\" + file).Replace('/', '\\');
                var ext  = System.IO.Path.GetExtension(file);
                if (defaultExt != null && ext == "")
                {
                    ext = defaultExt; path += ext;
                }
                if (!FilesWithoutEvents.Contains(path) && !FilesWithoutMemCells.Contains(path) && System.IO.File.Exists(path))
                {
                    if (allow != null && !allow.Contains(ext))
                    {
                        continue;
                    }
                    if (!ref_list.Any(p => p.Path == path) || allow_duplicates)
                    {
                        log.Debug("New reference: {0}", path);
                        var reference = new ProjectFile(path, role, list.Length == 2 ? list[1] : "");
                        ref_list.Add(reference);
                        reference.GetMemCells();
                        reference.GetEvents();
                        //reference.GetReferences(role,r,ref ref_list,allow_duplicates,ignore,allow,defaultExt);
                    }
                }
            }
        }