Skip to content

Commit

Permalink
0.0.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DartAlex committed Sep 6, 2016
1 parent 428ac60 commit 5fe306c
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 15 deletions.
3 changes: 2 additions & 1 deletion DirectoryList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class DirectoryList
public string name { get; set; }
public string type { get; set; }
public string size { get; set; }
public DateTime date { get; set; }
//public DateTime date { get; set; }
public string date { get; set; }
public FileAttributes atrributes { get; set; }
// Archive - Файл выбран для резервного копирования или удаления.

Expand Down
115 changes: 104 additions & 11 deletions DirectoryPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class DirectoryPanel : Panel
Panel panelDir = new Panel();
Panel panelInfoFolder = new Panel();
CustomListView listViewDirectory = new CustomListView();
List<DirectoryList> directoryList = new List<DirectoryList>();
List<DirectoryList> tempDirectoryList = new List<DirectoryList>();
//List<DirectoryList> directoryList = new List<DirectoryList>();
//List<DirectoryList> tempDirectoryList = new List<DirectoryList>();
Icon iconUp = Properties.Resources.IconUP;
Icon IconUnknown = Properties.Resources.IconUnknown;

Expand Down Expand Up @@ -172,9 +172,9 @@ private Icon GetIcon(string filePatch)
}

// Open selected item ListView
private void OpenSelected(int Index)
private void OpenSelected(int index)
{
if (!directoryList[selectionIndex].atrributes.ToString().Contains("Directory"))
/*if (!directoryList[selectionIndex].atrributes.ToString().Contains("Directory"))
{
if (directoryList[selectionIndex].type != "")
{
Expand All @@ -188,10 +188,103 @@ private void OpenSelected(int Index)
else
{
GetFoldersFiles(directoryList[selectionIndex].directory + "\\");
}*/

if (listViewDirectory.Items[index].Tag.ToString().Contains(("Directory")))
{
GetFoldersFiles(listViewDirectory.Items[index].Name.ToString() + "\\");
}
else
{
MessageBox.Show(listViewDirectory.Items[index].Name.ToString() + " " +listViewDirectory.Items[index].Tag.ToString());
}
}

public void GetFoldersFiles(string directory)
{

List<DirectoryList> directoryList = new List<DirectoryList>();
DirectoryInfo thisDirectory = new DirectoryInfo(directory);

// if root
rootDir = thisDirectory.Root.ToString();
currentDir = thisDirectory.FullName.ToString();

if (rootDir != currentDir)
{
string dirFolder = Directory.GetParent(Directory.GetParent(directory).ToString()).ToString();
DateTime dateFolder = Directory.GetCreationTime(dirFolder);

directoryList.Add(new DirectoryList()
{
icon = iconUp,
directory = dirFolder,
name = "[..]",
type = "",
size = "",
atrributes = thisDirectory.Attributes
});
}

try
{
// Get folders
DirectoryInfo[] folders = thisDirectory.GetDirectories();
foreach (DirectoryInfo folder in folders)
{
directoryList.Add(new DirectoryList()
{
icon = IconUnknown,
directory = folder.FullName,
name = "[" + folder.Name + "]",
type = "",
size = "<папка>",
//date = Directory.GetCreationTime(dirFolder),
atrributes = folder.Attributes
});
}

// Get folders
FileInfo[] files = thisDirectory.GetFiles();
foreach (FileInfo file in files)
{
directoryList.Add(new DirectoryList()
{
icon = IconUnknown,
directory = file.FullName,
name = file.Name,
type = file.Extension,
size = NumberFormat.DigitNumber(file.Length),
date = File.GetCreationTime(file.FullName).ToString(),
atrributes = file.Attributes
});
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
return;
}

listViewDirectory.Items.Clear();

foreach (DirectoryList lineDirectoryList in directoryList)
{
string[] item = { lineDirectoryList.name, lineDirectoryList.type, lineDirectoryList.size, lineDirectoryList.date };
ListViewItem listItem = new ListViewItem(item);
listItem.Name = lineDirectoryList.directory;
listItem.Tag = lineDirectoryList.atrributes;
listViewDirectory.Items.Add(listItem);
}

SetIcon(directoryList);

// select
listViewDirectory.Items[0].Selected = true;
listViewDirectory.Items[0].Focused = true;
}

/*public void GetFoldersFiles(string directory)
{
tempDirectoryList.Clear();
Expand All @@ -208,7 +301,7 @@ public void GetFoldersFiles(string directory)
tempDirectoryList.Add(new DirectoryList()
{
icon = /*iconFolder*/ iconUp,
icon = iconUp,
directory = dirFolder,
name = "[..]",
type = "",
Expand Down Expand Up @@ -299,7 +392,7 @@ public void GetFoldersFiles(string directory)
// Tread InfoFolder
Thread folderInfoThread = new Thread(GetFolderInfo);
folderInfoThread.Start();
}
}*/

// Add icon
public void AddIconListViewDirectory(ImageList value)
Expand All @@ -316,7 +409,7 @@ public void AddIconListViewDirectory(ImageList value)
}
}
// Tread
private void SetIcon()
private void SetIcon(List<DirectoryList> directoryList)
{
ImageList iconList = new ImageList();
iconList.ColorDepth = ColorDepth.Depth32Bit;
Expand Down Expand Up @@ -399,12 +492,12 @@ public static long DirSize(DirectoryInfo d)
// Focus
public void SetFocus()
{
listViewDirectory.Select();
listViewDirectory.Items[selectionIndex].Selected = true;
//listViewDirectory.Select();
//listViewDirectory.Items[selectionIndex].Selected = true;
}

// Key Tab press
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
/*protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool baseResult = true;
Expand Down Expand Up @@ -436,6 +529,6 @@ protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
}
return baseResult;
}
}*/
}
}
3 changes: 2 additions & 1 deletion FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ private void FormMain_Load(object sender, EventArgs e)

splitContainer.Panel1.Controls.Add(leftDirectoryPanel);
leftDirectoryPanel.Tag = "left";
leftDirectoryPanel.GetFoldersFiles(@"C:\");
//leftDirectoryPanel.GetFoldersFiles(@"C:\");
leftDirectoryPanel.GetFoldersFiles(@"c:\Windows\Fonts\");

splitContainer.Panel2.Controls.Add(rightDirectoryPanel);
rightDirectoryPanel.Tag = "right";
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// Можно задать все значения или принять номера сборки и редакции по умолчанию
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.6.1")]
[assembly: AssemblyFileVersion("0.0.6.1")]
[assembly: AssemblyVersion("0.0.7.1")]
[assembly: AssemblyFileVersion("0.0.7.1")]
Binary file modified bin/Debug/Commander.exe
Binary file not shown.
Binary file modified bin/Debug/Commander.pdb
Binary file not shown.
Binary file modified obj/Debug/Commander.csproj.GenerateResource.Cache
Binary file not shown.
Binary file modified obj/Debug/Commander.exe
Binary file not shown.
Binary file modified obj/Debug/Commander.pdb
Binary file not shown.

0 comments on commit 5fe306c

Please sign in to comment.