/// <inheritdoc />
        public override string GetPathItemName(OpenApiConvertSettings settings)
        {
            Utils.CheckArgumentNull(settings, nameof(settings));

            IList <IEdmStructuralProperty> keys = EntityType.Key().ToList();

            if (keys.Count() == 1)
            {
                string keyName = keys.First().Name;

                if (settings.PrefixEntityTypeNameBeforeKey)
                {
                    return("{" + EntityType.Name + "-" + keyName + KeyIndex.ToString() + "}");
                }
                else
                {
                    return("{" + keyName + KeyIndex.ToString() + "}");
                }
            }
            else
            {
                IList <string> keyStrings = new List <string>();
                foreach (var keyProperty in keys)
                {
                    keyStrings.Add(keyProperty.Name + "={" + keyProperty.Name + KeyIndex.ToString() + "}");
                }

                return(String.Join(",", keyStrings));
            }
        }
예제 #2
0
 private void ComponentOnNavigationMeshChanged(object sender, EventArgs eventArgs)
 {
     if (KeyIndex.TryGetValue((NavigationComponent)sender, out int index))
     {
         UpdateNavigationMesh(ComponentDataValues[index]);
     }
 }
예제 #3
0
        public AnimationClipResult GetAnimationClipResult(AnimationComponent animationComponent)
        {
            if (KeyIndex.TryGetValue(animationComponent, out int index) == false)
            {
                return(null);
            }

            return(ComponentDataValues[index].AnimationClipResult);
        }
 public Task <WalletAddress> DivideAddressAsync(
     KeyIndex keyIndex,
     int keyType)
 {
     return(DivideAddressAsync(
                account: keyIndex.Account,
                chain: keyIndex.Chain,
                index: keyIndex.Index,
                keyType: keyType));
 }
예제 #5
0
        protected override void Execute(NativeActivityContext context)
        {
            var cryptoKeyProvider = IoC.Instance.Resolve <ICryptoKeyProvider>();
            var keyindex          = KeyIndex.Get(context);
            var key    = cryptoKeyProvider.GetKey(keyindex);
            var str    = InStr.Get(context);
            var result = RunArgument == EnumCoding.Encoding ? CryptoHelper.Encrypt(str, key) : CryptoHelper.Decrypt(str, key);

            OutStr.Set(context, result);
        }
예제 #6
0
 public SecureBytes GetPublicKey(
     CurrencyConfig currency,
     KeyIndex keyIndex,
     int keyType)
 {
     return(GetPublicKey(
                currency: currency,
                account: keyIndex.Account,
                chain: keyIndex.Chain,
                index: keyIndex.Index,
                keyType: keyType));
 }
예제 #7
0
 public WalletAddress GetAddress(
     CurrencyConfig currency,
     KeyIndex keyIndex,
     int keyType)
 {
     return(GetAddress(
                currency: currency,
                account: keyIndex.Account,
                chain: keyIndex.Chain,
                index: keyIndex.Index,
                keyType: keyType));
 }
예제 #8
0
        public SecureBytes GetPrivateKey(
            CurrencyConfig currency,
            KeyIndex keyIndex,
            int keyType)
        {
            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      keyIndex: keyIndex,
                      keyType: keyType);

            return(extKey.GetPrivateKey());
        }
예제 #9
0
        public void Test_OnKeyChanged()
        {
            var key   = new KeyIndex(0);
            var calls = 0;

            key.Changed += delegate { calls++; };

            key.Value = key.Value;
            Assert.AreEqual(0, calls);

            key.Value++;
            Assert.AreEqual(1, calls);
        }
예제 #10
0
    // InputDevice piano;

    // Start is called before the first frame update
    void Start()
    {
        // get the keys
        for (int i = 0; i < numberOfKeys; i++)
        {
            GameObject key = GameObject.Find("Key" + i);
            Debug.Assert(key != null);
            keyObjects.Add(key);

            keyObjects[i].GetComponent <KeyControl>().keyOnKeyboard         = (KeyIndex)i;
            keyObjects[i].GetComponent <KeyControl>().keyOnComputerKeyboard = (ComputerKeyboardKeyIndex)i;
        }

        // match up 0 indexes keys with the midi note value (there is actually no reason to do this it's an artifact from before i knew how sound would be implemented

        System.Array indicesArray = KeyIndex.GetValues(typeof(KeyIndex)); // ugly way of getting an itteratable from an enum
        foreach (KeyIndex i in indicesArray)
        {
            indices.Add(i);
            keys[i] = keyObjects[(int)i];
        }

        System.Array keboardIndicesArray = ComputerKeyboardKeyIndex.GetValues(typeof(ComputerKeyboardKeyIndex)); // ugly way of getting an itteratable from an enum
        foreach (ComputerKeyboardKeyIndex i in keboardIndicesArray)
        {
            computerKeyboardIndices.Add(i);
        }

        System.Array notesArray = Note.GetValues(typeof(Note));
        foreach (Note n in notesArray)
        {
            notes.Add(n);
        }

        int length = indicesArray.Length < notesArray.Length ? indicesArray.Length : notesArray.Length; // use the smaller one just to be safe

        for (int i = 0; i < length; i++)
        {
            KeymappingKeyToNote[indices[i]] = notes[i];
            KeymappingNoteToKey[notes[i]]   = indices[i];

            KeymappingComputerKeyboardToNote[computerKeyboardIndices[i]] = notes[i];
            KeymappingNoteToComputerKeyboard[notes[i]] = computerKeyboardIndices[i];
        }

        foreach (GameObject key in keys.Values)
        {
            key.GetComponent <KeyControl>().note = KeymappingKeyToNote[key.GetComponent <KeyControl>().keyOnKeyboard];
        }
    }
예제 #11
0
        public byte[] SignMessage(
            CurrencyConfig currency,
            byte[] data,
            KeyIndex keyIndex,
            int keyType)
        {
            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      keyIndex: keyIndex,
                      keyType: keyType);

            return(extKey.SignMessage(data));
        }
예제 #12
0
 private IExtKey GetExtKey(
     CurrencyConfig currency,
     int purpose,
     KeyIndex keyIndex,
     int keyType)
 {
     return(GetExtKey(
                currency: currency,
                purpose: purpose,
                account: keyIndex.Account,
                chain: keyIndex.Chain,
                index: keyIndex.Index,
                keyType: keyType));
 }
예제 #13
0
        public byte[] SignHash(
            CurrencyConfig currency,
            byte[] hash,
            KeyIndex keyIndex,
            int keyType)
        {
            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      keyIndex: keyIndex,
                      keyType: keyType);

            return(extKey.SignHash(hash));
        }
예제 #14
0
        // *********************************
        // Methods:
        // *********************************

        public void ProcessKeys(KeyMessageID m, KeyEventArgs e)
        {
            KeyIndex keyindex = (KeyIndex)GetKeyIndex(e.KeyCode);

            switch (m)
            {
            case KeyMessageID.KeyDown:
                // If KeyDown event occured:
                if (!Receiver.Destroyed && Receiver.Enabled)
                {
                    switch ((KeyIndex)keyindex)
                    {
                    case KeyIndex.Up: Receiver.Direction = Directions.Up; KeysBuffer |= 0x01; break;

                    case KeyIndex.Down: Receiver.Direction = Directions.Down; KeysBuffer |= 0x02; break;

                    case KeyIndex.Left: Receiver.Direction = Directions.Left; KeysBuffer |= 0x04; break;

                    case KeyIndex.Right: Receiver.Direction = Directions.Right; KeysBuffer |= 0x08; break;

                    case KeyIndex.Shoot: Receiver.Shoot(); break;

                    default: break;
                    }
                }
                break;

            case KeyMessageID.KeyUp:
                // If KeyUp event occured:
                if (!Receiver.Destroyed)
                {
                    switch ((KeyIndex)keyindex)
                    {
                    case KeyIndex.Up: KeysBuffer &= 0x0e; break;

                    case KeyIndex.Down: KeysBuffer &= 0x0d; break;

                    case KeyIndex.Left: KeysBuffer &= 0x0b; break;

                    case KeyIndex.Right: KeysBuffer &= 0x07; break;

                    //case KeyIndex.Shoot: KeysBuffer &= 0x0e; break;

                    default: break;
                    }
                }
                break;
            }
        }
예제 #15
0
        public SecureBytes GetPrivateKey(Currency currency, KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                return(GetNonHdPrivateKey(currency, keyIndex.Index));
            }

            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      chain: keyIndex.Chain,
                      index: keyIndex.Index);

            return(extKey.GetPrivateKey());
        }
예제 #16
0
        public bool VerifyMessage(
            CurrencyConfig currency,
            byte[] data,
            byte[] signature,
            KeyIndex keyIndex,
            int keyType)
        {
            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      keyIndex: keyIndex,
                      keyType: keyType);

            return(extKey.VerifyMessage(data, signature));
        }
예제 #17
0
        public byte[] SignMessage(Currency currency, byte[] data, KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                return(GetNonHdKey(currency, keyIndex.Index)
                       .SignMessage(data));
            }

            return(GetExtKey(
                       currency: currency,
                       purpose: Bip44.Purpose,
                       chain: keyIndex.Chain,
                       index: keyIndex.Index)
                   .SignMessage(data));
        }
예제 #18
0
 /// <summary>
 /// 片方押しながらもう片方放しても入力を受け付けるやつ
 /// </summary>
 /// <param name="a"></param>
 /// <param name="b"></param>
 /// <returns></returns>
 private bool CheckRotateTrigger(KeyIndex a, KeyIndex b)
 {
     // トリガーされてたら入力あり
     if (CheckTriggeredKey(a))
     {
         return(true);
     }
     // 反対を押しっぱなしの場合
     if (CheckPressedKey(b) && CheckReleasedKey(a))
     {
         return(true);
     }
     // それ以外
     return(false);
 }
예제 #19
0
        public byte[] SignHash(Currency currency, byte[] hash, KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                return(GetNonHdKey(currency, keyIndex.Index)
                       .SignHash(hash));
            }

            return(GetExtKey(
                       currency: currency,
                       purpose: Bip44.Purpose,
                       chain: keyIndex.Chain,
                       index: keyIndex.Index)
                   .SignHash(hash));
        }
예제 #20
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("InternalNode. KeyIndex: " + KeyIndex.ToString() + ". Keys: [");
            for (int i = 0; i <= KeyIndex; i++)
            {
                sb.Append(Keys[i]);
                if (i != KeyIndex)
                {
                    sb.Append(" ");
                }
            }
            sb.Append("]");
            return(sb.ToString());
        }
예제 #21
0
        public byte[] SignMessage(Currency currency, byte[] data, KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                using var nonHdKey = GetNonHdKey(currency, keyIndex.Index);

                return(nonHdKey.SignMessage(data));
            }

            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      chain: keyIndex.Chain,
                      index: keyIndex.Index);

            return(extKey.SignMessage(data));
        }
예제 #22
0
        public byte[] GetPrivateKey(Currency currency, KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                return(GetNonHdPrivateKey(currency, keyIndex.Index));
            }

            var extKey = GetExtKey(
                currency: currency,
                purpose: Bip44.Purpose,
                chain: keyIndex.Chain,
                index: keyIndex.Index);

            extKey.GetPrivateKey(out var privateKey);

            return(privateKey);
        }
예제 #23
0
        private Keyboard.Code GetKeyCode(KeyIndex index)
        {
            Keyboard.Code ret = Keyboard.Code.W;
            if (index >= KeyIndex.W && index <= KeyIndex.D)
            {
                Keyboard.Code[] list = s_Normal;

                /*if (WorldSystem.Instance.IsPvpScene()) {
                 * int campId = WorldSystem.Instance.CampId;
                 * if (campId == (int)CampIdEnum.Blue)
                 *  list = s_Blue;
                 * else if (campId == (int)CampIdEnum.Red)
                 *  list = s_Red;
                 * }*/
                ret = list[(int)index];
            }
            return(ret);
        }
예제 #24
0
        public bool VerifyMessage(
            Currency currency,
            byte[] data,
            byte[] signature,
            KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                return(GetNonHdKey(currency, keyIndex.Index)
                       .VerifyMessage(data, signature));
            }

            return(GetExtKey(
                       currency: currency,
                       purpose: Bip44.Purpose,
                       chain: keyIndex.Chain,
                       index: keyIndex.Index)
                   .VerifyMessage(data, signature));
        }
예제 #25
0
        public bool VerifyHash(
            Currency currency,
            byte[] hash,
            byte[] signature,
            KeyIndex keyIndex)
        {
            if (keyIndex.Chain == NonHdKeysChain)
            {
                using var nonHdKey = GetNonHdKey(currency, keyIndex.Index);

                return(nonHdKey.VerifyHash(hash, signature));
            }

            using var extKey = GetExtKey(
                      currency: currency,
                      purpose: Bip44.Purpose,
                      chain: keyIndex.Chain,
                      index: keyIndex.Index);

            return(extKey.VerifyHash(hash, signature));
        }
예제 #26
0
 private void SaveKeyIndex(ICommands cmds, KeyIndex keyedIndex, string id)
 {
     var bytes = SerializationHelper.Serialize(keyedIndex);
     cmds.SaveAsync(id, bytes);
 }
예제 #27
0
 private void FireSaveKeyIndex(ICommands cmds, KeyIndex keyedIndex, string id)
 {
     lock (keyedIndex)
     {
         
     }
 }
예제 #28
0
 /// <summary>
 /// Creates a new TapNote instance.
 /// </summary>
 /// <param name="key">The key index the note is on.</param>
 /// <param name="beat">The beat the tap note occurs.</param>
 public TapNote(KeyIndex key, Beat beat) : base(key, beat)
 {
 }
예제 #29
0
 public byte[] GetPublicKey(Currency currency, KeyIndex keyIndex)
 {
     return(GetPublicKey(currency, keyIndex.Chain, keyIndex.Index));
 }
예제 #30
0
 /// <summary>
 /// Creates a new HoldNote instance.
 /// </summary>
 /// <param name="key">The key index the note is on.</param>
 /// <param name="beat">The beat the hold note starts.</param>
 /// <param name="length">The length of the hold note (in beats).</param>
 public HoldNote(KeyIndex key, Beat beat, BeatDuration length) : base(key, beat, length)
 {
 }
예제 #31
0
        public override string ToString()
        {
            string lockType = LockpickingChanceReduction == 0 ? "Open" : LockpickingChanceReduction >= 100 ? "No Lockpicking" : $"-{LockpickingChanceReduction}% Chance";

            return($"{Type}: Chest {ChestIndex}, Lock=[{lockType}], RemovedWhenEmpty={RemoveWhenEmpty}, Key={(KeyIndex == 0 ? "None" : KeyIndex.ToString())}, Event index if unlock failed {UnlockFailedEventIndex:x4}, Text {(TextIndex == 0xff ? "none" : TextIndex.ToString())}, Flags: {Flags}");
        }
예제 #32
0
        public override string ToString()
        {
            string lockType = LockpickingChanceReduction == 0 ? "Open" : LockpickingChanceReduction >= 100 ? "No Lockpicking" : $"-{LockpickingChanceReduction}% Chance";

            return($"{Type}: Key={(KeyIndex == 0 ? "None" : KeyIndex.ToString())}, Lock=[{lockType}], Event index if unlock failed {UnlockFailedEventIndex:x4}, Text {(TextIndex == 0xff ? "none" : TextIndex.ToString())}, UnlockText {(UnlockTextIndex == 0xff ? "none" : UnlockTextIndex.ToString())}, Door Index {DoorIndex}");
        }