Exemple #1
0
        public static Device LoadInstalled(string name)
        {
            if (!File.Exists("./res/devices/" + name + ".xml"))
            {
                return(null);
            }

            Dictionary <string, NavBar> navs = NavBar.GetAllAvailable();
            Device dev = new Device();

            dev.navBar = navs["stk_lollipop"];

            using (XmlReader reader = XmlReader.Create("./res/devices/" + name + ".xml"))
            {
                while (reader.Read())
                {
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                        case "id":
                            reader.Read();
                            dev.id = reader.Value;
                            break;

                        case "name":
                            reader.Read();
                            dev.name = reader.Value;
                            break;

                        case "vendor":
                            reader.Read();
                            dev.vendor = reader.Value;
                            break;

                        case "navbarid":
                            reader.Read();
                            NavBar t = null;
                            if (navs.TryGetValue(reader.Value, out t))
                            {
                                dev.navBar = NavBar.GetAllAvailable()[reader.Value];
                            }
                            break;

                        case "res":
                            reader.Read();
                            string[] s = reader.Value.Split('x');
                            dev.resolution = new Size(int.Parse(s[0]), int.Parse(s[1]));
                            break;

                        case "rem_scale":
                            reader.Read();
                            dev.scale = float.Parse(reader.Value);
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            return(dev);
        }
Exemple #2
0
 private void frmScreenshot_Load(object sender, EventArgs e)
 {
     Dictionary<string, NavBar> navBars = NavBar.GetAllAvailable();
     navBar1.NavBar = navBars.Values.First();
 }