Ejemplo n.º 1
0
        public static Dictionary <string, NavBar> GetAllAvailable()
        {
            Dictionary <string, NavBar> dic = new Dictionary <string, NavBar>();
            NavBar curr = null;

            foreach (string item in Directory.EnumerateFiles("./res/navbars", "nav_*.xml"))
            {
                using (XmlReader reader = XmlReader.Create(item))
                {
                    while (reader.Read())
                    {
                        if (reader.IsStartElement())
                        {
                            switch (reader.Name)
                            {
                            case "navbar":
                                curr = new NavBar();
                                break;

                            case "id":
                                reader.Read();
                                curr.id = reader.Value;
                                break;

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

                            case "btn_recent":
                                reader.Read();
                                curr.buttonRecent = Image.FromFile("./res/navbars/" + reader.Value);
                                break;

                            case "btn_home":
                                reader.Read();
                                curr.buttonHome = Image.FromFile("./res/navbars/" + reader.Value);
                                break;

                            case "btn_back":
                                reader.Read();
                                curr.buttonBack = Image.FromFile("./res/navbars/" + reader.Value);
                                break;

                            case "bgcolor":
                                reader.Read();
                                curr.bgColor = ColorTranslator.FromHtml(reader.Value);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                    dic.Add(curr.id, curr);
                }
            }

            return(dic);
        }
Ejemplo n.º 2
0
        public static Dictionary<string, NavBar> GetAllAvailable()
        {
            Dictionary<string, NavBar> dic = new Dictionary<string, NavBar>();
            NavBar curr = null;

            foreach (string item in Directory.EnumerateFiles("./res/navbars", "nav_*.xml"))
            {
                using (XmlReader reader = XmlReader.Create(item))
                {
                    while(reader.Read())
                    {
                        if (reader.IsStartElement())
                        {
                            switch (reader.Name)
                            {
                                case "navbar":
                                    curr = new NavBar();
                                    break;
                                case "id":
                                    reader.Read();
                                    curr.id = reader.Value;
                                    break;
                                case "name":
                                    reader.Read();
                                    curr.name = reader.Value;
                                    break;
                                case "btn_recent":
                                    reader.Read();
                                    curr.buttonRecent = Image.FromFile("./res/navbars/" + reader.Value);
                                    break;
                                case "btn_home":
                                    reader.Read();
                                    curr.buttonHome = Image.FromFile("./res/navbars/" + reader.Value);
                                    break;
                                case "btn_back":
                                    reader.Read();
                                    curr.buttonBack = Image.FromFile("./res/navbars/" + reader.Value);
                                    break;
                                case "bgcolor":
                                    reader.Read();
                                    curr.bgColor = ColorTranslator.FromHtml(reader.Value);
                                    break;
                                default:
                                    break;
                            }
                        }
                    }
                    dic.Add(curr.id, curr);
                }
            }

            return dic;
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 private void frmScreenshot_Load(object sender, EventArgs e)
 {
     Dictionary<string, NavBar> navBars = NavBar.GetAllAvailable();
     navBar1.NavBar = navBars.Values.First();
 }