init
This commit is contained in:
128
GUIS/filter/filter.ps1
Normal file
128
GUIS/filter/filter.ps1
Normal 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
54
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>
|
||||
Reference in New Issue
Block a user