aboutsummaryrefslogtreecommitdiff
path: root/TimeHACK.Engine/DesktopController.cs
blob: 6ccc4c1d779be58c4a1231d8a2e602040bf66aa2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;


namespace TimeHACK.Engine
{
    public static class DesktopController
    {
        public static void RefreshDesktopIcons(ListViewItem[] baseIcons, ref ListView theView, string theDirectory)
        {
            theView.Items.Clear(); // This resets it to it's default
            theView.Items.AddRange(baseIcons);

            foreach (string dir in Directory.GetDirectories(theDirectory))
            {
                theView.Items.Add(Path.GetFileName(dir));
                theView.FindItemWithText(Path.GetFileName(dir)).ImageIndex = 1;
            }

            foreach (string dir in Directory.GetFiles(theDirectory))
            {
                theView.Items.Add(Path.GetFileName(dir));
                theView.FindItemWithText(Path.GetFileName(dir)).ImageIndex = 12;
            }
        }
    }
}