Пример #1
0
        public StringBuilder GetUsingBuilder()
        {
            Using(UsingRecoder.Types);
            if (AssemblyBuilder.CustomUsingShut)
            {
                UsingScript.Clear();
                foreach (var @using in _usings)
                {
                    UsingScript.AppendLine($"using {@using};");
                }
            }
            else
            {
                Using(AssemblyBuilder.Compiler.Domain.GetPluginAssemblies());
                foreach (var @using in _usings)
                {
                    if (!GlobalUsing.HasElement(@using))
                    {
                        UsingScript.AppendLine($"using {@using};");
                    }
                }
            }


            return(UsingScript);
        }
Пример #2
0
        public StringBuilder GetUsingBuilder()
        {
            Using(UsingRecoder.Types);
            //如果用户想使用自定义的Using
            if (AssemblyBuilder.CustomUsingShut)
            {
                UsingScript = new StringBuilder();
                foreach (var @using in _usings)
                {
                    UsingScript.AppendLine($"using {@using};");
                }
            }
            else
            {
                //使用全局Using
                UsingScript.Append(GlobalUsing.DefaultScript);

                //把当前域中的using全部加上
                Using(AssemblyBuilder.Compiler.Domain.GetPluginAssemblies());
                foreach (var @using in _usings)
                {
                    //如果全局已经存在using了,就不加了
                    if (!GlobalUsing.HasElement(@using))
                    {
                        UsingScript.AppendLine($"using {@using};");
                    }
                }
            }


            return(UsingScript);
        }