public void ReflectHotkey(KeyName keycode) { this.keycode = keycode; // set up hotkey display if (hotkeyText != null) { this.hotkeyText.transform.parent.gameObject.SetActive(true); this.hotkeyText.text = GetPrettyStringFromKeycode(InputManager.keys[keycode].overrideKey); } else { this.hotkeyText.transform.parent.gameObject.SetActive(false); } }
/// <summary>Snippet for GetKey</summary> public void GetKeyRequestObject() { // Snippet: GetKey(GetKeyRequest, CallSettings) // Create client RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.Create(); // Initialize request argument(s) GetKeyRequest request = new GetKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request Key response = recaptchaEnterpriseServiceClient.GetKey(request); // End snippet }
public override int CreateTable() { var sqlStr = new StringBuilder(); sqlStr.AppendFormat("CREATE TABLE [{0}](", TableName); foreach (var item in Properties) { try { if (!item.PropertyType.IsSealed) { continue; } sqlStr.AppendFormat("[{0}{1}] ", Prefix, item.Name); if (item.PropertyType == typeof(string)) { sqlStr.AppendFormat("{0}(max)", SqlDbTypes[item.PropertyType]); } else if (item.PropertyType.IsEnum) { sqlStr.AppendFormat("{0}", SqlDbTypes[typeof(Enum)]); } else { sqlStr.AppendFormat("{0}", SqlDbTypes[item.PropertyType]); } if (Prefix + item.Name.ToLower() == KeyName.ToLower()) { sqlStr.Append(" PRIMARY KEY "); if (item.PropertyType == typeof(Int64) || item.PropertyType == typeof(Int32) || item.PropertyType == typeof(Int16)) { sqlStr.Append("IDENTITY"); } } sqlStr.Append(","); } catch { } } sqlStr.Append(")"); using (IDbConnection conn = new SqlConnection(GetConnectionString_Read(typeof(T)))) { conn.Execute(sqlStr.ToString()); } return(1); }
public bool IsFilterMatch(string text) { // if no filter then... if (string.IsNullOrEmpty(text)) { // Show record. return(true); } var value = text.ToLower(); return ((!string.IsNullOrEmpty(KeyName) && KeyName.ToLower().Contains(value)) || (!string.IsNullOrEmpty(KeyValue) && KeyValue.ToLower().Contains(value)) || (!string.IsNullOrEmpty(Replacement) && Replacement.ToLower().Contains(value))); }
static byte[] GetBytes(KeyName key, int size) { string value = GetConfigurationValue(key); byte[] bytes = new byte[size]; if (string.IsNullOrEmpty(value)) { Random rand = new Random(); rand.NextBytes(bytes); value = Convert.ToBase64String(bytes); SetConfigurationValue(key, value); } bytes = Convert.FromBase64String(value); return(bytes); }
public static string GetConfigurationValue(KeyName key) { try { if (appSection.Settings.AllKeys.Contains(key.ToString())) { return(appSection.Settings[key.ToString()].Value); } return(string.Empty); } catch { return(string.Empty); } }
/// <summary>Snippet for DeleteKey</summary> public void DeleteKeyRequestObject() { // Snippet: DeleteKey(DeleteKeyRequest, CallSettings) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.Create(); // Initialize request argument(s) DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request recaptchaEnterpriseServiceV1Beta1Client.DeleteKey(request); // End snippet }
/// <summary> /// <para>Method that is called if a key is pressed when this /// widget has the focus.</para> /// </summary> /// /// <param name="key"> /// <para>The key code.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> /// /// <param name="str"> /// <para>The translated string that corresponds to the key, or /// <see langword="null"/> if the key does not have a translation.</para> /// </param> /// /// <returns> /// <para>Returns <see langword="true"/> if the key has been processed /// and it should not be passed further up the focus tree. Returns /// <see langword="false"/> if the key should be passed further up /// the focus tree.</para> /// </returns> /// /// <remarks>The <paramref name="key"/> parameter indicates the X11 /// symbol that corresponds to the key, which allows cursor control /// and function keys to be easily distinguished. The /// <paramref name="str"/> is primarily of use to text /// input widgets.</remarks> protected override bool OnKeyPress(KeyName key, ModifierMask modifiers, String str) { // Check for "Ctrl+F4" to close the active MDI child. // We also allow "Shift+F4" and "Mod4+F4" because some // window managers redirect "Ctrl+F4" for desktop switching. // "Mod4" is usually the "Windows" key on PC keyboards. if ((key == KeyName.XK_F4 || key == KeyName.XK_KP_F4) && (modifiers & (ModifierMask.ControlMask | ModifierMask.ShiftMask | ModifierMask.Mod4Mask)) != 0) { if (activeChild != null) { activeChild.Child.Close(); } return(true); } // Check for Ctrl+Tab and Ctrl+Shift+Tab. "Mod4" can be // used in place of "Ctrl", same as above. Windows also // allows "Ctrl+F6" to be used instead of "Ctrl+Tab". if ((key == KeyName.XK_Tab || key == KeyName.XK_KP_Tab || key == KeyName.XK_F6) && (modifiers & (ModifierMask.ControlMask | ModifierMask.Mod4Mask)) != 0) { if ((modifiers & ModifierMask.ShiftMask) != 0) { TabBackward(); } else { TabForward(); } return(true); } if (key == KeyName.XK_ISO_Left_Tab && (modifiers & (ModifierMask.ControlMask | ModifierMask.Mod4Mask)) != 0) { TabBackward(); return(true); } // We don't know what this key is. return(false); }
public void DeleteKeyRequestObject() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteKey(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); client.DeleteKey(request); mockGrpcClient.VerifyAll(); }
public void KeyRename() { var value = new KeyName { Name = "hoge" }; var bytes = m_r.SerializeToMessagePack(value); var parsed = bytes.ParseAsMessagePack(); Assert.AreEqual("hoge", parsed["key"].GetString()); var restore = default(KeyName); m_r.Deserialize(parsed, ref restore); Assert.AreEqual("hoge", restore.Name); }
private void InputOperatorStack(KeyType type, KeyName name) { switch (type) { case KeyType.OperatorKey: InputOperatorStack_Operator(name); break; case KeyType.BacketLeftKey: InputOperatorStack_BacketLeftKey(name); break; case KeyType.BacketRightKey: InputOperatorStack_BacketRightKey(); break; } }
/// <summary>Snippet for DeleteKeyAsync</summary> public async Task DeleteKeyRequestObjectAsync() { // Snippet: DeleteKeyAsync(DeleteKeyRequest, CallSettings) // Additional: DeleteKeyAsync(DeleteKeyRequest, CancellationToken) // Create client RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = await RecaptchaEnterpriseServiceClient.CreateAsync(); // Initialize request argument(s) DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request await recaptchaEnterpriseServiceClient.DeleteKeyAsync(request); // End snippet }
[TestMethod] public void GenerateDeclarationWithName() { // Arrange var fields = fields_; var name = new KeyName("KeyName"); var key = new CandidateKey(name, fields); var mockBuilder = new Mock <IKeyDeclBuilder>(); // Act key.GenerateSqlDeclaration(mockBuilder.Object); // Assert mockBuilder.Verify(builder => builder.SetName(name)); mockBuilder.Verify(builder => builder.SetFields(Arg.IsSameSequence <IEnumerable <IField> >(fields))); mockBuilder.Verify(builder => builder.Build()); mockBuilder.VerifyNoOtherCalls(); }
public async stt::Task DeleteKeyRequestObjectAsync() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteKeyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteKeyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteKeyAsync(request, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public void Init(Ability ability, string hotkeyText, Entity entity, KeyName keycode) { this.entity = entity; abilities.Add(ability); // set up name, description, tier ReflectName(ability); ReflectDescription(ability); ReflectTier(ability); ReflectHotkey(GetPrettyStringFromKeycode(InputManager.keys[keycode].overrideKey)); this.keycode = keycode; // set up image abilityImage.sprite = AbilityUtilities.GetAbilityImage(ability); gleamed = ability is PassiveAbility; }
// Map an Xsharp key description into a "ToolkitKeys" value. internal static ToolkitKeys MapKey(KeyName key, ModifierMask modifiers) { ToolkitKeys toolkitKey = MapKey(key); if ((modifiers & ModifierMask.ControlMask) != 0) { toolkitKey |= ToolkitKeys.Control; } if ((modifiers & ModifierMask.ShiftMask) != 0) { toolkitKey |= ToolkitKeys.Shift; } if ((modifiers & ModifierMask.Mod1Mask) != 0) { toolkitKey |= ToolkitKeys.Alt; } return(toolkitKey); }
public static void RemoveFont(ObservableCollection <KeyName> fontListSource, KeyName pickerItem) { List <KeyName> removedFontList = new List <KeyName>(); if (pickerItem.Payload is StorageFile) { var file = pickerItem.Payload as StorageFile; FontDAO.InsertTempFont(file.Path); } if (fontListSource != null) { //공유되는 폰트를 모두 삭제 foreach (var font in fontListSource.Where(x => x.Payload == pickerItem.Payload).ToList()) { fontListSource.Remove(font); if (!removedFontList.Contains(font)) { removedFontList.Add(font); } } } if (FontList != null) { foreach (var font in FontList.Where(x => x.Payload == pickerItem.Payload).ToList()) { FontList.Remove(font); if (!removedFontList.Contains(font)) { removedFontList.Add(font); } } } //이벤트 처리 if (FontFamilyListChanged != null) { FontFamilyListChanged(FontList, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removedFontList)); } }
public static KeyType GetKeyTypeByName(KeyName keyName) { switch (keyName) { case KeyName.Number_0: case KeyName.Number_1: case KeyName.Number_2: case KeyName.Number_3: case KeyName.Number_4: case KeyName.Number_5: case KeyName.Number_6: case KeyName.Number_7: case KeyName.Number_8: case KeyName.Number_9: return(KeyType.NumberKey); case KeyName.Number_point: return(KeyType.NumberPointKey); case KeyName.Operator_Addition: case KeyName.Operator_Subtract: case KeyName.Operator_Multiply: case KeyName.Operator_Division: return(KeyType.OperatorKey); case KeyName.Bracket_Left: return(KeyType.BacketLeftKey); case KeyName.Bracket_Right: return(KeyType.BacketRightKey); case KeyName.GetResult: return(KeyType.ResultKey); case KeyName.Back: return(KeyType.BackKey); case KeyName.Clear: return(KeyType.ClearKey); } return(KeyType.None); }
public void Init(Ability ability, string hotkeyText, Entity entity, KeyName keycode, bool visualMode = false) { this.entity = entity; abilities.Add(ability); this.visualMode = visualMode; // set up name, description, tier ReflectName(ability); ReflectDescription(ability); ReflectTier(ability); ReflectHotkey(keycode); rangeCirclePrefab = ResourceManager.GetAsset <GameObject>("range_circle_prefab"); this.keycode = keycode; // set up image abilityImage.sprite = AbilityUtilities.GetAbilityImage(ability); gleamed = ability is PassiveAbility; }
private void FormSubmissionTicketModify_Load(object sender, EventArgs e) { this.tableLayoutPanelTextBoxes.Controls.Clear(); for (int i = 0; i < ReceiptMetaData.submissionTicketItemKeyName.Length; i++) { KeyName curKeyName = ReceiptMetaData.submissionTicketItemKeyName[i]; Label label = new Label(); label.Text = curKeyName.Name; this.tableLayoutPanelTextBoxes.Controls.Add(label); TextBox textBox = new TextBox(); textBox.Name = "textBox" + curKeyName.Key; //Console.WriteLine("{0} {1}", label.Text, textBox.Name); this.tableLayoutPanelTextBoxes.Controls.Add(textBox); } this.Controls.Find("textBoxSubmissionTicketID", true)[0].Text = this.submissionTicketID.ToString(); this.Controls.Find("textBoxSubmissionTicketID", true)[0].Enabled = false; this.Controls.Find("textBoxSupplyID", true)[0].Enabled = false; this.Controls.Find("textBoxSupplyID", true)[0].Text = this.receiptTicketItem.SupplyID.ToString(); /* * if (this.formMode == FormMode.ALTER) * { * * ReceiptTicketItemView receiptTicketItemView = (from s in this.wmsEntities.ReceiptTicketItemView * where s.ID == this.receiptTicketItemID * select s).Single(); * Utilities.CopyPropertiesToTextBoxes(receiptTicketItemView, this); * * } * this.Controls.Find("textBoxReceiptTicketID", true)[0].Enabled = false; * this.Controls.Find("textBoxReceiptTicketID", true)[0].Text = this.receiptTicketID.ToString(); */ }
private void InputOperatorStack_Operator(KeyName newName) { char newOperator = CalculatorData.GetKeyValueByName(newName); int newLevel = OperatorFactory.OperatorPriority(newOperator); while (operatorsStack.Count != 0 && operatorsStack.Peek() != CalculatorData.GetKeyValueByName(KeyName.Bracket_Left)) { var oldOperator = operatorsStack.Peek(); var oldLevel = OperatorFactory.OperatorPriority(oldOperator); if (newLevel <= oldLevel) { Calculate(); } else { operatorsStack.Push(newOperator); return; } } operatorsStack.Push(newOperator); }
public void GetKeyRequestObject() { moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client>(moq::MockBehavior.Strict); GetKeyRequest request = new GetKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; Key expectedResponse = new Key { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), DisplayName = "display_name137f65c2", WebSettings = new WebKeySettings(), AndroidSettings = new AndroidKeySettings(), IosSettings = new IOSKeySettings(), }; mockGrpcClient.Setup(x => x.GetKey(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceV1Beta1Client client = new RecaptchaEnterpriseServiceV1Beta1ClientImpl(mockGrpcClient.Object, null); Key response = client.GetKey(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public static bool BindKey(KeyName name, KeyCode code) { if (name == KeyName.ACTION || name == KeyName.CONSOLE || name == KeyName.MENU || name == KeyName.CANCEL) { return(false); } if (code == KeyCode.Return || code == KeyCode.BackQuote || code == KeyCode.Escape || code == KeyCode.Backspace) { return(false); } if (!keyNames.ContainsKey(code)) { return(false); } var query = (from k in keys where k.Value == code select k.Key).ToArray(); if (query.Length != 0) { keys[query[0]] = KeyCode.None; } keys[name] = code; return(true); }
public async stt::Task UpdateKeyRequestObjectAsync() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); UpdateKeyRequest request = new UpdateKeyRequest { Key = new Key(), UpdateMask = new wkt::FieldMask(), }; Key expectedResponse = new Key { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), DisplayName = "display_name137f65c2", WebSettings = new WebKeySettings(), AndroidSettings = new AndroidKeySettings(), IosSettings = new IOSKeySettings(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, CreateTime = new wkt::Timestamp(), TestingOptions = new TestingOptions(), }; mockGrpcClient.Setup(x => x.UpdateKeyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Key>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); Key responseCallSettings = await client.UpdateKeyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Key responseCancellationToken = await client.UpdateKeyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
// Override the key press event from Xsharp. protected override bool OnKeyPress(KeyName key, ModifierMask modifiers, String str) { if (base.OnKeyPress(key, modifiers, str)) { return(true); } bool processed = false; if (sink != null) { // Emit the "KeyDown" event. ToolkitKeys keyData = DrawingWindow.MapKey(key, modifiers); if (sink.ToolkitKeyDown(keyData)) { processed = true; } // Emit the "KeyChar" event if necessary. if (str != null) { foreach (char ch in str) { // Clean old ASCII DEL (0x7F) if (ch != (char)0x7F) { if (sink.ToolkitKeyChar(ch)) { processed = true; } } } } } return(processed); }
// Use this for initialization void Start() { string LevelName = PlayerPrefs.GetString("LoadLevel"); int LevelCount = PlayerPrefs.GetInt("LoadLevelINT"); switch (LevelCount) { case 1: NameText.text = "Level 1"; InfoText.text = "Hello, world"; break; default: NameText.text = "关卡" + LevelCount.ToString(); InfoText.text = "暂无信息"; break; } scoreSaver = new ScoreSaver(Application.persistentDataPath + "/gamesave"); TipText.text = "点击屏幕/键盘<i>" + KeyName.GetKeyName(scoreSaver.Key_OverView) + "</i>(俯视)/手柄(<i>A</i>)继续"; //这里清空几个静态类对象 //然后异步加载场景 StartCoroutine(MyLoad(LevelName)); }
/// <summary> /// Инициализация текущих значений параметрами из сейв-файла. /// Если в старой версии сейва нет какого-либо свойства, котрое есть в новой версии сейва, /// то этому свойству в новом сейве будет присвоено значение по-умолчанию вместо null. /// Так сделано для обратной совместимости разных версий сейвов. /// </summary> /// <param name="oldSaver">Сохраненный на диске десериализованный файл</param> private void Initialize(SaveManager oldSaver) { try { foreach (object keyName in oldSaver.optionsManager.controlOptions.keyButtons.Keys) { if (keyName is KeyName) { KeyName kn = (KeyName)keyName; optionsManager.controlOptions.keyButtons.Add(kn, oldSaver.optionsManager.controlOptions.keyButtons[kn]); } } } catch (Exception) { } optionsManager.controlOptions.mouseSensitivityX = oldSaver.optionsManager.controlOptions.mouseSensitivityX; optionsManager.controlOptions.mouseSensitivityY = oldSaver.optionsManager.controlOptions.mouseSensitivityY; optionsManager.graphicsOptions.antialiasing = oldSaver.optionsManager.graphicsOptions.antialiasing; optionsManager.graphicsOptions.isFullscreen = oldSaver.optionsManager.graphicsOptions.isFullscreen; optionsManager.graphicsOptions.resolution = oldSaver.optionsManager.graphicsOptions.resolution; optionsManager.graphicsOptions.textureQuality = oldSaver.optionsManager.graphicsOptions.textureQuality; optionsManager.graphicsOptions.vSync = oldSaver.optionsManager.graphicsOptions.vSync; optionsManager.musicOptions.musicVolume = oldSaver.optionsManager.musicOptions.musicVolume; }
public static int GetNumber(KeyName key, int defaultNum) { try { string numString = GetConfigurationValue(key); int num = int.Parse(numString); return num; } catch { return defaultNum; } }
public static bool SetConfigurationValue(KeyName key, string value) { try { if (!File.Exists(PublicConfigFilePath)) { CopyConfigFile(); ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = PublicConfigFilePath }; config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); appSection = config.AppSettings; SetConfigurationValue(KeyName.version, Assembly.GetEntryAssembly().GetName().Version.ToString()); } if (appSection.Settings.AllKeys.Contains(key.ToString())) { appSection.Settings[key.ToString()].Value = value; } else { appSection.Settings.Add(key.ToString(), value); } config.Save(); return true; } catch { } return false; }
// Dispatch a key release event to this widget from the top-level window. internal bool DispatchKeyReleaseEvent(KeyName key, ModifierMask modifiers) { if(FullSensitive) { return OnKeyRelease(key, modifiers); } else { return false; } }
// Dispatch a key event to this widget from the top-level window. internal bool DispatchKeyEvent(KeyName key, ModifierMask modifiers, String str) { if(FullSensitive) { return OnKeyPress(key, modifiers, str); } else { return false; } }
public static extern bool SetLightingForKeyWithKeyNameCode(KeyName keyCode, int redPercentage, int greenPercentage, int bluePercentage);
/// <summary> /// Initializes a new instance of the RegenerateKeyParameters class. /// </summary> /// <param name="keyName">key name to generate (Key1|Key2). Possible /// values include: 'Key1', 'Key2'</param> public RegenerateKeyParameters(KeyName keyName) { KeyName = keyName; CustomInit(); }
public static string GetConfigurationValue_AES(KeyName key) { try { string base64String = GetConfigurationValue(key); return DecryptText(base64String, "abcd_o82349834jefhdfer8&");//GetConfigurationValue(KeyName.s01)); } catch { return ""; } }
// Override the key release event from Xsharp. protected override bool OnKeyRelease(KeyName key, ModifierMask modifiers) { if(sink != null) { // Emit the "KeyUp" event. ToolkitKeys keyData = DrawingWindow.MapKey(key, modifiers); return sink.ToolkitKeyUp(keyData); } return false; }
// Override the key press event from Xsharp. protected override bool OnKeyPress(KeyName key, ModifierMask modifiers, String str) { bool processed = false; if(sink != null) { // Emit the "KeyDown" event. ToolkitKeys keyData = DrawingWindow.MapKey(key, modifiers); if(sink.ToolkitKeyDown(keyData)) { processed = true; } // Emit the "KeyChar" event if necessary. if(str != null) { foreach(char ch in str) { if(sink.ToolkitKeyChar(ch)) { processed = true; } } } } return processed; }
public static bool SetConfigurationValue_AES(KeyName key, string value) { try { return SetConfigurationValue(key, EncryptText(value, "abcd_o82349834jefhdfer8&"));//GetConfigurationValue(KeyName.s01))); } catch { } return false; }
static byte[] GetBytes(KeyName key, int size) { string value = GetConfigurationValue(key); byte[] bytes = new byte[size]; if (string.IsNullOrEmpty(value)) { Random rand = new Random(); rand.NextBytes(bytes); value = Convert.ToBase64String(bytes); SetConfigurationValue(key, value); } bytes = Convert.FromBase64String(value); return bytes; }
/// <summary> /// Regenerates the access keys for the specified storage account. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.Storage.IStorageAccountOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group within the user’s /// subscription. /// </param> /// <param name='accountName'> /// Required. The name of the storage account within the specified /// resource group. Storage account names must be between 3 and 24 /// characters in length and use numbers and lower-case letters only. /// </param> /// <param name='regenerateKey'> /// Required. Specifies name of the key which should be regenerated. /// </param> /// <returns> /// The RegenerateKey operation response. /// </returns> public static StorageAccountRegenerateKeyResponse RegenerateKey(this IStorageAccountOperations operations, string resourceGroupName, string accountName, KeyName regenerateKey) { return Task.Factory.StartNew((object s) => { return ((IStorageAccountOperations)s).RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey); } , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
/// <summary> /// Regenerates the access keys for the specified storage account. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.Storage.IStorageAccountOperations. /// </param> /// <param name='resourceGroupName'> /// Required. The name of the resource group within the user’s /// subscription. /// </param> /// <param name='accountName'> /// Required. The name of the storage account within the specified /// resource group. Storage account names must be between 3 and 24 /// characters in length and use numbers and lower-case letters only. /// </param> /// <param name='regenerateKey'> /// Required. Specifies name of the key which should be regenerated. /// </param> /// <returns> /// The RegenerateKey operation response. /// </returns> public static Task<StorageAccountRegenerateKeyResponse> RegenerateKeyAsync(this IStorageAccountOperations operations, string resourceGroupName, string accountName, KeyName regenerateKey) { return operations.RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey, CancellationToken.None); }
/// <summary> /// Regenerates the specified account key for the specified Cognitive Services /// account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='accountName'> /// The name of Cognitive Services account. /// </param> /// <param name='keyName'> /// key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' /// </param> public static ApiKeys RegenerateKey(this IAccountsOperations operations, string resourceGroupName, string accountName, KeyName keyName) { return(operations.RegenerateKeyAsync(resourceGroupName, accountName, keyName).GetAwaiter().GetResult()); }
// Map an Xsharp key description into a "ToolkitKeys" value. internal static ToolkitKeys MapKey(KeyName key, ModifierMask modifiers) { ToolkitKeys toolkitKey = ToolkitKeys.None; if((modifiers & ModifierMask.ControlMask) != 0) { toolkitKey |= ToolkitKeys.Control; } if((modifiers & ModifierMask.ShiftMask) != 0) { toolkitKey |= ToolkitKeys.Shift; } if((modifiers & ModifierMask.Mod1Mask) != 0) { toolkitKey |= ToolkitKeys.Alt; } return toolkitKey; }
/// <summary> /// Regenerates the specified account key for the specified Cognitive Services /// account. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='resourceGroupName'> /// The name of the resource group. The name is case insensitive. /// </param> /// <param name='accountName'> /// The name of Cognitive Services account. /// </param> /// <param name='keyName'> /// key name to generate (Key1|Key2). Possible values include: 'Key1', 'Key2' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ApiKeys> RegenerateKeyAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, KeyName keyName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, accountName, keyName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// <para>Method that is called if a key is pressed when this /// widget has the focus.</para> /// </summary> /// /// <param name="key"> /// <para>The key code.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> /// /// <param name="str"> /// <para>The translated string that corresponds to the key, or /// <see langword="null"/> if the key does not have a translation.</para> /// </param> /// /// <returns> /// <para>Returns <see langword="true"/> if the key has been processed /// and it should not be passed further up the focus tree. Returns /// <see langword="false"/> if the key should be passed further up /// the focus tree.</para> /// </returns> /// /// <remarks>The <paramref name="key"/> parameter indicates the X11 /// symbol that corresponds to the key, which allows cursor control /// and function keys to be easily distinguished. The /// <paramref name="str"/> is primarily of use to text /// input widgets.</remarks> protected virtual bool OnKeyPress(KeyName key, ModifierMask modifiers, String str) { // Nothing to do in this class. return false; }
public static string GetConfigurationValue(KeyName key) { try { return appSection.Settings[key.ToString()].Value; } catch { return ""; } }
/// <summary> /// <para>Method that is called if a key is released when this /// widget has the focus.</para> /// </summary> /// /// <param name="key"> /// <para>The key code.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> /// /// <returns> /// <para>Returns <see langword="true"/> if the key has been processed /// and it should not be passed further up the focus tree. Returns /// <see langword="false"/> if the key should be passed further up /// the focus tree.</para> /// </returns> protected virtual bool OnKeyRelease(KeyName key, ModifierMask modifiers) { // Nothing to do in this class. return false; }
// Map an Xsharp key description into a "ToolkitKeys" value. private static ToolkitKeys MapKey(KeyName key) { switch(key) { case KeyName.XK_BackSpace: return ToolkitKeys.Back; case KeyName.XK_Tab: return ToolkitKeys.Tab; case KeyName.XK_KP_Tab: return ToolkitKeys.Tab; case KeyName.XK_ISO_Left_Tab: return ToolkitKeys.Tab; case KeyName.XK_Linefeed: return ToolkitKeys.LineFeed; case KeyName.XK_Clear: return ToolkitKeys.Clear; case KeyName.XK_Return: return ToolkitKeys.Enter; case KeyName.XK_KP_Enter: return ToolkitKeys.Enter; case KeyName.XK_Pause: return ToolkitKeys.Pause; case KeyName.XK_Scroll_Lock: return ToolkitKeys.Scroll; case KeyName.XK_Escape: return ToolkitKeys.Escape; case KeyName.XK_Delete: return ToolkitKeys.Delete; case KeyName.XK_KP_Delete: return ToolkitKeys.Delete; case KeyName.XK_Home: return ToolkitKeys.Home; case KeyName.XK_KP_Home: return ToolkitKeys.Home; case KeyName.XK_Begin: return ToolkitKeys.Home; case KeyName.XK_KP_Begin: return ToolkitKeys.Home; case KeyName.XK_Left: return ToolkitKeys.Left; case KeyName.XK_KP_Left: return ToolkitKeys.Left; case KeyName.XK_Up: return ToolkitKeys.Up; case KeyName.XK_KP_Up: return ToolkitKeys.Up; case KeyName.XK_Right: return ToolkitKeys.Right; case KeyName.XK_KP_Right: return ToolkitKeys.Right; case KeyName.XK_Down: return ToolkitKeys.Down; case KeyName.XK_KP_Down: return ToolkitKeys.Down; case KeyName.XK_Prior: return ToolkitKeys.Prior; case KeyName.XK_KP_Prior: return ToolkitKeys.Prior; case KeyName.XK_Next: return ToolkitKeys.Next; case KeyName.XK_KP_Next: return ToolkitKeys.Next; case KeyName.XK_End: return ToolkitKeys.End; case KeyName.XK_KP_End: return ToolkitKeys.End; case KeyName.XK_Select: return ToolkitKeys.Select; case KeyName.XK_Print: return ToolkitKeys.Print; case KeyName.XK_Execute: return ToolkitKeys.Execute; case KeyName.XK_Insert: return ToolkitKeys.Insert; case KeyName.XK_KP_Insert: return ToolkitKeys.Insert; case KeyName.XK_Help: return ToolkitKeys.Help; case KeyName.XK_Num_Lock: return ToolkitKeys.NumLock; case KeyName.XK_space: return ToolkitKeys.Space; case KeyName.XK_KP_Space: return ToolkitKeys.Space; case KeyName.XK_F1: return ToolkitKeys.F1; case KeyName.XK_KP_F1: return ToolkitKeys.F1; case KeyName.XK_F2: return ToolkitKeys.F2; case KeyName.XK_KP_F2: return ToolkitKeys.F2; case KeyName.XK_F3: return ToolkitKeys.F3; case KeyName.XK_KP_F3: return ToolkitKeys.F3; case KeyName.XK_F4: return ToolkitKeys.F4; case KeyName.XK_KP_F4: return ToolkitKeys.F4; case KeyName.XK_F5: return ToolkitKeys.F5; case KeyName.XK_F6: return ToolkitKeys.F6; case KeyName.XK_F7: return ToolkitKeys.F7; case KeyName.XK_F8: return ToolkitKeys.F8; case KeyName.XK_F9: return ToolkitKeys.F9; case KeyName.XK_F10: return ToolkitKeys.F10; case KeyName.XK_F11: return ToolkitKeys.F11; case KeyName.XK_F12: return ToolkitKeys.F12; case KeyName.XK_F13: return ToolkitKeys.F13; case KeyName.XK_F14: return ToolkitKeys.F14; case KeyName.XK_F15: return ToolkitKeys.F15; case KeyName.XK_F16: return ToolkitKeys.F16; case KeyName.XK_F17: return ToolkitKeys.F17; case KeyName.XK_F18: return ToolkitKeys.F18; case KeyName.XK_F19: return ToolkitKeys.F19; case KeyName.XK_F20: return ToolkitKeys.F20; case KeyName.XK_F21: return ToolkitKeys.F21; case KeyName.XK_F22: return ToolkitKeys.F22; case KeyName.XK_F23: return ToolkitKeys.F23; case KeyName.XK_F24: return ToolkitKeys.F24; case KeyName.XK_KP_Multiply: return ToolkitKeys.Multiply; case KeyName.XK_KP_Add: return ToolkitKeys.Add; case KeyName.XK_KP_Separator: return ToolkitKeys.Separator; case KeyName.XK_KP_Subtract: return ToolkitKeys.Subtract; case KeyName.XK_KP_Decimal: return ToolkitKeys.Decimal; case KeyName.XK_KP_Divide: return ToolkitKeys.Divide; case KeyName.XK_KP_0: return ToolkitKeys.NumPad0; case KeyName.XK_KP_1: return ToolkitKeys.NumPad1; case KeyName.XK_KP_2: return ToolkitKeys.NumPad2; case KeyName.XK_KP_3: return ToolkitKeys.NumPad3; case KeyName.XK_KP_4: return ToolkitKeys.NumPad4; case KeyName.XK_KP_5: return ToolkitKeys.NumPad5; case KeyName.XK_KP_6: return ToolkitKeys.NumPad6; case KeyName.XK_KP_7: return ToolkitKeys.NumPad7; case KeyName.XK_KP_8: return ToolkitKeys.NumPad8; case KeyName.XK_KP_9: return ToolkitKeys.NumPad9; case KeyName.XK_Shift_L: return ToolkitKeys.LShiftKey; case KeyName.XK_Shift_R: return ToolkitKeys.RShiftKey; case KeyName.XK_Control_L: return ToolkitKeys.LControlKey; case KeyName.XK_Control_R: return ToolkitKeys.RControlKey; case KeyName.XK_Meta_L: case KeyName.XK_Alt_L: case KeyName.XK_Super_L: case KeyName.XK_Hyper_L: return ToolkitKeys.LMenu; case KeyName.XK_Meta_R: case KeyName.XK_Alt_R: case KeyName.XK_Super_R: case KeyName.XK_Hyper_R: return ToolkitKeys.RMenu; case KeyName.XK_Caps_Lock: return ToolkitKeys.CapsLock; case KeyName.XK_0: return ToolkitKeys.D0; case KeyName.XK_1: return ToolkitKeys.D1; case KeyName.XK_2: return ToolkitKeys.D2; case KeyName.XK_3: return ToolkitKeys.D3; case KeyName.XK_4: return ToolkitKeys.D4; case KeyName.XK_5: return ToolkitKeys.D5; case KeyName.XK_6: return ToolkitKeys.D6; case KeyName.XK_7: return ToolkitKeys.D7; case KeyName.XK_8: return ToolkitKeys.D8; case KeyName.XK_9: return ToolkitKeys.D9; case KeyName.XK_A: return ToolkitKeys.A; case KeyName.XK_B: return ToolkitKeys.B; case KeyName.XK_C: return ToolkitKeys.C; case KeyName.XK_D: return ToolkitKeys.D; case KeyName.XK_E: return ToolkitKeys.E; case KeyName.XK_F: return ToolkitKeys.F; case KeyName.XK_G: return ToolkitKeys.G; case KeyName.XK_H: return ToolkitKeys.H; case KeyName.XK_I: return ToolkitKeys.I; case KeyName.XK_J: return ToolkitKeys.J; case KeyName.XK_K: return ToolkitKeys.K; case KeyName.XK_L: return ToolkitKeys.L; case KeyName.XK_M: return ToolkitKeys.M; case KeyName.XK_N: return ToolkitKeys.N; case KeyName.XK_O: return ToolkitKeys.O; case KeyName.XK_P: return ToolkitKeys.P; case KeyName.XK_Q: return ToolkitKeys.Q; case KeyName.XK_R: return ToolkitKeys.R; case KeyName.XK_S: return ToolkitKeys.S; case KeyName.XK_T: return ToolkitKeys.T; case KeyName.XK_U: return ToolkitKeys.U; case KeyName.XK_V: return ToolkitKeys.V; case KeyName.XK_W: return ToolkitKeys.W; case KeyName.XK_X: return ToolkitKeys.X; case KeyName.XK_Y: return ToolkitKeys.Y; case KeyName.XK_Z: return ToolkitKeys.Z; case KeyName.XK_a: return ToolkitKeys.A; case KeyName.XK_b: return ToolkitKeys.B; case KeyName.XK_c: return ToolkitKeys.C; case KeyName.XK_d: return ToolkitKeys.D; case KeyName.XK_e: return ToolkitKeys.E; case KeyName.XK_f: return ToolkitKeys.F; case KeyName.XK_g: return ToolkitKeys.G; case KeyName.XK_h: return ToolkitKeys.H; case KeyName.XK_i: return ToolkitKeys.I; case KeyName.XK_j: return ToolkitKeys.J; case KeyName.XK_k: return ToolkitKeys.K; case KeyName.XK_l: return ToolkitKeys.L; case KeyName.XK_m: return ToolkitKeys.M; case KeyName.XK_n: return ToolkitKeys.N; case KeyName.XK_o: return ToolkitKeys.O; case KeyName.XK_p: return ToolkitKeys.P; case KeyName.XK_q: return ToolkitKeys.Q; case KeyName.XK_r: return ToolkitKeys.R; case KeyName.XK_s: return ToolkitKeys.S; case KeyName.XK_t: return ToolkitKeys.T; case KeyName.XK_u: return ToolkitKeys.U; case KeyName.XK_v: return ToolkitKeys.V; case KeyName.XK_w: return ToolkitKeys.W; case KeyName.XK_x: return ToolkitKeys.X; case KeyName.XK_y: return ToolkitKeys.Y; case KeyName.XK_z: return ToolkitKeys.Z; } return ToolkitKeys.None; }
/// <summary> /// <para>Method that is called if a key is pressed when this /// widget has the focus.</para> /// </summary> /// /// <param name="key"> /// <para>The key code.</para> /// </param> /// /// <param name="modifiers"> /// <para>Other button and shift flags that were active.</para> /// </param> /// /// <param name="str"> /// <para>The translated string that corresponds to the key, or /// <see langword="null"/> if the key does not have a translation.</para> /// </param> /// /// <returns> /// <para>Returns <see langword="true"/> if the key has been processed /// and it should not be passed further up the focus tree. Returns /// <see langword="false"/> if the key should be passed further up /// the focus tree.</para> /// </returns> /// /// <remarks>The <paramref name="key"/> parameter indicates the X11 /// symbol that corresponds to the key, which allows cursor control /// and function keys to be easily distinguished. The /// <paramref name="str"/> is primarily of use to text /// input widgets.</remarks> protected override bool OnKeyPress(KeyName key, ModifierMask modifiers, String str) { // Check for "Ctrl+F4" to close the active MDI child. // We also allow "Shift+F4" and "Mod4+F4" because some // window managers redirect "Ctrl+F4" for desktop switching. // "Mod4" is usually the "Windows" key on PC keyboards. if((key == KeyName.XK_F4 || key == KeyName.XK_KP_F4) && (modifiers & (ModifierMask.ControlMask | ModifierMask.ShiftMask | ModifierMask.Mod4Mask)) != 0) { if(activeChild != null) { activeChild.Child.Close(); } return true; } // Check for Ctrl+Tab and Ctrl+Shift+Tab. "Mod4" can be // used in place of "Ctrl", same as above. Windows also // allows "Ctrl+F6" to be used instead of "Ctrl+Tab". if((key == KeyName.XK_Tab || key == KeyName.XK_KP_Tab || key == KeyName.XK_F6) && (modifiers & (ModifierMask.ControlMask | ModifierMask.Mod4Mask)) != 0) { if((modifiers & ModifierMask.ShiftMask) != 0) { TabBackward(); } else { TabForward(); } return true; } if(key == KeyName.XK_ISO_Left_Tab && (modifiers & (ModifierMask.ControlMask | ModifierMask.Mod4Mask)) != 0) { TabBackward(); return true; } // We don't know what this key is. return false; }