public double getDouble(int counter) { string temp = workWithEndians(this.storage[counter]); Double2ulong d2ul = new Double2ulong(); string hex_input = temp.Substring(0, 16); ulong parsed = ulong.Parse(hex_input, NumberStyles.AllowHexSpecifier); d2ul.ul = parsed; return(d2ul.d); }
static void Main(string[] args) { const double min = 0.1d; const double max = 2.4d; long gameSensetivityRegistry = (long)Registry.GetValue("HKEY_CURRENT_USER\\Software\\Bennett Foddy\\Getting Over It", "MouseSensitivity_h2921938665", null); byte[] temp = BitConverter.GetBytes(gameSensetivityRegistry); Array.Reverse(temp); long reversed = BitConverter.ToInt64(temp, 0); string hex = string.Format("{0:X}", reversed); while (hex.Length < 16) { hex = "0" + hex; } Console.WriteLine("Hex Value: 0x" + hex); Double2ulong d2ul = new Double2ulong(); d2ul.ul = (ulong)gameSensetivityRegistry; double gamePrecent = d2ul.d; Console.WriteLine("Double Value: " + gamePrecent); double doublePrecent = (gamePrecent - min) / (max - min); double precent = (int)(doublePrecent * 10000) / 100d; Console.WriteLine("Game Sensetivity: " + precent + "%"); Console.Write("Enter your mouse DPI: "); try { int dpi = int.Parse(Console.ReadLine()); int edpi = (int)(dpi * gamePrecent); Console.WriteLine("eDIP: " + edpi); } catch { Console.WriteLine("Invalid DPI!"); } Console.WriteLine(); Console.WriteLine("Press any key to continue . . ."); Console.ReadKey(); }
public string setDouble(double value, int counter) { if (counter == 0) { return(this.storage[counter]); } Double2ulong d2ul = new Double2ulong(); d2ul.d = value; string conversion = string.Format("{0:X}", d2ul.ul); if (d2ul.d == 0) { conversion = "0000000000000000"; } conversion = conversion + workWithEndians(this.storage[counter]).Substring(16); this.storage[counter] = workWithEndians(conversion); return(this.storage[counter]); }