Exemple #1
0
        void ProcessFile(ScriptInfo fileInfo)
        {
            FileParserComparer fileComparer = new FileParserComparer();

            FileParser importedFile = new FileParser(fileInfo.fileName, fileInfo.parseParams, false, true, this.SearchDirs, throwOnError); //do not parse it yet (the third param is false)

            if (fileParsers.BinarySearch(importedFile, fileComparer) < 0)
            {
                if (File.Exists(importedFile.fileName))
                {
                    importedFile.ProcessFile(); //parse now namespaces, ref. assemblies and scripts; also it will do namespace renaming

                    this.fileParsers.Add(importedFile);
                    this.fileParsers.Sort(fileComparer);

                    foreach (string namespaceName in importedFile.ReferencedNamespaces)
                    {
                        PushNamespace(namespaceName);
                    }

                    foreach (string asmName in importedFile.ReferencedAssemblies)
                    {
                        PushAssembly(asmName);
                    }

                    foreach (string packageName in importedFile.Packages)
                    {
                        PushPackage(packageName);
                    }

                    foreach (string file in importedFile.Precompilers)
                    {
                        PushPrecompiler(file);
                    }

                    foreach (ScriptInfo scriptFile in importedFile.ReferencedScripts)
                    {
                        ProcessFile(scriptFile);
                    }

                    foreach (string resFile in importedFile.ReferencedResources)
                    {
                        PushResource(resFile);
                    }

                    foreach (string file in importedFile.IgnoreNamespaces)
                    {
                        PushIgnoreNamespace(file);
                    }

                    List <string> dirs = new List <string>(this.SearchDirs);
                    foreach (string dir in importedFile.ExtraSearchDirs)
                    {
                        if (Path.IsPathRooted(dir))
                        {
                            dirs.Add(Path.GetFullPath(dir));
                        }
                        else
                        {
                            dirs.Add(Path.Combine(Path.GetDirectoryName(importedFile.fileName), dir));
                        }
                    }
                    this.SearchDirs = dirs.ToArray();
                }
                else
                {
                    importedFile.fileNameImported = importedFile.fileName;
                    this.fileParsers.Add(importedFile);
                    this.fileParsers.Sort(fileComparer);
                }
            }
        }
Exemple #2
0
		private void ProcessFile(ScriptInfo fileInfo)
		{
			FileParserComparer fileComparer = new FileParserComparer();
			
			FileParser importedFile = new FileParser(fileInfo.fileName, fileInfo.parseParams, false, true, this.searchDirs); //do not parse it yet (the third param is false)
			if (fileParsers.BinarySearch(importedFile, fileComparer) < 0)
			{
				importedFile.ProcessFile(); //parse now namespaces, ref. assemblies and scripts; also it will do namespace renaming

				this.fileParsers.Add(importedFile);
				this.fileParsers.Sort(fileComparer);

				foreach (string namespaceName in importedFile.ReferencedNamespaces)
					PushNamespace(namespaceName);

				foreach (string asmName in importedFile.ReferencedAssemblies)
					PushAssembly(asmName);

				foreach(ScriptInfo scriptFile in importedFile.ReferencedScripts)
					ProcessFile(scriptFile);
			}
		}