コード例 #1
0
 public void UnBind(Zeze.Net.AsyncSocket link, IEnumerable <int> moduleIds, Zeze.Net.AsyncSocket provider, bool isOnProviderClose = false)
 {
     lock (this)
     {
         foreach (var moduleId in moduleIds)
         {
             if (Binds.TryGetValue(moduleId, out var exist))
             {
                 if (exist == provider.SessionId) // check owner? 也许不做这个检测更好?
                 {
                     Binds.Remove(moduleId);
                     if (false == isOnProviderClose)
                     {
                         (provider.UserState as ProviderSession)?.RemoveLinkSession(moduleId, link.SessionId);
                     }
                 }
                 else
                 {
                     var oldSocket = App.Instance.ProviderService.GetSocket(exist);
                     logger.Warn("LinkSession.UnBind not owner {0} {1} {2}", moduleId,
                                 oldSocket.Socket.RemoteEndPoint, provider.Socket.RemoteEndPoint);
                 }
             }
         }
     }
 }
コード例 #2
0
 public bool TryGetProvider(int moduleId, out long provider)
 {
     lock (this)
     {
         return(Binds.TryGetValue(moduleId, out provider));
     }
 }
コード例 #3
0
ファイル: BindUtility.cs プロジェクト: damphands/CM3
        /// <summary>
        /// Creates a two-way binding between this memory object and the given property.
        /// </summary>
        /// <param name="memory">the memory to bind.</param>
        /// <param name="owner">the object that owns the property.</param>
        /// <param name="propertyName">the property to bind.</param>
        public static void Bind <T>(IMemory <T> memory, object owner, string propertyName)
            where T : struct
        {
            Binds binds = BindsLookup.GetOrCreateValue(owner);

            binds.Bind <T>(memory, owner, propertyName);
        }
コード例 #4
0
        private static User.LowLevelKeyboardDelegate hDelegate; //The Hook Delegate

        /// <summary> SetValues()
        /// Sets the Values of all Attributes to there Start-Up value
        /// </summary>
        /// <returns>true</returns>
        private static bool SetValues()
        {
            cHandle = Kernel.GetConsoleWindow();
            visible = true;
            Hide();

            Process me = Process.GetCurrentProcess();

            safteyOn = false;
            mHandle  = Kernel.GetModuleHandle(me.MainModule.ModuleName);
            pHandle  = me.Id;

            hHandle  = IntPtr.Zero;
            mhHandle = IntPtr.Zero;
            position = new FourPoint(0, 0, 0, 0);

            state     = BaltoState.Starting;
            swapSave  = new FourPoint(false);
            bind      = Binds.ControlFreak;
            hDelegate = HookCallback;

            deckApps = new Deck[0];
            freeApps = new APPDAT[0];
            myWindow = new BaltoGUI();

            myWindow.Create();
            UpdateData();
            Update();

            myWindow.Hide();
            return(true);
        }
コード例 #5
0
ファイル: UIBindFactory.cs プロジェクト: Nutarb/Framework
        public void BindViewList <TItemVm, TItemView>
            (ObservableList <TItemVm> list, Transform root) where TItemVm : ViewModel
            where TItemView : View
        {
            var bind = new BindViewList <TItemVm, TItemView>(list, root);

            Binds.Add(bind);
        }
コード例 #6
0
ファイル: BindsManager.cs プロジェクト: Electrominch/BinderV2
        public BindViewModel CreateNewBind()
        {
            BindViewModel result = new BindViewModel();

            Binds.Add(result);
            OnPropertyChanged("Binds");
            return(result);
        }
コード例 #7
0
ファイル: UIBindFactory.cs プロジェクト: Nutarb/Framework
        public void BindIpairs <TItemVm, TItemView>
            (ObservableList <TItemVm> list, Transform root, string pattern) where TItemVm : ViewModel
            where TItemView : View
        {
            var bind = new BindIpairsViewList <TItemVm, TItemView>(list, pattern, root);

            Binds.Add(bind);
        }
コード例 #8
0
 public void Select()//выделить этот бинд
 {
     if (Binds.Count != 0)
     {
         Binds.ForEach(b => b.UnSelect());
     }
     bind.BorderBrush      = scbSelected;//делаем синюю границу
     lastSelectToScripting = this;
     UpdateScriptBox();
 }
コード例 #9
0
 public static void Bind(string name, Key[] keys, MouseButton[] mbtns)
 {
     if (Binds.ContainsKey(name))
     {
         Binds[name] = new InputBind(keys, mbtns);
     }
     else
     {
         Binds.Add(name, new InputBind(keys, mbtns));
     }
 }
コード例 #10
0
ファイル: BindsManager.cs プロジェクト: Electrominch/BinderV2
 public void ClearBinds()
 {
     foreach (var bvm in Binds)
     {
         bvm.Bind.Dispose();
     }
     Binds.Clear();
     SelectedBind = null;
     OnPropertyChanged("Binds");
     OnPropertyChanged("SelectedBind");
 }
コード例 #11
0
ファイル: BindsManager.cs プロジェクト: Electrominch/BinderV2
        public object[] DisableBindsByNames(params object[] ps)
        {
            foreach (var currentName in ps)
            {
                foreach (BindViewModel bvm in Binds.Where(BindVM => BindVM.Name == currentName.ToString()))
                {
                    bvm.IsEnabled = false;
                }
            }

            return(ps);
        }
コード例 #12
0
ファイル: BindsManager.cs プロジェクト: Electrominch/BinderV2
        public object[] StartBindsByNames(params object[] ps)
        {
            foreach (var currentName in ps)
            {
                foreach (BindViewModel bvm in Binds.Where(BindVM => BindVM.Name == currentName.ToString()))
                {
                    bvm.Bind.Invoke(null, new Trigger.Events.TriggeredEventArgs("StartBindsByNames", "StartBind();"));
                }
            }

            return(ps);
        }
コード例 #13
0
 void Awake()
 {
     if (!i)
     {
         i = this;
     }
     else
     {
         Debug.LogError(this + " : THERE ARE MULTIPLE INSTANCES OF THIS SCRIPT");
         Destroy(this);
     }
     GetSavedBinds();
 }
コード例 #14
0
 public void Bind(Zeze.Net.AsyncSocket link, IEnumerable <int> moduleIds, Zeze.Net.AsyncSocket provider)
 {
     lock (this)
     {
         foreach (var moduleId in moduleIds)
         {
             if (Binds.TryGetValue(moduleId, out var exist))
             {
                 var oldSocket = App.Instance.ProviderService.GetSocket(exist);
                 logger.Warn("LinkSession.Bind replace provider {0} {1} {2}", moduleId,
                             oldSocket.Socket.RemoteEndPoint, provider.Socket.RemoteEndPoint);
             }
             Binds[moduleId] = provider.SessionId;
             (provider.UserState as ProviderSession).AddLinkSession(moduleId, link.SessionId);
         }
     }
 }
コード例 #15
0
        public void UpdateBinds()
        {
            Binds.Clear();

            if (_Binds.Count < 1)
            {
                return;
            }

            foreach (Hotkey bk in _Binds)
            {
                if (Binds.ContainsKey(bk.Keys))
                {
                    Binds[bk.Keys] = bk.Function;
                    continue;
                }
                Binds.Add(bk.Keys, bk.Function);
            }
        }
コード例 #16
0
ファイル: BindSys.cs プロジェクト: asheraryam/Unary_Common
        private void Load(string ModID, string Path)
        {
            if (Entries.ContainsKey(ModID))
            {
                ConsoleSys.Error(ModID + " binds are already loaded in the system");
                return;
            }

            string FullPath = Path + '/' + "Binds.json";

            if (!FilesystemUtil.Sys.FileExists(FullPath))
            {
                ConsoleSys.Error("Tried loading binds at " + Path + " but file is not here");
                return;
            }

            Binds NewBinds = new Binds();

            NewBinds.Init(FullPath);
            Entries[ModID] = NewBinds;
        }
コード例 #17
0
ファイル: BindsManager.cs プロジェクト: Electrominch/BinderV2
        public void OpenBindsInPath(string path)
        {
            LastPath = path;
            ClearBinds();
            Bind[] binds = JsonUtilities.Deserialize <Bind[]>(File.ReadAllText(LastPath));
            int    count = 0;
            var    temp  = new List <BindViewModel>();

            foreach (Bind b in binds)
            {
                var bindVM = new BindViewModel(b);
                temp.Add(bindVM);

                if (count++ % 5 == 0)
                {
                    temp.ForEach(bvm => Binds.Add(bvm)); OnPropertyChanged("Binds");
                    temp.Clear();
                }
            }
            temp.ForEach(bvm => Binds.Add(bvm)); OnPropertyChanged("Binds");
        }
コード例 #18
0
ファイル: BindUtility.cs プロジェクト: damphands/CM3
        /// <summary>
        /// Clears all bindings on the given object.
        /// </summary>
        /// <param name="owner">the object that owns the property.</param>
        public static void ClearAll(object owner)
        {
            Binds binds = BindsLookup.GetOrCreateValue(owner);

            binds.ClearAll();
        }
コード例 #19
0
ファイル: BindUtility.cs プロジェクト: damphands/CM3
        /// <summary>
        /// Removes a binding.
        /// </summary>
        /// <param name="owner">the object that owns the property.</param>
        /// <param name="propertyName">the property to bind.</param>
        public static void Clear(object owner, string propertyName)
        {
            Binds binds = BindsLookup.GetOrCreateValue(owner);

            binds.Clear(propertyName);
        }
コード例 #20
0
 public static bool Unbind(string name)
 {
     return(Binds.Remove(name));
 }
コード例 #21
0
ファイル: BindsManager.cs プロジェクト: Electrominch/BinderV2
 public bool RemoveBind(BindViewModel toRemove)
 {
     toRemove.Bind.Dispose();
     OnPropertyChanged("Binds");
     return(Binds.Remove(toRemove));
 }
コード例 #22
0
 public static bool IsBound(string name)
 {
     return(Binds.ContainsKey(name));
 }
コード例 #23
0
ファイル: InputManager.cs プロジェクト: pxl1778/SwitchBlade
        /// <summary>
        /// When called, it checks between previous states of both mouse and keyboard to bind the next key/button pressed to the specified action
        /// </summary>
        /// <param name="keyToBind">The action that you wish to be bound</param>
        public void Bind(Binds keyToBind)
        {
            //Previous states of mouse buttons
            ButtonState leftState, middleState, rightState;

            leftState   = prevMState.LeftButton;
            middleState = prevMState.MiddleButton;
            rightState  = prevMState.RightButton;

            Keys[] prevPressedKeys = prevKbState.GetPressedKeys(); //list of the key presses in the previous keyboard state
            Keys[] pressedKeys     = kbState.GetPressedKeys();     //list of the key presses in the current keyboard state

            /*
             * Each case is for a different action
             * Creates an inputType object that's either mouse or keyboard depending on the input
             * Stores the inputType object in binds in its corresponding index
             * */
            switch (keyToBind)
            {
            case Binds.Up:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard up = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[0] = up;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse up = new InputMouse(mState, MouseButton.Left);
                    binds[0] = up;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse up = new InputMouse(mState, MouseButton.Middle);
                    binds[0] = up;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse up = new InputMouse(mState, MouseButton.Right);
                    binds[0] = up;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Down:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard down = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[1] = down;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse down = new InputMouse(mState, MouseButton.Left);
                    binds[1] = down;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse down = new InputMouse(mState, MouseButton.Middle);
                    binds[1] = down;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse down = new InputMouse(mState, MouseButton.Right);
                    binds[1] = down;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Left:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard left = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[2] = left;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse left = new InputMouse(mState, MouseButton.Left);
                    binds[2] = left;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse left = new InputMouse(mState, MouseButton.Middle);
                    binds[2] = left;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse left = new InputMouse(mState, MouseButton.Right);
                    binds[2] = left;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Right:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard right = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[3] = right;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse right = new InputMouse(mState, MouseButton.Left);
                    binds[3] = right;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse right = new InputMouse(mState, MouseButton.Middle);
                    binds[3] = right;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse right = new InputMouse(mState, MouseButton.Right);
                    binds[3] = right;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Attack:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard attack = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[4] = attack;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse attack = new InputMouse(mState, MouseButton.Left);
                    binds[4] = attack;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse attack = new InputMouse(mState, MouseButton.Middle);
                    binds[4] = attack;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse attack = new InputMouse(mState, MouseButton.Right);
                    binds[4] = attack;
                }
                else
                {
                    break;
                }
                break;

            case Binds.UseAbility:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard useAbility = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[5] = useAbility;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse useAbility = new InputMouse(mState, MouseButton.Left);
                    binds[5] = useAbility;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse useAbility = new InputMouse(mState, MouseButton.Middle);
                    binds[5] = useAbility;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse useAbility = new InputMouse(mState, MouseButton.Right);
                    binds[5] = useAbility;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Ability1:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard ability1 = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[6] = ability1;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse ability1 = new InputMouse(mState, MouseButton.Left);
                    binds[6] = ability1;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse ability1 = new InputMouse(mState, MouseButton.Middle);
                    binds[6] = ability1;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse ability1 = new InputMouse(mState, MouseButton.Right);
                    binds[6] = ability1;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Ability2:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard ability2 = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[7] = ability2;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse ability2 = new InputMouse(mState, MouseButton.Left);
                    binds[7] = ability2;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse ability2 = new InputMouse(mState, MouseButton.Middle);
                    binds[7] = ability2;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse ability2 = new InputMouse(mState, MouseButton.Right);
                    binds[7] = ability2;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Ability3:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard ability3 = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[8] = ability3;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse ability3 = new InputMouse(mState, MouseButton.Left);
                    binds[8] = ability3;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse ability3 = new InputMouse(mState, MouseButton.Middle);
                    binds[8] = ability3;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse ability3 = new InputMouse(mState, MouseButton.Right);
                    binds[8] = ability3;
                }
                else
                {
                    break;
                }
                break;

            case Binds.Ability4:
                if (!(prevPressedKeys.Equals(pressedKeys)))
                {
                    InputKeyboard ability4 = new InputKeyboard(kbState, pressedKeys[pressedKeys.Length - 1]);
                    binds[9] = ability4;
                }
                else if (leftState != mState.LeftButton)
                {
                    InputMouse ability4 = new InputMouse(mState, MouseButton.Left);
                    binds[9] = ability4;
                }
                else if (middleState != mState.MiddleButton)
                {
                    InputMouse ability4 = new InputMouse(mState, MouseButton.Middle);
                    binds[9] = ability4;
                }
                else if (rightState != mState.RightButton)
                {
                    InputMouse ability4 = new InputMouse(mState, MouseButton.Right);
                    binds[9] = ability4;
                }
                else
                {
                    break;
                }
                break;
            }
        }