public SecuritySyntaxWalker(RoslynSettings roslynSettings, SemanticModel model)
        {
            this._roslynSettings = roslynSettings;
            this._model          = model;

            _namespaceToCheck = _roslynSettings.prohibitedNamespace;
            _typeToCheck      = _roslynSettings.prohibitedType;
            _memberToCheck    = _roslynSettings.prohibitedMember;
        }
示例#2
0
        /// <summary>
        /// Create an AppDomain and get settings for the compiler.
        /// </summary>
        /// <param name="appDomainName">Name of the created AppDomain.</param>
        private void InitCompiler(string appDomainName)
        {
            //_scriptDomain = AppDomain.CreateDomain(appDomainName);
            _compilerIndex++;
            _scriptDomainName = appDomainName;

            _roslynSettings     = Resources.Load <ScriptableObject>("ScriptableObject/RoslynSettings") as RoslynSettings;
            _compilationOptions = new CSharpCompilationOptions(outputKind: OutputKind.DynamicallyLinkedLibrary).WithOptimizationLevel(_roslynSettings.optimizationLevel).WithAllowUnsafe(_roslynSettings.allowUnsafeCode).WithConcurrentBuild(_roslynSettings.allowConcurrentCompile);

            if (_roslynSettings != null)
            {
                Debug.Log("#Compiler# Roslyn Settings found !");
            }
            else
            {
                Debug.LogError("#Compiler# Roslyn Settings not found !");
            }
        }