Skip to content

Commit 7da0f4b

Browse files
authored
Chore: Some cleanup & refactoring (BornToBeRoot#2432)
* Chore: Some cleanup & refactoring * Fix: Use lib folder * Fix: Create folder
1 parent eed1694 commit 7da0f4b

12 files changed

Lines changed: 36 additions & 32 deletions

Scripts/PreBuildEventCommandLine.ps1

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1+
# Visual Studio pre build event:
2+
# PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File "$(ProjectDir)..\..\Scripts\PreBuildEventCommandLine.ps1" "$(TargetDir)"
3+
14
param(
25
[Parameter(
36
Position=0,
47
Mandatory=$true)]
58
[String]$OutPath
69
)
710

8-
# VS prebuild event call: PowerShell.exe -ExecutionPolicy Bypass -NoProfile -File "$(ProjectDir)..\..\Scripts\PreBuildEventCommandLine.ps1" "$(TargetDir)"
9-
10-
# Fix wrong path
11-
# Quotation marks are required if a blank is in the path... If there is no blank space in the path, a quote will be add to the end...
11+
# Fix wrong path (if there is no blank in the path, a quote will be added to the end...)
1212
if(-not($OutPath.StartsWith('"')))
1313
{
1414
$OutPath = $OutPath.TrimEnd('"')
1515
}
1616

17+
# NetBeauty will move all dependencies to the lib folder
18+
$OutPath = $OutPath + "\lib"
19+
20+
# Create folder
21+
New-Item -ItemType Directory -Path $OutPath
22+
1723
################################################
1824
### Generate MSTSCLib.dll and AxMSTSCLib.dll ###
1925
################################################
@@ -25,14 +31,6 @@ if((Test-Path -Path "$OutPath\MSTSCLib.dll") -and (Test-Path -Path "$OutPath\AxM
2531
return
2632
}
2733

28-
# Test if files are in the lib folder (NetBeauty) and copy them from there because this is faster than re-creating them...
29-
if((Test-Path -Path "$OutPath\lib\MSTSCLib.dll") -and (Test-Path -Path "$OutPath\lib\AxMSTSCLib.dll")) {
30-
Write-Host "MSTSCLib.dll and AxMSTSCLib.dll exist in lib folder! Copy them..."
31-
Copy-Item -Path "$OutPath\lib\MSTSCLib.dll" -Destination "$OutPath\MSTSCLib.dll" -Force
32-
Copy-Item -Path "$OutPath\lib\AxMSTSCLib.dll" -Destination "$OutPath\AxMSTSCLib.dll" -Force
33-
return
34-
}
35-
3634
# Detect x86 or x64
3735
$ProgramFiles_Path = ${Env:ProgramFiles(x86)}
3836

@@ -48,7 +46,7 @@ $IlasmPath = ((Get-ChildItem -Path "$($Env:windir)\Microsoft.NET\Framework\" -Re
4846

4947
if([String]::IsNullOrEmpty($AximpPath) -or [String]::IsNullOrEmpty($IldasmPath) -or [String]::IsNullOrEmpty($IlasmPath))
5048
{
51-
Write-Host "Could not find sdk tools:`naximp.exe`t$AximpPath`nildasm.exe`t$IldasmPath`nilasm.exe`t$IlasmPath"
49+
Write-Host "Could not find sdk tools:`naximp.exe`t=>`t$AximpPath`nildasm.exe`t=>`t$IldasmPath`nilasm.exe`t=>`t$IlasmPath"
5250
return
5351
}
5452

@@ -78,5 +76,6 @@ Write-Host "Replace ""[in] int32& plKeyData"" with ""[in] int32[] marshal([+0])
7876

7977
Start-Process -FilePath $IlasmPath -ArgumentList "/dll ""$MSTSCLibILPath"" /output:""$MSTSCLibDllPath""" -Wait -NoNewWindow
8078

79+
Write-Host "Remove temporary files..."
8180
Remove-Item -Path "$MSTSCLibILPath"
8281
Remove-Item -Path "$OutPath\MSTSCLib.res"

Source/NETworkManager.Models/Appearance/BaseColorInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace NETworkManager.Models.Appearance;
44

55
/// <summary>
6-
/// Base class for MahApps.Metro theme/accent informations.
6+
/// Base class for MahApps.Metro theme/accent information.
77
/// </summary>
88
public abstract class BaseColorInfo
99
{

Source/NETworkManager.Models/Appearance/ThemeColorInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace NETworkManager.Models.Appearance;
22

33
/// <summary>
4-
/// Class contains informations about MahApps.Metro themes.
4+
/// Class contains information about MahApps.Metro themes.
55
/// </summary>
66
public class ThemeColorInfo : BaseColorInfo
77
{

Source/NETworkManager/Controls/RemoteDesktopControl.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,5 @@
5454
<mah:ProgressRing Grid.Row="0" Grid.RowSpan="2" Height="50" Width="50" />
5555
<TextBlock Grid.Row="3" Text="{x:Static localization:Strings.ConnectingDots}" Style="{StaticResource MessageTextBlock}" />
5656
</Grid>
57-
5857
</Grid>
5958
</local:UserControlBase>

Source/NETworkManager/MainWindow.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
1313
xmlns:resources="clr-namespace:NETworkManager.Properties"
1414
xmlns:networkManager="clr-namespace:NETworkManager"
15+
xmlns:models="clr-namespace:NETworkManager.Models;assembly=NETworkManager.Models"
1516
mc:Ignorable="d"
1617
Style="{DynamicResource DefaultWindow}"
1718
MinWidth="800" Width="1024" Height="768" MinHeight="600"
@@ -409,7 +410,7 @@
409410
<ScrollViewer Grid.Row="1" ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback" Style="{StaticResource FadeOutScrollViewer}">
410411
<ListView x:Name="ListViewApplication" ItemsSource="{Binding Applications}" SelectedItem="{Binding SelectedApplication, Mode=TwoWay}" SelectionMode="Single" BorderThickness="0">
411412
<ListView.ItemTemplate>
412-
<DataTemplate DataType="networkManager:ApplicationViewInfo">
413+
<DataTemplate DataType="{x:Type models:ApplicationInfo}">
413414
<Grid Height="48">
414415
<Grid.ColumnDefinitions>
415416
<ColumnDefinition Width="48" />

Source/NETworkManager/NETworkManager.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@
4848
<None Remove="SplashScreen.png" />
4949
<None Include="..\.editorconfig" Link=".editorconfig" />
5050
<None Include="NETworkManager.ico">
51-
<Pack>True</Pack>
52-
<PackagePath></PackagePath>
51+
<Pack>True</Pack>
5352
</None>
5453
</ItemGroup>
5554
<!-- Target 6.0.0 for compatibility https://github.com/dotnet/core/issues/7176 -->
@@ -78,10 +77,10 @@
7877
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.2.13" />
7978
<PackageReference Include="nulastudio.NetBeauty" Version="2.1.4-beta.1" />
8079
<Reference Include="AxMSTSCLib">
81-
<HintPath>$(TargetDir)\AxMSTSCLib.dll</HintPath>
80+
<HintPath>$(TargetDir)\lib\AxMSTSCLib.dll</HintPath>
8281
</Reference>
8382
<Reference Include="MSTSCLib">
84-
<HintPath>$(TargetDir)\MSTSCLib.dll</HintPath>
83+
<HintPath>$(TargetDir)\lib\MSTSCLib.dll</HintPath>
8584
</Reference>
8685
<Compile Include="..\GlobalAssemblyInfo.cs" Link="Properties\GlobalAssemblyInfo.cs" />
8786
</ItemGroup>

Source/NETworkManager/Views/AWSSessionManagerHostView.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
xmlns:resources="clr-namespace:NETworkManager.Properties"
1414
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
1515
xmlns:interactivity="http://schemas.microsoft.com/xaml/behaviors"
16-
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
16+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
17+
xmlns:controls="clr-namespace:NETworkManager.Controls"
1718
dialogs:DialogParticipation.Register="{Binding}"
1819
Loaded="UserControl_Loaded"
1920
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:AWSSessionManagerHostViewModel}">
@@ -78,7 +79,7 @@
7879
</Grid>
7980
</dragablz:TabablzControl.HeaderSuffixContent>
8081
<dragablz:TabablzControl.HeaderItemTemplate>
81-
<DataTemplate DataType="controls:DragablzTabItem">
82+
<DataTemplate DataType="{x:Type controls:DragablzTabItem}">
8283
<Border BorderBrush="{DynamicResource MahApps.Brushes.Gray8}" BorderThickness="0,0,1,0">
8384
<Grid Height="32">
8485
<Grid.ContextMenu>

Source/NETworkManager/Views/PowerShellHostView.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
1313
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
1414
xmlns:interactivity="http://schemas.microsoft.com/xaml/behaviors"
15-
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
15+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
16+
xmlns:controls="clr-namespace:NETworkManager.Controls"
1617
dialogs:DialogParticipation.Register="{Binding}"
1718
Loaded="UserControl_Loaded"
1819
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:PowerShellHostViewModel}">
@@ -69,7 +70,7 @@
6970
</Grid>
7071
</dragablz:TabablzControl.HeaderSuffixContent>
7172
<dragablz:TabablzControl.HeaderItemTemplate>
72-
<DataTemplate DataType="controls:DragablzTabItem">
73+
<DataTemplate DataType="{x:Type controls:DragablzTabItem}">
7374
<Border BorderBrush="{DynamicResource MahApps.Brushes.Gray8}" BorderThickness="0,0,1,0">
7475
<Grid Height="32">
7576
<Grid.ContextMenu>

Source/NETworkManager/Views/RemoteDesktopHostView.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
1212
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
1313
xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF"
14-
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
14+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
15+
xmlns:controls="clr-namespace:NETworkManager.Controls"
1516
dialogs:DialogParticipation.Register="{Binding}"
1617
Loaded="UserControl_Loaded"
1718
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:RemoteDesktopHostViewModel}">
@@ -58,7 +59,7 @@
5859
</Grid>
5960
</dragablz:TabablzControl.HeaderSuffixContent>
6061
<dragablz:TabablzControl.HeaderItemTemplate>
61-
<DataTemplate DataType="controls:DragablzTabItem">
62+
<DataTemplate DataType="{x:Type controls:DragablzTabItem}">
6263
<Border BorderBrush="{DynamicResource MahApps.Brushes.Gray8}" BorderThickness="0,0,1,0">
6364
<Grid Height="32">
6465
<Grid.ContextMenu>

Source/NETworkManager/Views/TigerVNCHostView.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
1212
xmlns:wpfHelpers="clr-namespace:NETworkManager.Utilities.WPF;assembly=NETworkManager.Utilities.WPF"
1313
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
14-
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
14+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
15+
xmlns:controls="clr-namespace:NETworkManager.Controls"
1516
dialogs:DialogParticipation.Register="{Binding}"
1617
Loaded="UserControl_Loaded"
1718
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:TigerVNCHostViewModel}">
@@ -68,7 +69,7 @@
6869
</Grid>
6970
</dragablz:TabablzControl.HeaderSuffixContent>
7071
<dragablz:TabablzControl.HeaderItemTemplate>
71-
<DataTemplate DataType="controls:DragablzTabItem">
72+
<DataTemplate DataType="{x:Type controls:DragablzTabItem}">
7273
<Border BorderBrush="{DynamicResource MahApps.Brushes.Gray8}" BorderThickness="0,0,1,0">
7374
<Grid Height="32">
7475
<Grid.ContextMenu>

0 commit comments

Comments
 (0)