ParseMemoryLocation() public static method

public static ParseMemoryLocation ( string str ) : MemoryLocation
str string
return MemoryLocation
Esempio n. 1
0
        private static Tuple <Dictionary <string, UInt32>, Dictionary <string, MemoryLocation> > ParseAddresses()
        {
            var addresses = new Dictionary <string, UInt32>();
            var paths     = new Dictionary <string, MemoryLocation>();

            var results = new Tuple <Dictionary <string, uint>, Dictionary <string, MemoryLocation> >(addresses, paths);

            MemorySettings.Clear();
            using (StreamReader reader = new StreamReader(Constants.MemoryAddresses)) {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.Contains("="))
                    {
                        string[] split = line.Split('=');

                        string         key      = split[0].Trim().ToLower();
                        UInt32         value    = 0;
                        MemoryLocation location = MemoryLocation.ParseMemoryLocation(split[1]);
                        if (location != null)
                        {
                            paths.Add(key, location);
                        }
                        else if (!key.Contains("noparse") && UInt32.TryParse(split[1].Replace("0x", ""), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value))
                        {
                            addresses.Add(key, value);
                        }
                        else
                        {
                            key = key.Replace("noparse", "");
                            if (!MemorySettings.ContainsKey(key))
                            {
                                MemorySettings.Add(key, split[1]);
                            }
                        }
                    }
                }
            }
            return(results);
        }