예제 #1
0
        private void LoadFileList(string dirPath, int selectID)
        {
            listBox.Items.Clear();
            if (selectID == 0)
            {
                List <string> filesList = Directory.GetFiles(dirPath).ToList().CustomSort().ToList();
                foreach (string a in filesList)
                {
                    Grid      nline = listBox.Items[listBox.Items.Add(CloneUsingXaml(nlist))] as Grid;
                    TextBlock t1    = nline.Children[0] as TextBlock;
                    t1.Text = System.IO.Path.GetFileName(a);
                    TextBlock t2 = nline.Children[1] as TextBlock;
                    t2.Text = File.ReadAllText(a);

                    Newtonsoft.Json.Linq.JArray b = idlist;
                    var c = b.FirstOrDefault(e => e["appid"].ToString() == t2.Text);
                    if (c != null)
                    {
                        TextBlock t3 = nline.Children[2] as TextBlock;
                        t3.Text = c["name"].ToString();
                    }
                    else
                    {
                        TextBlock t3 = nline.Children[2] as TextBlock;
                        t3.Text = "Error";
                    }
                }
            }
            else
            {
                int i = 0;
                foreach (int appId in configFile.profileList[selectID - 1].idList)
                {
                    Grid      nline = listBox.Items[listBox.Items.Add(CloneUsingXaml(nlist))] as Grid;
                    TextBlock t1    = nline.Children[0] as TextBlock;
                    t1.Text = i.ToString() + ".txt";
                    TextBlock t2 = nline.Children[1] as TextBlock;
                    t2.Text = appId.ToString();

                    Newtonsoft.Json.Linq.JArray b = idlist;
                    var c = b.FirstOrDefault(e => e["appid"].ToString() == t2.Text);
                    if (c != null)
                    {
                        TextBlock t3 = nline.Children[2] as TextBlock;
                        t3.Text = c["name"].ToString();
                    }
                    else
                    {
                        TextBlock t3 = nline.Children[2] as TextBlock;
                        t3.Text = "Error";
                    }
                    i++;
                }
            }
        }
예제 #2
0
        private void loadFromName()
        {
            if (idlist != null)
            {
                Newtonsoft.Json.Linq.JArray b = idlist;
                var c = b.FirstOrDefault(f => f["name"].ToString() == comboBox.Text);

                if (c != null)
                {
                    idbox.Text = c["appid"].ToString();
                }
            }
        }