Esempio n. 1
0
        private TreeIter AppendItem(TreeIter parent, DCP.Item item)
        {
            TreeIter existIter = FindInPack(item);
            if (!TreeIter.Zero.Equals(existIter))
                return existIter;

            // add item to list store of current folder
            if (parent.Equals(currentFolder)) {
                packTreeView.SelectAndFocus(
                    folderStore.AppendValues(item.IsFolder ? folderIcon : fileIcon, item.Name, item)
                );
            }

            // add item to tree store of current pack
            if (TreeIter.Zero.Equals(parent))
                return packStore.AppendValues(item);
            else
                return packStore.AppendValues(parent, item);
        }
Esempio n. 2
0
 private TreeIter FindInPack(DCP.Item item)
 {
     // find iter in tree store of current pack
     TreeIter foundIter = TreeIter.Zero;
     packStore.Foreach((model, path, iter) => {
         DCP.Item foundItem = packStore.GetValue(iter, 0) as DCP.Item;
         if (item.FullName.CompareTo(foundItem.FullName) == 0) {
             foundIter = iter;
             return true;
         }
         return false;
     });
     return foundIter;
 }
Esempio n. 3
0
        private bool InitDCP()
        {
            // init dcp file system from dgle
            try {
                dcp = new DCP();

                return true;
            } catch {
                CustomMessageDialog dlg = new CustomMessageDialog(
                    this, MessageType.Error, ButtonsType.Ok,
                    "Failed to load DCP file system from DGLE!");
                dlg.Ok += (sender, e) => Program.Stop();
                dlg.Show();

                return false;
            }
        }
Esempio n. 4
0
        private TreeIter FindInCurrentFolder(DCP.Item item)
        {
            // find iter in list store of current folder
            TreeIter foundIter = TreeIter.Zero;
            folderStore.Foreach((model, path, iter) => {
                DCP.Item foundItem = folderStore.GetValue(iter, 2) as DCP.Item;
                if (foundItem.FullName.CompareTo(item.FullName) == 0) {
                    foundIter = iter;
                    return true;
                }
                return false;
            });

            return foundIter;
        }