init
This commit is contained in:
283
Test/GUIS/del/del.ps1
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
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
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
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
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
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
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
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
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
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
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>
|
||||
Reference in New Issue
Block a user