This commit is contained in:
Florian Späth
2025-01-31 01:47:45 +01:00
commit 6ba4884590
162 changed files with 4396 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/.vscode
/log.txt

150
Cleaner-IconAdd/root.ps1 Normal file
View File

@@ -0,0 +1,150 @@
Add-Type -AssemblyName PresentationFramework
Add-Type -AssemblyName System.Windows.Forms
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null
function Load_root {
[xml]$Form = Get-Content "$PSScriptRoot\root.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
$Script:btncleaner = $window.FindName("btncleaner")
$Script:btnfile = $window.findName("btnfile")
$Script:btnok = $window.FindName("btnok")
$Script:tbcleaner = $window.FindName("tbcleaner")
$Script:tbfile = $window.FindName("tbfile")
$Script:cbo = $window.FindName("cbo")
$Script:cbb = $window.FindName("cbb")
$Script:cbv = $window.FindName("cbv")
$Script:cba = $window.FindName("cba")
return $window
}
$main = Load_root
$Script:btncleaner.Add_Click({
$Script:cleaner=Select-FolderDialog
if (test-path "$Script:cleaner\icons.csv") {
$Script:tbcleaner.Text = "Cleaner: $Script:Cleaner"
}else{
$Script:tbcleaner.Text = "Cleaner: not valid"
}
})
$Script:btnfile.Add_Click({
$Script:file=Select-FileDialog
$Script:tbfile.Text = "Icon: $Script:file"
})
$Script:btnok.Add_Click({
$csv=import-csv path $Script:Cleaner\icons.csv
$type=$null
Write-host "$Script:file"
$name = get_icon $Script:file
Export-Icon -Path $Script:file -Destination "$Script:Cleaner\icons\$name.ico"
if ($cbo.IsSelected) {
$type=0
}elseif ($cbb.IsSelected) {
$type=1
}elseif ($cbv.IsSelected) {
$type=2
}elseif ($cba.IsSelected) {
$type=3
}
$id=($csv.ID[-1])+1
$item = "$id,$name,$type"
$item | Export-Csv -Path "$Script:Cleaner\icons.csv" -Append
})
Function Select-FolderDialog{
param([string]$Description="Zielverzeichnis wählen",[string]$RootFolder="Desktop")
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |Out-Null
$objForm = New-Object System.Windows.Forms.FolderBrowserDialog
$objForm.Rootfolder = $RootFolder
$objForm.Description = $Description
$Show = $objForm.ShowDialog()
If ($Show -eq "OK"){
Return $objForm.SelectedPath
}else{
Return $false
}
}
Function Select-FileDialog{
[void] [System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
if ($initialDirectory) { $OpenFileDialog.initialDirectory = $initialDirectory }
$OpenFileDialog.filter = 'All files (*.*)|*.*'
[void] $OpenFileDialog.ShowDialog()
return $OpenFileDialog.FileName
}
function get_icon {
param ($data)
$data = $data -replace '\s',''
$found = $false
for ($c = -1; $c -gt -10; $c--) {
$char = $data[$c]
if ($char -eq ".") {
$trim=$data.Length+$c
$trimdata=$data.Remove(0,$trim+1)
$c=-10
$found = $true
}
}
if (!$found) {
$return = 0
}else {
$return=$trimdata
}
return $return
}
function Export-Icon {
<#
.SYNOPSIS
Exports a file icon to a specified format.
.DESCRIPTION
Exports the icon associated with a while to a specified image format.
.NOTES
Author : Paul Broadwith (https://github.com/pauby)
History : 1.0 - 25/07/17 - Initial version.
.LINK
https://www.github.com/pauby
.EXAMPLE
Export-Icon -Path "C:\Windows\Notepad.exe"
Exports the icon for "C:\Windows\Notepad.exe" and saves it in bitmap
(BMP) format to "Notepad.bmp" in the current current directory.
.EXAMPLE
Export-Icon -Path "C:\Windows\Notepad.exe" `
-Destination "C:\Temp\Notepad-Icon.jpg" -Format JPEG
Exports the icon for "C:\Windows\Notepad.exe" and saves it in JPEG
format to "C:\Temp\Notepad-Icon.jpg"
#>
[CmdletBinding()]
Param (
# Path of the source file the icon is to be exported from.
[Parameter(Mandatory=$true)]
[string]$Path,
# Path to where the icon will be saved to. If this is blank or missing
# the file will be saved in the current directory with the basename of
# the $Path with the correct format extension.
[string]$Destination,
# Format to save the icon as. Defaults to a bitmap (BMP).
[System.Drawing.Imaging.ImageFormat]$Format = "Bmp"
)
if (!$Destination) {
$basename = (Get-Item $Path).BaseName
$extension = $format.ToString().ToLower()
$Destination = "$basename.$extension"
}
# Extract the icon from the source file.
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($Path)
# Save the icon in the specified format
$icon.ToBitmap().Save($Destination, [System.Drawing.Imaging.ImageFormat]::$Format)
}
$main.ShowDialog() | Out-Null

35
Cleaner-IconAdd/root.xaml Normal file
View File

@@ -0,0 +1,35 @@
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="IconAdd" Title="Cleaner - IconAdd" Height="291.5" Width="238.5" ResizeMode="NoResize">
<Window.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#0082c6"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#022335"/>
</Window.Resources>
<Grid Background="#00344E">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Content="Pfade auswählen" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="154" Width="200" Background="#013C5A" Foreground="White" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Center"/>
<Button TabIndex="7" Name="btnok" Content="Übernehmen" BorderThickness="0" HorizontalAlignment="Left" Margin="10,209,0,0" VerticalAlignment="Top" Width="200" Height="33" FontSize="20" FontWeight="Bold" Background="green" Foreground="white">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btncleaner" Content="..." HorizontalAlignment="Left" Margin="171,49,0,0" VerticalAlignment="Top" Width="23"/>
<Button Name="btnfile" Content="..." HorizontalAlignment="Left" Margin="171,74,0,0" VerticalAlignment="Top" Width="23"/>
<Label Content="Cleaner Ordner" HorizontalAlignment="Left" Margin="19,46,0,0" VerticalAlignment="Top" Width="147" Foreground="white"/>
<Label Content="Icon Vorlage" HorizontalAlignment="Left" Margin="19,71,0,0" VerticalAlignment="Top" Width="147" Foreground="white"/>
<TextBlock Name="tbcleaner" HorizontalAlignment="Left" Margin="24,97,0,0" TextWrapping="Wrap" Text="Cleaner:" VerticalAlignment="Top" Width="170" Foreground="white" Height="31"/>
<TextBlock Name="tbfile" HorizontalAlignment="Left" Margin="24,128,0,0" TextWrapping="Wrap" Text="Icon:" VerticalAlignment="Top" Width="170" Foreground="white" Height="32"/>
<CheckBox Name="cbo" Content="Office" HorizontalAlignment="Left" Margin="39,169,0,0" VerticalAlignment="Top" Width="56" Foreground="white"/>
<CheckBox Name="cbb" Content="Bilder" HorizontalAlignment="Left" Margin="122,169,0,0" VerticalAlignment="Top" Width="58" Foreground="white"/>
<CheckBox Name="cbv" Content="Videos" HorizontalAlignment="Left" Margin="39,189,0,0" VerticalAlignment="Top" Width="58" Foreground="white"/>
<CheckBox Name="cba" Content="Audios" HorizontalAlignment="Left" Margin="122,189,0,0" VerticalAlignment="Top" Width="58" Foreground="white"/>
</Grid>
</Window>

BIN
Dokumentation H-Cleaner.pdf Normal file

Binary file not shown.

286
GUIS/del/del.ps1 Normal file
View File

@@ -0,0 +1,286 @@
function Load_del {
param ($root)
# Speichert ob gelöscht oder verschoben werden soll
$Script:whattodo=""
# Arraydefinition
## 0=Name,1=Größe,2=checked
$Script:sortdel=@("up","up",$false)
# Lädt das Fenster
[xml]$Form = Get-Content "$root/GUIS/del/del.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$pb=$window.findName("pb")
$Script:Delbrowser = $window.findName("browser")
$Script:Delback = $window.findName("btnback")
$Script:Deldel = $window.findName("btnDeleteAll")
$Script:DelMove = $window.findName("btnMoveAll")
$Script:Delwarning = $window.findName("warning_delete")
$Script:Movewarning = $window.findName("warning_move")
$Script:Delmarked = $window.findName("marked_delete")
$Script:Movemarked = $window.findName("marked_move")
$Script:Delstats = $window.findName("stats")
$Script:Delsortname = $window.findName("btnsortname")
$Script:Delsortsize = $window.findName("btnsortsize")
$Script:Delcheckall = $window.findName("btncheckbox")
# Verknüpft feste Elemente
$window.icon="$root/Source/Logo.png"
### GIF Sanduhr
$file = (get-item "$root/Source/hourglas.gif")
$img = [System.Drawing.Image]::Fromfile($file);
$pb.Image = $img
return $window
}
function Browser_del {
$data = @()
for ($i = 0; $i -lt $Script:folderdb.Count; $i++) {
if ($Script:folderdb[$i][3]) {
if (!$Script:folderdb[$i][4]) {
$Length = calc_Size $Script:folderdb[$i][1]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\Source\Folder.png";Name=$Script:folderdb[$i][0];Size="$Length";Tag="f$i";SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$Script:folderdb[$i][2]}
#$logcontent = "Del: Browser f" + $i
#Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $filedb.Count; $i++) {
if ($Script:filedb[$i][3]) {
if (!$Script:filedb[$i][4]) {
$Length = calc_Size $Script:filedb[$i][1]
$icon = $Script:icontypes[$Script:filedb[$i][5]]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\icons\$icon.ico";Name=$Script:filedb[$i][0];Size="$Length";Tag=$i;SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$Script:filedb[$i][2]}
#$logcontent = "Del: Browser " + $i
#Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
$item = [System.Windows.Data.ListCollectionView]$data
$Script:Delbrowser.Remove
$Script:Delbrowser.ItemsSource = $item
}
function Check_Del {
param ($tag)
$data = @()
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
if (($delbrowser.Items.Tag[$i] -eq $tag) -or ($delbrowser.Items.Count -eq 1)) {
$item=$delbrowser.Items[$i]
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($Script:folderdb[$int][3]) {
$Script:folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png";Path=$item.Path}
}else {
$Script:folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$item.Path}
}
}else {
if ($Script:filedb[$tag][3]) {
$Script:filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png";Path=$item.Path}
}else {
$Script:filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$item.Path}
}
}
}else {
$data += $delbrowser.Items[$i]
}
[System.Windows.Forms.Application]::DoEvents()
}
$item = [System.Windows.Data.ListCollectionView]$data
$delbrowser.Remove
$delbrowser.ItemsSource = $item
}
function del_sortname{
#Log "### Del: sort name ###" -clear
$data= @()
for ($i = 0; $i -lt $delbrowser.Items.count; $i++) {
$item = $delbrowser.Items[$i]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked;Path=$item.Path}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortdel[0] -eq "up") {
$data = $data | Sort-Object -Property Name
$sortdel[0]="down"
}else {
$data = $data | Sort-Object -Property Name -Descending
$sortdel[0]="up"
}
$ItemList = [System.Windows.Data.ListCollectionView]$data
$delbrowser.ItemsSource = $ItemList
}
function del_sortsize {
#Log "### Del: sort size ###" -clear
$data=@()
$array=@()
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
$item = $delbrowser.Items[$i]
if ($item.Size.EndsWith("GB")) {
$stringtrim = $item.Size.TrimEnd(" GB")
}else {
$stringtrim = $item.Size.TrimEnd(" MB")
}
$int = [int]$stringtrim
$array += New-Object PSObject -prop @{Tag=$item.Tag;Size=$int}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortdel[1] -eq "up") {
$array = $array | Sort-Object -Property Size
$sortdel[1]="down"
}else {
$array = $array | Sort-Object -Property Size -Descending
$sortdel[1]="up"
}
for ($i = 0; $i -lt $array.Count; $i++) {
for ($e = 0; $e -lt $delbrowser.items.Count; $e++) {
if ($array.Tag[$i] -eq $delbrowser.Items.Tag[$e]) {
$item=$delbrowser.Items[$e]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked;Path=$item.Path}
$e=$delbrowser.items.Count
}
}
[System.Windows.Forms.Application]::DoEvents()
}
$ItemList = [System.Windows.Data.ListCollectionView]$data
$delbrowser.Remove
$delbrowser.ItemsSource = $ItemList
}
function del_checkall {
#Log "### Del: Check all ###" -clear
$data = @()
$check = 0
if ($sortdel[2]) {
$sortdel[2]=$false
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
$item = $delbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($folderdb[$int][3]) {
$folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}else {
if ($filedb[$tag][3]) {
$filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}else {
$sortdel[2]=$true
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
$item = $delbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if (!$folderdb[$int][3]) {
$folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}else {
if (!$filedb[$tag][3]) {
$filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
if ($check -eq 0) {
del_checkall
}else{
$ItemList = [System.Windows.Data.ListCollectionView]$data
$delbrowser.ItemsSource = $ItemList
}
}
function final_action {
if ($script:whattodo -eq "move") {
for ($i = 0; $i -lt $filedb.Count; $i++) {
if ($filedb[$i][3]) {
if (!$filedb[$i][4]) {
Move-Item -Path $filedb[$i][2] -Destination $Script:movelocation
$filedb[$i][4] = $true
#$logcontent = "Move: " + $filedb[$i][2] + " To: " + $Script:movelocation
#Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $folderdb.Count; $i++) {
if ($folderdb[$i][3]) {
if (!$folderdb[$i][4]) {
Move-Item -Path $folderdb[$i][2] -Destination $Script:movelocation
$folderdb[$i][4] = $true
#$logcontent = "Move: " + $folderdb[$i][2] + " To: " + $Script:movelocation
#Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}elseif ($Script:whattodo -eq "delete") {
for ($i = 0; $i -lt $filedb.Count; $i++) {
if ($filedb[$i][3]) {
if (!$filedb[$i][4]) {
Remove-Item $filedb[$i][2]
$filedb[$i][4] = $true
#$logcontent = "Removed: " + $filedb[$i][2]
#Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $folderdb.Count; $i++) {
if ($folderdb[$i][3]) {
if (!$folderdb[$i][4]) {
Remove-Item $folderdb[$i][2]
$folderdb[$i][4] = $true
#$logcontent = "Removed: " + $folderdb[$i][2]
#Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
}
#Log "### Del geladen ###" -clear

104
GUIS/del/del.xaml Normal file
View File

@@ -0,0 +1,104 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="Cleaner - Auswahlbestätigung" Height="459.667" Width="800" Icon="{Binding Icon}" ResizeMode="NoResize">
<Grid Background="#00344E">
<Label HorizontalAlignment="Center" Margin="10,357,10,0" VerticalAlignment="Top" Height="64" Width="774" Background="#013C5A">
<Label.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Label.Resources>
</Label>
<Button Name="btnDeleteAll" Content="Markierte löschen" BorderThickness="0" HorizontalAlignment="Left" Margin="601,366,0,0" VerticalAlignment="Top" Height="46" Width="172" FontSize="18" FontWeight="Bold" Background="#d50000" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnMoveAll" Content="Markierte verschieben" BorderThickness="0" HorizontalAlignment="Left" Margin="554,364,0,0" VerticalAlignment="Top" Height="46" Width="210" FontSize="18" FontWeight="Bold" Background="#d50000" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<TextBox Name="stats" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Margin="276,389,282,0" Text="TextBox" TextWrapping="Wrap" VerticalAlignment="Top" Width="236" Height="23" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" BorderThickness="0" IsTabStop="False"/>
<ListView Name="browser" Margin="8,43,8,79" Background="#013C5A" Foreground="White" BorderThickness="0">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="#013C5A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Width="30">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btncheckbox"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Name="CheckedImage" Source="{Binding SourceChecked}" Height="18"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="auto">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortname" Content="Name"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Name="Image_GridViewColumnName" Source="{Binding Source}" Height="20"/>
<Label Name="Label_GridViewColumnName" Content="{Binding name}" Foreground="White"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding size}" Width="auto">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortsize" Content="Größe"/>
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding path}" Width="auto">
<GridViewColumn.Header>
<GridViewColumnHeader Name="lbpath" Content="Pfad"/>
</GridViewColumn.Header>
</GridViewColumn>
</GridView>
</ListView.View>
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="ListViewItem.IsMouseOver" Value="True">
<Setter Property="Background" Value="#0082c6"></Setter>
<Setter Property="Foreground" Value="#022335"></Setter>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</ListView.Resources>
</ListView>
<Button Name="btnback" Content="Zurück" HorizontalAlignment="Left" Margin="18,366,0,0" VerticalAlignment="Top" Width="71" Height="46" FontSize="16" FontWeight="Bold" Background="#00b8d4" Foreground="White" RenderTransformOrigin="-0.018,0.517">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Label Name="warning_delete" Content="Die ausgewählten Dateien werden endgültig gelöscht!" HorizontalAlignment="Center" Margin="0,2,0,0" VerticalAlignment="Top" Height="36" Width="800" FontSize="18" HorizontalContentAlignment="Center" Foreground="white" Background="#d50000" FontWeight="Bold" Visibility="Visible"/>
<Label Name="warning_move" Content="Die ausgewählten Dateien werden endgültig gelöscht!" HorizontalAlignment="Center" Margin="0,2,0,0" VerticalAlignment="Top" Height="36" Width="800" FontSize="18" HorizontalContentAlignment="Center" Foreground="#FF9C6500" Background="#FFFFEB9C" FontWeight="Bold" Visibility="Hidden"/>
<Label Name="marked_delete" Content="Zum löschen markiert:" HorizontalAlignment="Left" Margin="276,357,0,0" VerticalAlignment="Top" Width="236" FontWeight="Bold" Foreground="white" FontSize="16" HorizontalContentAlignment="Center"/>
<Label Name="marked_move" Content="Zum Verschieben markiert:" HorizontalAlignment="Left" Margin="276,357,0,0" VerticalAlignment="Top" Width="236" FontWeight="Bold" Foreground="white" FontSize="16" HorizontalContentAlignment="Center"/>
<wfi:WindowsFormsHost Name="pbLoading" Height="40" Margin="745,2,0,0" Width="40" VerticalAlignment="Top" Visibility="Hidden">
<winForms:PictureBox x:Name="pb"></winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window>

18
GUIS/delconf/delconf.ps1 Normal file
View File

@@ -0,0 +1,18 @@
function Load_delconf {
param ($root)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\delconf.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Script:delconfsize = $window.FindName("tbdelsize")
$Script:delconfelements = $window.FindName("tbdeldata")
$Script:deltb = $window.FindName("tb_del")
$Script:movetb = $window.FindName("tb_move")
return $window
}

36
GUIS/delconf/delconf.xaml Normal file
View File

@@ -0,0 +1,36 @@
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Cleaner - Bestätigung" Height="198" Width="383" ResizeMode="NoResize" WindowStyle="None">
<Grid Background="#00344E">
<Label Content="" HorizontalAlignment="Left" Margin="63,42,0,0" VerticalAlignment="Top" Width="256" Height="94" Background="#013C5A" BorderThickness="0" >
<Label.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Label.Resources>
</Label>
<TextBox Name="tbdeldata" Text="" HorizontalAlignment="Left" Height="22" Margin="63,49,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="256" TextAlignment="Center" FontSize="14" Foreground="White" BorderThickness="0" Background="#013C5A" IsReadOnly="true" IsTabStop="False"/>
<TextBox Name="tbdelsize" Text="" HorizontalAlignment="Left" Height="24" Margin="63,76,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="256" TextAlignment="Center" FontSize="14" Foreground="White" BorderThickness="0" Background="#013C5A" IsReadOnly="true" IsTabStop="False"/>
<TextBox Name="tbco2" Text="" HorizontalAlignment="Left" Height="24" Margin="63,105,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="256" TextAlignment="Center" FontSize="14" Foreground="White" BorderThickness="0" Background="#013C5A" IsReadOnly="true" IsTabStop="False"/>
<Button Name="btnok" Content="OK" HorizontalAlignment="Left" Margin="140,152,0,0" VerticalAlignment="Top" Width="100" Height="36" BorderThickness="0" Background="#00b8d4" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<TextBox Name="tb_del" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="Alle ausgewählten Dateien wurden erfolgreich entfernt." VerticalAlignment="Top" Width="352" Margin="16,10,0,0" FontSize="14" BorderThickness="0" TextAlignment="Center" Foreground="White" Background="#00344E" IsReadOnly="true" IsTabStop="False"/>
<TextBox Name="tb_move" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="Alle ausgewählten Dateien wurden erfolgreich verschoben." VerticalAlignment="Top" Width="352" Margin="16,10,0,0" FontSize="14" BorderThickness="0" TextAlignment="Center" Foreground="White" Background="#00344E" IsReadOnly="true" IsTabStop="False"/>
</Grid>
</Window>

128
GUIS/filter/filter.ps1 Normal file
View File

@@ -0,0 +1,128 @@
function Load_filter {
param ($root)
#0=Office;1=Bilder;2=Videos;3=Audios;4=Unterordner einbeziehen
$Script:filtercheck=@($false,$false,$false,$false,$false)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\filter.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$Office=$window.FindName("imgoffice")
$Bilder=$window.FindName("imgbilder")
$Videos=$window.FindName("imgvideos")
$Audios=$window.FindName("imgaudios")
$Script:Filteroffice = $window.FindName("btnoffice")
$Script:Filterbilder = $window.FindName("btnbilder")
$Script:Filtervideos = $window.FindName("btnvideos")
$Script:Filteraudios = $window.FindName("btnaudios")
$Script:filterok = $window.FindName("btnsetzen")
$Script:filterreset = $window.FindName("btnreset")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Office.Source = "$root/Source/Office.png"
$Bilder.Source = "$root/Source/Bild.png"
$Videos.Source = "$root/Source/Video.png"
$Audios.Source = "$root/Source/Audio.png"
return $window
}
function Reset_Filter {
#0=Office;1=Bilder;2=Videos;3=Audios;4=Unterordner einbeziehen
$Script:filtercheck=@($false,$false,$false,$false,$false)
$Filteroffice.background = "#444444"
$Filterbilder.background = "#444444"
$Filtervideos.background = "#444444"
$Filteraudios.background = "#444444"
$mainimgswitch.Source = "$ScriptRoot/Source/swfalse.png"
}
function Filter_data {
param($tag)
$Script:data = @()
main_loading $true
Filter_deep $tag
main_loading $false
$item = [System.Windows.Data.ListCollectionView]$Script:data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $item
}
function Filter_deep {
param ($tag)
#Log "### Main: Filter deep ###" -clear
$folder = $Script:folderdb[$tag]
for ($i = 5; $i -lt $folder.count; $i++) {
if ($folder[$i] -match "f") {
if ($Script:filtercheck[4]) {
$string=$folder[$i].Substring(1)
$int = [int]$string
if (!$Script:folderdb[$int][4]) {
Filter_deep $int
}
}
}else {
if (!$Script:filedb[$folder[$i]][4]) {
for ($t = 0; $t -lt 3; $t++) {
if ($Script:filtercheck[$t]) {
for ($ti = 0; $ti -lt $Script:types[$t].Count; $ti++) {
if ($Script:types[$t][$ti] -eq $Script:filedb[$folder[$i]][5]) {
if ($Script:filedb[$folder[$i]][3]) {
$cp = "$Script:ScriptRoot\Source\checked.png"
}else {
$cp = "$Script:ScriptRoot\Source\unchecked.png"
}
$Length = calc_Size $Script:filedb[$folder[$i]][1]
$icon = $Script:icontypes[$Script:filedb[$folder[$i]][5]]
$Script:data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\icons\$icon.ico";Name=$Script:filedb[$folder[$i]][0];Size="$Length";Tag=$folder[$i];SourceChecked="$cp"}
Write-Host $Script:filedb[$folder[$i]][0]
}
[System.Windows.Forms.Application]::DoEvents()
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
}
[System.Windows.Forms.Application]::DoEvents()
}
return $data
}
function Update_Filter {
$ok = @($true,$true,$true,$true)
$btnname = @("Office","Bilder","Videos","Audios")
$Script:mainchoosen1.Content = $null
$Script:mainchoosen2.Content = $null
$Script:mainchoosen3.Content = $null
$Script:mainchoosen4.Content = $null
for ($i = 0; $i -lt 4; $i++) {
if ($Script:filtercheck[$i]) {
if ($ok[0]) {
$Script:mainchoosen1.Content = "- "+$btnname[$i]
$ok[0] = $false
#Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}elseif ($ok[1]) {
$Script:mainchoosen2.Content = "- "+$btnname[$i]
$ok[1] = $false
#Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}elseif ($ok[2]) {
$Script:mainchoosen3.Content = "- "+$btnname[$i]
$ok[2] = $false
#Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}elseif ($ok[3]) {
$Script:mainchoosen4.Content = "- "+$btnname[$i]
$ok[3] = $false
#Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
#Log "### Filter geladen ###" -clear

54
GUIS/filter/filter.xaml Normal file
View File

@@ -0,0 +1,54 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Cleaner - Filter" Height="240" Width="392.667" Icon="{Binding Icon}" ResizeMode="NoResize" WindowStyle="None">
<Grid Background="#00344E">
<Button Name="btnoffice" HorizontalAlignment="Left" Margin="10,54,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Office Dateien" TabIndex="0">
<Image Name="imgoffice" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnbilder" HorizontalAlignment="Left" Margin="106,54,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Bild Dateien" TabIndex="1">
<Image Name="imgbilder" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnvideos" HorizontalAlignment="Left" Margin="10,147,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Video Dateien" TabIndex="2">
<Image Name="imgvideos" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnaudios" HorizontalAlignment="Left" Margin="106,147,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Audio Dateien" TabIndex="3">
<Image Name="imgaudios" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnsetzen" Content="Fertig" HorizontalAlignment="Left" Margin="220,192,0,0" VerticalAlignment="Top" Width="162" Height="37" Background="#00b8d4" Foreground="White" FontSize="14" TabIndex="5">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Label Content="Dateitypen auswählen" Margin="112,4,0,0" VerticalAlignment="Top" Width="196" Foreground="White" FontWeight="Bold" FontSize="18" HorizontalAlignment="Left"/>
<Button x:Name="btnreset" Content="Zurücksetzen" HorizontalAlignment="Left" Margin="220,147,0,0" VerticalAlignment="Top" Width="162" Height="35" Background="#00b8d4" Foreground="White" FontSize="14" TabIndex="4">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
</Grid>
</Window>

20
GUIS/info/info.ps1 Normal file
View File

@@ -0,0 +1,20 @@
function Load_info {
param ($root)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\info.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$text = $window.FindName("text")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$text.Text = "Der Speicherbedarf auf Gruppenlaufwerken, insbesondere aber auf persönlichen Home-Laufwerken steigt stetig. Daher muss jährlich ein hoher Betrag in die Erweiterung und die Erneuerung von Speichersystemen investiert werden.
Gleichzeitig soll im BR die Zusammenarbeit durch das Teilen von Informationen, Dokumenten und Content verbessert werden. Persönliche und damit exklusive Inhalte und Daten sind dabei kontraproduktiv. Dies gilt vor allem für den produzierten Mediencontent.
Mit diesem Werkzeug können Sie den zu löschenden oder zu verschiebenden Inhalt leichter identifizieren. `n`n$Script:Version `nCopyright Bayerischer Rundfunk (2022)`nAutor: Florian Späth `nDSGVO-konform"
return $window
}

28
GUIS/info/info.xaml Normal file
View File

@@ -0,0 +1,28 @@
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="Window" Title="Cleaner - Information" Height="440" Width="624" Icon="{Binding Icon}" ResizeMode="NoResize" WindowStyle="None">
<Grid Background="#00344E">
<TextBlock Name="text" Text="" HorizontalAlignment="Left" Margin="34,44,0,0" TextWrapping="Wrap" Foreground="White" Width="554" TextAlignment="Center" Height="360" VerticalAlignment="Top" FontSize="16"></TextBlock>
<Button Name="btnok" Content="OK" HorizontalAlignment="Left" Margin="264,390,0,0" VerticalAlignment="Top" Width="100" Height="36" BorderThickness="0" Background="#00b8d4" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Label Content="Information" HorizontalAlignment="Left" VerticalAlignment="Top" Width="624" HorizontalContentAlignment="Center" Foreground="White" FontSize="20" FontWeight="Bold"/>
</Grid>
</Window>

520
GUIS/main/main.ps1 Normal file
View File

@@ -0,0 +1,520 @@
function Load_main {
param ($root)
# Arraydefinition
## 0=Name,1=Größe,2=checked,3=$false->Name $true->Größe
$Script:sortmain=@("up","up",$false, $false)
# XAML Fenster
[XML]$Form = @"
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="Window" Title="Cleaner - Hauptfenster" Height="551" Width="1003.333" Icon="{Binding Icon}" ResizeMode="NoResize">
<Window.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#0082c6"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#022335"/>
</Window.Resources>
<Grid Background="#00344E">
<TreeView TabIndex="2" Name="treeview" BorderThickness="0" HorizontalAlignment="Left" Height="374" Margin="10,57,0,0" VerticalAlignment="Top" Width="218" Background="#013C5A" Foreground="White">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Name="treeimage" Source="$root\Source\Folder.png" HorizontalAlignment="Left" Width="18" Margin="2" />
<TextBlock VerticalAlignment="Center" Text="{Binding}" FontSize="14" Foreground="White"/>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="TreeViewItem.IsMouseOver" Value="True">
<Setter Property="Background" Value="#0082c6"></Setter>
<Setter Property="Foreground" Value="#022335"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</TreeView.Resources>
</TreeView>
<Image Name="Laufwerk" HorizontalAlignment="Left" Height="104" Margin="-18,428,0,-10" VerticalAlignment="Top" Width="110" Source="Binding" RenderTransformOrigin="0.409,0.857"/>
<Label Content="H-Laufwerk Auslastung:" HorizontalAlignment="Left" Margin="68,446,0,0" VerticalAlignment="Top" Height="36" Width="186" FontSize="16" Foreground="White"/>
<TextBox Name="tblaufwerkauslastung" BorderThickness="0" HorizontalAlignment="Left" Height="22" Margin="68,478,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="190" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" IsTabStop="False"/>
<ListView TabIndex="3" Name="browser" BorderThickness="0" HorizontalAlignment="Left" Height="374" Margin="233,57,0,0" VerticalAlignment="Top" Width="550" Background="#013C5A" Foreground="White">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="#013C5A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Width="30">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btncheckbox" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Name="CheckedImage" Source="{Binding SourceChecked}" Height="18"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="230">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortname" Content="Name" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Name="Image_GridViewColumnName" Source="{Binding Source}" Height="20"/>
<Label Name="Label_GridViewColumnName" Content="{Binding name}" Foreground="White"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding size}" Width="70">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortsize" Content="Größe" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn Width="210">
<GridViewColumn.Header>
<GridViewColumnHeader Name="empty" Content="" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Name="Empty_Label" Content=""/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="red"/>
</Style.Resources>
<Style.Triggers>
<Trigger Property="ListViewItem.IsMouseOver" Value="True">
<Setter Property="Background" Value="#0082c6"></Setter>
<Setter Property="Foreground" Value="#022335"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</ListView.Resources>
</ListView>
<Label Content="Selektierte Auswahl" HorizontalAlignment="Left" Margin="788,348,0,0" VerticalAlignment="Top" Height="83" Width="200" Background="#013C5A" Foreground="White" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Center"/>
<Label Content="Dateitypen" HorizontalAlignment="Left" Margin="788,57,0,0" VerticalAlignment="Top" Height="286" Width="200" Background="#013C5A" Foreground="White" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Center"/>
<Label Content="Gewählte Filter:" HorizontalAlignment="Left" Margin="799,129,0,0" VerticalAlignment="Top" Width="177" Height="27" Foreground="White" FontWeight="Medium"/>
<Button TabIndex="4" Name="btnchoosefilter" Content="Auswählen" BorderThickness="0" HorizontalAlignment="Left" Margin="799,88,0,0" VerticalAlignment="Top" Width="177" Height="36" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="5" Name="btnfiltersw" FontSize="13" BorderThickness="0" HorizontalAlignment="Left" Margin="799,300,0,0" VerticalAlignment="Top" Width="50" Height="30" Background="Transparent" Foreground="White" FontWeight="Medium">
<Image Name="imgswitch" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="0" Name="btnScanner" Content="Zum Scannen" BorderThickness="0" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="218" Height="42" FontSize="16" FontWeight="Bold" Background="#00b8d4" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="7" Name="btndel" Content="Löschen" BorderThickness="0" HorizontalAlignment="Left" Margin="857,436,0,0" VerticalAlignment="Top" Width="131" Height="77" FontSize="20" FontWeight="Bold" Background="#FFC5C5C5" Foreground="#FF7A7A7A" IsEnabled="False">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<TextBox Name="elemente" BorderThickness="0" HorizontalAlignment="Left" Height="22" Margin="794,377,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="186" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" TextAlignment="Center" IsTabStop="False"/>
<TextBox Name="size" BorderThickness="0" HorizontalAlignment="Left" Height="22" Margin="794,404,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="186" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" TextAlignment="Center" IsTabStop="False"/>
<ProgressBar Name="pbbar" HorizontalAlignment="Left" Height="4" Margin="68,502,0,0" VerticalAlignment="Top" Width="190" Background="#008000" Foreground="#ff6400" IsTabStop="False"/>
<Label Content="Dieses Tool hilft Ihnen beim Bereinigen Ihres H-Laufwerks. Rechts können Sie auswählen, &#xD;&#xA;welche Art von Dateien aus dem ausgewählten Ordner angezeigt werden sollen." HorizontalAlignment="Left" Margin="233,5,0,0" VerticalAlignment="Top" Width="755" Height="52" FontSize="15" Foreground="White"/>
<Label Content="Unterordner mit &#xD;&#xA;einbeziehen" HorizontalAlignment="Left" Margin="857,291,0,0" VerticalAlignment="Top" Width="177" Height="63" Foreground="White" FontWeight="Medium" FontSize="13"/>
<Label Name="choosen1" Content="" HorizontalAlignment="Left" Margin="799,156,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Label Name="choosen2" Content="" HorizontalAlignment="Left" Margin="799,179,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Label Name="choosen3" Content="" HorizontalAlignment="Left" Margin="799,202,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Label Name="choosen4" Content="" HorizontalAlignment="Left" Margin="799,225,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Button TabIndex="1" Name="btninfo" HorizontalAlignment="Left" Margin="955,15,0,0" VerticalAlignment="Top" Width="30" Height="30" Background="Transparent" ToolTip="Information" BorderThickness="0">
<Image Name="imginfo" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="6" Name="btnmove" Content="Verschieben" BorderThickness="0" HorizontalAlignment="Left" Margin="718,436,0,0" VerticalAlignment="Top" Width="131" Height="77" FontSize="20" FontWeight="Bold" Background="#FFC5C5C5" Foreground="#FF7A7A7A" IsEnabled="False">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<wfi:WindowsFormsHost Name="pbLoading" Height="95" Margin="453,202,456,0" Width="95" Visibility="Hidden" VerticalAlignment="Top" Background="#013C5A">
<winForms:PictureBox x:Name="pb"></winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window>
"@
# Lädt das Fenster
$window=[Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $Form))
# Objekt - Variablen Verknüpfung
$pb = $window.findName("pb")
$Laufwerk = $window.findName("Laufwerk")
$Script:mainimgswitch = $window.findName("imgswitch")
$imginfo = $window.findName("imginfo")
$Script:mainelements = $window.findName("elemente")
$Script:mainsize = $window.findName("size")
$Script:bar = $window.findName("pbbar")
$Script:last = $window.findName("tblaufwerkauslastung")
$Script:maintree = $window.findName("treeview")
$Script:mainbrowser = $window.findName("browser")
$Script:mainscanner = $window.findName("btnScanner")
$Script:mainfilter = $window.findName("btnchoosefilter")
$Script:maininfo = $window.findName("btninfo")
$Script:mainloading = $window.findName("pbLoading")
$Script:mainswitch = $window.findName("btnfiltersw")
$Script:maindel = $window.findName("btndel")
$Script:mainmove = $window.findName("btnmove")
$Script:mainsortname = $window.findName("btnsortname")
$Script:mainsortsize = $window.findName("btnsortsize")
$Script:maincheckall = $window.findName("btncheckbox")
$Script:mainchoosen1 = $window.findName("choosen1")
$Script:mainchoosen2 = $window.findName("choosen2")
$Script:mainchoosen3 = $window.findName("choosen3")
$Script:mainchoosen4 = $window.findName("choosen4")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Laufwerk.Source = "$root/Source/HDD1.png"
$mainimgswitch.Source = "$root/Source/swfalse.png"
$imginfo.Source = "$root/Source/info.png"
$mainelements.Text = " 0 Elemente"
$mainsize.Text = " 0 MB"
### GIF Sanduhr
$file = (get-item "$root/Source/mainhourglas.gif")
$img = [System.Drawing.Image]::Fromfile($file);
$pb.Image = $img
return $window
}
function Set_Defaults_Main {
param ($array)
if (!$array[5]) {
$Script:bar.Value=$array[4]
$Script:last.Text=$array[0]
}else{
$Script:last.Text="OFFLINE"
}
}
function Get_TreeView {
$maintree.Items.Clear()
$RootItem = New-Object System.Windows.Controls.TreeViewItem
$RootItem.Header = $Script:folderdb[0][0]
$RootItem.Tag = 0
for ($i = 5; $i -lt $Script:folderdb[0].count; $i++) {
if ($Script:folderdb[0][$i].contains("f")) {
$item=$Script:folderdb[0][$i].Substring(1)
Get_TreeViewExpand $RootItem $item
}
[System.Windows.Forms.Application]::DoEvents()
}
$maintree.Items.Add($RootItem)
}
function Get_TreeViewExpand {
param ($parentItem, $Folder)
$int = [int]$Folder
if (!$Script:folderdb[$int][4]) {
$subItem = New-Object System.Windows.Controls.TreeViewItem
$subItem.Header = $Script:folderdb[$int][0]
$subItem.Tag = $int
[void]$parentItem.Items.Add($subItem)
for ($i = 5; $i -lt $Script:folderdb[$int].count; $i++) {
if ($Script:folderdb[$int][$i] -match "f") {
$item=$Script:folderdb[$int][$i].Substring(1)
Get_TreeViewExpand $subItem $item
}
[System.Windows.Forms.Application]::DoEvents()
}
}
}
function Browser_Path {
param ($path)
$data = @()
$c=$false
#Log "Tree $path" -clear
for ($t = 0; $t -lt 3; $t++) {
if ($Script:filtercheck[$t]) {
$c=$true
}
[System.Windows.Forms.Application]::DoEvents()
}
if ($c) {
Filter_data $path
}else {
for ($i = 5; $i -lt $Script:folderdb[$path].count; $i++) {
if ($Script:folderdb[$path][$i] -match "f") {
$string=$Script:folderdb[$path][$i].Substring(1)
$int = [int]$string
if (!$Script:folderdb[$int][4]) {
if ($Script:folderdb[$int][3]) {
$cp = "$Script:ScriptRoot\Source\checked.png"
}else {
$cp = "$Script:ScriptRoot\Source\unchecked.png"
}
$Length = calc_Size $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\Source\Folder.png";Name=$Script:folderdb[$int][0];Size="$Length";Tag=$Script:folderdb[$path][$i];SourceChecked="$cp"}
}
}else {
if (!$Script:filedb[$Script:folderdb[$path][$i]][4]) {
if ($Script:filedb[$Script:folderdb[$path][$i]][3]) {
$cp = "$Script:ScriptRoot\Source\checked.png"
}else {
$cp = "$Script:ScriptRoot\Source\unchecked.png"
}
$Length = calc_Size $Script:filedb[$Script:folderdb[$path][$i]][1]
$icon = $Script:icontypes[$Script:filedb[$Script:folderdb[$path][$i]][5]]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\icons\$icon.ico";Name=$Script:filedb[$Script:folderdb[$path][$i]][0];Size="$Length";Tag=$Script:folderdb[$path][$i];SourceChecked="$cp"}
}
}
[System.Windows.Forms.Application]::DoEvents()
#$logcontent = "Main: Browser " + $Script:folderdb[$path][$i]
#Log $logcontent -clear
}
$item = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $item
}
}
function Check_Browser {
param ($tag)
$data = @()
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
if (($mainbrowser.Items.Tag[$i] -eq $tag) -or ($mainbrowser.Items.Count -eq 1)) {
$item=$mainbrowser.Items[$i]
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($Script:folderdb[$int][3]) {
$Script:folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
}else {
$Script:folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
}
}else {
if ($Script:filedb[$tag][3]) {
$Script:filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
}else {
$Script:filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
}
}
}else {
$data += $mainbrowser.Items[$i]
}
[System.Windows.Forms.Application]::DoEvents()
}
$item = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $item
}
function main_sortname{
param([switch]$change)
$data= @()
if ($change) {
if ($sortmain[0] -eq "up") {
$sortmain[0]="down"
}else {
$sortmain[0]="up"
}
}
for ($i = 0; $i -lt $mainbrowser.Items.count; $i++) {
$item = $mainbrowser.Items[$i]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortmain[0] -eq "up") {
$data = $data | Sort-Object -Property Name
}else {
$data = $data | Sort-Object -Property Name -Descending
}
$sortmain[3]=$false
$ItemList = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.ItemsSource = $ItemList
}
function main_sortsize {
param([switch]$change)
if ($change) {
if ($sortmain[1] -eq "up") {
$sortmain[1]="down"
}else {
$sortmain[1]="up"
}
}
$data=@()
$array=@()
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
$item = $mainbrowser.Items[$i]
if ($item.Size.EndsWith("GB")) {
$stringtrim = $item.Size.TrimEnd(" GB")
$int = [int]$stringtrim
$int = $int + 1000000
}elseif ($item.Size.EndsWith("MB")) {
$stringtrim = $item.Size.TrimEnd(" MB")
$int = [int]$stringtrim
$int = $int + 1000
}else {
$stringtrim = $item.Size.TrimEnd(" KB")
$int = [int]$stringtrim
}
$array += New-Object PSObject -prop @{Tag=$item.Tag;Size=$int}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortmain[1] -eq "up") {
$array = $array | Sort-Object -Property Size
}else {
$array = $array | Sort-Object -Property Size -Descending
}
for ($i = 0; $i -lt $array.Count; $i++) {
for ($e = 0; $e -lt $mainbrowser.items.Count; $e++) {
if ($array.Tag[$i] -eq $mainbrowser.Items.Tag[$e]) {
$item=$mainbrowser.Items[$e]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked}
$e=$mainbrowser.items.Count
}
[System.Windows.Forms.Application]::DoEvents()
}
[System.Windows.Forms.Application]::DoEvents()
}
$sortmain[3]=$true
$ItemList = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $ItemList
}
function main_checkall {
$data = @()
$check = 0
if ($sortmain[2]) {
$sortmain[2]=$false
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
$item = $mainbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($folderdb[$int][3]) {
$folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}else {
if ($filedb[$tag][3]) {
$filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}else {
$sortmain[2]=$true
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
$item = $mainbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if (!$folderdb[$int][3]) {
$folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}else {
if (!$filedb[$tag][3]) {
$filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
if ($check -eq 0) {
main_checkall
}else{
$ItemList = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.ItemsSource = $ItemList
}
}
function main_loading {
param ($stat)
if($stat){
$Script:mainloading.Visibility = "Visible"
$Script:maininfo.Visibility = "Hidden"
}else {
$Script:mainloading.Visibility = "Hidden"
$Script:maininfo.Visibility = "Visible"
}
}
Function Select-FolderDialog{
param([string]$Description="Zielverzeichnis wählen",[string]$RootFolder="Desktop")
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |Out-Null
$objForm = New-Object System.Windows.Forms.FolderBrowserDialog
$objForm.Rootfolder = $RootFolder
$objForm.Description = $Description
$Show = $objForm.ShowDialog()
If ($Show -eq "OK"){
Return $objForm.SelectedPath
}else{
Return $false
}
}
#Log "### Main geladen ###" -clear

254
GUIS/scanner/scanner.ps1 Normal file
View File

@@ -0,0 +1,254 @@
#0=ScanAktiv;
$Script:switch=@($false,$false)
function Load_scanner {
param ($root)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\scanner.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$pb=$window.findName("pb")
$Logo=$window.findName("Logo")
$Laufwerk=$window.findName("Laufwerk")
$Script:bar = $window.FindName("pbbar")
$Script:offline = $window.findName("Offline")
$Script:gesamt = $window.FindName("tbgesamt")
$Script:belegt = $window.FindName("tbbelegt")
$Script:scantxt = $window.findName("Scantxt")
$Script:pbloading = $window.findName("pbLoading")
$Script:scannerscan = $window.findName("btnscan")
$Script:scanlb = $window.findName("lbanalyse1")
$Script:POOP_AIDS_COPY = $window.findName("lbanalyse2")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Logo.Source="$root/Source/Logowhite.png"
$Laufwerk.Source="$root/Source/HDD1.png"
### GIF Sanduhr
$file = (get-item "$root/Source/hourglas.gif")
$img = [System.Drawing.Image]::Fromfile($file);
$pb.Image = $img
return $window
}
function Scan_Label_Swtich {
param(
[switch]$scan
)
if (!$scan) {
$Script:scanlb.Visibility="Visible"
$Script:POOP_AIDS_COPY.Visibility="Hidden"
}else{
$Script:scanlb.Visibility="Hidden"
$Script:POOP_AIDS_COPY.Visibility="Visible"
}
}
function Set_Defaults_Scanner {
param ($array)
if (!$array[5]) {
$Script:H_Size=$array[4]
$Script:bar.Value=$Script:H_Size
$Script:gesamt.Text=$Array[2]
$script:belegt.Text=$array[3]
}else{
$Script:offline.Visibility="Visible"
}
}
function Start_Scan {
param ()
if (!$Script:switch[0]) {
Scan_Label_Swtich -scan
$Script:switch[0]=$true
Init_Scan_Process
#Log "### Start Scan ###" -clear
#### Variablen Deklaration Script ####
#0=Ordner;1=Datei
$Script:counter=@(0,0)
$Script:Scan_prozess = 0
$Script:belegt.Visibility="Hidden"
$Script:bar.Foreground="#008000"
$Script:scantxt.Visibility="Visible"
$Script:pbloading.Visibility="Visible"
$Script:scannerscan.Content="Abbrechen"
$Script:scannerscan.background="$Script:Delcolor"
renew_DB
start_create_database
Add_Root_Folder_Size
Get_TreeView
Browser_Path -path 0
$maintree.Items[0].IsExpanded = $true
$maintree.Items[0].IsSelected = $true
if ($Script:switch[0]) {
$Script:switch[0]=$false
$Script:bar.Foreground="#00b8d4"
$Script:scantxt.Visibility="Hidden"
$Script:pbloading.Visibility="Hidden"
$Script:scannerscan.Content="Scannen"
$Script:belegt.Visibility="Visible"
$Script:bar.Value=$Script:H_Size
$Script:Scan_prozess = 0
Scan_process
Scan_Label_Swtich
$Script:scannerscan.background="$Script:Standardbtncolor"
$Script:scanner.hide()
#Log "### Scan fertig ###" -clear
$Script:main.ShowDialog() | Out-Null
}
}else {
$Script:switch[0]=$false
$Script:bar.Foreground="#00b8d4"
$Script:scantxt.Visibility="Hidden"
$Script:pbloading.Visibility="Hidden"
$Script:scannerscan.Content="Scannen"
$Script:belegt.Visibility="Visible"
$Script:bar.Value=$Script:H_Size
Scan_Label_Swtich
$Script:scannerscan.background="$Script:Standardbtncolor"
}
}
function renew_DB {
#Log "### Datenbank zurückgesetzt ###" -clear
$Script:folderdb = @{
Legende = @("Name","Größe","Pfad","Checked","Deleted","Vorgänger","Inhalt")
}
$Script:filedb = @{
Legende = @("Name","Größe","Pfad","Checked","Deleted","Endung")
}
}
function Init_Scan_Process{
$Script:Scan_prozess = 0
$Scan_exclude_percent = 0.85
$Script:Scan_used_exclude=$Script:used*$Scan_exclude_percent
}
function Scan_Process {
param ($Item)
$Scan_Percent=0
$Script:Scan_Prozess=$Script:Scan_Prozess+$Item
if ($Script:Scan_Prozess -gt $Script:Scan_used_exclude) {
$Scan_Percent = ($Script:Scan_Prozess/$Script:used)*100
}else{
$Scan_Percent = ($Script:Scan_Prozess/$Script:Scan_used_exclude)*100
}
$Script:bar.Value = $Scan_Percent
#Log "Scan prozess: $Scan_Percent" -clear
#Log "$Script:used $Script:Scan_Prozess" -clear
}
function start_create_database {
param ()
$collection = Get-ChildItem -path G:\ -Directory
$Script:folderdb[$Script:counter[0]] = @("H-Laufwerk",1,"H:",$false,$false)
create_file_database "H:"
foreach ($item in $collection){
$Script:switch[1]=$false
foreach ($itemex in $Script:exclude){
if ($item.FullName -eq $itemex) {
$Script:switch[1]=$true
}
[System.Windows.Forms.Application]::DoEvents()
}
if (!$Script:switch[1] -and $Script:switch[0]) {
$Script:counter[0]++
$Script:folderdb[$Script:counter[0]] = @($item.Name,$item.length,$item.FullName,$false,$false)
$Script:folderdb[0] += "f"+$Script:counter[0]
create_file_database $item.FullName
create_folder_database $item.FullName $Script:counter[0]
[System.Windows.Forms.Application]::DoEvents()
}
[System.Windows.Forms.Application]::DoEvents()
}
}
function create_folder_database {
param ($folder,$davor)
if ($Script:switch[0]) {
$collection = Get-ChildItem -path $folder -Directory
foreach ($item in $collection){
$Script:counter[0]++
$Script:folderdb[$Script:counter[0]] = @($item.Name,$item.length,$item.FullName,$false,$false)
$text = " " + $Script:counter[0] + " " + $Script:folderdb[$Script:counter[0]]
#Log $text
$Script:folderdb[$davor] += "f"+$Script:counter[0]
create_file_database $item.FullName
create_folder_database $item.FullName $Script:counter[0]
[System.Windows.Forms.Application]::DoEvents()
}
}
}
function create_file_database {
param ($folder)
$collection = Get-ChildItem -path $folder -File
foreach ($item in $collection) {
$Script:filedb[$Script:counter[1]] = @($item.Name,$item.length,$item.FullName,$false,$false,(get_icon $item.Name))
Scan_Process $item.length
$text = " " + $Script:counter[1] + " " + $Script:filedb[$Script:counter[1]]
#Log $text
$Script:folderdb[$Script:counter[0]] += $Script:counter[1]
$Script:counter[1]++
[System.Windows.Forms.Application]::DoEvents()
}
}
function Add_Root_Folder_Size {
$size=0
for ($i = 5; $i -lt $Script:folderdb[0].count; $i++) {
if ($Script:folderdb[0][$i] -match "f") {
$size=$size+(Add_Folder_Size $Script:folderdb[0][$i])
}else {
$size=$size+$Script:filedb[$Script:folderdb[0][$i]][1]
}
[System.Windows.Forms.Application]::DoEvents()
}
$Script:folderdb[0][1]=$Size
}
function Add_Folder_Size {
param ($Folder)
$string=$Folder.Substring(1)
$Folder = [int]$string
$size=0
for ($i = 5; $i -lt $Script:folderdb[$Folder].count; $i++) {
if ($Script:folderdb[$Folder][$i] -match "f") {
$size=$size+(Add_Folder_Size $Script:folderdb[$Folder][$i])
}else {
$size=$size+$Script:filedb[$Script:folderdb[$Folder][$i]][1]
}
[System.Windows.Forms.Application]::DoEvents()
}
$Script:folderdb[$Folder][1]=$size
return $size
}
function get_icon {
param ($data)
if ($data -match '.') {
$trimdata = (($data.Split('.'))[1]).ToLower()
$index=[array]::indexof($icontypes,$trimdata)
if ($index -eq -1) {
$return = -1
}else{
$return = $index
}
return $return
}else{
return $data
}
}
#Log "### Scanner geladen ###" -clear

53
GUIS/scanner/scanner.xaml Normal file
View File

@@ -0,0 +1,53 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="Window" Title="Cleaner - Startseite" Height="182" Width="751.666" Icon="{Binding Icon}" ResizeMode="NoResize" BorderBrush="Blue">
<Grid Background="#00344E">
<Label HorizontalAlignment="Left" Margin="8,100,0,0" VerticalAlignment="Top" Height="47" Width="730" Background="#013C5A">
<Label.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Label.Resources>
</Label>
<Image Name="Logo" Source="{Binding Logo}" HorizontalAlignment="Left" Margin="8,2,0,0" VerticalAlignment="Top" Height="60" Width="45"/>
<Label Content="cleaner" HorizontalAlignment="Left" Margin="53,1,0,0" VerticalAlignment="Top" FontSize="25" Width="106" Foreground="#FFE1F7FE"/>
<ProgressBar Name="pbbar" HorizontalAlignment="Left" Height="17" Margin="164,109,0,0" VerticalAlignment="Top" Width="451" Background="#00344E" Foreground="#00b8d4">
<ProgressBar.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</ProgressBar.Resources>
</ProgressBar>
<Image Name="Laufwerk" HorizontalAlignment="Left" Height="60" Margin="8,94,0,0" VerticalAlignment="Top" Width="65" Source="{Binding}"/>
<Label Content="H-Laufwerk" HorizontalAlignment="Left" Margin="57,100,0,0" VerticalAlignment="Top" Foreground="White" Width="94" FontSize="16"/>
<Label Name="lbanalyse1" Content="Starte jetzt die Analyse deines H-Laufwerks" HorizontalAlignment="Left" Margin="208,28,0,0" VerticalAlignment="Top" Foreground="White" FontSize="18" Visibility="Visible"/>
<Label Name="lbanalyse2" Content="Die Analyse des H-Laufwerks läuft..." HorizontalAlignment="Left" Margin="208,28,0,0" VerticalAlignment="Top" Foreground="White" FontSize="18" Visibility="Hidden"/>
<Label Content="Die Analyse kann je nach Anzahl der Dateien und Ordner auf dem H-Laufwerk länger dauern" HorizontalAlignment="Left" Margin="122,59,0,0" VerticalAlignment="Top" Foreground="#FFCFCFCF"/>
<TextBlock Name="tbgesamt" Text="" HorizontalAlignment="Left" Margin="64,126,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFCFCFCF"/>
<TextBlock Name="tbbelegt" HorizontalAlignment="Left" Margin="566,126,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Foreground="#FF16D12F" TextAlignment="Right"/>
<Button Name="btnscan" Content="Scannen" BorderThickness="0" HorizontalAlignment="Left" Margin="633,106,0,0" VerticalAlignment="Top" Width="99" Height="36" Background="#00b8d4" Foreground="White" FontSize="14">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Label Name="Scantxt" Content="Es wird mit längeren Laufzeiten gerechnet. Sie können währenddessen am PC weiterarbeiten." FontSize="11" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="151,116,0,0" VerticalAlignment="Top" VerticalContentAlignment="Center" Foreground="White" Visibility="Hidden" Height="38" Width="475"/>
<Label Name="Offline" Content="Das H-Laufwerk ist offline" HorizontalAlignment="Left" Margin="275,5,0,0" VerticalAlignment="Top" Foreground="White" Background="red" FontSize="15" HorizontalContentAlignment="Center" Height="29" Width="218" Visibility="Hidden"/>
<wfi:WindowsFormsHost Name="pbLoading" Height="40" Margin="700,8,0,0" Width="40" Visibility="Hidden" VerticalAlignment="Top">
<winForms:PictureBox x:Name="pb"></winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window>

BIN
H-Cleaner v1.0.0.zip Normal file

Binary file not shown.

BIN
H-Cleaner.exe Normal file

Binary file not shown.

12
README.md Normal file
View File

@@ -0,0 +1,12 @@
# H-Cleaner
### !!!Das Programm ist scharf geschaltet. Dateien und Ordner werden verschoben und gelöscht!!!
# Installation
Um den H-Cleaner zu benutzen den Zip Ordner herunterladen und entpacken. Um das Programm zu Starten lediglich die H-Cleaner.exe ausführen.
# Bugs
Bekannte Bugs sind als Tickets im GitLab hinterlegt.

32
ScanBSP.ps1 Normal file
View File

@@ -0,0 +1,32 @@
#Scan Funktion vereinfacht dargestellt
$Start=Get-Date
Get-Childitem H:\ -Recurse | Format-Table -property FullName
$Stamp=Get-Date
function null {
$collection = Get-ChildItem -path H:\ -Directory
foreach ($item in $collection) {
Write-Host $item.FullName
eins $item.fullname
zwei $item.FullName
}
}
function eins {
param($folder)
$collection = Get-ChildItem -path $folder -File
foreach ($item in $collection){
Write-Host $item.FullName
}
}
function zwei {
param($folder)
$collection = Get-ChildItem -path $folder -Directory
foreach ($item in $collection){
Write-Host $item.FullName
eins $item.FullName
zwei $item.FullName
}
}
null
$Finish=Get-Date
Write-Host "Start: $Start Zwischenzeit: $Stamp Ende: $Finish"

BIN
Source/Archiv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Audio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Bild.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Checked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
Source/Container.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Datenbank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
Source/Folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
Source/HDD1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Internet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
Source/Kofig.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Logo-alt.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
Source/Logo.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

BIN
Source/Logowhite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
Source/Mail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
Source/Mails.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Office.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Sonstiges.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Texte-Logs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/Unchecked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
Source/Video.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Source/hourglas.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
Source/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
Source/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

BIN
Source/mainhourglas.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
Source/marked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
Source/swfalse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
Source/swtrue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

1
Start.ps1 Normal file
View File

@@ -0,0 +1 @@
.\root.ps1

Binary file not shown.

283
Test/GUIS/del/del.ps1 Normal file
View File

@@ -0,0 +1,283 @@
function Load_del {
param ($root)
# Speichert ob gelöscht oder verschoben werden soll
$Script:whattodo=""
# Arraydefinition
## 0=Name,1=Größe,2=checked
$Script:sortdel=@("up","up",$false)
# Lädt das Fenster
[xml]$Form = Get-Content "$root/GUIS/del/del.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$pb=$window.findName("pb")
$Script:Delbrowser = $window.findName("browser")
$Script:Delback = $window.findName("btnback")
$Script:Deldel = $window.findName("btnDeleteAll")
$Script:Delwarning = $window.findName("warning")
$Script:Delmarked = $window.findName("marked")
$Script:Delstats = $window.findName("stats")
$Script:Delsortname = $window.findName("btnsortname")
$Script:Delsortsize = $window.findName("btnsortsize")
$Script:Delcheckall = $window.findName("btncheckbox")
# Verknüpft feste Elemente
$window.icon="$root/Source/Logo.png"
### GIF Sanduhr
$file = (get-item "$root/Source/hourglas.gif")
$img = [System.Drawing.Image]::Fromfile($file);
$pb.Image = $img
return $window
}
function Browser_del {
$data = @()
for ($i = 0; $i -lt $Script:folderdb.Count; $i++) {
if ($Script:folderdb[$i][3]) {
if (!$Script:folderdb[$i][4]) {
$Length = calc_Size $Script:folderdb[$i][1]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\Source\Folder.png";Name=$Script:folderdb[$i][0];Size="$Length";Tag="f$i";SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$Script:folderdb[$i][2]}
$logcontent = "Del: Browser f" + $i
Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $filedb.Count; $i++) {
if ($Script:filedb[$i][3]) {
if (!$Script:filedb[$i][4]) {
$Length = calc_Size $Script:filedb[$i][1]
$icon = $Script:icontypes[$Script:filedb[$i][5]]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\icons\$icon.ico";Name=$Script:filedb[$i][0];Size="$Length";Tag=$i;SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$Script:filedb[$i][2]}
$logcontent = "Del: Browser " + $i
Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
$item = [System.Windows.Data.ListCollectionView]$data
$Script:Delbrowser.Remove
$Script:Delbrowser.ItemsSource = $item
}
function Check_Del {
param ($tag)
$data = @()
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
if (($delbrowser.Items.Tag[$i] -eq $tag) -or ($delbrowser.Items.Count -eq 1)) {
$item=$delbrowser.Items[$i]
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($Script:folderdb[$int][3]) {
$Script:folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png";Path=$item.Path}
}else {
$Script:folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$item.Path}
}
}else {
if ($Script:filedb[$tag][3]) {
$Script:filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png";Path=$item.Path}
}else {
$Script:filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png";Path=$item.Path}
}
}
}else {
$data += $delbrowser.Items[$i]
}
[System.Windows.Forms.Application]::DoEvents()
}
$item = [System.Windows.Data.ListCollectionView]$data
$delbrowser.Remove
$delbrowser.ItemsSource = $item
}
function del_sortname{
Log "### Del: sort name ###" -clear
$data= @()
for ($i = 0; $i -lt $delbrowser.Items.count; $i++) {
$item = $delbrowser.Items[$i]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked;Path=$item.Path}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortdel[0] -eq "up") {
$data = $data | Sort-Object -Property Name
$sortdel[0]="down"
}else {
$data = $data | Sort-Object -Property Name -Descending
$sortdel[0]="up"
}
$ItemList = [System.Windows.Data.ListCollectionView]$data
$delbrowser.ItemsSource = $ItemList
}
function del_sortsize {
Log "### Del: sort size ###" -clear
$data=@()
$array=@()
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
$item = $delbrowser.Items[$i]
if ($item.Size.EndsWith("GB")) {
$stringtrim = $item.Size.TrimEnd(" GB")
}else {
$stringtrim = $item.Size.TrimEnd(" MB")
}
$int = [int]$stringtrim
$array += New-Object PSObject -prop @{Tag=$item.Tag;Size=$int}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortdel[1] -eq "up") {
$array = $array | Sort-Object -Property Size
$sortdel[1]="down"
}else {
$array = $array | Sort-Object -Property Size -Descending
$sortdel[1]="up"
}
for ($i = 0; $i -lt $array.Count; $i++) {
for ($e = 0; $e -lt $delbrowser.items.Count; $e++) {
if ($array.Tag[$i] -eq $delbrowser.Items.Tag[$e]) {
$item=$delbrowser.Items[$e]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked;Path=$item.Path}
$e=$delbrowser.items.Count
}
}
[System.Windows.Forms.Application]::DoEvents()
}
$ItemList = [System.Windows.Data.ListCollectionView]$data
$delbrowser.Remove
$delbrowser.ItemsSource = $ItemList
}
function del_checkall {
Log "### Del: Check all ###" -clear
$data = @()
$check = 0
if ($sortdel[2]) {
$sortdel[2]=$false
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
$item = $delbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($folderdb[$int][3]) {
$folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}else {
if ($filedb[$tag][3]) {
$filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}else {
$sortdel[2]=$true
for ($i = 0; $i -lt $delbrowser.Items.Count; $i++) {
$item = $delbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if (!$folderdb[$int][3]) {
$folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}else {
if (!$filedb[$tag][3]) {
$filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
if ($check -eq 0) {
del_checkall
}else{
$ItemList = [System.Windows.Data.ListCollectionView]$data
$delbrowser.ItemsSource = $ItemList
}
}
function final_action {
if ($script:whattodo -eq "move") {
for ($i = 0; $i -lt $filedb.Count; $i++) {
if ($filedb[$i][3]) {
if (!$filedb[$i][4]) {
Move-Item -Path $filedb[$i][2] -Destination $Script:movelocation
$filedb[$i][4] = $true
$logcontent = "Move: " + $filedb[$i][2] + " To: " + $Script:movelocation
Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $folderdb.Count; $i++) {
if ($folderdb[$i][3]) {
if (!$folderdb[$i][4]) {
Move-Item -Path $folderdb[$i][2] -Destination $Script:movelocation
$folderdb[$i][4] = $true
$logcontent = "Move: " + $folderdb[$i][2] + " To: " + $Script:movelocation
Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}elseif ($Script:whattodo -eq "delete") {
for ($i = 0; $i -lt $filedb.Count; $i++) {
if ($filedb[$i][3]) {
if (!$filedb[$i][4]) {
Remove-Item $filedb[$i][2]
$filedb[$i][4] = $true
$logcontent = "Removed: " + $filedb[$i][2]
Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $folderdb.Count; $i++) {
if ($folderdb[$i][3]) {
if (!$folderdb[$i][4]) {
Remove-Item $folderdb[$i][2]
$folderdb[$i][4] = $true
$logcontent = "Removed: " + $folderdb[$i][2]
Log $logcontent -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
}
Log "### Del geladen ###" -clear

95
Test/GUIS/del/del.xaml Normal file
View File

@@ -0,0 +1,95 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="Cleaner - Auswahlbestätigung" Height="459.667" Width="800" Icon="{Binding Icon}" ResizeMode="NoResize">
<Grid Background="#00344E">
<Label HorizontalAlignment="Center" Margin="10,357,10,0" VerticalAlignment="Top" Height="64" Width="774" Background="#013C5A">
<Label.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Label.Resources>
</Label>
<Button Name="btnDeleteAll" Content="Markierte löschen" BorderThickness="0" HorizontalAlignment="Left" Margin="601,366,0,0" VerticalAlignment="Top" Height="46" Width="172" FontSize="18" FontWeight="Bold" Background="#d50000" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<TextBox Name="stats" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Margin="276,389,282,0" Text="TextBox" TextWrapping="Wrap" VerticalAlignment="Top" Width="236" Height="23" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" BorderThickness="0" IsTabStop="False"/>
<ListView Name="browser" Margin="8,43,8,79" Background="#013C5A" Foreground="White" BorderThickness="0">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="#013C5A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Width="30">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btncheckbox"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Name="CheckedImage" Source="{Binding SourceChecked}" Height="18"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="auto">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortname" Content="Name"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Name="Image_GridViewColumnName" Source="{Binding Source}" Height="20"/>
<Label Name="Label_GridViewColumnName" Content="{Binding name}" Foreground="White"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding size}" Width="auto">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortsize" Content="Größe"/>
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding path}" Width="auto">
<GridViewColumn.Header>
<GridViewColumnHeader Name="lbpath" Content="Pfad"/>
</GridViewColumn.Header>
</GridViewColumn>
</GridView>
</ListView.View>
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Triggers>
<Trigger Property="ListViewItem.IsMouseOver" Value="True">
<Setter Property="Background" Value="#0082c6"></Setter>
<Setter Property="Foreground" Value="#022335"></Setter>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</ListView.Resources>
</ListView>
<Button Name="btnback" Content="Zurück" HorizontalAlignment="Left" Margin="18,366,0,0" VerticalAlignment="Top" Width="71" Height="46" FontSize="16" FontWeight="Bold" Background="#00b8d4" Foreground="White" RenderTransformOrigin="-0.018,0.517">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Label Name="warning" Content="Die ausgewählten Dateien werden endgültig gelöscht!" HorizontalAlignment="Center" Margin="0,2,0,0" VerticalAlignment="Top" Height="36" Width="800" FontSize="18" HorizontalContentAlignment="Center" Foreground="white" Background="red" FontWeight="Bold"/>
<Label Name="marked" Content="Zum löschen markiert:" HorizontalAlignment="Left" Margin="276,357,0,0" VerticalAlignment="Top" Width="236" FontWeight="Bold" Foreground="white" FontSize="16" HorizontalContentAlignment="Center"/>
<wfi:WindowsFormsHost Name="pbLoading" Height="40" Margin="745,2,0,0" Width="40" VerticalAlignment="Top" Visibility="Hidden">
<winForms:PictureBox x:Name="pb"></winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window>

View File

@@ -0,0 +1,17 @@
function Load_delconf {
param ($root)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\delconf.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Script:delconfsize = $window.FindName("tbdelsize")
$Script:delconfelements = $window.FindName("tbdeldata")
$Script:deltb = $window.FindName("tb")
return $window
}

View File

@@ -0,0 +1,35 @@
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Cleaner - Bestätigung" Height="198" Width="383" ResizeMode="NoResize" WindowStyle="None">
<Grid Background="#00344E">
<Label Content="" HorizontalAlignment="Left" Margin="63,42,0,0" VerticalAlignment="Top" Width="256" Height="94" Background="#013C5A" BorderThickness="0" >
<Label.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Label.Resources>
</Label>
<TextBox Name="tbdeldata" Text="" HorizontalAlignment="Left" Height="22" Margin="63,49,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="256" TextAlignment="Center" FontSize="14" Foreground="White" BorderThickness="0" Background="#013C5A" IsReadOnly="true" IsTabStop="False"/>
<TextBox Name="tbdelsize" Text="" HorizontalAlignment="Left" Height="24" Margin="63,76,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="256" TextAlignment="Center" FontSize="14" Foreground="White" BorderThickness="0" Background="#013C5A" IsReadOnly="true" IsTabStop="False"/>
<TextBox Name="tbco2" Text="" HorizontalAlignment="Left" Height="24" Margin="63,105,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="256" TextAlignment="Center" FontSize="14" Foreground="White" BorderThickness="0" Background="#013C5A" IsReadOnly="true" IsTabStop="False"/>
<Button Name="btnok" Content="OK" HorizontalAlignment="Left" Margin="140,152,0,0" VerticalAlignment="Top" Width="100" Height="36" BorderThickness="0" Background="#00b8d4" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<TextBox Name="tb" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="Alle ausgewählten Dateien wurden erfolgreich entfernt." VerticalAlignment="Top" Width="352" Margin="16,10,0,0" FontSize="14" BorderThickness="0" TextAlignment="Center" Foreground="White" Background="#00344E" IsReadOnly="true" IsTabStop="False"/>
</Grid>
</Window>

129
Test/GUIS/filter/filter.ps1 Normal file
View File

@@ -0,0 +1,129 @@
function Load_filter {
param ($root)
#0=Office;1=Bilder;2=Videos;3=Audios;4=Unterordner einbeziehen
$Script:filtercheck=@($false,$false,$false,$false,$false)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\filter.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$Office=$window.FindName("imgoffice")
$Bilder=$window.FindName("imgbilder")
$Videos=$window.FindName("imgvideos")
$Audios=$window.FindName("imgaudios")
$Script:Filteroffice = $window.FindName("btnoffice")
$Script:Filterbilder = $window.FindName("btnbilder")
$Script:Filtervideos = $window.FindName("btnvideos")
$Script:Filteraudios = $window.FindName("btnaudios")
$Script:filterok = $window.FindName("btnsetzen")
$Script:filterreset = $window.FindName("btnreset")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Office.Source = "$root/Source/Office.png"
$Bilder.Source = "$root/Source/Bild.png"
$Videos.Source = "$root/Source/Video.png"
$Audios.Source = "$root/Source/Audio.png"
return $window
}
function Reset_Filter {
#0=Office;1=Bilder;2=Videos;3=Audios;4=Unterordner einbeziehen
$Script:filtercheck=@($false,$false,$false,$false,$false)
$Filteroffice.background = "#444444"
$Filterbilder.background = "#444444"
$Filtervideos.background = "#444444"
$Filteraudios.background = "#444444"
$mainimgswitch.Source = "$ScriptRoot/Source/swfalse.png"
}
function Filter_data {
param($tag)
$Script:data = @()
main_loading $true
Filter_deep $tag
main_loading $false
$item = [System.Windows.Data.ListCollectionView]$Script:data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $item
}
function Filter_deep {
param ($tag)
Log "### Main: Filter deep ###" -clear
$folder = $Script:folderdb[$tag]
for ($i = 5; $i -lt $folder.count; $i++) {
if ($folder[$i] -match "f") {
if ($Script:filtercheck[4]) {
$string=$folder[$i].Substring(1)
$int = [int]$string
if (!$Script:folderdb[$int][4]) {
Filter_deep $int
}
}
}else {
if (!$Script:filedb[$folder[$i]][4]) {
for ($t = 0; $t -lt 3; $t++) {
if ($Script:filtercheck[$t]) {
for ($ti = 0; $ti -lt $Script:types[$t].Count; $ti++) {
if ($Script:types[$t][$ti] -eq $Script:filedb[$folder[$i]][5]) {
if ($Script:filedb[$folder[$i]][3]) {
$cp = "$Script:ScriptRoot\Source\checked.png"
}else {
$cp = "$Script:ScriptRoot\Source\unchecked.png"
}
$Length = calc_Size $Script:filedb[$folder[$i]][1]
$icon = $Script:icontypes[$Script:filedb[$folder[$i]][5]]
$Script:data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\icons\$icon.ico";Name=$Script:filedb[$folder[$i]][0];Size="$Length";Tag=$folder[$i];SourceChecked="$cp"}
Write-Host $Script:filedb[$folder[$i]][0]
}
[System.Windows.Forms.Application]::DoEvents()
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
}
[System.Windows.Forms.Application]::DoEvents()
}
return $data
}
function Update_Filter {
$ok = @($true,$true,$true,$true)
$btnname = @("Office","Bilder","Videos","Audios")
$Script:mainchoosen1.Content = $null
$Script:mainchoosen2.Content = $null
$Script:mainchoosen3.Content = $null
$Script:mainchoosen4.Content = $null
for ($i = 0; $i -lt 4; $i++) {
if ($Script:filtercheck[$i]) {
if ($ok[0]) {
$Script:mainchoosen1.Content = "- "+$btnname[$i]
$ok[0] = $false
Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}elseif ($ok[1]) {
$Script:mainchoosen2.Content = "- "+$btnname[$i]
$ok[1] = $false
Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}elseif ($ok[2]) {
$Script:mainchoosen3.Content = "- "+$btnname[$i]
$ok[2] = $false
Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}elseif ($ok[3]) {
$Script:mainchoosen4.Content = "- "+$btnname[$i]
$ok[3] = $false
Log "### Filter "+$btnname[$i]+" gesetzt ###" -clear
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
Log "### Filter geladen ###" -clear

View File

@@ -0,0 +1,54 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Cleaner - Filter" Height="240" Width="392.667" Icon="{Binding Icon}" ResizeMode="NoResize" WindowStyle="None">
<Grid Background="#00344E">
<Button Name="btnoffice" HorizontalAlignment="Left" Margin="10,54,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Office Dateien" TabIndex="0">
<Image Name="imgoffice" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnbilder" HorizontalAlignment="Left" Margin="106,54,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Bild Dateien" TabIndex="1">
<Image Name="imgbilder" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnvideos" HorizontalAlignment="Left" Margin="10,147,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Video Dateien" TabIndex="2">
<Image Name="imgvideos" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnaudios" HorizontalAlignment="Left" Margin="106,147,0,0" VerticalAlignment="Top" Width="82" Height="82" Background="#444444" ToolTip="Audio Dateien" TabIndex="3">
<Image Name="imgaudios" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button Name="btnsetzen" Content="Fertig" HorizontalAlignment="Left" Margin="220,192,0,0" VerticalAlignment="Top" Width="162" Height="37" Background="#00b8d4" Foreground="White" FontSize="14" TabIndex="5">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Label Content="Dateitypen auswählen" Margin="112,4,0,0" VerticalAlignment="Top" Width="196" Foreground="White" FontWeight="Bold" FontSize="18" HorizontalAlignment="Left"/>
<Button x:Name="btnreset" Content="Zurücksetzen" HorizontalAlignment="Left" Margin="220,147,0,0" VerticalAlignment="Top" Width="162" Height="35" Background="#00b8d4" Foreground="White" FontSize="14" TabIndex="4">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
</Grid>
</Window>

20
Test/GUIS/info/info.ps1 Normal file
View File

@@ -0,0 +1,20 @@
function Load_info {
param ($root)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\info.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$text = $window.FindName("text")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$text.Text = "Der Speicherbedarf auf Gruppenlaufwerken, insbesondere aber auf persönlichen Home-Laufwerken steigt stetig. Daher muss jährlich ein hoher Betrag in die Erweiterung und die Erneuerung von Speichersystemen investiert werden.
Gleichzeitig soll im BR die Zusammenarbeit durch das Teilen von Informationen, Dokumenten und Content verbessert werden. Persönliche und damit exklusive Inhalte und Daten sind dabei kontraproduktiv. Dies gilt vor allem für den produzierten Mediencontent.
Mit diesem Werkzeug können Sie den zu löschenden oder zu verschiebenden Inhalt leichter identifizieren. `n`n$Script:Version `nCopyright Bayerischer Rundfunk (2021)`nAutor: Florian Späth `nDSGVO-konform"
return $window
}

28
Test/GUIS/info/info.xaml Normal file
View File

@@ -0,0 +1,28 @@
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="Window" Title="Cleaner - Information" Height="440" Width="624" Icon="{Binding Icon}" ResizeMode="NoResize" WindowStyle="None">
<Grid Background="#00344E">
<TextBlock Name="text" Text="" HorizontalAlignment="Left" Margin="34,44,0,0" TextWrapping="Wrap" Foreground="White" Width="554" TextAlignment="Center" Height="360" VerticalAlignment="Top" FontSize="16"></TextBlock>
<Button Name="btnok" Content="OK" HorizontalAlignment="Left" Margin="264,390,0,0" VerticalAlignment="Top" Width="100" Height="36" BorderThickness="0" Background="#00b8d4" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Label Content="Information" HorizontalAlignment="Left" VerticalAlignment="Top" Width="624" HorizontalContentAlignment="Center" Foreground="White" FontSize="20" FontWeight="Bold"/>
</Grid>
</Window>

514
Test/GUIS/main/main.ps1 Normal file
View File

@@ -0,0 +1,514 @@
function Load_main {
param ($root)
# Arraydefinition
## 0=Name,1=Größe,2=checked,3=$false->Name $true->Größe
$Script:sortmain=@("up","up",$false, $false)
# XAML Fenster
[XML]$Form = @"
<?xaml encoding="utf-8"?>
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="Window" Title="Cleaner - Hauptfenster" Height="551" Width="1003.333" Icon="{Binding Icon}" ResizeMode="NoResize">
<Window.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="#0082c6"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="#022335"/>
</Window.Resources>
<Grid Background="#00344E">
<TreeView TabIndex="2" Name="treeview" BorderThickness="0" HorizontalAlignment="Left" Height="374" Margin="10,57,0,0" VerticalAlignment="Top" Width="218" Background="#013C5A" Foreground="White">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Name="treeimage" Source="$root\Source\Folder.png" HorizontalAlignment="Left" Width="18" Margin="2" />
<TextBlock VerticalAlignment="Center" Text="{Binding}" FontSize="14" Foreground="White"/>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="TreeViewItem.IsMouseOver" Value="True">
<Setter Property="Background" Value="#0082c6"></Setter>
<Setter Property="Foreground" Value="#022335"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</TreeView.Resources>
</TreeView>
<Image Name="Laufwerk" HorizontalAlignment="Left" Height="104" Margin="-18,428,0,-10" VerticalAlignment="Top" Width="110" Source="Binding" RenderTransformOrigin="0.409,0.857"/>
<Label Content="H-Laufwerk Auslastung:" HorizontalAlignment="Left" Margin="68,446,0,0" VerticalAlignment="Top" Height="36" Width="186" FontSize="16" Foreground="White"/>
<TextBox Name="tblaufwerkauslastung" BorderThickness="0" HorizontalAlignment="Left" Height="22" Margin="68,478,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="190" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" IsTabStop="False"/>
<ListView TabIndex="3" Name="browser" BorderThickness="0" HorizontalAlignment="Left" Height="374" Margin="233,57,0,0" VerticalAlignment="Top" Width="550" Background="#013C5A" Foreground="White">
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="#013C5A"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Width="30">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btncheckbox" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Image Name="CheckedImage" Source="{Binding SourceChecked}" Height="18"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="230">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortname" Content="Name" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Name="Image_GridViewColumnName" Source="{Binding Source}" Height="20"/>
<Label Name="Label_GridViewColumnName" Content="{Binding name}" Foreground="White"/>
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn DisplayMemberBinding="{Binding size}" Width="70">
<GridViewColumn.Header>
<GridViewColumnHeader Name="btnsortsize" Content="Größe" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
</GridViewColumn>
<GridViewColumn Width="210">
<GridViewColumn.Header>
<GridViewColumnHeader Name="empty" Content="" Margin="0,-1,0,-1"/>
</GridViewColumn.Header>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Name="Empty_Label" Content=""/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
<ListView.Resources>
<Style TargetType="ListViewItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="red"/>
</Style.Resources>
<Style.Triggers>
<Trigger Property="ListViewItem.IsMouseOver" Value="True">
<Setter Property="Background" Value="#0082c6"></Setter>
<Setter Property="Foreground" Value="#022335"></Setter>
</Trigger>
</Style.Triggers>
</Style>
</ListView.Resources>
</ListView>
<Label Content="Selektierte Auswahl" HorizontalAlignment="Left" Margin="788,348,0,0" VerticalAlignment="Top" Height="83" Width="200" Background="#013C5A" Foreground="White" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Center"/>
<Label Content="Dateitypen" HorizontalAlignment="Left" Margin="788,57,0,0" VerticalAlignment="Top" Height="286" Width="200" Background="#013C5A" Foreground="White" FontSize="16" FontWeight="Bold" HorizontalContentAlignment="Center"/>
<Label Content="Gewählte Filter:" HorizontalAlignment="Left" Margin="799,129,0,0" VerticalAlignment="Top" Width="177" Height="27" Foreground="White" FontWeight="Medium"/>
<Button TabIndex="4" Name="btnchoosefilter" Content="Auswählen" BorderThickness="0" HorizontalAlignment="Left" Margin="799,88,0,0" VerticalAlignment="Top" Width="177" Height="36" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="5" Name="btnfiltersw" FontSize="13" BorderThickness="0" HorizontalAlignment="Left" Margin="799,300,0,0" VerticalAlignment="Top" Width="50" Height="30" Background="Transparent" Foreground="White" FontWeight="Medium">
<Image Name="imgswitch" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="8"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="0" Name="btnScanner" Content="Zum Scannen" BorderThickness="0" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="218" Height="42" FontSize="16" FontWeight="Bold" Background="#00b8d4" Foreground="White">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="7" Name="btndel" Content="Löschen" BorderThickness="0" HorizontalAlignment="Left" Margin="857,436,0,0" VerticalAlignment="Top" Width="131" Height="77" FontSize="20" FontWeight="Bold" Background="#FFC5C5C5" Foreground="#FF7A7A7A" IsEnabled="False">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<TextBox Name="elemente" BorderThickness="0" HorizontalAlignment="Left" Height="22" Margin="794,377,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="186" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" TextAlignment="Center" IsTabStop="False"/>
<TextBox Name="size" BorderThickness="0" HorizontalAlignment="Left" Height="22" Margin="794,404,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="186" Background="#013C5A" Foreground="White" IsReadOnly="True" FontSize="14" TextAlignment="Center" IsTabStop="False"/>
<ProgressBar Name="pbbar" HorizontalAlignment="Left" Height="4" Margin="68,502,0,0" VerticalAlignment="Top" Width="190" Background="#008000" Foreground="#ff6400" IsTabStop="False"/>
<Label Content="Dieses Tool hilft Ihnen beim Bereinigen Ihres H-Laufwerks. Rechts können Sie auswählen, &#xD;&#xA;welche Art von Dateien aus dem ausgewählten Ordner angezeigt werden sollen." HorizontalAlignment="Left" Margin="233,5,0,0" VerticalAlignment="Top" Width="755" Height="52" FontSize="15" Foreground="White"/>
<Label Content="Unterordner mit &#xD;&#xA;einbeziehen" HorizontalAlignment="Left" Margin="857,291,0,0" VerticalAlignment="Top" Width="177" Height="63" Foreground="White" FontWeight="Medium" FontSize="13"/>
<Label Name="choosen1" Content="" HorizontalAlignment="Left" Margin="799,156,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Label Name="choosen2" Content="" HorizontalAlignment="Left" Margin="799,179,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Label Name="choosen3" Content="" HorizontalAlignment="Left" Margin="799,202,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Label Name="choosen4" Content="" HorizontalAlignment="Left" Margin="799,225,0,0" VerticalAlignment="Top" Width="177" Height="23" FontSize="12" Foreground="White"/>
<Button TabIndex="1" Name="btninfo" HorizontalAlignment="Left" Margin="955,15,0,0" VerticalAlignment="Top" Width="30" Height="30" Background="Transparent" ToolTip="Information" BorderThickness="0">
<Image Name="imginfo" Source="{Binding}"/>
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Button.Resources>
</Button>
<Button TabIndex="6" Name="btnmove" Content="Verschieben" BorderThickness="0" HorizontalAlignment="Left" Margin="718,436,0,0" VerticalAlignment="Top" Width="131" Height="77" FontSize="20" FontWeight="Bold" Background="#FFC5C5C5" Foreground="#FF7A7A7A" IsEnabled="False">
<Button.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
</Button>
<wfi:WindowsFormsHost Name="pbLoading" Height="95" Margin="453,202,456,0" Width="95" Visibility="Hidden" VerticalAlignment="Top" Background="#013C5A">
<winForms:PictureBox x:Name="pb"></winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window>
"@
# Lädt das Fenster
$window=[Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $Form))
# Objekt - Variablen Verknüpfung
$pb = $window.findName("pb")
$Laufwerk = $window.findName("Laufwerk")
$Script:mainimgswitch = $window.findName("imgswitch")
$imginfo = $window.findName("imginfo")
$Script:mainelements = $window.findName("elemente")
$Script:mainsize = $window.findName("size")
$Script:bar = $window.findName("pbbar")
$Script:last = $window.findName("tblaufwerkauslastung")
$Script:maintree = $window.findName("treeview")
$Script:mainbrowser = $window.findName("browser")
$Script:mainscanner = $window.findName("btnScanner")
$Script:mainfilter = $window.findName("btnchoosefilter")
$Script:maininfo = $window.findName("btninfo")
$Script:mainloading = $window.findName("pbLoading")
$Script:mainswitch = $window.findName("btnfiltersw")
$Script:maindel = $window.findName("btndel")
$Script:mainmove = $window.findName("btnmove")
$Script:mainsortname = $window.findName("btnsortname")
$Script:mainsortsize = $window.findName("btnsortsize")
$Script:maincheckall = $window.findName("btncheckbox")
$Script:mainchoosen1 = $window.findName("choosen1")
$Script:mainchoosen2 = $window.findName("choosen2")
$Script:mainchoosen3 = $window.findName("choosen3")
$Script:mainchoosen4 = $window.findName("choosen4")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Laufwerk.Source = "$root/Source/HDD1.png"
$mainimgswitch.Source = "$root/Source/swfalse.png"
$imginfo.Source = "$root/Source/info.png"
$mainelements.Text = " 0 Elemente"
$mainsize.Text = " 0 MB"
### GIF Sanduhr
$file = (get-item "$root/Source/mainhourglas.gif")
$img = [System.Drawing.Image]::Fromfile($file);
$pb.Image = $img
return $window
}
function Set_Defaults_Main {
param ($array)
if (!$array[5]) {
$Script:bar.Value=$array[4]
$Script:last.Text=$array[0]
}else{
$Script:last.Text="OFFLINE"
}
}
function Get_TreeView {
$maintree.Items.Clear()
$RootItem = New-Object System.Windows.Controls.TreeViewItem
$RootItem.Header = $Script:folderdb[0][0]
$RootItem.Tag = 0
for ($i = 5; $i -lt $Script:folderdb[0].count; $i++) {
if ($Script:folderdb[0][$i].contains("f")) {
$item=$Script:folderdb[0][$i].Substring(1)
Get_TreeViewExpand $RootItem $item
}
[System.Windows.Forms.Application]::DoEvents()
}
$maintree.Items.Add($RootItem)
}
function Get_TreeViewExpand {
param ($parentItem, $Folder)
$int = [int]$Folder
if (!$Script:folderdb[$int][4]) {
$subItem = New-Object System.Windows.Controls.TreeViewItem
$subItem.Header = $Script:folderdb[$int][0]
$subItem.Tag = $int
[void]$parentItem.Items.Add($subItem)
for ($i = 5; $i -lt $Script:folderdb[$int].count; $i++) {
if ($Script:folderdb[$int][$i] -match "f") {
$item=$Script:folderdb[$int][$i].Substring(1)
Get_TreeViewExpand $subItem $item
}
[System.Windows.Forms.Application]::DoEvents()
}
}
}
function Browser_Path {
param ($path)
$data = @()
$c=$false
Log "Tree $path" -clear
for ($t = 0; $t -lt 3; $t++) {
if ($Script:filtercheck[$t]) {
$c=$true
}
[System.Windows.Forms.Application]::DoEvents()
}
if ($c) {
Filter_data $path
}else {
for ($i = 5; $i -lt $Script:folderdb[$path].count; $i++) {
if ($Script:folderdb[$path][$i] -match "f") {
$string=$Script:folderdb[$path][$i].Substring(1)
$int = [int]$string
if (!$Script:folderdb[$int][4]) {
if ($Script:folderdb[$int][3]) {
$cp = "$Script:ScriptRoot\Source\checked.png"
}else {
$cp = "$Script:ScriptRoot\Source\unchecked.png"
}
$Length = calc_Size $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\Source\Folder.png";Name=$Script:folderdb[$int][0];Size="$Length";Tag=$Script:folderdb[$path][$i];SourceChecked="$cp"}
}
}else {
if (!$Script:filedb[$Script:folderdb[$path][$i]][4]) {
if ($Script:filedb[$Script:folderdb[$path][$i]][3]) {
$cp = "$Script:ScriptRoot\Source\checked.png"
}else {
$cp = "$Script:ScriptRoot\Source\unchecked.png"
}
$Length = calc_Size $Script:filedb[$Script:folderdb[$path][$i]][1]
$icon = $Script:icontypes[$Script:filedb[$Script:folderdb[$path][$i]][5]]
$data += New-Object PSObject -prop @{Source="$Script:ScriptRoot\icons\$icon.ico";Name=$Script:filedb[$Script:folderdb[$path][$i]][0];Size="$Length";Tag=$Script:folderdb[$path][$i];SourceChecked="$cp"}
}
}
[System.Windows.Forms.Application]::DoEvents()
$logcontent = "Main: Browser " + $Script:folderdb[$path][$i]
Log $logcontent -clear
}
$item = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $item
}
}
function Check_Browser {
param ($tag)
$data = @()
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
if (($mainbrowser.Items.Tag[$i] -eq $tag) -or ($mainbrowser.Items.Count -eq 1)) {
$item=$mainbrowser.Items[$i]
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($Script:folderdb[$int][3]) {
$Script:folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
}else {
$Script:folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
}
}else {
if ($Script:filedb[$tag][3]) {
$Script:filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
}else {
$Script:filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Source=$item.Source;Name=$item.Name;Size=$item.Size;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
}
}
}else {
$data += $mainbrowser.Items[$i]
}
[System.Windows.Forms.Application]::DoEvents()
}
$item = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $item
}
function main_sortname{
param([switch]$change)
$data= @()
if ($change) {
if ($sortmain[0] -eq "up") {
$sortmain[0]="down"
}else {
$sortmain[0]="up"
}
}
for ($i = 0; $i -lt $mainbrowser.Items.count; $i++) {
$item = $mainbrowser.Items[$i]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortmain[0] -eq "up") {
$data = $data | Sort-Object -Property Name
}else {
$data = $data | Sort-Object -Property Name -Descending
}
$sortmain[3]=$false
$ItemList = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.ItemsSource = $ItemList
}
function main_sortsize {
param([switch]$change)
if ($change) {
if ($sortmain[1] -eq "up") {
$sortmain[1]="down"
}else {
$sortmain[1]="up"
}
}
$data=@()
$array=@()
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
$item = $mainbrowser.Items[$i]
if ($item.Size.EndsWith("GB")) {
$stringtrim = $item.Size.TrimEnd(" GB")
}else {
$stringtrim = $item.Size.TrimEnd(" MB")
}
$int = [int]$stringtrim
$array += New-Object PSObject -prop @{Tag=$item.Tag;Size=$int}
[System.Windows.Forms.Application]::DoEvents()
}
if ($sortmain[1] -eq "up") {
$array = $array | Sort-Object -Property Size
}else {
$array = $array | Sort-Object -Property Size -Descending
}
for ($i = 0; $i -lt $array.Count; $i++) {
for ($e = 0; $e -lt $mainbrowser.items.Count; $e++) {
if ($array.Tag[$i] -eq $mainbrowser.Items.Tag[$e]) {
$item=$mainbrowser.Items[$e]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$item.Checked;Tag=$item.Tag;SourceChecked=$Item.SourceChecked}
$e=$mainbrowser.items.Count
}
[System.Windows.Forms.Application]::DoEvents()
}
[System.Windows.Forms.Application]::DoEvents()
}
$sortmain[3]=$true
$ItemList = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.Remove
$mainbrowser.ItemsSource = $ItemList
}
function main_checkall {
$data = @()
$check = 0
if ($sortmain[2]) {
$sortmain[2]=$false
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
$item = $mainbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if ($folderdb[$int][3]) {
$folderdb[$int][3]=$false
count_element $false $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}else {
if ($filedb[$tag][3]) {
$filedb[$tag][3]=$false
count_element $false $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$false;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\unchecked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}else {
$sortmain[2]=$true
for ($i = 0; $i -lt $mainbrowser.Items.Count; $i++) {
$item = $mainbrowser.Items[$i]
$tag=$item.Tag
if ($tag -match "f") {
$string=$tag.Substring(1)
$int = [int]$string
if (!$folderdb[$int][3]) {
$folderdb[$int][3]=$true
count_element $true $Script:folderdb[$int][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}else {
if (!$filedb[$tag][3]) {
$filedb[$tag][3]=$true
count_element $true $Script:filedb[$tag][1]
$data += New-Object PSObject -prop @{Name=$item.Name;Source=$item.Source;Size=$item.Size;Checked=$true;Tag=$item.Tag;SourceChecked="$Script:ScriptRoot\Source\checked.png"}
$check++
}else {
$data += $item
}
}
[System.Windows.Forms.Application]::DoEvents()
}
}
if ($check -eq 0) {
main_checkall
}else{
$ItemList = [System.Windows.Data.ListCollectionView]$data
$mainbrowser.ItemsSource = $ItemList
}
}
function main_loading {
param ($stat)
if($stat){
$Script:mainloading.Visibility = "Visible"
$Script:maininfo.Visibility = "Hidden"
}else {
$Script:mainloading.Visibility = "Hidden"
$Script:maininfo.Visibility = "Visible"
}
}
Function Select-FolderDialog{
param([string]$Description="Zielverzeichnis wählen",[string]$RootFolder="Desktop")
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |Out-Null
$objForm = New-Object System.Windows.Forms.FolderBrowserDialog
$objForm.Rootfolder = $RootFolder
$objForm.Description = $Description
$Show = $objForm.ShowDialog()
If ($Show -eq "OK"){
Return $objForm.SelectedPath
}else{
Return $false
}
}
Log "### Main geladen ###" -clear

View File

@@ -0,0 +1,235 @@
#0=ScanAktiv;
$Script:switch=@($false,$false)
function Load_scanner {
param ($root)
# Lädt das Fenster
[xml]$Form = Get-Content "$PSScriptRoot\scanner.xaml" -Encoding utf8
$NR=(New-Object System.Xml.XmlNodeReader $Form)
$window=[Windows.Markup.XamlReader]::Load($NR)
# Objekt - Variablen Verknüpfung
$pb=$window.findName("pb")
$Logo=$window.findName("Logo")
$Laufwerk=$window.findName("Laufwerk")
$Script:bar = $window.FindName("pbbar")
$Script:offline = $window.findName("Offline")
$Script:gesamt = $window.FindName("tbgesamt")
$Script:belegt = $window.FindName("tbbelegt")
$Script:scantxt = $window.findName("Scantxt")
$Script:pbloading = $window.findName("pbLoading")
$Script:scannerscan = $window.findName("btnscan")
$Script:scanlb = $window.findName("lbanalyse")
# Verknüpft feste Elemente
$window.Title = $Script:Version
$window.icon="$root/Source/Logo.png"
$Logo.Source="$root/Source/Logowhite.png"
$Laufwerk.Source="$root/Source/HDD1.png"
### GIF Sanduhr
$file = (get-item "$root/Source/hourglas.gif")
$img = [System.Drawing.Image]::Fromfile($file);
$pb.Image = $img
return $window
}
function Set_Defaults_Scanner {
param ($array)
if (!$array[5]) {
$Script:bar.Value=$array[4]
$Script:gesamt.Text=$Array[2]
$script:belegt.Text=$array[3]
}else{
$Script:offline.Visibility="Visible"
}
}
function Start_Scan {
param ()
if (!$Script:switch[0]) {
Log "### Start Scan ###" -clear
#### Variablen Deklaration Script ####
#0=Ordner;1=Datei
$Script:counter=@(0,0)
$Script:Scanprocess = 0
renew_DB
$Script:scanlb.Content = "Die Analyse des H-Laufwerks läuft..."
$Script:switch[0]=$true
$Script:bar.Background="#ff6400"
$Script:bar.Foreground="#008000"
$Script:scantxt.Visibility="Visible"
$Script:pbloading.Visibility="Visible"
$Script:scannerscan.Content="Abbrechen"
$Script:scannerscan.background="$Script:Delcolor"
start_create_database
Add_Root_Folder_Size
Get_TreeView
Browser_Path -path 0
$maintree.Items[0].IsExpanded = $true
$maintree.Items[0].IsSelected = $true
if ($Script:switch[0]) {
$Script:switch[0]=$false
$Script:bar.Background="#008000"
$Script:bar.Foreground="#ff6400"
$Script:scantxt.Visibility="Hidden"
$Script:pbloading.Visibility="Hidden"
$Script:scannerscan.Content="Scannen"
$Script:scanlb.Content = "Starte jetzt die Analyse deines H-Laufwerks"
$Script:scannerscan.background="$Script:Standardbtncolor"
$Script:scanner.hide()
Log "### Scan fertig ###" -clear
$Script:main.ShowDialog() | Out-Null
}
}else {
$Script:switch[0]=$false
$Script:bar.Background="#008000"
$Script:bar.Foreground="#ff6400"
$Script:scantxt.Visibility="Hidden"
$Script:pbloading.Visibility="Hidden"
$Script:scannerscan.Content="Scannen"
$Script:scanlb.Content = "Die Analyse des H-Laufwerks läuft..."
$Script:scannerscan.background="$Script:Standardbtncolor"
}
}
function renew_DB {
Log "### Datenbank zurückgesetzt ###" -clear
$Script:folderdb = @{
Legende = @("Name","Größe","Pfad","Checked","Deleted","Vorgänger","Inhalt")
}
$Script:filedb = @{
Legende = @("Name","Größe","Pfad","Checked","Deleted","Endung")
}
}
function Scan_Process {
param ($process)
$Value= (($Script:Scanprocess + $process)/$Script:used)*100
$Script:bar.Value = $Value
Log "Scan prozess: $Value" -clear
}
function start_create_database {
param ()
$collection = Get-ChildItem -path H:\ -Directory
$Script:folderdb[$Script:counter[0]] = @("H-Laufwerk",1,"H:",$false,$false)
create_file_database "H:\"
foreach ($item in $collection){
$Script:switch[1]=$false
foreach ($itemex in $Script:exclude){
if ($item.FullName -eq $itemex) {
$Script:switch[1]=$true
}
[System.Windows.Forms.Application]::DoEvents()
}
if (!$Script:switch[1] -and $Script:switch[0]) {
$Script:counter[0]++
$Script:folderdb[$Script:counter[0]] = @($item.Name,$item.length,$item.FullName,$false,$false)
$Script:folderdb[0] += "f"+$Script:counter[0]
create_file_database $item.FullName
create_folder_database $item.FullName $Script:counter[0]
[System.Windows.Forms.Application]::DoEvents()
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $Script:folderdb.Count; $i++) {
$text = "$i " + $Script:folderdb.$i
Log $text
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $Script:filedb.Count; $i++) {
$text = "$i " + $Script:filedb.$i
Log $text
[System.Windows.Forms.Application]::DoEvents()
}
}
function create_folder_database {
param ($folder,$davor)
if ($Script:switch[0]) {
$collection = Get-ChildItem -path $folder -Directory
foreach ($item in $collection){
$Script:counter[0]++
$Script:folderdb[$Script:counter[0]] = @($item.Name,$item.length,$item.FullName,$false,$false)
$Script:folderdb[$davor] += "f"+$Script:counter[0]
create_file_database $item.FullName
create_folder_database $item.FullName $Script:counter[0]
[System.Windows.Forms.Application]::DoEvents()
}
}
}
function create_file_database {
param ($folder)
$collection = Get-ChildItem -path $folder -File
foreach ($item in $collection) {
$Script:filedb[$Script:counter[1]] = @($item.Name,$item.length,$item.FullName,$false,$false,(get_icon $item.Name))
$Script:folderdb[$Script:counter[0]] += $Script:counter[1]
$Script:counter[1]++
[System.Windows.Forms.Application]::DoEvents()
}
}
function Add_Root_Folder_Size {
param ()
$size=0
for ($i = 5; $i -lt $Script:folderdb[0].count; $i++) {
if ($Script:folderdb[0][$i] -match "f") {
$size=$size+(Add_Folder_Size $Script:folderdb[0][$i])
}else {
$size=$size+$Script:filedb[$Script:folderdb[0][$i]][1]
}
[System.Windows.Forms.Application]::DoEvents()
}
$Script:folderdb[0][1]=$Size
}
function Add_Folder_Size {
param ($Folder)
$string=$Folder.Substring(1)
$Folder = [int]$string
$size=0
for ($i = 5; $i -lt $Script:folderdb[$Folder].count; $i++) {
if ($Script:folderdb[$Folder][$i] -match "f") {
$size=$size+(Add_Folder_Size $Script:folderdb[$Folder][$i])
}else {
$size=$size+$Script:filedb[$Script:folderdb[$Folder][$i]][1]
}
[System.Windows.Forms.Application]::DoEvents()
}
$Script:folderdb[$Folder][1]=$size
return $size
}
function get_icon {
param ($data)
$data = $data -replace '\s',''
$found = $true
for ($c = -1; $c -gt -10; $c--) {
$char = $data[$c]
if ($char -eq ".") {
$trim=$data.Length+$c
$trimdata=$data.Remove(0,$trim+1)
$c=-10
}
[System.Windows.Forms.Application]::DoEvents()
}
for ($i = 0; $i -lt $script:icontypes.Count; $i++) {
if ($trimdata -eq $script:icontypes[$i]) {
$return = $i
$i = $script:icontypes.Count
$found = $false
}
[System.Windows.Forms.Application]::DoEvents()
}
if ($found) {
$return = 0
}
return $return
}
Log "### Scanner geladen ###" -clear

View File

@@ -0,0 +1,52 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Name="Window" Title="Cleaner - Startseite" Height="182" Width="751.666" Icon="{Binding Icon}" ResizeMode="NoResize" BorderBrush="Blue">
<Grid Background="#00344E">
<Label HorizontalAlignment="Left" Margin="8,100,0,0" VerticalAlignment="Top" Height="47" Width="730" Background="#013C5A">
<Label.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</Label.Resources>
</Label>
<Image Name="Logo" Source="{Binding Logo}" HorizontalAlignment="Left" Margin="8,2,0,0" VerticalAlignment="Top" Height="60" Width="45"/>
<Label Content="cleaner" HorizontalAlignment="Left" Margin="53,1,0,0" VerticalAlignment="Top" FontSize="25" Width="106" Foreground="#FFE1F7FE"/>
<ProgressBar Name="pbbar" HorizontalAlignment="Left" Height="17" Margin="164,109,0,0" VerticalAlignment="Top" Width="451" Background="#008000" Foreground="#ff6400">
<ProgressBar.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="5"/>
</Style>
</ProgressBar.Resources>
</ProgressBar>
<Image Name="Laufwerk" HorizontalAlignment="Left" Height="60" Margin="8,94,0,0" VerticalAlignment="Top" Width="65" Source="{Binding}"/>
<Label Content="H-Laufwerk" HorizontalAlignment="Left" Margin="57,100,0,0" VerticalAlignment="Top" Foreground="White" Width="94" FontSize="16"/>
<Label Name="lbanalyse" Content="Starte jetzt die Analyse deines H-Laufwerks" HorizontalAlignment="Left" Margin="208,28,0,0" VerticalAlignment="Top" Foreground="White" FontSize="18"/>
<Label Content="Die Analyse kann je nach Anzahl der Dateien und Ordner auf dem H-Laufwerk länger dauern" HorizontalAlignment="Left" Margin="122,59,0,0" VerticalAlignment="Top" Foreground="#FFCFCFCF"/>
<TextBlock Name="tbgesamt" Text="" HorizontalAlignment="Left" Margin="64,126,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Foreground="#FFCFCFCF"/>
<TextBlock Name="tbbelegt" HorizontalAlignment="Left" Margin="566,126,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Foreground="#FF16D12F" TextAlignment="Right"/>
<Button Name="btnscan" Content="Scannen" BorderThickness="0" HorizontalAlignment="Left" Margin="633,106,0,0" VerticalAlignment="Top" Width="99" Height="36" Background="#00b8d4" Foreground="White" FontSize="14">
<Button.Resources>
<Style TargetType="Border">
<Setter Property="CornerRadius" Value="2"/>
</Style>
</Button.Resources>
<Button.Style>
<Style TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="Black"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
<Label Name="Scantxt" Content="Scannen..." HorizontalAlignment="Left" Margin="348,129,0,0" VerticalAlignment="Top" Foreground="White" Visibility="Hidden"/>
<Label Name="Offline" Content="Das H-Laufwerk ist offline" HorizontalAlignment="Left" Margin="275,5,0,0" VerticalAlignment="Top" Foreground="White" Background="red" FontSize="15" HorizontalContentAlignment="Center" Height="29" Width="218" Visibility="Hidden"/>
<wfi:WindowsFormsHost Name="pbLoading" Height="40" Margin="700,8,0,0" Width="40" Visibility="Hidden" VerticalAlignment="Top">
<winForms:PictureBox x:Name="pb"></winForms:PictureBox>
</wfi:WindowsFormsHost>
</Grid>
</Window>

BIN
Test/H-Cleaner (Log).zip Normal file

Binary file not shown.

BIN
Test/H-Cleaner.exe Normal file

Binary file not shown.

7
Test/Log.txt Normal file
View File

@@ -0,0 +1,7 @@
[02/14/2022 09:30:37] ### Tool gestartet ###
[02/14/2022 09:30:38] ### Del geladen ###
[02/14/2022 09:30:38] ### Filter geladen ###
[02/14/2022 09:30:38] ### Main geladen ###
[02/14/2022 09:30:38] ### Scanner geladen ###
[02/14/2022 09:30:59] ### Cleaner sichtbar ###

15
Test/README.md Normal file
View File

@@ -0,0 +1,15 @@
# H-Cleaner
### !!!Das Programm ist scharf geschaltet. Dateien und Ordner werden verschoben und gelöscht!!!
# Installation
Um den H-Cleaner zu benutzen den Zip Ordner herunterladen und auf dem H-Laufwerk entpacken. Um das Programm zu Starten lediglich die H-Cleaner.exe ausführen.
# Bugs
Bekannte Bugs sind als Tickets im GitLab hinterlegt.
# Log
Um ein erstelltes Log ein zu reichen dieses an ein Ticket im GitLab anfügen und das Problem beschreiben.

BIN
Test/Source/Archiv.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Audio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Bild.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Checked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
Test/Source/Container.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Datenbank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
Test/Source/Folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
Test/Source/HDD1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Internet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

BIN
Test/Source/Kofig.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Logo-alt.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
Test/Source/Logo.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

BIN
Test/Source/Logowhite.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
Test/Source/Mail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
Test/Source/Mails.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Office.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Sonstiges.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Texte-Logs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/Unchecked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
Test/Source/Video.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
Test/Source/hourglas.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
Test/Source/info.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
Test/Source/loading.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
Test/Source/marked.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
Test/Source/swfalse.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
Test/Source/swtrue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
Test/Tickets erstellen.docx Normal file

Binary file not shown.

47
Test/icons.csv Normal file
View File

@@ -0,0 +1,47 @@
ID,Dateiendung,Type,(0=Office;1=Bilder;2=Videos;3=Audios)
1,"empty","0"
2,"xml","0"
3,"cmd","1"
4,"ai","0"
5,"csv","0"
6,"doc","0"
7,"docx","0"
8,"exe",""
9,"gif","1"
10,"ico","1"
11,"img","1"
12,"indd","0"
13,"jar","0"
14,"jpeg","1"
15,"jpg","1"
16,"pdf","0"
17,"png","1"
18,"ppt","0"
19,"pptx","0"
20,"ps1",""
21,"psd","1"
22,"py",""
23,"rss","0"
24,"xaml","0"
25,"xls","0"
26,"xlsx","0"
27,"zip","0"
28,"md",""
29,"sh",""
30,"mp4","2"
31,"mov","2"
32,"wmv","2"
33,"avi","2"
34,"avchd","2"
35,"flv","2"
36,"f4v","2"
37,"swf","2"
38,"mkv","2"
39,"webm","2"
40,"wav","3"
41,"mp3","3"
42,"wma","3"
43,"aac","3"
44,"ogg","3"
45,"flac","3"
46,"rm","3"
1 ID Dateiendung Type (0=Office;1=Bilder;2=Videos;3=Audios)
2 1 empty 0
3 2 xml 0
4 3 cmd 1
5 4 ai 0
6 5 csv 0
7 6 doc 0
8 7 docx 0
9 8 exe
10 9 gif 1
11 10 ico 1
12 11 img 1
13 12 indd 0
14 13 jar 0
15 14 jpeg 1
16 15 jpg 1
17 16 pdf 0
18 17 png 1
19 18 ppt 0
20 19 pptx 0
21 20 ps1
22 21 psd 1
23 22 py
24 23 rss 0
25 24 xaml 0
26 25 xls 0
27 26 xlsx 0
28 27 zip 0
29 28 md
30 29 sh
31 30 mp4 2
32 31 mov 2
33 32 wmv 2
34 33 avi 2
35 34 avchd 2
36 35 flv 2
37 36 f4v 2
38 37 swf 2
39 38 mkv 2
40 39 webm 2
41 40 wav 3
42 41 mp3 3
43 42 wma 3
44 43 aac 3
45 44 ogg 3
46 45 flac 3
47 46 rm 3

BIN
Test/icons/ai.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

BIN
Test/icons/cmd.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

BIN
Test/icons/csv.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

BIN
Test/icons/dll.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Some files were not shown because too many files have changed in this diff Show More