public void DisableDevicesSimple() { // Mute the microphone. try { WindowsMicrophoneMuteLibrary.WindowsMicMute micMute = new WindowsMicMute(); micMute.MuteMic(); } catch (Exception ex) { Debug.WriteLine("Couldn't mute mic " + ex.Message); } this.devcon.StartInfo.Arguments = "disable =Image"; this.devcon.Start(); while (!this.devcon.StandardOutput.EndOfStream) { string line = this.devcon.StandardOutput.ReadLine(); Debug.WriteLine(line); } this.devcon.StartInfo.Arguments = "disable =MEDIA"; this.devcon.Start(); while (!this.devcon.StandardOutput.EndOfStream) { string line = this.devcon.StandardOutput.ReadLine(); Debug.WriteLine(line); } }
private static void Main() { var micMute = new WindowsMicMute(); if (micMute.IsMicMuted) { micMute.UnMuteMic(); } else { micMute.MuteMic(); } var micStatus = (micMute.IsMicMuted ? string.Empty : "un") + "muted"; try { CueSettingsSdk(micMute.IsMicMuted); } catch (Exception exception) { Console.WriteLine(exception.Message); } ToastNotification("Mic is " + micStatus, micStatus); }
public Form1() { //AllocConsole(); InitializeComponent(); LoadSettings(); _proc = HookCallback; _hookID = SetHook(_proc); theMic = new WindowsMicMute(); Console.WriteLine("Muting mic"); Mute(); lastPress = DateTime.Now.Ticks; }
public void EnableDevices() { try { WindowsMicrophoneMuteLibrary.WindowsMicMute micMute = new WindowsMicMute(); micMute.UnMuteMic(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } List <string> keysToRemove = new List <string>(); foreach (KeyValuePair <string, string> kvp in this.currentlyDisabledDeviceDictionary) { string uniqueID = this.GetUniqueID(kvp.Key); if (uniqueID.Length == 0) { throw new Exception("Unable to enable device, a unique id could not be found."); } this.devcon.StartInfo.Arguments = @"enable """ + uniqueID + @""""; this.devcon.Start(); while (!this.devcon.StandardOutput.EndOfStream) { string line = this.devcon.StandardOutput.ReadLine(); Debug.WriteLine(line); if (line.Contains(kvp.Key + ": Enabled")) { Debug.WriteLine("The device has been renabled. " + uniqueID); keysToRemove.Add(kvp.Key); } else { Debug.WriteLine("Unable to enable device : " + uniqueID); } } } if (keysToRemove.Count > 0) { foreach (string k in keysToRemove) { this.currentlyDisabledDeviceDictionary.Remove(k); } } }
public void DisableDevices(List <string> deviceNames = null) { // Mute the microphone. try { WindowsMicrophoneMuteLibrary.WindowsMicMute micMute = new WindowsMicMute(); micMute.MuteMic(); } catch (Exception ex) { Debug.WriteLine("Couldn't mute mic " + ex.Message); } if (deviceNames == null) { AddDefaultDevicesToDisable(); } else { KeyValuePair <string, string> deviceTemp; foreach (string name in deviceNames) { deviceTemp = FindDeviceByString(name); if (!deviceTemp.Equals(default(KeyValuePair <string, string>))) { AddDeviceToDisable(deviceTemp); } } } // Loops through the list of devices to disable, and disable with devcon. foreach (string deviceID in DisabledDeviceIDsToList()) { Debug.WriteLine("Attempting to disable " + deviceID); if (DisableDeviceByString(deviceID)) { Debug.WriteLine("Device disabled : " + deviceID); currentlyDisabledDeviceDictionary.Add(deviceID, FindDeviceNameByString(deviceID)); } else { Debug.WriteLine("Unable to disable device by string : " + deviceID); } } }
static void Main(string[] args) { slowMode = false; irc = new IRCClient("irc.twitch.tv", 6667, "twitch_username", "oauth:<your_token>"); irc.joinRoom(irc.getUsername()); Console.WriteLine("TwitchVOICE Chatbot [v1.0.0] ALPHA"); Console.WriteLine("---------------"); Console.WriteLine("Connected account: " + irc.getUsername()); mic = new WindowsMicMute(); engine = new SpeechRecognitionEngine(); commands = new Choices(); grammarBuilder = new GrammarBuilder(); commands.Add(new String[] { "open sub mode", "close sub mode", "sikerim", "ananı", "slow mode" }); grammarBuilder.Append(commands); grammer = new Grammar(grammarBuilder); engine.LoadGrammarAsync(grammer); engine.SetInputToDefaultAudioDevice(); engine.RecognizeAsync(RecognizeMode.Multiple); engine.SpeechRecognized += engineRecognized; while (true) { string message = irc.readMessage(); if (message.Contains("PRIVMSG")) { Int32 intIndexParseSign = message.IndexOf('!'); String username = message.Substring(1, intIndexParseSign - 1); intIndexParseSign = message.IndexOf(" :"); message = message.Substring(intIndexParseSign + 2); Console.WriteLine(username + ": " + message); if (username.Equals(irc.getUsername())) { if (message.Equals("!exit")) { irc.sendChatMessage("See you again guys! Have a nice day"); Environment.Exit(0); } } if (message.Contains("have fun")) { irc.sendChatMessage("Have fun to you @" + username + "!"); } if (message.Contains("low")) { irc.sendChatMessage("What did you say @" + username + " ?"); } if (message.Equals("hi") || message.Equals("s.a")) { irc.sendChatMessage("Hi @" + username + ", welcome!"); } if (message.Equals("!facebook")) { irc.sendChatMessage("https://facebook.com/<facebook_page>"); } if (message.Equals("!twitter")) { irc.sendChatMessage("https://twitter.com/alimsahy"); } foreach (String word in badWords) { if (message.Contains(word)) { irc.sendChatMessage("/timeout " + username + " 1"); irc.sendChatMessage("Watch your words... @" + username); } } } } }