Esempio n. 1
0
        void AddNode(Folder f, TreeNode n, ListViewCreateItem CreateListViewItem)
        {
            ListViewItem li = new ListViewItem(f.Name);
            li.Tag = f;
            li.SubItems.Add(f.EntryType);
            li.SubItems.Add("");
            li.SubItems.Add(f.ModifiedDate.ToString());
            li.ImageIndex = 0;
            li.Name = f.Name;
            TreeNode tn = new TreeNode(f.Name);
            tn.Name = f.Name;
            // Check our cache to see if we have cached this title ID

            string Label = Cache.CheckCache(f.FullPath);
            if (Label != null)
            {
                tn.Text += " | " + Label;
                li.SubItems.Add(Label);
            }

            if (f.IsTitleIDFolder)
            {
                if (Properties.Settings.Default.loadTIDNames)
                {
                    if (Cache.CheckCache(f.Name) != null)
                    {
                        tn.Text += " | " + Cache.CheckCache(f.Name);
                        li.SubItems.Add(Cache.CheckCache(f.Name));
                    }
                    // Didn't find it, need to grab that shit
                    else if (!f.IsKnownFolder )
                    {
                        if (f.GameName() != null && f.GameName() != "")
                        {
                            if (!f.IsKnownFolder)
                            {
                                Cache.AddID(f.Name, f.GameName());
                            }
                            tn.Text += " | " + f.GameName();
                            li.SubItems.Add(f.GameName());
                        }
                    }
                }

                if (Properties.Settings.Default.SaveIcons)
                {
                    // Getting the icon
                    if (!f.IsKnownFolder || f.Name.ToLower() == "FFFE07D1".ToLower())
                    {
                        if (!siL.Images.Keys.Contains(f.Name.ToUpper()))
                        {
                            // Check the cache for the icon
                            if (Cache.GetIcon(f.Name) != null)
                            {
                                treeView1.Invoke((MethodInvoker)delegate
                                {
                                    if (!siL.Images.ContainsKey(f.Name.ToUpper()))
                                    {
                                        siL.Images.Add(f.Name.ToUpper(), Cache.GetIcon(f.Name));
                                        liL.Images.Add(f.Name.ToUpper(), Cache.GetIcon(f.Name));
                                    }
                                    tn.ImageKey = f.Name.ToUpper();
                                    tn.SelectedImageKey = tn.ImageKey;
                                    li.ImageKey = f.Name.ToUpper();
                                });
                            }
                            else
                            {
                                if (f.GameIcon() != null)
                                {
                                    Cache.AddIcon(f.GameIcon(), f.Name);
                                    treeView1.Invoke((MethodInvoker)delegate
                                    {
                                        if (!siL.Images.ContainsKey(f.Name.ToUpper()))
                                        {
                                            siL.Images.Add(f.Name.ToUpper(), f.GameIcon());
                                            liL.Images.Add(f.Name.ToUpper(), f.GameIcon());
                                        }
                                        tn.ImageKey = f.Name.ToUpper();
                                        tn.SelectedImageKey = tn.ImageKey;
                                        li.ImageKey = f.Name.ToUpper();
                                    }
                                    );
                                }
                            }
                        }
                        else
                        {
                            tn.ImageKey = f.Name.ToUpper();
                            tn.SelectedImageKey = tn.ImageKey;
                            li.ImageKey = f.Name.ToUpper();
                        }
                    }
                        // For profile folders
                    else
                    {
                        Image I = Cache.GetIcon(f.Name);
                        if (I != null)
                        {
                            treeView1.Invoke((MethodInvoker)delegate
                            {
                                if (!siL.Images.ContainsKey(f.Name.ToUpper()))
                                {
                                    siL.Images.Add(f.Name.ToUpper(), I);
                                    liL.Images.Add(f.Name.ToUpper(), I);
                                }
                                tn.ImageKey = f.Name.ToUpper();
                                tn.SelectedImageKey = tn.ImageKey;
                                li.ImageKey = f.Name.ToUpper();
                            });
                        }
                        else
                        {
                            File FILE = f.IsProfileFolder();
                            if (FILE != null)
                            {
                                I = FILE.ContentIcon();
                                if (I != null)
                                {
                                    Cache.AddIcon(I, f.Name);
                                    if (!siL.Images.ContainsKey(f.Name.ToUpper()))
                                    {
                                        siL.Images.Add(f.Name.ToUpper(), I);
                                        liL.Images.Add(f.Name.ToUpper(), I);
                                    }
                                    tn.ImageKey = f.Name.ToUpper();
                                    tn.SelectedImageKey = tn.ImageKey;
                                    li.ImageKey = f.Name.ToUpper();
                                }
                            }
                        }
                    }
                }
            }
            tn.ToolTipText = tn.Text;
            tn.Tag = (Folder)f;
            treeView1.Invoke((MethodInvoker)delegate
            {
                n.Nodes.Add(tn);
                if (CreateListViewItem == ListViewCreateItem.DecideForMeNigga)
                {
                    if (((Folder)n.Tag).FullPath == treeView1.SelectedNode.RealPath())
                    {
                        listView1.Invoke((MethodInvoker)delegate { listView1.Items.Add(li); });
                    }
                }
                else if (CreateListViewItem == ListViewCreateItem.FuckYes)
                {
                    listView1.Invoke((MethodInvoker)delegate { listView1.Items.Add(li); });
                }
            });
        }
Esempio n. 2
0
 void AddFolder(Folder Parent)
 {
     listView1.Invoke((MethodInvoker)delegate
     {
         ListViewItem li = new ListViewItem(Parent.Name);
         li.Tag = Parent;
         ListViewItem.ListViewSubItem l1 = new ListViewItem.ListViewSubItem(li, Parent.EntryType);
         ListViewItem.ListViewSubItem l2 = new ListViewItem.ListViewSubItem(li, "");
         ListViewItem.ListViewSubItem l3 = new ListViewItem.ListViewSubItem(li, Parent.ModifiedDate.ToString());
         li.SubItems.Add(l1);
         li.SubItems.Add(l2);
         li.SubItems.Add(l3);
         if (stfsInfo.Checked && Parent.IsTitleIDFolder)
         {
             if (Parent.IsKnownFolder)
             {
                 for (int i = 0; i < CLKsFATXLib.VariousFunctions.Known.Length; i++)
                 {
                     if (Parent.Name.ToLower() == CLKsFATXLib.VariousFunctions.Known[i].ToLower())
                     {
                         ListViewItem.ListViewSubItem lsi = new ListViewItem.ListViewSubItem(li, CLKsFATXLib.VariousFunctions.KnownEquivilent[i]);
                         li.SubItems.Add(lsi);
                         break;
                     }
                 }
             }
             else
             {
                 ListViewItem.ListViewSubItem lsi = new ListViewItem.ListViewSubItem(li, Parent.GameName());
                 li.SubItems.Add(lsi);
             }
         }
         else
         {
             ListViewItem.ListViewSubItem lsi = new ListViewItem.ListViewSubItem(li, "");
             li.SubItems.Add(lsi);
         }
         ListViewItem.ListViewSubItem l4 = new ListViewItem.ListViewSubItem(li, Parent.FullPath);
         li.SubItems.Add(l4);
         listView1.Invoke((MethodInvoker)delegate { listView1.Items.Add(li); });
     });
 }