private int InitKeyboard(uint KeyboardID, string KeyboardName, bool SuppressMessages = false) { if (SuppressMessages == false) { UpdateStatusMessage.ShowStatusMessage(4, "Searching for " + KeyboardName + " (" + KeyboardID.ToString("X") + ")"); } ; this.keyboardUsbDevice = this.GetDeviceHandle(0x1B1C, KeyboardID, 0x3); if (this.keyboardUsbDevice == IntPtr.Zero) { UpdateStatusMessage.ShowStatusMessage(3, KeyboardName + " not found"); return(1); } if (SuppressMessages == false) { UpdateStatusMessage.ShowStatusMessage(4, KeyboardName + " Found"); } ; if (isRestoringLighting == false) { // Construct XY lookup table if (InitiateLookupTable(SuppressMessages) == false) { UpdateStatusMessage.ShowStatusMessage(3, "An error occurred when attempting to initiate the keyboard"); return(1); } InitiateDrawTable(SuppressMessages); } return(0); }
public static void Watch() { InactivityStatusChanged.UpdateInactivity(0); uint idleTime; // Run the main watcher while (Program.WatchForInactivity == true) { idleTime = IdleTimeFinder.GetIdleTime(); if (Program.DevMode) { UpdateStatusMessage.ShowStatusMessage(1, "Inactive: " + idleTime); } // When inactivity timer pops, change layout and then enter a loop waiting for activity if ((IdleTimeFinder.GetIdleTime() / 1000) >= Program.InactivityTimeTrigger * 60 && Program.InactivityTimeTrigger > 0) { InactivityStatusChanged.UpdateInactivity(1); while ((idleTime / 1000) >= Program.InactivityTimeTrigger * 60) { idleTime = IdleTimeFinder.GetIdleTime(); Thread.Sleep(100); } InactivityStatusChanged.UpdateInactivity(2); } Thread.Sleep(100); } }
private static void CSCore_StopCapture() { UpdateStatusMessage.ShowStatusMessage(2, "Stopping Capture"); try { capture.Stop(); } catch { } CSCore_Cleanup(); }
private static void FftCalculated(object sender, FftEventArgs e) { int CanvasWidth = Program.MyCanvasWidth; byte[] fftData = new byte[fftLength]; KeyboardWriter KeyWriter = keyWriter; for (int i = 0; i < fftLength; i++) { double fftmag = Math.Sqrt((e.Result[i].Real * e.Result[i].Real) + (e.Result[i].Imaginary * e.Result[i].Imaginary)); fftData[i] = (byte)(fftmag); } keyWriter.Write(1, fftData, Program.StaticKeyColorsBytes, CanvasWidth); if (Program.LogLevel == 5) { UpdateStatusMessage.ShowStatusMessage(10, "Loop Time: " + sw.ElapsedMilliseconds); sw.Restart(); } ; if (Program.RefreshDelay > 0) { Thread.Sleep(Program.RefreshDelay); } ; }
private void InitiateDrawTable(bool SuppressMessages = false) { int PreviousKey = 0; int CurrentKey = 0; for (int y = 0; y < 7; y++) { for (int x = 0; x < 104; x++) { CurrentKey = ledMatrix[y, x]; if (CurrentKey == 255) { drawMatrix[y, x] = 0; } else { drawMatrix[y, x] = CurrentKey; }; PreviousKey = CurrentKey; } } if (SuppressMessages == false) { UpdateStatusMessage.ShowStatusMessage(4, "InitializeDrawTable Done"); } ; return; }
public void KeyboardControl() { if (Program.RunKeyboardThread != 11) { return; } ; UpdateStatusMessage.ShowStatusMessage(2, "Starting Heatmap"); // Raw Input Hook // http://www.codeproject.com/Articles/558413/Minimal-Key-Logger-Using-RAWINPUT //Program.InputHook = new RawInputHook(); Program.InputHook.OnRawInputFromKeyboard += InputFromKeyboard_Heatmap; KeyboardWriter keyWriter = new KeyboardWriter(); int sR = 0; int sG = 0; int sB = 0; int eR = 0; int eG = 0; int eB = 0; sR = Program.HeatmapColors.StartR; sG = Program.HeatmapColors.StartG; sB = Program.HeatmapColors.StartB; eR = Program.HeatmapColors.EndR; eG = Program.HeatmapColors.EndG; eB = Program.HeatmapColors.EndB; for (int i = 0; i < 144; i++) { keyMatrix[i] = new HeatmapKey( (byte)sR, (byte)sG, (byte)sB, (byte)eR, (byte)eG, (byte)eB); sendMatrix[i] = new StaticColorCollection(); } while (Program.RunKeyboardThread == 11) { for (int i = 0; i < 144; i++) { sendMatrix[i].SetD(keyMatrix[i].KeyColor); } keyWriter.Write(sendMatrix, true); Thread.Sleep(100); } Program.InputHook.OnRawInputFromKeyboard -= InputFromKeyboard_Heatmap; UpdateStatusMessage.ShowStatusMessage(2, "Stopping Heatmap"); }
private static void CSCore_Cleanup() { if (capture != null) { capture.Dispose(); capture = null; } UpdateStatusMessage.ShowStatusMessage(2, "Capture Destroyed"); }
private void UpdateMouse() { // Perform USB control message to keyboard // // Request Type: 0x21 // Request: 0x09 // Value 0x0300 // Index: 0x03 // Size: 64 this.dataPacket[0] = 0x07; this.dataPacket[1] = 0x22; this.dataPacket[2] = 0x04; this.dataPacket[3] = 0x01; // Light 1 this.dataPacket[4] = 0x01; this.dataPacket[5] = redValues[0]; this.dataPacket[6] = greenValues[0]; this.dataPacket[7] = blueValues[0]; // Light 2 this.dataPacket[8] = 0x02; this.dataPacket[9] = redValues[1]; this.dataPacket[10] = greenValues[1]; this.dataPacket[11] = blueValues[1]; // Light 3 this.dataPacket[12] = 0x03; this.dataPacket[13] = redValues[2]; this.dataPacket[14] = greenValues[2]; this.dataPacket[15] = blueValues[2]; // Light 4 this.dataPacket[16] = 0x04; this.dataPacket[17] = redValues[3]; this.dataPacket[18] = greenValues[3]; this.dataPacket[19] = blueValues[3]; if (this.SendUsbMessage(dataPacket) == false) { UpdateStatusMessage.ShowStatusMessage(3, "Mouse Packet Failed"); } ; Program.ThreadStatus = 1; }
private void SetLed(int x, int y, int r, int g, int b) { int led = this.ledMatrix[y, x]; if (led >= 144) { return; } if (r > 7) { r = 7; } if (g > 7) { g = 7; } if (b > 7) { b = 7; } /* The keyboard considers 7 as off, and 0 as maximum brightness, so invert values. * The selected M key, however, ignores this rule. Led 23 is M1, so apply this rule * to all keys but that one, and make sure that you have M1 selected during operation. */ if (led != 23) { r = 7 - r; g = 7 - g; b = 7 - b; } if (r > 7 || r < 0 || g > 7 || g < 0 || b > 7 || g < 0) { UpdateStatusMessage.ShowStatusMessage(3, "RGB Incorrect! (" + r + ", " + g + ", " + b + ")"); } this.redValues[led] = (byte)r; this.greenValues[led] = (byte)g; this.blueValues[led] = (byte)b; }
private int InitMouse(uint MouseID, string MouseName, bool SuppressMessages = false) { if (SuppressMessages == false) { UpdateStatusMessage.ShowStatusMessage(4, "Searching for " + MouseName + " (" + MouseID.ToString("X") + ")"); } ; this.mouseUsbDevice = this.GetDeviceHandle(0x1B1C, MouseID, 0x3); if (this.mouseUsbDevice == IntPtr.Zero) { UpdateStatusMessage.ShowStatusMessage(3, MouseName + " not found"); return(1); } if (SuppressMessages == false) { UpdateStatusMessage.ShowStatusMessage(4, MouseName + " Found"); } ; return(0); }
public KeyboardWriter(bool restoreLighting = false, bool SuppressMessages = false) { if (restoreLighting == true) { isRestoringLighting = true; InitKeyboard(Program.SettingsKeyboardID, Program.SettingsKeyboardModel); bool packet1success = SendUsbMessage(RestorePacket1); bool packet2success = SendUsbMessage(RestorePacket2); return; } if (InitKeyboard(Program.SettingsKeyboardID, Program.SettingsKeyboardModel, SuppressMessages) == 1) { Program.RunKeyboardThread = 0; return; } for (int i = 0; i < dataPacket.Length; i++) { this.dataPacket[i] = new byte[64]; } UpdateStatusMessage.ShowStatusMessage(10, "Running"); return; }
public void KeyboardControl() { if (Program.RunKeyboardThread != 10) { return; } ; UpdateStatusMessage.ShowStatusMessage(2, "Starting Reactive Typing"); // Raw Input Hook // http://www.codeproject.com/Articles/558413/Minimal-Key-Logger-Using-RAWINPUT //Program.InputHook = new RawInputHook(); Program.InputHook.OnRawInputFromKeyboard += InputFromKeyboard_SingleLight; KeyboardWriter keyWriter = new KeyboardWriter(); InitiateReactiveBackground(); while (Program.RunKeyboardThread == 10) { for (int i = 0; i < 144; i++) { sendMatrix[i].SetD(keyMatrix[i].KeyColor); keyMatrix[i].IncrementStep(); } keyWriter.Write(sendMatrix, true); Thread.Sleep(Program.ReactSettings.Frequency); } //Program.InputHook.OnRawInputFromKeyboard -= InputFromKeyboard_SingleLight; UpdateStatusMessage.ShowStatusMessage(2, "Stopping Reactive Typing"); }
public static void KeyboardControl(int captureType, MMDevice captureDevice) { if (Program.RunKeyboardThread == 1) { keyWriter = new KeyboardWriter(); while (Program.RunKeyboardThread == 1) { keyWriter.Write(-1, null, Program.StaticKeyColorsBytes, Program.TestLed); Thread.Sleep(20); } } else { Program.CSCore_CaptureStarted = false; switch (captureType) { case 0: capture = new WasapiLoopbackCapture(); break; case 1: capture = new WasapiCapture(); capture.Device = captureDevice; break; default: capture = new WasapiLoopbackCapture(); break; } capture.Initialize(); int captureSampleRate = capture.WaveFormat.SampleRate; switch (captureSampleRate) { case 48000: fftLength = 1024; break; case 96000: fftLength = 2048; break; case 192000: fftLength = 4096; break; default: fftLength = 1024; break; } sampleAggregator = new SampleAggregator(fftLength); CreateDeviceHandles(); Program.CSCore_NewDevice = false; keyWriter = new KeyboardWriter(); sw = new Stopwatch(); sw.Start(); // Start loop counting stopwatch if (Program.RunKeyboardThread != 0) { UpdateStatusMessage.ShowStatusMessage(2, "Starting Capture"); capture.Start(); } Program.CSCore_FirstStart = false; while (Program.CSCore_CaptureStarted == false) { if (Program.RunKeyboardThread != 2) { CSCore_StopCapture(); break; } ; } } }
public void InputFromKeyboard_SingleLight(RAWINPUTHEADER riHeader, RAWKEYBOARD riKeyboard) { if (riKeyboard.Flags == 0x0) { return; } ; if (riKeyboard.Flags == 0x2 && Control.IsKeyLocked(Keys.NumLock)) { return; } ; string s = ""; s = s + "0x" + riKeyboard.MakeCode.ToString("X4"); s = s + " 0x" + riKeyboard.VKey.ToString("X4"); // s = s + " Mssg: 0x" + riKeyboard.Message.ToString("X4"); s = s + " 0x" + riKeyboard.Flags.ToString("X4"); // s = s + " Rsrvd: 0x" + riKeyboard.Reserved.ToString("X4"); // s = s + " ExInf: 0x" + riKeyboard.ExtraInformation.ToString("X4"); // s = s + " Devc: 0x" + riHeader.hDevice.ToString("X4"); // s = s + " .Size: 0x" + riHeader.dwSize.ToString("X4"); // s = s + " .Type: 0x" + riHeader.dwType.ToString("X4"); // s = s + " wPara: 0x" + riHeader.wParam.ToString("X4"); System.Diagnostics.Debug.Write(s); UpdateStatusMessage.ShowStatusMessage(5, s); int currentKey = keys.GetKeyCode(riKeyboard.MakeCode, riKeyboard.VKey, riKeyboard.Flags, Control.IsKeyLocked(Keys.NumLock)); int sR = 0; int sG = 0; int sB = 0; int eR = 0; int eG = 0; int eB = 0; switch (Program.ReactTypeStart) { case 0: sR = Program.ReactColors.StartR; sG = Program.ReactColors.StartG; sB = Program.ReactColors.StartB; break; case 1: //Figure out how to make a rainbow here, probably going to need to rewrite SingleKeyFade classs break; case 2: sR = rnd.Next(Program.ReactColors.SRandRLow, Program.ReactColors.SRandRHigh); sG = rnd.Next(Program.ReactColors.SRandGLow, Program.ReactColors.SRandGHigh); sB = rnd.Next(Program.ReactColors.SRandBLow, Program.ReactColors.SRandBHigh); break; default: break; } switch (Program.ReactTypeEnd) { case 0: eR = Program.ReactColors.EndR; eG = Program.ReactColors.EndG; eB = Program.ReactColors.EndB; break; case 1: if (Program.StaticKeyColors[currentKey] != Color.Transparent) { eR = Program.StaticKeyColors[currentKey].R; eG = Program.StaticKeyColors[currentKey].G; eB = Program.StaticKeyColors[currentKey].B; } break; case 2: eR = rnd.Next(Program.ReactColors.ERandRLow, Program.ReactColors.ERandRHigh); eG = rnd.Next(Program.ReactColors.ERandGLow, Program.ReactColors.ERandGHigh); eB = rnd.Next(Program.ReactColors.ERandBLow, Program.ReactColors.ERandBHigh); break; default: break; } keyMatrix[currentKey] = new SingleKeyFade( Program.ReactSettings.Duration, (byte)sR, (byte)sG, (byte)sB, (byte)eR, (byte)eG, (byte)eB); }
private void UpdateRgbKeyboard() { // Perform USB control message to keyboard // // Request Type: 0x21 // Request: 0x09 // Value 0x0300 // Index: 0x03 // Size: 64 this.dataPacket[0][0] = 0x7F; this.dataPacket[0][1] = 0x01; this.dataPacket[0][2] = 0x3C; this.dataPacket[1][0] = 0x7F; this.dataPacket[1][1] = 0x02; this.dataPacket[1][2] = 0x3C; this.dataPacket[2][0] = 0x7F; this.dataPacket[2][1] = 0x03; this.dataPacket[2][2] = 0x3C; this.dataPacket[3][0] = 0x7F; this.dataPacket[3][1] = 0x04; this.dataPacket[3][2] = 0x24; this.dataPacket[4][0] = 0x07; this.dataPacket[4][1] = 0x27; this.dataPacket[4][4] = 0xD8; for (int i = 0; i < 60; i++) { this.dataPacket[0][i + 4] = (byte)(this.redValues[i * 2 + 1] << 4 | this.redValues[i * 2]); } for (int i = 0; i < 12; i++) { this.dataPacket[1][i + 4] = (byte)(this.redValues[i * 2 + 121] << 4 | this.redValues[i * 2 + 120]); } for (int i = 0; i < 48; i++) { this.dataPacket[1][i + 16] = (byte)(this.greenValues[i * 2 + 1] << 4 | this.greenValues[i * 2]); } for (int i = 0; i < 24; i++) { this.dataPacket[2][i + 4] = (byte)(this.greenValues[i * 2 + 97] << 4 | this.greenValues[i * 2 + 96]); } for (int i = 0; i < 36; i++) { this.dataPacket[2][i + 28] = (byte)(this.blueValues[i * 2 + 1] << 4 | this.blueValues[i * 2]); } for (int i = 0; i < 36; i++) { this.dataPacket[3][i + 4] = (byte)(this.blueValues[i * 2 + 73] << 4 | this.blueValues[i * 2 + 72]); } for (int i = 36; i < 60; i++) { this.dataPacket[3][i + 4] = (byte)0; } for (int i = 0; i < 60; i++) { this.dataPacket[4][i + 4] = (byte)0; } for (int p = 0; p < 5; p++) { if (this.SendUsbMessage(dataPacket[p]) == false) { UpdateStatusMessage.ShowStatusMessage(3, "Packet " + p + " Failed"); UpdateStatusMessage.ShowStatusMessage(3, "Packet " + p + " Failed"); } ; Program.ThreadStatus = 1; } }
public static void KeyboardControl() { if (Program.RunKeyboardThread != 3) { return; } ; UpdateStatusMessage.ShowStatusMessage(2, "Starting Effects"); KeyboardWriter keyWriter = new KeyboardWriter(); SingleKeyFade[] keyMatrix = new SingleKeyFade[148]; StaticColorCollection[] sendMatrix = new StaticColorCollection[144]; MouseWriter mouseWriter = new MouseWriter(); MouseColorCollection[] mouseMatrix = new MouseColorCollection[4]; Random rnd = new Random(); for (int i = 0; i < 144; i++) { keyMatrix[i] = new SingleKeyFade(Program.EfSettings.Duration, 0, 0, 0); sendMatrix[i] = new StaticColorCollection(); } for (int i = 144; i < 148; i++) { keyMatrix[i] = new SingleKeyFade(Program.EfSettings.Duration, 0, 0, 0); mouseMatrix[i - 144] = new MouseColorCollection(); } while (Program.RunKeyboardThread == 3) { int keyToLight = rnd.Next(0, 148); // Try 20 times to find a key that is finished its animation. // If a key can't be found, give up and run another cycle. for (int r = 0; r < 20; r++) { if (keyMatrix[keyToLight].EffectInProgress == false) { switch (Program.EfColors.Mode) { case 1: keyMatrix[keyToLight] = new SingleKeyFade( Program.EfSettings.Duration, (byte)Program.EfColors.StartR, (byte)Program.EfColors.StartG, (byte)Program.EfColors.StartB, (byte)Program.EfColors.EndR, (byte)Program.EfColors.EndG, (byte)Program.EfColors.EndB); break; case 2: keyMatrix[keyToLight] = new SingleKeyFade( Program.EfSettings.Duration, (byte)rnd.Next(Program.EfColors.SRandRLow, Program.EfColors.SRandRHigh), (byte)rnd.Next(Program.EfColors.SRandGLow, Program.EfColors.SRandGHigh), (byte)rnd.Next(Program.EfColors.SRandBLow, Program.EfColors.SRandBHigh), (byte)Program.EfColors.EndR, (byte)Program.EfColors.EndG, (byte)Program.EfColors.EndB); break; case 3: keyMatrix[keyToLight] = new SingleKeyFade( Program.EfSettings.Duration, (byte)Program.EfColors.StartR, (byte)Program.EfColors.StartG, (byte)Program.EfColors.StartB, (byte)rnd.Next(Program.EfColors.ERandRLow, Program.EfColors.ERandRHigh), (byte)rnd.Next(Program.EfColors.ERandGLow, Program.EfColors.ERandGHigh), (byte)rnd.Next(Program.EfColors.ERandBLow, Program.EfColors.ERandBHigh)); break; case 4: keyMatrix[keyToLight] = new SingleKeyFade( Program.EfSettings.Duration, (byte)rnd.Next(Program.EfColors.SRandRLow, Program.EfColors.SRandRHigh), (byte)rnd.Next(Program.EfColors.SRandGLow, Program.EfColors.SRandGHigh), (byte)rnd.Next(Program.EfColors.SRandBLow, Program.EfColors.SRandBHigh), (byte)rnd.Next(Program.EfColors.ERandRLow, Program.EfColors.ERandRHigh), (byte)rnd.Next(Program.EfColors.ERandGLow, Program.EfColors.ERandGHigh), (byte)rnd.Next(Program.EfColors.ERandBLow, Program.EfColors.ERandBHigh)); break; } break; } } for (int i = 0; i < 144; i++) { if (Program.AnimationsUseStaticKeys == true && Program.StaticKeyColorsBytes[i].Transparent == false) { sendMatrix[i].Set(Program.StaticKeyColorsBytes[i].KeyColor); } else { sendMatrix[i].SetD(keyMatrix[i].KeyColor); } keyMatrix[i].IncrementStep(); } for (int i = 144; i < 148; i++) { mouseMatrix[i - 144].Set(keyMatrix[i].KeyColor); keyMatrix[i].IncrementStep(); } keyWriter.Write(sendMatrix, true); if (Program.IncludeMouseInEffects) { if (!Program.AnimationsUseStaticKeys) { mouseWriter.Write(mouseMatrix, true); } else { mouseWriter.Write(Program.MouseColors, true); }; } ; Thread.Sleep(Program.EfSettings.Frequency); } UpdateStatusMessage.ShowStatusMessage(2, "Stopping Effects"); }
private bool InitiateLookupTable(bool SuppressMessages = false) { var keys = Program.MyPositionMap.GetEnumerator(); keys.MoveNext(); var sizes = Program.MySizeMap.GetEnumerator(); sizes.MoveNext(); for (int y = 0; y < 7; y++) { byte key = 0x00; int size = 0; for (int x = 0; x < Program.MyCanvasWidth; x++) { if (size == 0) { try { float sizef = (float)sizes.Current; sizes.MoveNext(); if (sizef < 0) { size = (int)(-sizef * 4); key = 255; } else { //UpdateStatusMessage.ShowStatusMessage(6, "x: " + x + " y: " + y + " key: " + keys.Current); key = (byte)keys.Current; keys.MoveNext(); size = (int)(sizef * 4); } } catch { UpdateStatusMessage.ShowStatusMessage(3, "Enumeration Failed"); return(false); } } ledMatrix[y, x] = key; size--; } if ((byte)keys.Current != 255 || (float)sizes.Current != 0f) { UpdateStatusMessage.ShowStatusMessage(4, "Bad line: " + keys.Current + ", " + sizes.Current + " Key " + key + "." + y); } else { //UpdateStatusMessage.ShowStatusMessage(5, "Row Okay: " + keys.Current + ", " + sizes.Current + " Key " + key + "." + y); } keys.MoveNext(); sizes.MoveNext(); } if (SuppressMessages == false) { UpdateStatusMessage.ShowStatusMessage(4, "InitializeLookupTable Done"); } ; return(true); }
private void UpdateStrafeRgbKeyboard() { var packets = new byte[12][]; for (var i = 0; i < packets.Length; ++i) { packets[i] = new byte[64]; } var j = 0; while (j < 12) { packets[j][0] = 127; packets[j][1] = 1; packets[j][2] = 60; packets[j + 1][0] = 127; packets[j + 1][1] = 2; packets[j + 1][2] = 60; packets[j + 2][0] = 127; packets[j + 2][1] = 3; packets[j + 2][2] = 48; packets[j + 3][0] = 7; packets[j + 3][1] = 40; packets[j + 3][3] = 3; j += 4; } packets[3][2] = 1; packets[3][4] = 1; packets[7][2] = 2; packets[7][4] = 1; packets[11][2] = 3; packets[11][4] = 2; for (var i = 0; i < 60; ++i) { packets[0][i + 4] = redValues[i]; packets[4][i + 4] = greenValues[i]; packets[8][i + 4] = blueValues[i]; } for (var i = 0; i < 60; ++i) { packets[1][i + 4] = redValues[i + 60]; packets[5][i + 4] = greenValues[i + 60]; packets[9][i + 4] = blueValues[i + 60]; } for (var i = 0; i < 24; ++i) { packets[2][i + 4] = redValues[i + 120]; packets[6][i + 4] = greenValues[i + 120]; packets[10][i + 4] = blueValues[i + 120]; } for (var i = 0; i < 12; ++i) { var packet = packets[i]; if (!SendUsbMessage(packet)) { UpdateStatusMessage.ShowStatusMessage(3, "Packet " + packet + " Failed"); } Program.ThreadStatus = 1; } }
public KeyColors LoadProfile(string xmlPath) { KeyColors keyData = new KeyColors(); XmlDocument doc = new XmlDocument(); doc.Load(xmlPath); XmlElement root = doc.DocumentElement; XmlNodeList keys = root.SelectNodes("key"); XmlNodeList mouses = root.SelectNodes("mouse"); try { string keyboardID = root.Attributes["keyboard"].Value; } catch { UpdateStatusMessage.ShowStatusMessage(3, "Failed to load profile."); keyData.Success = false; return(keyData); } Color tempColor = new Color(); int k = 0; int m = 0; foreach (XmlNode key in keys) { if (key.Name == "key") { if (key.InnerText == "Transparent") { keyData.Colors[k] = Color.Transparent; } else { tempColor = ColorTranslator.FromHtml(key.InnerText); keyData.Colors[k] = Color.FromArgb(127, tempColor.R, tempColor.G, tempColor.B); } k++; } } foreach (XmlNode mouse in mouses) { if (mouse.Name == "mouse") { if (mouse.InnerText == "Transparent") { keyData.Colors[m + 144] = Color.Transparent; } else { keyData.Colors[m + 144] = ColorTranslator.FromHtml(mouse.InnerText); } m++; } ; } keyData.Success = true; return(keyData); }