• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Design.MethodDef类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Behaviac.Design.MethodDef的典型用法代码示例。如果您正苦于以下问题:C# MethodDef类的具体用法?C# MethodDef怎么用?C# MethodDef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MethodDef类属于Behaviac.Design命名空间,在下文中一共展示了MethodDef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GenerateCode

        public static string GenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
        {
            if (property.IsPar || property.IsCustomized)
                return ParInfoCsExporter.GenerateCode(property, isRefParam, stream, indent, typename, var, caller);

            string agentName = GetGenerateAgentName(property, var, caller);
            string prop = GetProperty(property, arrayIndexElement, stream, indent, var, caller);

            if (!property.IsReadonly)
            {
                if (setValue == null)
                {
                    if (!string.IsNullOrEmpty(var))
                    {
                        if (string.IsNullOrEmpty(typename))
                        {
                            stream.WriteLine("{0}{1} = {2};", indent, var, prop);
                        }
                        else
                        {
                            string nativeType = DataCsExporter.GetPropertyNativeType(property, arrayIndexElement);

                            stream.WriteLine("{0}{1} {2} = {3};", indent, nativeType, var, prop);
                        }
                    }
                }
                else
                {
                    string propBasicName = property.BasicName.Replace("[]", "");
                    stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, propBasicName, setValue);
                }
            }

            return prop;
        }
开发者ID:pjkui,项目名称:behaviac,代码行数:35,代码来源:PropertyCsExporter.cs


示例2: MetaMethodDialog

        public MetaMethodDialog(AgentType agent, MethodDef method, MemberType memberType)
        {
            InitializeComponent();

            this.Owner = MainWindow.Instance;

            this.metaMethodPanel.Initialize(true, agent, method, memberType);
        }
开发者ID:675492062,项目名称:behaviac,代码行数:8,代码来源:MetaMethodDialog.cs


示例3: ResetMembers

        public override bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null)
        {
            bool bReset = false;

            if (this._frames != null)
            {
                bReset |= this._frames.ResetMembers(check, agentType, clear, method, property);
            }

            bReset |= base.ResetMembers(check, agentType, clear, method, property);

            return bReset;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:13,代码来源:WaitFramesState.cs


示例4: GetProperty

        public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string var, string caller)
        {
            string agentName = GetGenerateAgentName(property, var, caller);

            if (property.Owner != Behaviac.Design.VariableDef.kSelf)
            {
                string instanceName = property.Owner.Replace("::", ".");

                stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Utils.GetParentAgent(pAgent, \"{2}\");", indent, agentName, instanceName);
                stream.WriteLine("{0}Debug.Check({1} != null || Utils.IsStaticClass(\"{2}\"));", indent, agentName, instanceName);
            }

            string prop = getProperty(property, arrayIndexElement, agentName, stream, indent);

            return prop;
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:16,代码来源:PropertyCsExporter.cs


示例5: PostGenerateCode

        public static void PostGenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null)
        {
            if (property.IsPar || property.IsCustomized)
            {
                ParInfoCsExporter.PostGenerateCode(property, arrayIndexElement, stream, indent, typename, var, caller);
                return;
            }

            if (!property.IsReadonly)
            {
                string agentName = GetGenerateAgentName(property, var, caller);
                string prop = setValue;

                if (property.Owner != Behaviac.Design.VariableDef.kSelf)
                {
                    stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Agent.GetInstance(\"{2}\", pAgent.GetContextId());", indent, agentName, property.Owner.Replace("::", "."));
                    stream.WriteLine("{0}Debug.Check({1} != null);", indent, agentName);
                }

                string propBasicName = property.BasicName.Replace("[]", "");

                if (setValue != null)
                {
                    stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, propBasicName, prop);
                }
                else
                {
                    prop = getProperty(property, arrayIndexElement, agentName, stream, indent);
                }

                uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName);
                stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id);

                if (string.IsNullOrEmpty(typename))
                {
                    typename = property.NativeType;
                }
                typename = DataCsExporter.GetGeneratedNativeType(typename);

                stream.WriteLine("{0}{1}.SetVariable<{2}>(\"{3}\", {4}, {5}u);", indent, agentName, typename, property.BasicName, prop, id);

            }
        }
开发者ID:pjkui,项目名称:behaviac,代码行数:43,代码来源:PropertyCsExporter.cs


示例6: GenerateCode

        public static string GenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller)
        {
            if (property.IsPar || property.IsCustomized)
                return ParInfoCppExporter.GenerateCode(property, isRefParam, stream, indent, typename, var, caller);

            string prop = GetProperty(property, arrayIndexElement, stream, indent, var, caller);

            if (!string.IsNullOrEmpty(var))
            {
                if (string.IsNullOrEmpty(typename))
                {
                    stream.WriteLine("{0}{1} = {2};", indent, var, prop);
                }
                else
                {
                    stream.WriteLine("{0}{1} {2} = {3};", indent, DataCppExporter.GetGeneratedNativeType(property.NativeType), var, prop);
                }
            }

            return prop;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:21,代码来源:PropertyCppExporter.cs


示例7: LoadCustomMembers


//.........这里部分代码省略.........
                                    if (string.IsNullOrEmpty(classname))
                                    { classname = agent.AgentTypeName; }

                                    string propDisp = GetAttribute(propNode, "disp");

                                    if (string.IsNullOrEmpty(propDisp))
                                    { propDisp = propName; }

                                    string propDesc = GetAttribute(propNode, "desc");

                                    PropertyDef prop = new PropertyDef(agent, type, classname, propName, propDisp, propDesc);
                                    prop.IsStatic = bStatic;
                                    prop.IsPublic = bPublic;
                                    prop.IsReadonly = bReadonly;

                                    string defaultValue = GetAttribute(propNode, "defaultvalue");

                                    if (!string.IsNullOrEmpty(defaultValue)) {
                                        prop.Variable = new VariableDef(null);
                                        Plugin.InvokeTypeParser(result, type, defaultValue, (object value) => prop.Variable.Value = value, null);
                                    }

                                    agent.AddProperty(prop);
                                }
                            }

                        } else if (bbNode.Name == "methods") {
                            foreach(XmlNode methodNode in bbNode) {
                                if (methodNode.Name == "method") {
                                    string methodName = GetAttribute(methodNode, "name");
                                    Type returnType = Plugin.GetTypeFromName(GetAttribute(methodNode, "returntype"));

                                    string isStatic = GetAttribute(methodNode, "static");
                                    bool bStatic = false;

                                    if (!string.IsNullOrEmpty(isStatic) && isStatic == "true")
                                    { bStatic = true; }

                                    string isPublic = GetAttribute(methodNode, "public");
                                    bool bPublic = false;

                                    if (string.IsNullOrEmpty(isPublic) || isPublic == "true")
                                    { bPublic = true; }

                                    string classname = GetAttribute(methodNode, "classname");

                                    if (string.IsNullOrEmpty(classname))
                                    { classname = agent.AgentTypeName; }

                                    string methodDisp = GetAttribute(methodNode, "disp");

                                    if (string.IsNullOrEmpty(methodDisp))
                                    { methodDisp = methodName; }

                                    string methodDesc = GetAttribute(methodNode, "desc");

                                    bool istask = (GetAttribute(methodNode, "istask") == "true");
                                    //bool isevent = (GetAttribute(methodNode, "isevent") == "true");

                                    MemberType memberType = MemberType.Method;

                                    if (istask) {
                                        memberType = MemberType.Task;
                                    }

                                    methodName = string.Format("{0}::{1}", agent.AgentTypeName, methodName);

                                    MethodDef method = new MethodDef(agent, memberType, classname, methodName, methodDisp, methodDesc, "", returnType);
                                    method.IsStatic = bStatic;
                                    method.IsPublic = bPublic;

                                    agent.AddMethod(method);

                                    foreach(XmlNode paramNode in methodNode) {
                                        string paramName = GetAttribute(paramNode, "name");
                                        Type paramType = Plugin.GetTypeFromName(GetAttribute(paramNode, "type"));
                                        bool isOut = (GetAttribute(paramNode, "isout") == "true");
                                        bool isRef = (GetAttribute(paramNode, "isref") == "true");
                                        string nativeType = Plugin.GetNativeTypeName(paramType);

                                        string paramDisp = GetAttribute(paramNode, "disp");

                                        if (string.IsNullOrEmpty(paramDisp))
                                        { paramDisp = paramName; }

                                        string paramDesc = GetAttribute(paramNode, "desc");

                                        MethodDef.Param param = new MethodDef.Param(paramName, paramType, nativeType, paramDisp, paramDesc);
                                        param.IsOut = isOut;
                                        param.IsRef = isRef;

                                        method.Params.Add(param);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:pjkui,项目名称:behaviac,代码行数:101,代码来源:Workspace.cs


示例8: getPrefixString

        private string getPrefixString(MethodDef m)
        {
            if (m != null)
            {
                if (m.IsChangeableType)
                    return (m.ReturnType == typeof(object)) ? Empty_Type_Str : Changeable_Type_Str;

                if (m.IsCustomized)
                    return Customized_Str;
            }

            return Member_Str;
        }
开发者ID:yecaokinux,项目名称:behaviac,代码行数:13,代码来源:MetaStoreDock.cs


示例9: GetProperty

        public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent)
        {
            string retStr = string.Empty;
            if (property != null)
            {
                string typename = DataCppExporter.GetGeneratedNativeType(property.NativeType);
                if (!typename.EndsWith("*") && Plugin.IsRefType(property.Type))
                {
                    typename += "*";
                }

                if (property.IsArrayElement && !typename.StartsWith("behaviac::vector<"))
                {
                    typename = string.Format("behaviac::vector<{0} >", typename);
                }

                string propBasicName = property.BasicName.Replace("[]", "");
                uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName);

                stream.WriteLine("{0}BEHAVIAC_ASSERT(behaviac::MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id);
                retStr = string.Format("({0}&)pAgent->GetVariable<{0} >({1}u)", typename, id);
            }

            return retStr;
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:25,代码来源:ParInfoCppExporter.cs


示例10: GetProperty

        public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent)
        {
            string retStr = string.Empty;
            if (property != null)
            {
                string typename = DataCsExporter.GetGeneratedNativeType(property.NativeType);
                if (property.IsArrayElement && !typename.StartsWith("List<"))
                {
                    typename = string.Format("List<{0}>", typename);
                }

                string propBasicName = property.BasicName.Replace("[]", "");
                uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName);
                //stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id);

                retStr = string.Format("({0})pAgent.GetVariable({1}u)", typename, id);
            }

            return retStr;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:20,代码来源:ParInfoCsExporter.cs


示例11: checkMembersInWorkspace

        private bool checkMembersInWorkspace(AgentType agentType, bool clear, MethodDef method, PropertyDef property)
        {
            foreach(Nodes.BehaviorNode behavior in getAllBehaviors(property)) {
                if (behavior != null && behavior is Nodes.Node) {
                    bool bReset = ((Nodes.Node)behavior).ResetMembers(true, agentType, clear, method, property);
                    if (bReset)
                        return DialogResult.Yes == MessageBox.Show(Resources.ModifyMemberWarning, Resources.Warning, MessageBoxButtons.YesNo);
                }
            }

            return true;
        }
开发者ID:yecaokinux,项目名称:behaviac,代码行数:12,代码来源:MetaStoreDock.cs


示例12: ResetMembers

        public bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method, PropertyDef property)
        {
            bool bReset = false;

            if (method != null)
            {
                if (method.OldName == this.Name)
                {
                    bReset = true;

                    if (!check)
                    {
                        this.CopyFrom(method);
                    }
                }

            }
            else if (property != null)
            {
                foreach (MethodDef.Param param in this.Params)
                {
                    if (param.Value is VariableDef)
                    {
                        VariableDef var = param.Value as VariableDef;
                        bReset |= var.ResetMembers(check, agentType, clear, property);

                    }
                    else if (param.Value is ParInfo)
                    {
                        ParInfo par = param.Value as ParInfo;

                        if (property.IsPar && (property.OldName == par.Name ||
                        !property.IsArrayElement && par.IsArrayElement && (property.OldName + "[]") == par.Name))
                        {
                            if (clear || this.ShouldBeCleared(agentType))
                            {
                                bReset = true;

                                if (!check)
                                { param.Value = Plugin.DefaultValue(param.Type); }

                            }
                            else
                            {
                                bReset = true;

                                if (!check)
                                {
                                    bool isArrayElement = par.IsArrayElement;

                                    par.CopyFrom(property);

                                    if (isArrayElement)
                                    { par.SetArrayElement(property); }
                                }
                            }
                        }
                    }
                }
            }

            return bReset;
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:63,代码来源:DataType.cs


示例13: GetProperty

        public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string var, string caller)
        {
            string agentName = GetGenerateAgentName(property, var, caller);

            if (property.Owner != Behaviac.Design.VariableDef.kSelf)
            {
                stream.WriteLine("{0}Agent* {1} = Agent::GetInstance(pAgent, \"{2}\");", indent, agentName, property.Owner);
                stream.WriteLine("{0}BEHAVIAC_ASSERT({1});", indent, agentName);
            }

            string prop = getProperty(property, arrayIndexElement, agentName, stream, indent);

            return prop;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:14,代码来源:PropertyCppExporter.cs


示例14: MethodDef

 public MethodDef(MethodDef other)
 {
     CopyFrom(other);
 }
开发者ID:Just4F,项目名称:behaviac,代码行数:4,代码来源:DataType.cs


示例15: GetPropertyBasicName

        public static string GetPropertyBasicName(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement)
        {
            string propName = property.BasicName;

            if (property != null && property.IsArrayElement && arrayIndexElement != null)
            {
                propName = propName.Replace("[]", "");
            }

            return propName;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:11,代码来源:DataCppExporter.cs


示例16: GetPropertyNativeType

        public static string GetPropertyNativeType(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement)
        {
            string nativeType = DataCppExporter.GetGeneratedNativeType(property.NativeType);

            return nativeType;
        }
开发者ID:675492062,项目名称:behaviac,代码行数:6,代码来源:DataCppExporter.cs


示例17: ResetMembers

        public override bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null) {
            bool bReset = false;

            if (this.Opl != null) {
                bReset |= this.Opl.ResetMembers(check, agentType, clear, method, property);
            }

            if (this.Opr1 != null) {
                bReset |= this.Opr1.ResetMembers(check, agentType, clear, method, property);
            }

            if (this.Opr2 != null) {
                bReset |= this.Opr2.ResetMembers(check, agentType, clear, method, property);
            }

            bReset |= base.ResetMembers(check, agentType, clear, method, property);

            if (!check && bReset) {
                OnPropertyValueChanged(false);
            }

            return bReset;
        }
开发者ID:Just4F,项目名称:behaviac,代码行数:23,代码来源:AttachAction.cs


示例18: isNullMethod

 private bool isNullMethod(MethodDef method)
 {
     return (method != null && method.BasicName == "null_method");
 }
开发者ID:675492062,项目名称:behaviac,代码行数:4,代码来源:ActionCsExporter.cs


示例19: PostGenerateCode

        public static void PostGenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string typename, string var, string caller)
        {
            if (string.IsNullOrEmpty(typename))
            {
                typename = property.NativeType;
            }
            typename = DataCsExporter.GetGeneratedNativeType(typename);

            string propBasicName = property.BasicName.Replace("[]", "");
            uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName);

            stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id);
            stream.WriteLine("{0}pAgent.SetVariable<{1}>(\"{2}\", ({1}){3}, {4}u);", indent, typename, property.Name, var, id);
        }
开发者ID:675492062,项目名称:behaviac,代码行数:14,代码来源:ParInfoCsExporter.cs


示例20: createParamEditor

        void createParamEditor(MethodDef method, bool enable)
        {
            List<MethodDef.Param> parameters = method.Params;
            foreach (MethodDef.Param p in parameters)
            {
                Type editorType = typeof(DesignerParameterComboEnumEditor);
                string arugmentsName = "    " + p.DisplayName;
                Label label = propertyGrid.AddProperty(arugmentsName, editorType, p.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly));

                label.MouseEnter += new EventHandler(label_MouseEnter);

                DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag;
                editor.Enabled = enable;
                editor.SetParameter(p, _selectedObject);
                editor.ValueWasAssigned();
                editor.MouseEnter += editor_MouseEnter;
                editor.DescriptionWasChanged += editor_DescriptionWasChanged;
                editor.ValueWasChanged += editor_ValueWasChanged;
            }
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:20,代码来源:PropertiesDock.cs



注:本文中的Behaviac.Design.MethodDef类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Design.NodeViewData类代码示例发布时间:2022-05-24
下一篇:
C# Design.AgentType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap