Esempio n. 1
0
 public ControlNodeData(Control control, XmlElement ele, string format, BindType cdata)
 {
     this._control    = control;
     this._xmlElement = ele;
     this._format     = format;
     this._type       = cdata;
 }
Esempio n. 2
0
        string GetValueFromElement(XmlElement ele, string name, BindType type)
        {
            switch (type)
            {
            case BindType.Default:
            {
                return(ele.GetAttribute(name));
            }

            case BindType.CDATA:
            {
                XmlElement eleValue = (XmlElement)ele.SelectSingleNode(string.Format("cdata[@type='{0}']", name));
                if (eleValue == null)
                {
                    return("");
                }
                else
                {
                    XmlCDataSection cdata = (XmlCDataSection)eleValue.FirstChild;
                    if (cdata == null)
                    {
                        return("");
                    }
                    else
                    {
                        return(cdata.Value);
                    }
                }
            }

            default:
                throw new ArgumentException("未知的type:" + type, "type");
            }
        }
Esempio n. 3
0
        public void BindMaterialGroups(BindType bindType)
        {
            var queryargument = new QueryArgument(UserContext.DataBaseInfo)
            {
                BindType  = bindType,
                FilterKey = bindType == BindType.Form ? SelectedGroupId : string.Empty,
                filter1   = SelectedTypeId,
                QueryType = Constants.MatGroupGroup
            };
            var hierarchy = _controlPanel.GetMaterialHierarchies(queryargument);

            if (bindType == BindType.Form)
            {
                var materialGroup = hierarchy.FirstOrDefault();
                if (materialGroup == null)
                {
                    return;
                }
                GroupClassId     = ((MaterialGroup)materialGroup).MaterialClass.Id;
                GroupTypeId      = ((MaterialGroup)materialGroup).MaterialType.Id;
                GroupId          = materialGroup.Id;
                GroupName        = materialGroup.Description;
                GroupCreatedDate = materialGroup.CreatedDate;
                //Margin = materialGroup.Margin;
            }
            else
            {
                MaterialGroupGridViewDataSource = hierarchy;
            }
        }
 public PlayerBindExecutedEventArgs(Player player, BindType bindType, KeyState keyState, string key)
 {
     this.Player   = player;
     this.BindType = bindType;
     this.KeyState = keyState;
     this.Key      = key;
 }
            public void GenerateWrap(object userData)
            {
                BindType bindType = (BindType)userData;

                if (!string.IsNullOrEmpty(bindType.baseClass))
                {
                    try
                    {
                        Type.GetType(bindType.baseClass);
                    }
                    catch
                    {
                        EditorUtility.DisplayDialog("Information", "baseClass must use AssemblyQualifiedName", "Ok");
                        return;
                    }
                }

                bindType.isBuilded = true;
                if (!wrappedCustomTypeList.Contains(bindType))
                {
                    wrappedCustomTypeList.Add(bindType);
                }
                m_instance.GenLuaFile(bindType);
                m_instance.GenDelegate();
                m_instance.GenLuaBinder();
                m_instance.Save();
                EditorUtility.DisplayDialog("Information", "GenerateWrap success!", "Ok");
                AssetDatabase.Refresh();
            }
Esempio n. 6
0
        public void BindMaterialClass(BindType bindType)
        {
            var queryargument = new QueryArgument(UserContext.DataBaseInfo)
            {
                BindType  = bindType,
                FilterKey = bindType == BindType.Form ? SelectedClassId : string.Empty,
                QueryType = Constants.MatGroupClass
            };
            var hierarchy = _controlPanel.GetMaterialHierarchies(queryargument);

            if (bindType == BindType.Form)
            {
                var materialClass = hierarchy.FirstOrDefault();
                if (materialClass == null)
                {
                    return;
                }
                ClassId          = materialClass.Id;
                ClassName        = materialClass.Description;
                ClassCreatedDate = materialClass.CreatedDate;
            }
            else
            {
                MaterialClassGridViewDataSource = hierarchy;
            }
        }
Esempio n. 7
0
 public BindRegistration(KeyCode key, string command, BindType type, bool locked)
 {
     Key         = key;
     Command     = command;
     BindType    = type;
     this.locked = locked;
 }
Esempio n. 8
0
        public override void Gen(BindType bt)
        {
            _baseSB = new StringBuilder();
            if (bt.baseType != null)
            {
                _baseSB.AppendFormat("---@class {0} : {1}\n", bt.name, bt.baseType.GetTypeStr());
            }
            else
            {
                _baseSB.AppendFormat("---@class {0}\n", bt.name);
            }

            _propBuilder   = new StringBuilder();
            _methodBuilder = new StringBuilder();
            base.Gen(bt);

            _baseSB.Append(_propBuilder);
            _baseSB.Append("local m = {}\n");
            _baseSB.Append(_methodBuilder);

            string[] ns = bt.name.Split('.');
            for (int i = 0; i < ns.Length - 1; i++)
            {
                _baseSB.AppendFormat("{0} = {{}}\n", string.Join(".", ns, 0, i + 1));
            }
            _baseSB.AppendFormat("{0} = m\n", bt.name);
            _baseSB.Append("return m");

            string fileName = string.Format("LuaAPI/{0}Wrap.lua", bt.wrapName);

            File.WriteAllBytes(fileName, Encoding.GetEncoding("UTF-8").GetBytes(_baseSB.ToString()));
        }
Esempio n. 9
0
        public virtual void Gen(BindType bt)
        {
            _bindType = bt;

            GenMethods();
            GenProperties();
        }
Esempio n. 10
0
    public override void OnInspectorGUI()
    {
        bool   isRefresh = false;
        UIBind bind      = target as UIBind;

        EditorGUILayout.BeginVertical(GUILayout.Width(600), GUILayout.Height(100));
        EditorGUILayout.LabelField("选择对应的类型");


        curBindType   = bind.BindType;
        bind.BindType = (BindType)EditorGUILayout.Popup(bind.BindType.GetHashCode(), bindTypeStrs, GUILayout.Width(100));
        if (curBindType != bind.BindType)
        {
            isRefresh = true;
        }

        curBindType = bind.BindType;


        switch (bind.BindType)
        {
        case BindType.Default:
            EditorGUILayout.LabelField("默认类型为:" + bind.DefaultName());
            bind.SelectTypeName = string.Empty;
            break;

        case BindType.Custom:
            curSelectType = bind.SelectTypeName;
            EditorGUILayout.BeginHorizontal(GUILayout.Width(600), GUILayout.Height(50));
            EditorGUILayout.LabelField("选择预定义Type:", GUILayout.Width(100));
            if (string.IsNullOrEmpty(bind.SelectTypeName))
            {
                bind.SelectTypeName = selectTypes[customTypeIndex];
            }
            customTypeIndex     = selectTypes.ToList().IndexOf(bind.SelectTypeName);
            customTypeIndex     = EditorGUILayout.Popup(customTypeIndex, selectTypes, GUILayout.Width(100));
            bind.SelectTypeName = selectTypes[customTypeIndex];
            if (curSelectType != bind.SelectTypeName)
            {
                isRefresh = true;
            }

            curSelectType = bind.SelectTypeName;
            EditorGUILayout.EndHorizontal();
            break;

        default:
            break;
        }

        EditorGUILayout.EndVertical();
        base.OnInspectorGUI();

        if (isRefresh)
        {
            Undo.RegisterCompleteObjectUndo(bind, "modify value");
            EditorUtility.SetDirty(bind);
            AssetDatabase.SaveAssets();
        }
    }
Esempio n. 11
0
        public override void Gen(BindType bt)
        {
            _baseSB = new StringBuilder();
            if (bt.baseType != null)
            {
                _baseSB.AppendFormat("---@class {0} : {1}\n", bt.name, bt.baseType.GetTypeStr());
            }
            else
            {
                _baseSB.AppendFormat("---@class {0}\n", bt.name);
            }

            _propBuilder   = new StringBuilder();
            _methodBuilder = new StringBuilder();
            base.Gen(bt);

            _baseSB.Append(_propBuilder);
            _baseSB.Append("local m = {}\n");
            _baseSB.Append(_methodBuilder);
            _baseSB.Append("return m");

            string fileName = string.Format("LuaAPI/{0}Wrap.lua", bt.wrapName);

            File.WriteAllBytes(fileName, Encoding.GetEncoding("UTF-8").GetBytes(_baseSB.ToString()));
        }
        protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindType bindType = (BindType)Convert.ToInt32(this.ddlType.SelectedValue);

            switch (bindType)
            {
            case BindType.Key:
            case BindType.Topic:
                this.liUrl.Visible   = false;
                this.liValue.Visible = true;
                break;

            case BindType.Url:
                this.liUrl.Visible   = true;
                this.liValue.Visible = false;
                break;

            default:
                this.liUrl.Visible   = false;
                this.liValue.Visible = false;
                break;
            }
            if (bindType != BindType.Key)
            {
                return;
            }
            this.ddlValue.DataSource     = (object)Enumerable.Where <ReplyInfo>((IEnumerable <ReplyInfo>)ReplyHelper.GetAllReply(), (Func <ReplyInfo, bool>)(a => !string.IsNullOrWhiteSpace(a.Keys)));
            this.ddlValue.DataTextField  = "Keys";
            this.ddlValue.DataValueField = "Id";
            this.ddlValue.DataBind();
        }
Esempio n. 13
0
        private void btnAddMenu_Click(object sender, EventArgs e)
        {
            if ((this.ddlType.SelectedValue == "1") && (this.ddlValue.Items.Count <= 0))
            {
                this.ShowMsg("关键字不能为空", false);
            }
            else
            {
                MenuInfo menu = new MenuInfo {
                    Name         = this.txtCategoryName.Text,
                    ParentMenuId = base.GetUrlIntParam("pid"),
                    wid          = this.wid
                };
                if (!VShopHelper.CanAddMenu(menu.ParentMenuId, this.wid))
                {
                    this.ShowMsg("一级菜单不能超过三个,对应二级菜单不能超过五个", false);
                }
                else
                {
                    menu.Bind = Convert.ToInt32(this.ddlType.SelectedValue);
                    BindType bindType = menu.BindType;
                    switch (bindType)
                    {
                    case BindType.Key:
                        menu.ReplyId = Convert.ToInt32(this.ddlValue.SelectedValue);
                        break;

                    case BindType.Topic:
                        menu.Content = this.ddlValue.SelectedValue;
                        break;

                    default:
                        if (bindType == BindType.Url)
                        {
                            menu.Content = this.txtUrl.Text.Trim();
                        }
                        break;
                    }
                    menu.Type = "click";
                    if (menu.ParentMenuId == 0)
                    {
                        menu.Type = "view";
                    }
                    else if (string.IsNullOrEmpty(this.ddlType.SelectedValue) || (this.ddlType.SelectedValue == "0"))
                    {
                        this.ShowMsg("二级菜单必须绑定一个对象", false);
                        return;
                    }
                    if (VShopHelper.SaveMenu(menu))
                    {
                        base.Response.Redirect("ManageMenu.aspx");
                    }
                    else
                    {
                        this.ShowMsg("添加失败", false);
                    }
                }
            }
        }
Esempio n. 14
0
        public void BindData(BindType bindType)
        {
            if (bindType == BindType.Form)
            {
                var queryargument = new QueryArgument(UserContext.DataBaseInfo)
                {
                    Key          = CountryId,
                    filter1      = Constants.CountryType,
                    BindType     = bindType,
                    QueryType    = Constants.TableMCatHeader,
                    SubFilterKey = Constants.TableMCatDetls
                };
                var countries = _controlPanel.GetCountry(queryargument);

                if (countries == null)
                {
                    return;
                }
                var country = countries.FirstOrDefault();
                if (country != null)
                {
                    CountryId      = country.CountryId;
                    CountryName    = country.CountryName.Trim();
                    CurrencyCode   = country.CurrencyCode.Trim();
                    CurrencyName   = country.CurrencyName.Trim();
                    CurrencySymbol = country.CurrencySymbol.Trim();
                    Denomination   = country.Denomination.Trim();
                }
                lnkSubmit.Visible = hidAction.Value != Constants.ViewAction;

                var state = country.States;
                GridViewState.DataSource = state;
                if (_newPageIndex >= 0)
                {
                    GridViewState.PageIndex = _newPageIndex;
                }
                GridViewState.DataBind();
                uplForm.Update();
            }
            else
            {
                var queryargument = new QueryArgument(UserContext.DataBaseInfo)
                {
                    Key       = CountryId,
                    filter1   = Constants.CountryType,
                    BindType  = bindType,
                    QueryType = Constants.TableMCatHeader
                };
                var countries = _controlPanel.GetCountry(queryargument);

                GridViewTable.DataSource = countries;
                if (_newPageIndex >= 0)
                {
                    GridViewTable.PageIndex = _newPageIndex;
                }
                GridViewTable.DataBind();
                uplView.Update();
            }
        }
Esempio n. 15
0
        protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
        {
            BindType bindType = (BindType)Convert.ToInt32(this.ddlType.SelectedValue);

            switch (bindType)
            {
            case BindType.Url:
                this.liUrl.Visible   = true;
                this.liValue.Visible = false;
                break;

            case BindType.Key:
            case BindType.Topic:
                this.liUrl.Visible   = false;
                this.liValue.Visible = true;
                break;

            default:
                this.liUrl.Visible   = false;
                this.liValue.Visible = false;
                break;
            }
            this.btnAddMenu.Enabled = true;
            switch (bindType)
            {
            case BindType.Key:
                this.liTitle.InnerText   = "选择关键字:";
                this.ddlValue.DataSource = from a in ReplyHelper.GetAllReply()
                                           where !string.IsNullOrWhiteSpace(a.Keys)
                                           select a;
                this.ddlValue.DataTextField  = "Keys";
                this.ddlValue.DataValueField = "Id";
                this.ddlValue.DataBind();
                break;

            case BindType.Topic:
            {
                this.liTitle.InnerText = "选择页面:";
                IList <TopicInfo> list = VShopHelper.Gettopics();
                if (list.Count > 0)
                {
                    this.ddlValue.DataSource     = list;
                    this.ddlValue.DataTextField  = "Title";
                    this.ddlValue.DataValueField = "TopicId";
                    this.ddlValue.DataBind();
                }
                else
                {
                    this.ddlValue.Items.Clear();
                    ListItem listItem = new ListItem();
                    listItem.Text  = "";
                    listItem.Value = "";
                    this.ddlValue.Items.Insert(0, listItem);
                    this.btnAddMenu.Enabled = false;
                }
                break;
            }
            }
        }
Esempio n. 16
0
 public void UpdateValue(TComponent component, ObservableProperty <TData> property, Action <TData> fieldChangeCb,
                         UnityEvent <TData> componentEvent, BindType bindType,
                         Func <TData, TData> property2CpntWrap, Func <TData, TData> cpnt2PropWrap)
 {
     SetValue(component, property, fieldChangeCb, componentEvent, bindType, property2CpntWrap,
              cpnt2PropWrap);
     InitCpntValue();
 }
Esempio n. 17
0
 static bool CheckType(Type t, bool custom)
 {
     if (t == null)
     {
         return(false);
     }
     return(!BindType.IsObsolete(t));
 }
Esempio n. 18
0
 public virtual void Clean()
 {
     m_BindType           = BindType.None;
     m_Source             = null;
     m_Target             = null;
     m_SourcePropertyName = null;
     m_TargetPropertyName = null;
 }
Esempio n. 19
0
 /// <summary>
 /// Edits or creates a new bind.
 /// </summary>
 public static bool SetBind(string key, string command, BindType type, bool locked)
 {
     if (Enum.TryParse(key, out KeyCode kc))
     {
         return(SetBind(kc, command, type, locked));
     }
     LogBadKey(key);
     return(false);
 }
Esempio n. 20
0
 public void RegisterKey(BindType type, Key key, Action action)
 {
     Binds.Add(new Bind()
     {
         Type   = type,
         Key    = key,
         Action = action
     });
 }
Esempio n. 21
0
    void BindByType(BindType type, UIParamAnimation anim)
    {
        var obj         = gameObject;
        var image       = obj.GetComponent <Image>();
        var text        = obj.GetComponent <Text>();
        var advText     = obj.GetComponent <TMPro.TextMeshProUGUI>();
        var canvasGroup = obj.GetComponent <CanvasGroup>();

        switch (type)
        {
        case BindType.Color:
            anim.OnUpdate(paramAnimation =>
            {
                if (image != null)
                {
                    image.color = paramAnimation.Color();
                }
                if (text != null)
                {
                    text.color = paramAnimation.Color();
                }
                if (advText != null)
                {
                    advText.color = paramAnimation.Color();
                }
            });
            break;

        case BindType.Size:
            anim.OnUpdate(paramAnimation =>
            {
                transform.localScale = paramAnimation.Scale();
            });
            break;

        case BindType.Alpha:
            anim.OnUpdate(paramAnimation =>
            {
                if (canvasGroup != null)
                {
                    canvasGroup.alpha = paramAnimation.Float();
                }
            });
            break;

        case BindType.Visibility:
            anim.OnStart(paramAnimation =>
            {
                gameObject.SetActive(!paramAnimation.Reversed);
            });
            anim.OnFinished(paramAnimation =>
            {
                gameObject.SetActive(paramAnimation.Reversed);
            });
            break;
        }
    }
Esempio n. 22
0
        public void BindData(CompanyProfiles companyProfiles, BindType bindType)
        {
            if (companyProfiles == null)
            {
                return;
            }
            if (bindType == BindType.Form)
            {
                var companyProfile = companyProfiles.FirstOrDefault();

                if (companyProfile != null)
                {
                    Id   = companyProfile.Id;
                    Name = companyProfile.Name.Trim();

                    Address.Address = companyProfile.Address.Trim();
                    Address.City    = companyProfile.City.Trim();
                    Address.Country = companyProfile.Country.Trim();
                    Address.State   = companyProfile.State.Trim();
                    Address.ZipCode = companyProfile.Zip.Trim();
                    Address.Email   = companyProfile.Email.Trim();
                    //Address.Mobile = companyProfile.Mobile.Trim();
                    Address.Phone = companyProfile.Phone.Trim();
                    Logo          = companyProfile.Logo;
                    if (CType == Constants.CompanyCType || CType == Constants.BuCType)
                    {
                        Cst                 = companyProfile.Tax1.Trim();
                        Tin                 = companyProfile.Tax2.Trim();
                        Excise              = companyProfile.Tax3.Trim();
                        ExciseActiveTill    = companyProfile.TaxValidity3.Trim();
                        FinancialPeriodFrom =
                            companyProfile.FinancialYearStart.GetValueOrDefault().ToString(Constants.Format02);
                        FinancialPeriodTo =
                            companyProfile.FinancialYearEnd.GetValueOrDefault().ToString(Constants.Format02);
                        TransactionCurrency = companyProfile.TrnCurrency;
                    }
                    else
                    {
                        ContactPersonName1  = companyProfile.CName;
                        ContactPersonPhone1 = companyProfile.CPhone;
                    }
                }
                lnkSave.Visible = hidAction.Value != Constants.ViewAction;
                uplForm.Update();
            }
            else
            {
                GridViewTable.DataSource = companyProfiles;
                if (_newPageIndex >= 0)
                {
                    GridViewTable.PageIndex = _newPageIndex;
                }
                GridViewTable.DataSource = companyProfiles;
                GridViewTable.DataBind();
                uplView.Update();
            }
        }
Esempio n. 23
0
 public void RegisterKey(BindType type, Key key, Action action)
 {
     Binds.Add(new Bind()
     {
         Type = type,
         Key = key,
         Action = action
     });
 }
 public BindPointInfo(BindPointInfo info)
 {
     
     this.target = info.target;
     this.controller = info.controller;
     this.bindType = info.bindType;
     this.bindLen = info.bindLen;
     this.priority = info.priority;
 }
Esempio n. 25
0
        void SetValuesToElement(XmlElement ele, string name, BindType type, string[] values)
        {
            switch (type)
            {
            case BindType.Default:
            {
                XmlNode bindNode = ele.SelectSingleNode(string.Format("group[@type='{0}']", name));
                if (bindNode == null)
                {
                    bindNode = ele.OwnerDocument.CreateElement("group");
                    ((XmlElement)bindNode).SetAttribute("type", name);
                    ele.AppendChild(bindNode);
                }
                else
                {
                    bindNode.RemoveAll();
                    ((XmlElement)bindNode).SetAttribute("type", name);
                }

                foreach (string str in values)
                {
                    XmlElement subItem = ele.OwnerDocument.CreateElement("item");
                    subItem.SetAttribute("value", str);
                    bindNode.AppendChild(subItem);
                }
                break;
            }

            case BindType.CDATA:
            {
                XmlNode bindNode = ele.SelectSingleNode(string.Format("group[@type='{0}']", name));
                if (bindNode == null)
                {
                    bindNode = ele.OwnerDocument.CreateElement("group");
                    ((XmlElement)bindNode).SetAttribute("type", name);
                    ele.AppendChild(bindNode);
                }
                else
                {
                    bindNode.RemoveAll();
                    ((XmlElement)bindNode).SetAttribute("type", name);
                }

                foreach (string str in values)
                {
                    XmlElement      subItem = ele.OwnerDocument.CreateElement("item");
                    XmlCDataSection cdata   = ele.OwnerDocument.CreateCDataSection(str);
                    subItem.AppendChild(cdata);
                    bindNode.AppendChild(subItem);
                }
                break;
            }

            default:
                throw new ArgumentException("未知的type:" + type, "type");
            }
        }
Esempio n. 26
0
        public static BindingResult Bind(string assemblyPath,
                                         string ipAddressString,
                                         string portString,
                                         BindType bindType,
                                         BindingParams bindingParams,
                                         bool unsafeBinding = false)
        {
            switch (bindType)
            {
            case BindType.CertificateThumbprint:
                var thumbprintParams = bindingParams as CertificateThumbprintBindingParams;
                if (thumbprintParams == null)
                {
                    Logger.LogDebug("Binder", $"CertificateThumbprintBindingParams expected, got {bindingParams.GetType().Name}");
                    return(new BindingResult
                    {
                        Status = BindingStatus.InvalidParams,
                        Reason = "Invalid params type"
                    });
                }
                return(Bind(assemblyPath, ipAddressString, portString, thumbprintParams, unsafeBinding));

            case BindType.SubjectName:
                var subjectNameParams = bindingParams as CertificateSubjectnameParams;
                if (subjectNameParams == null)
                {
                    Logger.LogDebug("Binder", $"CertificateSubjectnameParams expected, got {bindingParams.GetType().Name}");
                    return(new BindingResult
                    {
                        Status = BindingStatus.InvalidParams,
                        Reason = "Invalid params type"
                    });
                }
                return(Bind(assemblyPath, ipAddressString, portString, subjectNameParams, unsafeBinding));

            case BindType.FromFile:
                var fileParams = bindingParams as CertificateFileBindingParams;
                if (fileParams == null)
                {
                    Logger.LogDebug("Binder", $"CertificateFileBindingParams expected, got {bindingParams.GetType().Name}");
                    return(new BindingResult
                    {
                        Status = BindingStatus.InvalidParams,
                        Reason = "Invalid params type"
                    });
                }
                return(Bind(assemblyPath, ipAddressString, portString, fileParams, unsafeBinding));

            default:
                return(new BindingResult
                {
                    Status = BindingStatus.InvalidParams,
                    Reason = "Invalid bind type"
                });
            }
        }
Esempio n. 27
0
            public void UnDropWrap(object userData)
            {
                BindType bindType = (BindType)userData;

                bindType.drop = false;
                dropedTypeList.Remove(bindType);
                m_instance.Save();
                EditorUtility.DisplayDialog("Information", "DropWrap success!", "Ok");
                AssetDatabase.Refresh();
            }
Esempio n. 28
0
    static void AutoAddBaseType(BindType bt, bool beDropBaseType)
    {
        Type t = bt.baseType;

        if (t == null)
        {
            return;
        }

        if (t.IsInterface)
        {
            Debugger.LogWarning("{0} has a base type {1} is Interface, use SetBaseType to jump it", bt.name, t.FullName);
            bt.baseType = t.BaseType;
        }
        else if (dropType.IndexOf(t) >= 0)
        {
            Debugger.LogWarning("{0} has a base type {1} is a drop type", bt.name, t.FullName);
            bt.baseType = t.BaseType;
        }
        else if (!beDropBaseType || baseType.IndexOf(t) < 0)
        {
            int index = allTypes.FindIndex((iter) => { return(iter.type == t); });

            if (index < 0)
            {
#if JUMP_NODEFINED_ABSTRACT
                if (t.IsAbstract && !t.IsSealed)
                {
                    Debugger.LogWarning("not defined bindtype for {0}, it is abstract class, jump it, child class is {1}", t.FullName, bt.name);
                    bt.baseType = t.BaseType;
                }
                else
                {
                    Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, bt.name);
                    bt = new BindType(t);
                    allTypes.Add(bt);
                }
#else
                Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, bt.name);
                bt = new BindType(t);
                allTypes.Add(bt);
#endif
            }
            else
            {
                return;
            }
        }
        else
        {
            return;
        }

        AutoAddBaseType(bt, beDropBaseType);
    }
Esempio n. 29
0
        //protected Type m_SourcePropertyType;
        //protected Type m_TargetPropertyType;

        public virtual void Bind(object source, string sourcePropertyName, object target, string targetPropertyName, BindType bindType)
        {
            m_Source             = source;
            m_SourcePropertyName = sourcePropertyName;
            m_Target             = target;
            m_TargetPropertyName = targetPropertyName;

            m_BindType = bindType;

            SetupGetterSetter();
        }
Esempio n. 30
0
    static BindType[] GenBindTypes(BindType[] list, bool beDropBaseType = true)
    {
        allTypes = new List <BindType>(list);

        for (int i = 0; i < list.Length; i++)
        {
            if (dropType.IndexOf(list[i].type) >= 0)
            {
                Debug.LogWarning(list[i].type.FullName + " in dropType table, not need to export");
                allTypes.Remove(list[i]);
                continue;
            }
            else if (beDropBaseType && baseType.IndexOf(list[i].type) >= 0)
            {
                Debug.LogWarning(list[i].type.FullName + " is Base Type, not need to export");
                allTypes.Remove(list[i]);
                continue;
            }
            else if (list[i].type.IsEnum)
            {
                continue;
            }

            Type t = list[i].baseType;

            while (t != null)
            {
                if (t.IsInterface)
                {
                    list[i].baseType = t.BaseType;
                }
                else if (dropType.IndexOf(t) >= 0)
                {
                    Debugger.LogWarning(string.Format("{0} has a base type {1} is a drop type", list[i].name, t.FullName));
                    list[i].baseType = t.BaseType;
                }
                else if (!beDropBaseType || baseType.IndexOf(t) < 0)
                {
                    int index = allTypes.FindIndex((bt) => { return(bt.type == t); });

                    if (index < 0)
                    {
                        Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, list[i].name);
                        BindType bt = new BindType(t);
                        allTypes.Add(bt);
                    }
                }

                t = t.BaseType;
            }
        }

        return(allTypes.ToArray());
    }
Esempio n. 31
0
 private void SetValue(TComponent component, ObservableProperty <TData> property, Action <TData> fieldChangeCb,
                       UnityEvent <TData> componentEvent, BindType bindType,
                       Func <TData, TData> property2CpntWrap, Func <TData, TData> cpnt2PropWrap)
 {
     this._component      = component;
     this._property       = property;
     this._bindType       = bindType;
     _prop2CpntWrap       = property2CpntWrap;
     this._cpnt2PropWrap  = cpnt2PropWrap;
     _propChangeCb        = fieldChangeCb;
     this._componentEvent = componentEvent;
 }
Esempio n. 32
0
            public void DeleteDelegate(object userData)
            {
                BindType bindType = (BindType)userData;

                bindType.isBuilded = false;
                wrappedDelegateList.Remove(bindType);
                m_instance.GenDelegate();
                m_instance.GenLuaBinder();
                m_instance.Save();
                EditorUtility.DisplayDialog("Information", "DeleteDelegate success!", "Ok");
                AssetDatabase.Refresh();
            }
Esempio n. 33
0
        internal static PduBase CreateBindPdu(
            uint sequenceNumber,
            BindType bindType,
            string systemId,
            string password,
            BindOptions options)
        {
            switch (bindType)
            {
                case BindType.Transmitter:
                    return new BindTransmitter(
                        sequenceNumber,
                        systemId,
                        password,
                        options.SystemType,
                        options.InterfaceVersion,
                        options.Ton,
                        options.Npi,
                        options.AddressRange);

                case BindType.Receiver:
                    return new BindReceiver(
                        sequenceNumber,
                        systemId,
                        password,
                        options.SystemType,
                        options.InterfaceVersion,
                        options.Ton,
                        options.Npi,
                        options.AddressRange);

                case BindType.Transceiver:
                    return new BindTransceiver(
                        sequenceNumber,
                        systemId,
                        password,
                        options.SystemType,
                        options.InterfaceVersion,
                        options.Ton,
                        options.Npi,
                        options.AddressRange);

                default:
                    return null;
            }
        }
 public static void SetBindType(BindType type)
 {
     bind = (BindingFlags)type;
 }
Esempio n. 35
0
 internal object this[BindType type, object key]
 {
     get{return ((Hashtable)this.m_bindMap[type])[key];}
 }
Esempio n. 36
0
 internal bool ContainsValue(BindType type, object value)
 {
     return ((Hashtable)this.m_bindMap[type]).ContainsValue(value);
 }
    static void GenPreLoadFunction(BindType bt, StringBuilder sb)
    {
        string funcName = "LuaOpen_" + bt.wrapName;

        sb.AppendLineEx("\r\n\t[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]");
        sb.AppendFormat("\tstatic int {0}(IntPtr L)\r\n", funcName);
        sb.AppendLineEx("\t{");
        sb.AppendLineEx("\t\ttry");
        sb.AppendLineEx("\t\t{");
        sb.AppendLineEx("\t\t\tLuaState state = LuaState.Get(L);");
        sb.AppendFormat("\t\t\tint preTop = state.BeginPreModule(\"{0}\");\r\n", bt.nameSpace);
        sb.AppendFormat("\t\t\t{0}Wrap.Register(state);\r\n", bt.wrapName);
        sb.AppendLineEx("\t\t\tstate.EndPreModule(preTop);");
        sb.AppendFormat("\t\t\tint reference = state.GetMetaReference(typeof({0}));\r\n", bt.name);
        sb.AppendLineEx("\t\t\tLuaDLL.lua_getref(L, reference);");
        sb.AppendLineEx("\t\t\treturn 1;");
        sb.AppendLineEx("\t\t}");
        sb.AppendLineEx("\t\tcatch(Exception e)");
        sb.AppendLineEx("\t\t{");
        sb.AppendLineEx("\t\t\treturn LuaDLL.toluaL_exception(L, e);");
        sb.AppendLineEx("\t\t}");
        sb.AppendLineEx("\t}");
    }
Esempio n. 38
0
 void Unbind(BindType type, Action callback)
 {
     Binding binding;
     for(var i = bindings.Count - 1; i >= 0; i--)
     {
         binding = bindings[i];
         if(binding.callback == callback)
         {
             bindings.RemoveAt(i);
         }
     }
 }
Esempio n. 39
0
 internal Task<BindResult> Bind(BindType type, string systemId, string password)
 {
     return Bind(type, systemId, password, new BindOptions());
 }
Esempio n. 40
0
 private static string BindToString(BindType value)
 {
     string ret = "";
     switch (value.ToString())
     {
         case "NULL":
             break;
         case "NOT_NULL":
             break;
         case "NOT_ACTIVE":
             break;
         case "GREATER_THAN":
             break;
         case "LESS_THAN":
             break;
         case "EQUALS":
             break;
         case "NOT_EQUALS":
             break;
         case "IS_CHECKED":
             break;
         case "LESS_EQUALS_THAN":
             break;
         case "GREATER_EQUALS_THAN":
             break;
     }
     return ret;
 }
Esempio n. 41
0
        private static extern void libSMPP_ClientSetLoginType(
					IntPtr hClient, BindType loginType
			);
Esempio n. 42
0
 public Task<BindResult> Bind(BindType type, string systemId, string password)
 {
     return _currentSession.Bind(type, systemId, password);
 }
Esempio n. 43
0
 Binding FindBinding(BindType type, KeyCode[] keysCombo)
 {
     Binding binding;
     KeyCode[] keys;
     var len = keysCombo.Length;
     bool found;
     for(var i = bindings.Count - 1; i >= 0; i--)
     {
         binding = bindings[i];
         keys = binding.keysCombo;
         if(binding.type == type && keys.Length == len)
         {
             found = true;
             for(var j = keys.Length - 1; j >= 0; j--)
             {
                 if(keys[j] != keysCombo[j])
                 {
                     found = false;
                     break;
                 }
             }
             if(found)
             {
                 return binding;
             }
         }
     }
     return null;
 }
Esempio n. 44
0
    public CriFsBindRequest(BindType type, CriFsBinder targetBinder, CriFsBinder srcBinder, string path)
    {
        /* パスの保存 */
        this.path = path;

        /* バインド種別のチェック */
        switch (type) {
            case BindType.Cpk:
            this.bindId = targetBinder.BindCpk(srcBinder, path);
            break;

            case BindType.Directory:
            this.bindId = targetBinder.BindDirectory(srcBinder, path);
            break;

            case BindType.File:
            this.bindId = targetBinder.BindFile(srcBinder, path);
            break;

            default:
            throw new Exception("Invalid bind type.");
        }
    }
Esempio n. 45
0
    Binding FindOrCreateBinding(BindType type, KeyCode[] keysCombo)
    {
        var binding = FindBinding(type, keysCombo);
        if(binding == null)
        {
            binding = new Binding(type, keysCombo);
            bindings.Add(binding);

            if(keysCombo.Length > 1)
            {
                // those with more combo gets picked up earlier.
                bindings.Sort((a, b) => a.keysCombo.Length - b.keysCombo.Length);
            }
        }
        return binding;
    }
Esempio n. 46
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bindType"></param>
        /// <param name="server"></param>
        /// <param name="port"></param>
        public void Bind(BindType bindType, string server, ushort port)
        {
            if (m_bound)
            {
                throw new InvalidOperationException("Already bound");
            }

            libSMPP_ClientSetLoginType(m_handle, bindType);
            libSMPP_ClientSetServerAddress(m_handle, server, port);
            libSMPP_ClientSetAddressRange(m_handle, String.Join("|", m_addresses.ToArray()));
            libSMPP_ClientSetMessageSettings(m_handle, m_settings);

            BindResult result = libSMPP_ClientBind(m_handle);

            if (result != BindResult.Ok)
            {
                throw new BindException(result);
            }

            m_bound = true;
        }
Esempio n. 47
0
 public Column(string header, string bind, BindType bindType)
 {
     this.header = header;
     this.bind = bind;
     this.bindType = bindType;
 }
Esempio n. 48
0
    static BindType[] GenBindTypes(BindType[] list, bool beDropBaseType = true)
    {                
        allTypes = new List<BindType>(list);

        for (int i = 0; i < list.Length; i++)
        {            
            if (dropType.IndexOf(list[i].type) >= 0)
            {
                Debug.LogWarning(list[i].type.FullName + " in dropType table, not need to export");
                allTypes.Remove(list[i]);
                continue;
            }
            else if (beDropBaseType && baseType.IndexOf(list[i].type) >= 0)
            {
                Debug.LogWarning(list[i].type.FullName + " is Base Type, not need to export");
                allTypes.Remove(list[i]);
                continue;
            }
            else if (list[i].type.IsEnum) 
            {
                continue;
            }

            Type t = list[i].baseType;

            while (t != null)
            {
                if (t.IsInterface)
                {
                    list[i].baseType = t.BaseType;       
                }
                else if (dropType.IndexOf(t) >= 0)
                {
                    Debugger.LogWarning("{0} has a base type {1} is a drop type", list[i].name, t.FullName);
                    list[i].baseType = t.BaseType;                    
                }
                else if (!beDropBaseType || baseType.IndexOf(t) < 0)
                {
                    int index = allTypes.FindIndex((bt) => { return bt.type == t; });

                    if (index < 0)
                    {
                        Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, list[i].name);
                        BindType bt = new BindType(t);
                        allTypes.Add(bt);
                    }                    
                }

                t = t.BaseType;
            }
        }

        return allTypes.ToArray();
    }
Esempio n. 49
0
        internal Task<BindResult> Bind(BindType type, string systemId, string password, BindOptions options)
        {
            EnsureOpen();

            var sequence = GetNextSequenceNumber();
            var pdu = BindHelper.CreateBindPdu(sequence, type, systemId, password, options);
            var task = _taskRegistry.Register<BindResult>(sequence);

            _pduSender.Enqueue(pdu);
            return task.GetTask<BindResult>();
        }
Esempio n. 50
0
 public void UnregisterKey(BindType type, Key key)
 {
     Binds.RemoveAll((a) => a.Key == key && a.Type == type);
 }
    static void AutoAddBaseType(BindType bt, bool beDropBaseType)
    {
        Type t = bt.baseType;

        if (t == null)
        {
            return;
        }

        if (t.IsInterface)
        {
            Debugger.LogWarning("{0} has a base type {1} is Interface, use SetBaseType to jump it", bt.name, t.FullName);
            bt.baseType = t.BaseType;
        }
        else if (dropType.IndexOf(t) >= 0)
        {
            Debugger.LogWarning("{0} has a base type {1} is a drop type", bt.name, t.FullName);
            bt.baseType = t.BaseType;
        }
        else if (!beDropBaseType || baseType.IndexOf(t) < 0)
        {
            int index = allTypes.FindIndex((iter) => { return iter.type == t; });

            if (index < 0)
            {
        #if JUMP_NODEFINED_ABSTRACT
                if (t.IsAbstract && !t.IsSealed)
                {
                    Debugger.LogWarning("not defined bindtype for {0}, it is abstract class, jump it, child class is {1}", t.FullName, bt.name);
                    bt.baseType = t.BaseType;
                }
                else
                {
                    Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, bt.name);
                    bt = new BindType(t);
                    allTypes.Add(bt);
                }
        #else
                Debugger.LogWarning("not defined bindtype for {0}, autogen it, child class is {1}", t.FullName, bt.name);
                bt = new BindType(t);
                allTypes.Add(bt);
        #endif
            }
            else
            {
                return;
            }
        }
        else
        {
            return;
        }

        AutoAddBaseType(bt, beDropBaseType);
    }
Esempio n. 52
0
 public Binding(BindType type, KeyCode[] keysCombo)
 {
     this.type = type;
     this.keysCombo = keysCombo;
     if(keysCombo.Length == 0) throw new System.Exception("Key combo can not be blank.");
 }
    static BindType[] GenBindTypes(BindType[] list, bool beDropBaseType = true)
    {
        allTypes = new List<BindType>(list);
        for (int i = 0; i < list.Length; i++)
        {
            for (int j = i + 1; j < list.Length; j++)
            {
                if (list[i].type == list[j].type)
                    throw new NotSupportedException("Repeat BindType:"+list[i].type);
            }

            if (dropType.IndexOf(list[i].type) >= 0)
            {
                Debug.LogWarning(list[i].type.FullName + " in dropType table, not need to export");
                allTypes.Remove(list[i]);
                continue;
            }
            else if (beDropBaseType && baseType.IndexOf(list[i].type) >= 0)
            {
                Debug.LogWarning(list[i].type.FullName + " is Base Type, not need to export");
                allTypes.Remove(list[i]);
                continue;
            }
            else if (list[i].type.IsEnum)
            {
                continue;
            }

            AutoAddBaseType(list[i], beDropBaseType);
        }

        return allTypes.ToArray();
    }
        private void Initialize()
        {
            try
            {
                if (ctrlDesc.attrs.ContainsKey(strBind))
                {
                    //TODO: usually target is the first parameter,but it can be set via named parameter Target
                    string[] splitTarget = ctrlDesc.attrs[strBind][0].Split(' ');
                    target = splitTarget[0];
                    if ((String.Compare(target, "get") == 0 || String.Compare(target, "post") == 0) && splitTarget.Length > 1)
                        target = splitTarget[1];

                    foreach (string param in ctrlDesc.attrs[strBind])
                    {
                        if (param.Contains("ControllerBindType"))
                        {
                            string[] type = param.Split(' ');
                            switch (type[2])
                            {
                                case "After":
                                    bindType = BindType.After;
                                    break;
                                case "Before":
                                    bindType = BindType.Before;
                                    break;
                                case "TearDown":
                                    bindType = BindType.Teardown;
                                    break;
                                case "PayLoad":
                                    bindType = BindType.Payload;
                                    break;
                            }
                        }
                        else if (param.Contains("Priority"))
                        {
                            string[] splitPrior = param.Split(' ');
                            priority = Convert.ToInt32(splitPrior[2]);
                        }

                    }
                }
                else
                {
                    //set default values
                    bindType = BindType.After;
                    priority = -1;
                    target = "";
                }
                bindLen = BindPointUtilities.GetBindComponents(Target).Length;
            }
            catch (Exception ex)
            {
            }
            
        }