init
BIN
Test/Dokumentation H-Cleaner.pdf
Normal file
283
Test/GUIS/del/del.ps1
Normal 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
@@ -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>
|
||||
17
Test/GUIS/delconf/delconf.ps1
Normal 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
|
||||
}
|
||||
35
Test/GUIS/delconf/delconf.xaml
Normal 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
@@ -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
|
||||
54
Test/GUIS/filter/filter.xaml
Normal 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
@@ -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
@@ -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
@@ -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, 
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 
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
|
||||
235
Test/GUIS/scanner/scanner.ps1
Normal 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
|
||||
52
Test/GUIS/scanner/scanner.xaml
Normal 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
BIN
Test/H-Cleaner.exe
Normal file
7
Test/Log.txt
Normal 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
@@ -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
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Audio.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Bild.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Checked.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
Test/Source/Container.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Datenbank.png
Normal file
|
After Width: | Height: | Size: 116 KiB |
BIN
Test/Source/Folder.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
Test/Source/HDD1.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Internet.png
Normal file
|
After Width: | Height: | Size: 133 KiB |
BIN
Test/Source/Kofig.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Logo-alt.PNG
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
Test/Source/Logo.PNG
Normal file
|
After Width: | Height: | Size: 298 KiB |
BIN
Test/Source/Logowhite.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Test/Source/Mail.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
Test/Source/Mails.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Office.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Softwareentwicklung.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Sonstiges.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Texte-Logs.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/Unchecked.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
Test/Source/Video.png
Normal file
|
After Width: | Height: | Size: 64 KiB |
BIN
Test/Source/hourglas.gif
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
Test/Source/hourglas_original.gif
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
Test/Source/info.png
Normal file
|
After Width: | Height: | Size: 55 KiB |
BIN
Test/Source/loading.gif
Normal file
|
After Width: | Height: | Size: 206 KiB |
BIN
Test/Source/mainhourglas.gif
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
Test/Source/marked.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
Test/Source/swfalse.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
Test/Source/swtrue.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
Test/Tickets erstellen.docx
Normal file
47
Test/icons.csv
Normal 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"
|
||||
|
BIN
Test/icons/ai.ico
Normal file
|
After Width: | Height: | Size: 613 B |
BIN
Test/icons/cmd.ico
Normal file
|
After Width: | Height: | Size: 725 B |
BIN
Test/icons/csv.ico
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
Test/icons/dll.ico
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
Test/icons/doc.ico
Normal file
|
After Width: | Height: | Size: 543 B |
BIN
Test/icons/docx.ico
Normal file
|
After Width: | Height: | Size: 543 B |
BIN
Test/icons/empty.ico
Normal file
|
After Width: | Height: | Size: 793 B |
BIN
Test/icons/exe.ico
Normal file
|
After Width: | Height: | Size: 389 B |
BIN
Test/icons/gif.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Test/icons/ico.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Test/icons/img.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Test/icons/indd.ico
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
Test/icons/jar.ico
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Test/icons/jpeg.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Test/icons/jpg.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Test/icons/md.ico
Normal file
|
After Width: | Height: | Size: 708 B |
BIN
Test/icons/pdf.ico
Normal file
|
After Width: | Height: | Size: 688 B |
BIN
Test/icons/png.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
Test/icons/ppt.ico
Normal file
|
After Width: | Height: | Size: 585 B |
BIN
Test/icons/pptx.ico
Normal file
|
After Width: | Height: | Size: 585 B |
BIN
Test/icons/ps1.ico
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
Test/icons/psd.ico
Normal file
|
After Width: | Height: | Size: 631 B |
BIN
Test/icons/py.ico
Normal file
|
After Width: | Height: | Size: 817 B |
BIN
Test/icons/rss.ico
Normal file
|
After Width: | Height: | Size: 838 B |
BIN
Test/icons/sh.ico
Normal file
|
After Width: | Height: | Size: 725 B |
BIN
Test/icons/xaml.ico
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Test/icons/xls.ico
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
Test/icons/xlsx.ico
Normal file
|
After Width: | Height: | Size: 580 B |
BIN
Test/icons/xml.ico
Normal file
|
After Width: | Height: | Size: 838 B |
BIN
Test/icons/zip.ico
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
72
Test/pseudonymisierung.ps1
Normal file
@@ -0,0 +1,72 @@
|
||||
function init_pseudo {
|
||||
if (Test-Path ".\Log.txt") {
|
||||
Remove-Item ".\Log.txt"
|
||||
}
|
||||
$Script:pseudotbl = @()
|
||||
$Script:realtbl = @("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z")
|
||||
do {
|
||||
$tmp = get-random -Minimum 0 -Maximum 256
|
||||
if (!($Script:pseudotbl.contains($tmp))) {
|
||||
$Script:pseudotbl += $tmp
|
||||
}
|
||||
} while ($null -eq $Script:pseudotbl[23])
|
||||
}
|
||||
init_pseudo
|
||||
|
||||
function pseudo {
|
||||
param($realinput)
|
||||
if ($realinput -is [String]) {
|
||||
[String]$tmp = $realinput.toLower()
|
||||
for($i=0;$i -lt $tmp.length;$i++){
|
||||
if($tmp[$i] -match "[a-z]"){
|
||||
for($c=0;$c -lt 23;$c++){
|
||||
if($tmp[$i] -eq $Script:realtbl[$c]){
|
||||
$pseudooutput += [char]$Script:pseudotbl[$c]
|
||||
$c = 23
|
||||
}
|
||||
}
|
||||
}else {
|
||||
$pseudooutput += $tmp[$i]
|
||||
}
|
||||
}
|
||||
}elseif ($realinput -is [Object[]]) {
|
||||
$pseudooutput = @()
|
||||
foreach($item in $realinput){
|
||||
$partoutput=""
|
||||
if($item -is [String]){
|
||||
[String]$tmp = $item.toLower()
|
||||
for($i=0;$i -lt $tmp.length;$i++){
|
||||
if($tmp[$i] -match "[a-z]"){
|
||||
for($c=0;$c -lt 23;$c++){
|
||||
if($tmp[$i] -eq $Script:realtbl[$c]){
|
||||
$partoutput += [char]$Script:pseudotbl[$c]
|
||||
$c = 23
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$partoutput += $tmp[$i]
|
||||
}
|
||||
}
|
||||
$pseudooutput += $partoutput
|
||||
}else{
|
||||
$pseudooutput += $item
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$pseudooutput = $realinput
|
||||
}
|
||||
return $pseudooutput
|
||||
}
|
||||
|
||||
|
||||
function Log {
|
||||
param ($loginput,[switch]$clear)
|
||||
if($clear){
|
||||
#Add-Content -Path .\Log.txt -Value "[$(Get-Date)] $loginput"
|
||||
$Script:logvar += "[$(Get-Date)] $loginput `r`n"
|
||||
}else{
|
||||
$Script:logvar += "[$(Get-Date)] " + (pseudo $loginput) + "`r`n"
|
||||
#$logcontent = "[$(Get-Date)] " + (pseudo $loginput)
|
||||
#Add-Content -Path .\Log.txt -Value $logcontent
|
||||
}
|
||||
}
|
||||
459
Test/root.ps1
Normal file
@@ -0,0 +1,459 @@
|
||||
$Script:Version = "H-Cleaner v0.4.1 (LOG-VERION)"
|
||||
#Ersteller: Florian Späth
|
||||
#Diese Software soll helfen im H-Laufwerk geordnet Daten zu löschen
|
||||
|
||||
##
|
||||
### Notiz: Ticket #66 geschlossen, Ticket #51 geschlossen
|
||||
##
|
||||
|
||||
#### Pseudonymisierung und Log ####
|
||||
. .\pseudonymisierung.ps1
|
||||
Log "### Tool gestartet ###" -clear
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null
|
||||
|
||||
#### Lädt Scripte ####
|
||||
|
||||
. .\GUIS\del\del.ps1
|
||||
. .\GUIS\delconf\delconf.ps1
|
||||
. .\GUIS\filter\filter.ps1
|
||||
. .\GUIS\info\info.ps1
|
||||
. .\GUIS\main\main.ps1
|
||||
. .\GUIS\scanner\scanner.ps1
|
||||
|
||||
#### Ordner die bei der Suche ausgeschlossen werden ####
|
||||
|
||||
$Script:exclude=@("H:\EINSTELLUNGEN","H:\Application Data","H:\meancore","H:\Cleaner","H:\Microsoft")
|
||||
|
||||
#### Lädt Guis ####
|
||||
$Script:main = Load_main $PSScriptRoot # Variable: $main
|
||||
$Script:scanner = Load_scanner $PSScriptRoot # Variable: $scanner
|
||||
$Script:filter = Load_filter $PSScriptRoot # Variable: $filter
|
||||
$Script:del = Load_del $PSScriptRoot # Variable: $del
|
||||
$Script:delconf = Load_delconf $PSScriptRoot # Variable: $delconf
|
||||
$Script:info = Load_info $PSScriptRoot # Variable: $info
|
||||
|
||||
#### Definition globaler Variablen ####
|
||||
|
||||
$Script:ScriptRoot = $PSScriptRoot
|
||||
$Script:iconpath = "$PSScriptRoot\icons"
|
||||
########################1########2######3######4####5######6########7######8#######9#####10#####11#####12######13####14#######15#####16#####17#####18#####19######20####21####22#####23#####24#######25####26######27#####28####29###
|
||||
|
||||
$Script:Elementcount
|
||||
$Script:Elementsize
|
||||
|
||||
### Farb Variablen ###
|
||||
|
||||
$Script:Standardbtncolor = "#00b8d4"
|
||||
$Script:Delcolor = "#d50000"
|
||||
$Script:BackgroundMovecolor = "#FFFFEB9C"
|
||||
$Script:ForegroundMovecolor = "#FF9C6500"
|
||||
$Script:Foregroundgrey = "#FF7A7A7A"
|
||||
$Script:Backgroundgrey = "#FFC5C5C5"
|
||||
|
||||
#### Verknüpfungen GUI Objekte - Variablen ####
|
||||
|
||||
### Info ###
|
||||
|
||||
$infook = $info.findName("btnok")
|
||||
|
||||
### DelConf ###
|
||||
|
||||
$delconfok = $delconf.FindName("btnok")
|
||||
|
||||
#### Funktionen ####
|
||||
### Global ###
|
||||
function Load_Iconfile {
|
||||
$Script:types =New-Object int[][] (4)
|
||||
$Script:icontypes = @()
|
||||
$iconcsv = Import-Csv "$PSScriptRoot\icons.csv" -Encoding utf8
|
||||
for ($i = 0; $i -lt $iconcsv.Count; $i++) {
|
||||
$Script:icontypes += $iconcsv.Dateiendung[$i]
|
||||
for ($a = 0; $a -lt 3; $a++) {
|
||||
if ($iconcsv.Type[$i] -eq $a) {
|
||||
$Script:types[$a] += $iconcsv.ID[$i]
|
||||
}
|
||||
[System.Windows.Forms.Application]::DoEvents()
|
||||
}
|
||||
[System.Windows.Forms.Application]::DoEvents()
|
||||
}
|
||||
}
|
||||
|
||||
function calc_Size {
|
||||
param($number)
|
||||
$res = $number/1MB
|
||||
$size = " MB"
|
||||
if($res -gt 1024){
|
||||
$res = $number/1GB
|
||||
$size = " GB"
|
||||
}
|
||||
$res = $res.ToString(".00")
|
||||
if ($res.StartsWith(",") ) {
|
||||
$res = "0" + $res
|
||||
}
|
||||
return $res + $size
|
||||
}
|
||||
|
||||
function Get_Freespace (){
|
||||
# 0=Text Auslastung; 1=Freier Speicher; 2=Gesamter Speicher; 3=Belegter Speicher; 4=Wert für ProgressBar; 5=OFFLINE
|
||||
$array=@("",0,0,0,$false)
|
||||
|
||||
$use = Get-WMIObject Win32_LogicalDisk -filter "name='H:'"
|
||||
$check = Get-WMIObject Win32_LogicalDisk -filter "name='C:'"
|
||||
if ($use.size -ne $check.size) {
|
||||
$array[1] = calc_Size $use.Freespace
|
||||
$array[2] = calc_Size $use.size
|
||||
$free = calc_Size $use.Freespace
|
||||
$size = calc_Size $use.size
|
||||
$array[3] = calc_Size ($use.size-($use.size-$use.Freespace))
|
||||
if (!$use) {
|
||||
$array[0] = " FEHLER"
|
||||
}else {
|
||||
$array[0] = "$free frei von $size"
|
||||
$bar = ($use.Freespace/$use.size)*100
|
||||
$array[4] = 100-$bar
|
||||
}
|
||||
}else{
|
||||
$array[4] = 100
|
||||
$array[5] = $true
|
||||
}
|
||||
return $array
|
||||
}
|
||||
|
||||
function count_element {
|
||||
param (
|
||||
$count, $size
|
||||
)
|
||||
if ($count) {
|
||||
$Script:Elementcount++
|
||||
$Script:Elementsize = $Script:Elementsize+$size
|
||||
}else {
|
||||
$Script:Elementcount--
|
||||
$Script:Elementsize = $Script:Elementsize-$size
|
||||
}
|
||||
if ($Script:Elementcount -eq 0) {
|
||||
$maindel.Background = $Script:Backgroundgrey
|
||||
$mainmove.Background = $Script:Backgroundgrey
|
||||
$maindel.Foreground = $Script:Foregroundgrey
|
||||
$mainmove.Foreground = $Script:Foregroundgrey
|
||||
$mainmove.IsEnabled=$false
|
||||
$maindel.IsEnabled=$false
|
||||
$Deldel.Background = $Script:Backgroundgrey
|
||||
$Deldel.Foreground = $Script:Foregroundgrey
|
||||
$Deldel.IsEnabled = $false
|
||||
}else {
|
||||
$maindel.Background="$Script:Delcolor"
|
||||
$mainmove.Background="$Script:BackgroundMovecolor"
|
||||
$maindel.Foreground="white"
|
||||
$mainmove.Foreground="$Script:ForegroundMovecolor"
|
||||
$mainmove.IsEnabled=$true
|
||||
$maindel.IsEnabled=$true
|
||||
$Deldel.Background = "$Script:Delcolor"
|
||||
$Deldel.Foreground = "white"
|
||||
$Deldel.IsEnabled = $true
|
||||
}
|
||||
$size = calc_Size $Script:Elementsize
|
||||
if ($Script:Elementcount -le 1) {
|
||||
$Delstats.Text = " $Script:Elementcount Element $size"
|
||||
$mainelements.Text = " $Script:Elementcount Element"
|
||||
$delconfelements.Text = " $Script:Elementcount Element"
|
||||
}else {
|
||||
$Delstats.Text = " $Script:Elementcount Elemente $size"
|
||||
$mainelements.Text = " $Script:Elementcount Elemente"
|
||||
$delconfelements.Text = " $Script:Elementcount Elemente"
|
||||
}
|
||||
$mainsize.Text = " $size"
|
||||
$delconfsize.Text = " $size"
|
||||
}
|
||||
|
||||
### GUIs ###
|
||||
## Scanner ##
|
||||
|
||||
$scannerscan.Add_Click({
|
||||
Start_Scan
|
||||
(New-Object -ComObject WScript.Shell).AppActivate((Get-Process | Where-Object { $_.Id -Match $PID }).MainWindowTitle)
|
||||
})
|
||||
|
||||
$scanner.Add_KeyDown{
|
||||
param(
|
||||
[Parameter(Mandatory)][Object]$sender,
|
||||
[Parameter(Mandatory)][Windows.Input.KeyEventArgs]$e
|
||||
)
|
||||
if($e.Key -eq "Enter"){
|
||||
Start_Scan
|
||||
(New-Object -ComObject WScript.Shell).AppActivate((Get-Process | Where-Object { $_.Id -Match $PID }).MainWindowTitle)
|
||||
}
|
||||
}
|
||||
|
||||
## Main ##
|
||||
|
||||
$mainscanner.Add_Click({
|
||||
$main.Hide()
|
||||
$scanner.ShowDialog() | Out-Null
|
||||
})
|
||||
|
||||
$mainfilter.Add_Click({
|
||||
$filter.Showdialog() | Out-Null
|
||||
})
|
||||
|
||||
$maininfo.Add_Click({
|
||||
$info.ShowDialog() | Out-Null
|
||||
})
|
||||
|
||||
$maintree.Add_KeyDown{
|
||||
param(
|
||||
[Parameter(Mandatory)][Object]$sender,
|
||||
[Parameter(Mandatory)][Windows.Input.KeyEventArgs]$e
|
||||
)
|
||||
if($e.Key -eq "Enter"){
|
||||
$maintree.SelectedItem.IsExpanded = $true
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
}
|
||||
}
|
||||
|
||||
$maintree.Add_MouseLeftButtonUp({
|
||||
if ($maintree.SelectedItem.tag -ne $null) {
|
||||
$maintree.SelectedItem.IsExpanded = $true
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
#if ($Script:sortmain[3]) {
|
||||
# main_sortsize
|
||||
#}else{
|
||||
# main_sortname
|
||||
#}
|
||||
}
|
||||
})
|
||||
|
||||
$mainbrowser.Add_MouseLeftButtonUp({
|
||||
if ($mainbrowser.Selecteditems.tag -ne $null) {
|
||||
$logcontent = "Main: Clicked " + $mainbrowser.Selecteditems.tag
|
||||
Log $logcontent -clear
|
||||
Check_Browser $mainbrowser.Selecteditems.tag
|
||||
}
|
||||
})
|
||||
|
||||
$mainsortname.Add_MouseLeftButtonUp({
|
||||
if ($mainbrowser.Items.Count -ne 1) {
|
||||
Log "### Sortierung nach Name ###" -clear
|
||||
main_sortname -change
|
||||
}
|
||||
})
|
||||
|
||||
$mainsortsize.Add_MouseLeftButtonUp({
|
||||
if ($mainbrowser.Items.Count -ne 1) {
|
||||
Log "### Sortierung nach Größe ###" -clear
|
||||
main_sortsize -change
|
||||
}
|
||||
})
|
||||
|
||||
$maincheckall.Add_MouseLeftButtonUp({
|
||||
main_checkall
|
||||
})
|
||||
|
||||
$mainswitch.Add_Click({
|
||||
if ($Script:filtercheck[4]) {
|
||||
Log "### Filter ohne Unterordner ###" -clear
|
||||
$mainimgswitch.Source = "$ScriptRoot/Source/swfalse.png"
|
||||
$Script:filtercheck[4] = $false
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
}else {
|
||||
Log "### Filter mit Unterordner ###" -clear
|
||||
$mainimgswitch.Source = "$ScriptRoot/Source/swtrue.png"
|
||||
$Script:filtercheck[4] =$true
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$mainmove.Add_Click({
|
||||
$Script:movelocation = Select-FolderDialog
|
||||
if ($Script:movelocation -ne $false) {
|
||||
Log "### Clicked MOVE Button ###" -clear
|
||||
Reset_Filter
|
||||
Browser_del
|
||||
$Script:Delwarning.Content = "Zielverzeichnis: $Script:movelocation "
|
||||
$Script:Delwarning.Background = "$Script:BackgroundMovecolor"
|
||||
$Script:Delwarning.Foreground = "$Script:ForegroundMovecolor"
|
||||
|
||||
$Script:Delmarked.Content = "Zum Verschieben markiert:"
|
||||
|
||||
$Deldel.Margin="554,364,0,0"
|
||||
$Deldel.Width="210"
|
||||
$Deldel.Content = "Markierte verschieben"
|
||||
$Deldel.Background = "$Script:BackgroundMovecolor"
|
||||
$Deldel.Foreground = "$Script:ForegroundMovecolor"
|
||||
$Deltb.Text = "Alle ausgewählten Dateien wurden erfolgreich verschoben."
|
||||
$Script:whattodo="move"
|
||||
$main.Hide()
|
||||
$Del.ShowDialog() | Out-Null
|
||||
}
|
||||
})
|
||||
|
||||
$maindel.Add_Click({
|
||||
Log "### Clicked DEL Button ###" -clear
|
||||
Reset_Filter
|
||||
Browser_del
|
||||
$Script:Delwarning.Content = "Die ausgewählten Dateien werden endgültig gelöscht!"
|
||||
$Script:Delwarning.Background = "$Script:Delcolor"
|
||||
$Script:Delwarning.Foreground = "white"
|
||||
|
||||
$Script:Delmarked.Content = "Zum löschen markiert:"
|
||||
|
||||
$Deldel.Content = "Markierte löschen"
|
||||
$Deldel.Margin="592,364,0,0"
|
||||
$Deldel.Width="172"
|
||||
$Deldel.Content="Markierte löschen"
|
||||
$Deldel.Background = "$Script:Delcolor"
|
||||
$Deldel.Foreground = "white"
|
||||
$Deltb.Text = "Alle ausgewählten Dateien wurden erfolgreich entfernt."
|
||||
$Script:whattodo="delete"
|
||||
$main.Hide()
|
||||
$Del.ShowDialog() | Out-Null
|
||||
})
|
||||
|
||||
## Del ##
|
||||
|
||||
$Script:Delback.Add_Click({
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
$Del.Hide()
|
||||
$main.ShowDialog() | Out-Null
|
||||
})
|
||||
|
||||
$Script:Deldel.Add_Click({
|
||||
final_action
|
||||
Get_TreeView
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
$del.hide()
|
||||
$delconf.ShowDialog() | Out-Null
|
||||
})
|
||||
|
||||
$delbrowser.Add_MouseLeftButtonUp({
|
||||
if ($delbrowser.Selecteditems.tag -ne $null) {
|
||||
$logcontent = "Del: Clicked " + $delbrowser.Selecteditems.tag
|
||||
Log $logcontent -clear
|
||||
Check_Del $delbrowser.Selecteditems.tag
|
||||
}
|
||||
})
|
||||
|
||||
$Delsortname.Add_MouseLeftButtonUp({
|
||||
del_sortname
|
||||
})
|
||||
|
||||
$Delsortsize.Add_MouseLeftButtonUp({
|
||||
del_sortsize
|
||||
})
|
||||
|
||||
$Delcheckall.Add_MouseLeftButtonUp({
|
||||
del_checkall
|
||||
})
|
||||
|
||||
## Filter ##
|
||||
|
||||
$script:filterok.Add_Click({
|
||||
$filter.Hide()
|
||||
Update_Filter
|
||||
$check=$false
|
||||
foreach($item in $Script:filtercheck){
|
||||
if ($item) {
|
||||
$check=$true
|
||||
}
|
||||
[System.Windows.Forms.Application]::DoEvents()
|
||||
}
|
||||
if ($check) {
|
||||
Filter_data -tag $maintree.SelectedItem.tag
|
||||
}else {
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
}
|
||||
})
|
||||
|
||||
$Script:filterreset.Add_Click({
|
||||
Reset_Filter
|
||||
Update_Filter
|
||||
Browser_Path -path $maintree.SelectedItem.tag
|
||||
$filter.Hide()
|
||||
})
|
||||
|
||||
$filter.Add_MouseLeftButtonDown({
|
||||
$filter.DragMove()
|
||||
})
|
||||
|
||||
$filteroffice.Add_Click({
|
||||
if ($Script:filtercheck[0]) {
|
||||
$Filteroffice.background = "#444444"
|
||||
$Script:filtercheck[0] = $false
|
||||
}else {
|
||||
$Filteroffice.background = "#00c853"
|
||||
$Script:filtercheck[0] = $true
|
||||
}
|
||||
Update_Filter
|
||||
})
|
||||
|
||||
$filterbilder.Add_Click({
|
||||
if ($Script:filtercheck[1]) {
|
||||
$Filterbilder.background = "#444444"
|
||||
$Script:filtercheck[1] = $false
|
||||
}else {
|
||||
$Filterbilder.background = "#00c853"
|
||||
$Script:filtercheck[1] = $true
|
||||
}
|
||||
Update_Filter
|
||||
})
|
||||
|
||||
$filtervideos.Add_Click({
|
||||
if ($Script:filtercheck[2]) {
|
||||
$Filtervideos.background = "#444444"
|
||||
$Script:filtercheck[2] = $false
|
||||
}else {
|
||||
$Filtervideos.background = "#00c853"
|
||||
$Script:filtercheck[2] = $true
|
||||
}
|
||||
Update_Filter
|
||||
})
|
||||
|
||||
$filteraudios.Add_Click({
|
||||
if ($Script:filtercheck[3]) {
|
||||
$Filteraudios.background = "#444444"
|
||||
$Script:filtercheck[3] = $false
|
||||
}else {
|
||||
$Filteraudios.background = "#00c853"
|
||||
$Script:filtercheck[3] = $true
|
||||
}
|
||||
Update_Filter
|
||||
})
|
||||
|
||||
## Info ##
|
||||
|
||||
$info.Add_MouseLeftButtonDown({
|
||||
$info.DragMove()
|
||||
})
|
||||
|
||||
$infook.Add_Click({
|
||||
$info.Hide()
|
||||
})
|
||||
|
||||
## DelConf ##
|
||||
|
||||
$delconf.Add_MouseLeftButtonDown({
|
||||
$delconf.DragMove()
|
||||
})
|
||||
|
||||
$delconfok.Add_Click({
|
||||
$delconf.Hide()
|
||||
$main.ShowDialog() | Out-Null
|
||||
})
|
||||
|
||||
#### Startet die Anwendung ####
|
||||
|
||||
### Initialisieren ###
|
||||
Set_Defaults_Scanner (Get_Freespace)
|
||||
Set_Defaults_Main (Get_Freespace)
|
||||
Load_Iconfile
|
||||
|
||||
### Öffnet erstes Fenster ###
|
||||
|
||||
Log "### Cleaner sichtbar ###" -clear
|
||||
|
||||
$Scanner.ShowDialog() | Out-Null
|
||||
|
||||
Add-Content -Path .\Log.txt -Value $Script:logvar
|
||||