Add files via upload
This commit is contained in:
parent
d42dc1c384
commit
b7b2011b15
81 changed files with 5710 additions and 0 deletions
40
src/Privatezilla/Interfaces/IListView.cs
vendored
Normal file
40
src/Privatezilla/Interfaces/IListView.cs
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Privatezilla
|
||||
{
|
||||
/* Modified ListView sort example from https://support.microsoft.com/en-us/kb/319401
|
||||
which will not only sort ascending but both ways */
|
||||
|
||||
public class ListViewItemComparer : IComparer
|
||||
{
|
||||
private readonly int col;
|
||||
private readonly bool bAsc = false;
|
||||
|
||||
public ListViewItemComparer()
|
||||
{
|
||||
col = 0;
|
||||
}
|
||||
|
||||
public ListViewItemComparer(int column, bool b)
|
||||
{
|
||||
col = column;
|
||||
bAsc = b;
|
||||
}
|
||||
|
||||
public int Compare(object x, object y)
|
||||
{
|
||||
if (bAsc)
|
||||
{
|
||||
return String.Compare(((ListViewItem)x).SubItems[col].Text, ((ListViewItem)y).SubItems[col].Text);
|
||||
// bAsc = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.Compare(((ListViewItem)y).SubItems[col].Text, ((ListViewItem)x).SubItems[col].Text);
|
||||
// bAsc = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
src/Privatezilla/Interfaces/ITreeNode.cs
vendored
Normal file
25
src/Privatezilla/Interfaces/ITreeNode.cs
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Privatezilla.ITreeNode
|
||||
{
|
||||
public static class ITreeNode
|
||||
{
|
||||
// Retrieving TreeView nodes as IEnumerable
|
||||
public static IEnumerable<TreeNode> All(this TreeNodeCollection nodes)
|
||||
{
|
||||
if (nodes == null) throw new ArgumentNullException(nameof(nodes));
|
||||
|
||||
foreach (TreeNode n in nodes)
|
||||
{
|
||||
yield return n;
|
||||
|
||||
foreach (TreeNode child in n.Nodes.All())
|
||||
{
|
||||
yield return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue