static KeyboardInputSimulation() { var combos = new[] { ModifierKeys.None, ModifierKeys.Shift, ModifierKeys.Control, ModifierKeys.Alt, ModifierKeys.Alt | ModifierKeys.Shift }; var map = new Dictionary <KeyInput, KeyData>(); foreach (var c in KeyInputUtil.CharLettersLower) { foreach (var mod in combos) { var keyMod = AlternateKeyUtil.ConvertToKeyModifiers(mod); var keyInput = KeyInputUtil.ApplyKeyModifiersToChar(c, keyMod); var key = (Key)((c - 'a') + (int)Key.A); map[keyInput] = new KeyData(key, mod); } } map[KeyInputUtil.CharToKeyInput(' ')] = new KeyData(Key.Space, ModifierKeys.None); map[KeyInputUtil.CharToKeyInput('.')] = new KeyData(Key.OemPeriod, ModifierKeys.None); map[KeyInputUtil.CharToKeyInput(';')] = new KeyData(Key.OemSemicolon, ModifierKeys.None); map[KeyInputUtil.CharToKeyInput(':')] = new KeyData(Key.OemSemicolon, ModifierKeys.Shift); s_keyDataMap = map; }
private static List <KeyData> GetValues <T>(string pParam, T pParams, List <string> pComments) { List <KeyData> lstValues = new List <KeyData>(); var objType = typeof(T); if (objType.IsGenericType && objType.GetInterfaces().Any(t => t.GetGenericTypeDefinition() == typeof(IEnumerable <>))) { foreach (var obj in (IEnumerable <KeyValuePair <string, string> >)pParams) { var objKeyData = new KeyData(obj.Key); objKeyData.Value = obj.Value; lstValues.Add(objKeyData); } } else { var objKeyData = new KeyData(pParam); objKeyData.Value = pParams.ToString(); if (pComments != null && pComments.Count > 0) { if (pComments.Count > 1 || !String.IsNullOrEmpty(pComments[0])) { objKeyData.Comments = pComments; } } lstValues.Add(objKeyData); } return(lstValues); }
void KeyPickedUp(KeyData data) { if (this.data == data) { Destroy(gameObject); } }
void DoorOpened(KeyData data) { if (data == key) { Destroy(gameObject); } }
// Use this for initialization void Awake() { mInputKeyTimeDict = new Dictionary<KeyData, ValData>(); mUsbHid = GetComponent<NemoUsbHid_HardScan>(); mUsbHid.FuncHSThread_AddKeyPress += Func_InInvokeKeyEvent; mUsbHid.Evt_HSThread_FrameStart += Handle_HSThread_Update; mKeyDataBuff = new KeyData(); //mValBuff = new ValData(); mDeleteKeyDataInUpdateLoop = new List<KeyValuePair<KeyData, ValData>>(); mTimeIgnoreInputTick = TimeIgnoreInputMS * 10000; // //mKeyDataBuff.CtrllerIdx = 1; //mKeyDataBuff.InputKey = NemoUsbHid_HardScan.InputCmd.BtnA; //Debug.Log(mInputKeyTimeDict.TryGetValue(mKeyDataBuff, out mValBuff)); //KeyData kd = new KeyData(); //kd.CtrllerIdx = 1; //kd.InputKey = NemoUsbHid_HardScan.InputCmd.BtnA; //ValData vd = new ValData(); //vd.KeyStateStart = vd.KeyStateLast = true; //vd.TimeStartDelayTrigger = System.DateTime.Now.Ticks; //mInputKeyTimeDict.Add(kd, vd); //mKeyDataBuff.CtrllerIdx = 2; //mKeyDataBuff.InputKey = NemoUsbHid_HardScan.InputCmd.BtnA; //Debug.Log(mInputKeyTimeDict.TryGetValue(mKeyDataBuff, out mValBuff)); }
bool Func_InInvokeKeyEvent(int ctrllerIdx, NemoUsbHid_HardScan.InputCmd key, bool keyState) { mKeyDataBuff.CtrllerIdx = ctrllerIdx; mKeyDataBuff.InputKey = key; //Debug.Log("Func_InInvokeKeyEvent keyState = " + keyState); if (mInputKeyTimeDict.TryGetValue(mKeyDataBuff, out mValBuff)) { //Debug.Log("mInputKeyTimeDict.TryGetValue;"); mValBuff.KeyStateLast = keyState; } else { KeyData kd = new KeyData(); kd.CtrllerIdx = ctrllerIdx; kd.InputKey = key; ValData vd = new ValData(); vd.KeyStateStart = vd.KeyStateLast = keyState; vd.TimeStartDelayTrigger = System.DateTime.Now.Ticks; mInputKeyTimeDict.Add(kd, vd); //Debug.Log("mInputKeyTimeDict.Add(kd, vd);"); } return false; }
static Gui() { Renderer = new NoRenderer(); DoubleClickSpeed = 250; Buttons = new ButtonState[5]; KeyBuffer = new KeyData[0x100]; }
// private static void AddKeyToIni(IniData data, string SectionName, string TestKey, string TestValue, string Comment) { KeyData key = new KeyData(TestKey); key.Value = TestValue; key.Comments.Add(Comment); data[SectionName].AddKey(key); }
void OnPassphraseChanged(object sender, TextChangedEventArgs e) { var widget = sender as TextBox; uint key = KeyData.EncodePassPhrase(widget.Text); Passkey.Text = key.ToString("X8"); }
public static string ToLegacyType(string key, string type, out bool isKnownKey, out bool isSpecialType) { isKnownKey = false; isSpecialType = false; key = AsciiUtil.ToLower(key); type = AsciiUtil.ToLower(type); KeyData keyData = KEYMAP.Get(key); if (keyData != null) { isKnownKey = true; Type t = keyData.TypeMap.Get(type); if (t != null) { return(t.legacyId); } if (keyData.SpecialTypes != null) { foreach (SpecialType st in keyData.SpecialTypes) { if (st.GetHandler().IsWellFormed(type)) { isSpecialType = true; return(st.GetHandler().Canonicalize(type)); } } } } return(null); }
static KeyboardInputSimulation() { var combos = new[] { ModifierKeys.None, ModifierKeys.Shift, ModifierKeys.Control, ModifierKeys.Alt, ModifierKeys.Alt | ModifierKeys.Shift }; var map = new Dictionary<KeyInput, KeyData>(); foreach (char c in KeyInputUtilTest.CharLettersLower) { foreach (var mod in combos) { var keyMod = AlternateKeyUtil.ConvertToKeyModifiers(mod); var keyInput = KeyInputUtil.ApplyKeyModifiersToChar(c, keyMod); var key = (Key)((c - 'a') + (int)Key.A); map[keyInput] = new KeyData(key, mod); } } map[KeyInputUtil.CharToKeyInput(' ')] = new KeyData(Key.Space, ModifierKeys.None); map[KeyInputUtil.CharToKeyInput('.')] = new KeyData(Key.OemPeriod, ModifierKeys.None); map[KeyInputUtil.CharToKeyInput(';')] = new KeyData(Key.OemSemicolon, ModifierKeys.None); map[KeyInputUtil.CharToKeyInput(':')] = new KeyData(Key.OemSemicolon, ModifierKeys.Shift); KeyDataMap = map; }
/// <summary> /// Decrypts the specified data using a 128-bit cipher. The key can be any length. /// </summary> /// <param name="Data">The data to be decrypted.</param> /// <param name="Key">The key used to decrypt the data.</param> /// <returns>A string containing the decoded data.</returns> public static Stream Decrypt128Stream(Stream Data, byte[] Key) { AesManaged AES = null; CryptoStream CS = null; try { //Get the IV and length corrected Key. KeyData KeyData = GenerateKeyIV128(Key); //Create the AES crytpograhy object. AES = new AesManaged { BlockSize = 128, KeySize = 128, Key = KeyData.Key, IV = KeyData.IV }; CS = new CryptoStream(Data, AES.CreateDecryptor(), CryptoStreamMode.Read); var D = new byte[CS.Length]; CS.Read(D, 0, (int)CS.Length - 1); return(new MemoryStream(D)); } finally { if (AES != null) { AES.Clear(); } if (CS != null) { CS.Dispose(); } } }
public bool Equals(CfdDescriptorScriptData other) { if (ScriptType != other.ScriptType) { return(false); } switch (ScriptType) { case CfdDescriptorScriptType.Pk: case CfdDescriptorScriptType.Pkh: case CfdDescriptorScriptType.Wpkh: case CfdDescriptorScriptType.Combo: return(KeyData.Equals(other.KeyData)); case CfdDescriptorScriptType.Sh: case CfdDescriptorScriptType.Wsh: case CfdDescriptorScriptType.Multi: case CfdDescriptorScriptType.SortedMulti: case CfdDescriptorScriptType.Raw: return(RedeemScript.Equals(other.RedeemScript)); case CfdDescriptorScriptType.Addr: return(Address.Equals(other.Address)); default: return(false); } }
public void Validate(IField field) { var thisHindrRecMes = new KeyData<Rectangle, string>( Rect, "hindrance (" + ToString() + ")"); if (!field.Rect.Contains(thisHindrRecMes.Key)) throw new RectIsNotInsideAnotherRectException( thisHindrRecMes.Data, string.Format("field (Panel with Size = ({0}, {1}))", field.Size.Width, field.Size.Height) ); var anotherRectMes = new KeyData<Rectangle, string>(); foreach (var tank in field.Tanks) { anotherRectMes.Key = tank.Rect; anotherRectMes.Data = "tank (" + tank.ToString() + ")"; rectValidator.Validate(thisHindrRecMes, anotherRectMes); } foreach (var hindr in field.Hindrances) if (ID != hindr.ID) { anotherRectMes.Key = hindr.Rect; anotherRectMes.Data = "hindrance (" + hindr.ToString() + ")"; rectValidator.Validate(thisHindrRecMes, anotherRectMes); } }
private Pressure ExtractPressureFromKeyData(KeyData pressureData) { string keyValue = pressureData.Value; return(Pressure.FromPsi(Regex.Split(keyValue, @"[^0-9\.]+") .Where(c => c != "." && c.Trim() != "").Select(double.Parse).First())); }
public void OnDrop(PointerEventData eventData) { KeyData droppedItem = eventData.pointerDrag.GetComponent <KeyData>(); if (cKey.items[id].ID == -1) { cKey.items[droppedItem.slot] = new Item(); cKey.items[id] = droppedItem.item; droppedItem.slot = id; } else if (droppedItem.slot != id) { Transform item = this.transform.GetChild(0); item.GetComponent <KeyData>().slot = droppedItem.slot; item.transform.SetParent(cKey.slots[droppedItem.slot].transform); item.transform.position = cKey.slots[droppedItem.slot].transform.position; droppedItem.slot = id; droppedItem.transform.SetParent(this.transform); droppedItem.transform.position = this.transform.position; cKey.items[droppedItem.slot] = item.GetComponent <KeyData>().item; cKey.items[id] = droppedItem.item; } }
public override int GetHashCode() { var hash = 1; if (HasKeyData) { hash ^= KeyData.GetHashCode(); } if (HasTransmissionRiskLevel) { hash ^= TransmissionRiskLevel.GetHashCode(); } if (HasRollingStartIntervalNumber) { hash ^= RollingStartIntervalNumber.GetHashCode(); } if (HasRollingPeriod) { hash ^= RollingPeriod.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Encrypts the specified data using a 128-bit cipher. The key can be any length. /// </summary> /// <param name="Data">The data to be encrypted.</param> /// <param name="Key">The key used to encrypt the data.</param> /// <returns>A stream containing the encoded data.</returns> public static Stream Encrypt128Stream(byte[] Data, byte[] Key) { AesManaged AES = null; var MS = new MemoryStream(); CryptoStream CS = null; try { //Get the IV and length corrected Key. KeyData KeyData = GenerateKeyIV128(Key); //Create the AES crytpograhy object. AES = new AesManaged { BlockSize = 128, KeySize = 128, Key = KeyData.Key, IV = KeyData.IV }; CS = new CryptoStream(MS, AES.CreateEncryptor(), CryptoStreamMode.Write); CS.Write(Data, 0, Data.Length); CS.FlushFinalBlock(); return(MS); } finally { if (AES != null) { AES.Clear(); } if (CS != null) { CS.Dispose(); } MS.Dispose(); } }
private void SetOrUpdateKeyValue(SettingsPropertyValue property, KeyUpdateMode mode) { var keyName = property.Name; var keyData = new KeyData(keyName) { Value = property.SerializedValue.ToString() }; var sectionName = GetSectionNameByPropertyName(property.Name); if (sectionName != null) { var section = _iniData.Sections.GetSectionData(sectionName); if (mode == KeyUpdateMode.SetKeyValue && !section.Keys.ContainsKey(property.Name)) { section.Keys.AddKey(keyName); } //Do not save empty values if (!string.IsNullOrEmpty(keyData.Value)) { section.Keys.SetKeyData(keyData); } else { section.Keys.RemoveKey(keyName); } } }
/// <summary> /// Decrypts the specified data using a 128-bit cipher. The key can be any length. /// </summary> /// <param name="Data">The data to be decrypted.</param> /// <param name="Key">The key used to decrypt the data.</param> /// <returns>A string containing the decoded data.</returns> public static string Decrypt128String(Stream Data, byte[] Key) { AesManaged AES = null; CryptoStream CS = null; StreamReader DS = null; try { //Get the IV and length corrected Key. KeyData KeyData = GenerateKeyIV128(Key); //Create the AES crytpograhy object. AES = new AesManaged { BlockSize = 128, KeySize = 128, Key = KeyData.Key, IV = KeyData.IV }; CS = new CryptoStream(Data, AES.CreateDecryptor(), CryptoStreamMode.Read); DS = new StreamReader(CS); return(DS.ReadToEnd()); } finally { if (AES != null) { AES.Clear(); } if (CS != null) { CS.Dispose(); } if (DS != null) { DS.Dispose(); } } }
public Services() { var parser = new FileIniDataParser(); IniData data = parser.ReadFile("SyncClientConfig.ini"); KeyData keyApiBaseURL = data.Global.GetKeyData("ApiBaseURL"); ApiBaseURL = keyApiBaseURL.Value; KeyData keyApiReportStatus = data.Global.GetKeyData("ApiReportStatus"); ApiReportStatus = keyApiReportStatus.Value; KeyData keyApiFileTransmission = data.Global.GetKeyData("ApiFileTransmission"); ApiFileTransmission = keyApiFileTransmission.Value; KeyData keyADCStatusPath = data.Global.GetKeyData("ADCStatusPath"); ADCStatusPath = keyADCStatusPath.Value; KeyData keyFromADCPath = data.Global.GetKeyData("FromADCPath"); FromADCPath = keyFromADCPath.Value; KeyData keySplitFromADCPath = data.Global.GetKeyData("SplitFromADCPath"); SplitFromADCPath = keySplitFromADCPath.Value; KeyData keyLogFile = data.Global.GetKeyData("LogFile"); LogFile = keyLogFile.Value; KeyData keyApiAuthToken = data.Global.GetKeyData("ApiAuthToken"); ApiAuthToken = keyApiAuthToken.Value; }
/// <summary> /// Encrypts the specified data using a 128-bit cipher. The key can be any length. /// </summary> /// <param name="Data">The data to be encrypted.</param> /// <param name="Key">The key used to encrypt the data.</param> /// <returns>A Base-64 string containing the encoded data.</returns> public static string Encrypt128Base64(string Data, byte[] Key) { AesManaged AES = null; var MS = new MemoryStream(); CryptoStream CS = null; try { //Get the IV and length corrected Key. KeyData KeyData = GenerateKeyIV128(Key); //Create the AES crytpograhy object. AES = new AesManaged { BlockSize = 128, KeySize = 128, Key = KeyData.Key, IV = KeyData.IV }; CS = new CryptoStream(MS, AES.CreateEncryptor(), CryptoStreamMode.Write); CS.Write(System.Text.Encoding.UTF8.GetBytes(Data), 0, System.Text.Encoding.UTF8.GetByteCount(Data)); CS.FlushFinalBlock(); return(Convert.ToBase64String(MS.ToArray())); } finally { if (AES != null) { AES.Clear(); } if (CS != null) { CS.Dispose(); } MS.Dispose(); } }
private void KeyCombinationAnalyzer(KeyData key) { switch (key.Keyname) { case "LeftCtrl": LeftCtrlPressed = true; break; case "F1": if (LeftCtrlPressed) { Visable?.Invoke(); } break; case "F2": if (LeftCtrlPressed) { SHEmptyRecycleBin(IntPtr.Zero, "", SHERB_NOSOUND); } break; default: LeftCtrlPressed = false; break; } }
public override int GetHashCode() { var hash = 1; if (HasKeyData) { hash ^= KeyData.GetHashCode(); } if (HasTransmissionRiskLevel) { hash ^= TransmissionRiskLevel.GetHashCode(); } if (HasRollingStartIntervalNumber) { hash ^= RollingStartIntervalNumber.GetHashCode(); } if (HasRollingPeriod) { hash ^= RollingPeriod.GetHashCode(); } if (HasReportType) { hash ^= ReportType.GetHashCode(); } if (HasDaysSinceOnsetOfSymptoms) { hash ^= DaysSinceOnsetOfSymptoms.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
void PM_OnBeforeKeyPress(KeyData key, ref bool processed) { //throw new NotImplementedException(); if (key.FunctionCode == 10003) { consultaCliente(); } }
internal byte[] Decrypt(PropertyInfo property, byte[] bytes) { if (Locked) { return(null); } return(KeyData.Decrypt(property, bytes)); }
private void InvokeJump(KeyData data) { if (jumpKey != data.Code) { return; } Invoke(Jump, data.AxisValue); }
private void InvokeUnWalk(KeyData data) { if (!Contains(data.Code, walkKey) || data.State != KeyState.Up) { return; } Invoke(Unwalk, data.AxisValue); }
private void InvokeRun(KeyData data) { if (runKey != data.Code) { return; } Invoke(Run, data.AxisValue); }
private void InvokePause(KeyData data) { if (pauseKey != data.Code) { return; } Invoke(Pause); }
private void InvokeExit(KeyData data) { if (exitKey != data.Code) { return; } Invoke(Exit); }
public KeyData(KeyData input) { this.X = input.X; this.Y = input.Y; this.Z = input.Z; this.Command = input.Command; this.Key = new Key(input.Key); }
public bool GetButtonPress(KeyData key) { if ((NowInp & (short)key) != 0) { return(true); } return(false); }
protected override string GetDefaultUrl(ISource source, IPageData pageData, OutputData outputData) { KeyData key = outputData.Data.Convert <KeyData>(); var pageInfo = pageData.SourceInfo; var url = $"~/c/xml/C/{pageInfo.Source}?InitValue={key.SingleValue}"; return(WebUtil.ResolveUrl(url)); }
//------------------------------------------------------------------------------- // public KeyInputRight(KeyData keydata, int groupID) { InitializeComponent(); Keydata = keydata; GroupID = groupID; SetLabelText(); lblKey.MouseClick += new MouseEventHandler(control_MouseClick); btnEdit.MouseClick += new MouseEventHandler(control_MouseClick); }
public void correct_comment_assigment_to_keydata() { IniData inidata = new IniData(); inidata.Sections.AddSection("TestSection"); KeyData key = new KeyData("TestKey"); key.Value = "TestValue"; key.Comments.Add("This is a comment"); inidata["TestSection"].SetKeyData(key); Assert.That(inidata["TestSection"].GetKeyData("TestKey").Comments[0], Is.EqualTo("This is a comment")); }
//------------------------------------------------------------------------------- // private Tuple<Label, KeyInputRight> GetOneItem(string title, KeyData keydata, int groupID) { var l = new Label() { AutoSize = false, AutoEllipsis = true, BorderStyle = BorderStyle.FixedSingle, Size = new Size(flpnlLeft.Width, 16), Text = title, TextAlign = ContentAlignment.MiddleLeft, Margin = new Padding(0) }; l.MouseClick += focus_ByMouse; //l.Anchor = AnchorStyles.Left | AnchorStyles.Right; var r = new KeyInputRight(keydata, groupID) { Width = flpnlRight.Width }; r.KeyDataChanging += keyinputright_KeyDataChanging; r.MouseClick += focus_ByMouse; //r.Anchor = AnchorStyles.Left | AnchorStyles.Right; return new Tuple<Label, KeyInputRight>(l, r); }
public HotKeyAction( KeyData hk ) { m_Key = hk; }
public HotKeyAction( string[] args ) { try { int loc = Convert.ToInt32( args[1] ); if ( loc != 0 ) m_Key = HotKey.Get( loc ); } catch { } if ( m_Key == null ) m_Key = HotKey.Get( args[2] ); if ( m_Key == null ) throw new Exception( "HotKey not found." ); }
/// <summary> /// EN: Add key to selected section with key value and comment /// </summary> /// <param name="key">Key name to add</param> /// <param name="value">Value to set</param> /// <param name="comment">Comment to set</param> /// <example>Example: How to add key with value and comment to selected section</example> /// <code>addKeyToSelectedSection("name", "My best frend" ,"Igor")</code> public void addKeyToSelectedSection(string key, string value, string comment) { if (sectionData != null) { if (sectionData.Keys.GetKeyData(key) != null) { // Get key from Section keyData = sectionData.Keys.GetKeyData(key); } else { // Adding key to Sectrion sectionData.Keys.AddKey(key); // Get key from Section keyData = sectionData.Keys.GetKeyData(key); } if (comment != null && !comment.Equals("")) { if (keyData.Comments.Count > 0) { keyData.Comments.Clear(); } keyData.Comments.Add(comment); } if (value != null) { // Set value to key keyData.Value = value; } } }
private void pbKeyboard_Paint(object sender, PaintEventArgs e) { int position = 2032 - vsbKeyboard.Value; KeyData[] Data = new KeyData[128]; for (int i = 0; i < 128; i++) { if (i % 12 == 0 || i % 12 == 2 || i % 12 == 4 || i % 12 == 5 || i % 12 == 7 || i % 12 == 9 || i % 12 == 11) { Data[i].Color = Color.White; Data[i].NColor = Color.White; Data[i].Semitone = false; } else { Data[i].Color = Color.FromArgb(31,24,22); Data[i].NColor = Color.White; Data[i].Semitone = true; } } if (_DrumMap != null && _Setting != null) foreach (DMap dm in _DrumMap) { Color C1 = Cyan; Color C2 = Cyan2; Color C3 = Cyan3; if (!dm.Single) { if (_Setting[dm.Head].Note < 128) { string NameEx = " Head"; if (_Setting[dm.Head].Type == PinType.Piezo) { C1 = Cyan; C2 = Cyan2; C3 = Cyan3; } else if (_Setting[dm.Head].Type == PinType.Switch) { C1 = Yellow; C2 = Yellow2; C3 = Yellow3; } else if (_Setting[dm.Head].Type == PinType.HHC) { NameEx = " CC"; C1 = Magenta; C2 = Magenta2; C3 = Magenta3; } else if (_Setting[dm.Head].Type == PinType.HH) { NameEx = " Close"; C1 = Green; C2 = Green2; C3 = Green3; } Data[_Setting[dm.Head].Note].Name = dm.Name + NameEx; Data[_Setting[dm.Head].Note].NColor = C1; Data[_Setting[dm.Head].Note].Color = Data[_Setting[dm.Head].Note].Semitone ? C3 : C2; } if (_Setting[dm.Rim].Note < 128) { string NameEx = " Rim"; if (_Setting[dm.Rim].Type == PinType.Piezo) { C1 = Cyan; C2 = Cyan2; C3 = Cyan3; } else if (_Setting[dm.Rim].Type == PinType.Switch) { C1 = Yellow; C2 = Yellow2; C3 = Yellow3; } else if (_Setting[dm.Rim].Type == PinType.HHC) { NameEx = " CC"; C1 = Magenta; C2 = Magenta2; C3 = Magenta3; } else if (_Setting[dm.Rim].Type == PinType.HH) { NameEx = " Close"; C1 = Green; C2 = Green2; C3 = Green3; } Data[_Setting[dm.Rim].Note].Name = dm.Name + NameEx; Data[_Setting[dm.Rim].Note].NColor = C1; Data[_Setting[dm.Rim].Note].Color = Data[_Setting[dm.Rim].Note].Semitone ? C3 : C2; } } else { if (_Setting[dm.Head].Note < 128) { if (_Setting[dm.Head].Type == PinType.Piezo) { C1 = Cyan; C2 = Cyan2; C3 = Cyan3; } else if (_Setting[dm.Head].Type == PinType.Switch) { C1 = Yellow; C2 = Yellow2; C3 = Yellow3; } else if (_Setting[dm.Head].Type == PinType.HHC) { C1 = Magenta; C2 = Magenta2; C3 = Magenta3; } else if (_Setting[dm.Head].Type == PinType.HH) { C1 = Green; C2 = Green2; C3 = Green3; } Data[_Setting[dm.Head].Note].Name = dm.Name; Data[_Setting[dm.Head].Note].NColor = C1; Data[_Setting[dm.Head].Note].Color = Data[_Setting[dm.Head].Note].Semitone ? C3 : C2; } } } Data[_hhSetting.A_Note].Name = "ANote"; Data[_hhSetting.A_Note].NColor = Green; Data[_hhSetting.A_Note].Color = Data[_hhSetting.A_Note].Semitone ? Green3 : Green2; Data[_hhSetting.B_Note].Name = "BNote"; Data[_hhSetting.B_Note].NColor = Green; Data[_hhSetting.B_Note].Color = Data[_hhSetting.B_Note].Semitone ? Green3 : Green2; Data[_hhSetting.C_Note].Name = "CNote"; Data[_hhSetting.C_Note].NColor = Green; Data[_hhSetting.C_Note].Color = Data[_hhSetting.C_Note].Semitone ? Green3 : Green2; Data[_hhSetting.D_Note].Name = "DNote"; Data[_hhSetting.D_Note].NColor = Green; Data[_hhSetting.D_Note].Color = Data[_hhSetting.D_Note].Semitone ? Green3 : Green2; //Foot Close //Foot Open int Vel = 0; for (int i = 0; i < 128; i++) { Vel = (int)(127.0f * (float)(Click.X - 29) / 90.0f); Rectangle rect = new Rectangle(29, position - 16 * i + 6, 90, 14); if (i % 12 == 0 || i % 12 == 2 || i % 12 == 4 || i % 12 == 5 || i % 12 == 7 || i % 12 == 9 || i % 12 == 11) { rect = new Rectangle(29, position - 16 * i + 6, 160, 14); Vel = (int)(127.0f * (float)(Click.X - 29) / 160.0f); } if (rect.Contains(Click)) { Data[i].Color = Color.Blue; ClickNote = i; } } for (int i = 0; i < 128; i++) { SolidBrush A = new SolidBrush(Data[i].NColor); SolidBrush B = new SolidBrush(Color.BlueViolet); SolidBrush C = new SolidBrush(Data[i].Color); SolidBrush D = new SolidBrush(Color.BlueViolet); e.Graphics.FillEllipse(A, 4, position - 16 * i + 4, 16, 16); e.Graphics.FillRectangle(A, 12, position - 16 * i + 5, 15, 15); if (i % 12 == 0 || i % 12 == 2 || i % 12 == 4 || i % 12 == 5 || i % 12 == 7 || i % 12 == 9 || i % 12 == 11) { e.Graphics.FillRectangle(C, 29, position - 16 * i + 6, 160, 14); } else { B = new SolidBrush(Data[i - 1].Color); D = new SolidBrush(Data[i + 1].Color); e.Graphics.FillRectangle(C, 29, position - 16 * i + 6, 90, 14); if (i % 12 == 1 || i % 12 == 5 || i % 12 == 6) { e.Graphics.FillRectangle(D, 29 + 93, position - 16 * i - 1, 67, 9); e.Graphics.FillRectangle(B, 29 + 93, position - 16 * i + 10, 67, 12); } else if (i % 12 == 3 || i % 12 == 10) { e.Graphics.FillRectangle(D, 29 + 93, position - 16 * i + 4, 67, 10); e.Graphics.FillRectangle(B, 29 + 93, position - 16 * i + 16, 67, 10); } else { e.Graphics.FillRectangle(D, 29 + 93, position - 16 * i + 2, 67, 9); e.Graphics.FillRectangle(B, 29 + 93, position - 16 * i + 13, 67, 10); } } e.Graphics.DrawString(i.ToString(), this.Font, Brushes.Black, 6, position - 16 * i + 6); e.Graphics.DrawString(Data[i].Name, this.Font, Brushes.Black, 30, position - 16 * i + 6); } if (ClickNote != -1) UtilityAudio.MIDI_NoteOn((byte)ClickNote, (byte)Vel); ClickNote = -1; }
//------------------------------------------------------------------------------- // private void btnEdit_Click(object sender, EventArgs e) { using (KeyEditForm frm = new KeyEditForm(Keydata)) { if (frm.ShowDialog() == DialogResult.OK) { var ce = new KeyDataChangingEventArgs(frm.KeyData, Keydata); if (KeyDataChanging != null) { KeyDataChanging(this, ce); } if (!ce.Cancel) { Keydata = frm.KeyData; SetLabelText(); } } } }
/// <summary> /// EN: Add key to selected section with key value /// </summary> /// <param name="key">Key name to add</param> /// <param name="value">Key value to set</param> /// <example>Example: How to add key with value to selected section</example> /// <code>addKeyToSelectedSection("name", "Igor")</code> public void addKeyToSelectedSection(string key, string value) { if (sectionData != null) { if (sectionData.Keys.GetKeyData(key) != null) { // Get key from Section keyData = sectionData.Keys.GetKeyData(key); } else { // Adding key to Sectrion sectionData.Keys.AddKey(key); // Get key from Section keyData = sectionData.Keys.GetKeyData(key); } if (value != null) { // Set value to key keyData.Value = value; } } }
//------------------------------------------------------------------------------- // private void txtKey_KeyDown(object sender, KeyEventArgs e) { txtKey.ImeMode = ImeMode.Off; // 全角入力禁止のため if (e.KeyCode == Keys.Escape || e.KeyCode == Keys.ProcessKey) { _keyData = null; } else { KeyData keyData = new KeyData(); keyData.Ctrl = e.Control; keyData.Alt = e.Alt; keyData.Shift = e.Shift; keyData.Key = e.KeyCode; _keyData = keyData; } if (_keyData == null) { btnOK.Enabled = true; txtKey.Text = ""; } else { btnOK.Enabled = !_keyData.IsModifyOnly(); txtKey.Text = _keyData.ToString(true); } e.SuppressKeyPress = true; }
public KeyDataChangingEventArgs(KeyData newkeydata, KeyData prevkeydata) : base() { NewKeyData = (newkeydata == null) ? null : newkeydata.DeepCopyClone(); PreviousKeyData = (prevkeydata == null) ? null : prevkeydata.DeepCopyClone(); }
internal static KeyData Append(KeyData key, Segment segment) => new KeyData(key.Key + key.Sep + segment.Name, string.IsNullOrEmpty(key.Path) ? segment.Name : key.Path + "/" + segment.Name, segment.Separator);
private void SaveReg( string itemspec, string root, string key, string name, string type, string val) { string err = null; if ( root == null ) err = "root"; if ( key == null ) err = "key"; //if ( name == null ) err = "name"; if ( type == null ) err = "type"; //if ( val == null ) err = "val"; if ( err != null ) throw new Exception(String.Format("Bad {1} for CreatePseudoInstallScript RawReg item {0}", itemspec, err)); string fullKey = String.Format("{0}\\{1}", root, key); if ( m_verbose ) { Log.LogMessage(String.Format("^Check whether to ignore \"{0}\"", fullKey)); } foreach(ITaskItem ignoreKey in m_ignoreKeys) { string comment = ignoreKey.ItemSpec; string prefixToIgnore = ignoreKey.GetMetadata("Prefix").ToUpper(); if ( m_verbose ) { Log.LogMessage(String.Format(" ??Checking against \"{1}\" ({0})", comment, prefixToIgnore)); } if ( fullKey.ToUpper().StartsWith(prefixToIgnore) ) { if ( m_verbose ) Log.LogMessage(String.Format(" !!Ignoring key \"{0}\" ({1})", fullKey, comment)); return; } } if ( m_verbose ) Log.LogMessage(String.Format("*Check whether to remap key \"{0}\"", fullKey)); ITaskItem longestMatchingPrefixItem = null; foreach(ITaskItem replaceKey in m_keyReplacements ) { string prefixToReplace = replaceKey.GetMetadata("Prefix"); if ( m_verbose ) Log.LogMessage(String.Format(" ??Checking against \"{1}\" ({0})", replaceKey.ItemSpec, prefixToReplace)); if ( fullKey.ToUpper().StartsWith(prefixToReplace.ToUpper()) ) { if ( longestMatchingPrefixItem == null ) longestMatchingPrefixItem = replaceKey; else if ( prefixToReplace.Length > longestMatchingPrefixItem.GetMetadata("Prefix").Length ) longestMatchingPrefixItem = replaceKey; } } if ( longestMatchingPrefixItem != null ) { string replacement = longestMatchingPrefixItem.GetMetadata("ReplaceWith") + fullKey.Substring(longestMatchingPrefixItem.GetMetadata("Prefix").Length); if ( m_verbose ) Log.LogMessage(String.Format(" !!Replacing key \"{0}\" with \"{1}\" ({2})", fullKey, replacement, longestMatchingPrefixItem.ItemSpec)); fullKey = replacement; } else { if ( m_verbose ) Log.LogMessage(String.Format(" !!No matching prefix for \"{0}\"", fullKey)); } KeyData keyData = new KeyData(root, fullKey, name, type, val); m_installReg.Add(keyData); }
//Computes an 256-bit Initialization Vector private static KeyData GenerateKeyIV256(byte[] Key) { // Generate the Initialization Vector. byte[] IVH = Hash.Compute512Byte(Key); var IV = new byte[Bits256]; for (int i = 0; i < Bits256; i++) IV[i] = IVH[i]; //Make sure the key is the proper length and fix it if needed. if (Key.Length != Bits256) { var TempKey = new List<byte>(Key); int c = Bits256; while (TempKey.Count != Bits256) { if (TempKey.Count < Bits256) TempKey.Add(IVH[c++]); else if (TempKey.Count > Bits256) TempKey.RemoveAt(0); else break; if (c > IVH.Length - 1) c = Bits256; } Key = TempKey.ToArray(); } var NK = new KeyData{ Key = Key, IV = IV }; return NK; }
//------------------------------------------------------------------------------- // private void ProcessKey(KeyData key) { // TODO ShortcutKey処理 }
//------------------------------------------------------------------------------- /// <summary> /// コンストラクタ /// </summary> /// <param name="data">初期入力のKeyData</param> public KeyEditForm(KeyData data) { InitializeComponent(); txtKey.Text = (data == null) ? "" : data.ToString(); _keyData = data; }
public override void Update(GameTime time) { bool[] buttons = new bool[4]; int scroll = 0; int num = 0; Game.Input.GetAbsMouseState(ref mAbsPosX, ref mAbsPosY, ref buttons[0], ref buttons[1], ref buttons[2], ref buttons[3], ref scroll); int wheel = scroll > LastScroll ? -1 : (scroll < LastScroll ? 1 : 0); LastScroll = scroll; Game.Input.GetKeyBuffer(KeyBuffer, ref num); GUI.SetMouse(mAbsPosX, mAbsPosY, wheel); GUI.SetButtons(buttons); KeyData[] keys = new KeyData[num]; for (int i = 0; i < keys.Length; i++) { keys[i].Scancode = KeyBuffer[i].Key; keys[i].Pressed = KeyBuffer[i].Pressed != 0; keys[i].Released = KeyBuffer[i].Released != 0; } GUI.SetKeyboard(keys); GUI.TimeElapsed = time.ElapsedMilliseconds; calculateCamera(); checkCombatButtons(); base.Update(time); }
static int KeyDataComparisonShort(KeyData left, KeyData right) { int comp = string.Compare(left.m_root, right.m_root); if (comp == 0) { comp = string.Compare(left.m_key, right.m_key); if (comp == 0) { if (left.m_name != null && right.m_name != null) { comp = string.Compare(left.m_name, right.m_name); } } } return comp; }