Add files via upload

This commit is contained in:
Belim 2020-08-22 16:09:19 +02:00 committed by GitHub
parent d42dc1c384
commit b7b2011b15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 5710 additions and 0 deletions

View 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;
}
}
}
}

View 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;
}
}
}
}
}