Example #1
0
        /// <summary>
        /// 创建一个枚举Operator,命名空间默认是程序集命
        /// </summary>
        /// <param name="name">枚举名</param>
        /// <returns></returns>
        public OopOperator CreateEnum(string name = default)
        {
            var @operator = new OopOperator().OopName(name).Namespace(Options.Name).ChangeToEnum();

            _builderCache.Add(@operator);
            return(@operator);
        }
Example #2
0
        public Type GetType(string code, string typeName = default)
        {
            OopOperator oopOperator = OopOperator.Create(Complier, OptionAction);
            string      result      = oopOperator
                                      .GetUsingBuilder()
                                      .Append(code).ToString();

            oopOperator.Complier.SyntaxInfos.Add(result, oopOperator.Usings);

            var text = result;

            if (typeName == default)
            {
                typeName = ScriptHelper.GetClassName(text);
                if (typeName == default)
                {
                    typeName = ScriptHelper.GetInterfaceName(text);
                    if (typeName == default)
                    {
                        typeName = ScriptHelper.GetStructName(text);
                        if (typeName == default)
                        {
                            typeName = ScriptHelper.GetEnumName(text);
                        }
                    }
                }
            }

            return(oopOperator.Complier.GetType(typeName));
        }
Example #3
0
        /// <summary>
        /// 创建一个结构体Operator,命名空间默认是程序集命
        /// </summary>
        /// <param name="name">结构体名</param>
        /// <returns></returns>
        public OopOperator CreateStruct(string name = default)
        {
            var @operator = new OopOperator().OopName(name).Namespace(Options.AssemblyName).ChangeToStruct();

            _builderCache.Add(@operator);
            return(@operator);
        }
Example #4
0
        public static (CompilationException Exception, Type Type) Create(Action <OopOperator> action, int classIndex = 1, int namespaceIndex = 1)
        {
            OopOperator builder = new OopOperator();

            builder.Public.ChangeToStruct();
            action(builder);
            var result = builder.GetType(classIndex, namespaceIndex);

            return(builder.Complier.ComplieException, result);
        }
Example #5
0
 public DomainOperator()
 {
     _operator = new OopOperator();
 }
Example #6
0
 public DomainOperator()
 {
     _operator = new OopOperator();
     Complier  = new AssemblyComplier();
 }