Пример #1
0
        void AfterSelect()
        {
            listView1.Items.Clear();

            System.IO.DirectoryInfo clicked = new System.IO.DirectoryInfo((string)treeView1.SelectedNode.Tag);
            foreach (System.IO.DirectoryInfo di in clicked.GetDirectories())
            {
                ListViewItem li = new ListViewItem(di.Name);
                li.SubItems.Add("File Folder");
                li.SubItems.Add("");
                li.SubItems.Add(di.LastWriteTime.ToString());
                li.SubItems.Add((VariousFunctions.IsTitleIDFolder(di.Name)) ? Party_Buffalo.Cache.CheckCache(di.Name) : "");
                li.Tag        = new object[] { di.FullName, true };
                li.ImageIndex = 0;
                listView1.Items.Add(li);
            }

            foreach (System.IO.FileInfo fi in clicked.GetFiles())
            {
                ListViewItem li = new ListViewItem(fi.Name);
                li.SubItems.Add("File");
                li.SubItems.Add(VariousFunctions.ByteConversion(fi.Length));
                li.SubItems.Add(fi.LastWriteTime.ToString());
                // Get the file name
                CLKsFATXLib.Streams.Reader br = new CLKsFATXLib.Streams.Reader(new System.IO.FileStream(fi.FullName, System.IO.FileMode.Open));
                if (br.BaseStream.Length > 4)
                {
                    uint header = br.ReadUInt32(true);
                    if (header == 0x434F4E20 || header == 0x4C495645 || header == 0x50495253)
                    {
                        br.BaseStream.Position = (long)CLKsFATXLib.Geometry.STFSOffsets.DisplayName;
                        li.SubItems.Add(br.ReadUnicodeString(0x80));
                    }
                }
                br.Close();
                li.Tag        = new object[] { fi.FullName, true };
                li.ImageIndex = 1;
                listView1.Items.Add(li);
            }
        }