Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 5
0
 public DomainOperator()
 {
     _operator = new OopOperator();
 }
Ejemplo n.º 6
0
 public DomainOperator()
 {
     _operator = new OopOperator();
     Complier  = new AssemblyComplier();
 }