Skip to content

Commit 213b73e

Browse files
authored
Merge pull request #3 from mcoot/mcoot/package-management
Version 2.0.0 with reworked package management
2 parents 75891bf + a97b930 commit 213b73e

10 files changed

Lines changed: 966 additions & 188 deletions

Config.cs

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,49 @@ public ConfigSaveException(string message) : base(message) { }
6969
public ConfigSaveException(string message, Exception inner) : base(message, inner) { }
7070
}
7171

72+
public class DebugConfig : INotifyPropertyChanged
73+
{
74+
public event PropertyChangedEventHandler PropertyChanged;
75+
protected virtual void OnPropertyChanged(string propertyName)
76+
{
77+
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
78+
}
79+
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
80+
{
81+
if (Equals(storage, value)) return false;
82+
83+
storage = value;
84+
this.OnPropertyChanged(propertyName);
85+
return true;
86+
}
87+
88+
private bool disableCopyOnUpdate = false;
89+
public bool DisableCopyOnUpdate
90+
{
91+
get { return disableCopyOnUpdate; }
92+
set
93+
{
94+
if (SetProperty(ref disableCopyOnUpdate, value))
95+
{
96+
this.OnPropertyChanged("DisableCopyOnUpdate");
97+
}
98+
}
99+
}
100+
101+
private string alternatePackageConfigFile = null;
102+
public string AlternatePackageConfigFile
103+
{
104+
get { return alternatePackageConfigFile; }
105+
set
106+
{
107+
if (SetProperty(ref alternatePackageConfigFile, value))
108+
{
109+
this.OnPropertyChanged("AlternatePackageConfigFile");
110+
}
111+
}
112+
}
113+
}
114+
72115
public class LoginServerConfig : INotifyPropertyChanged
73116
{
74117
public event PropertyChangedEventHandler PropertyChanged;
@@ -213,7 +256,15 @@ public bool IsAutomatic
213256
get { return Mode == InjectMode.Automatic; }
214257
}
215258
}
216-
259+
260+
public static readonly List<String> DefaultGamePaths = new List<string>
261+
{
262+
"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Tribes\\Binaries\\Win32\\TribesAscend.exe",
263+
"D:\\Program Files (x86)\\Steam\\steamapps\\common\\Tribes\\Binaries\\Win32\\TribesAscend.exe",
264+
"E:\\Program Files (x86)\\Steam\\steamapps\\common\\Tribes\\Binaries\\Win32\\TribesAscend.exe",
265+
"C:\\Program Files (x86)\\HiRezGames\\Tribes\\Binaries\\Win32\\TribesAscend.exe",
266+
};
267+
217268
private string gamePath = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\Tribes\\Binaries\\Win32\\TribesAscend.exe";
218269
public string GamePath
219270
{
@@ -226,7 +277,9 @@ public string CustomArguments
226277
get { return customArguments; }
227278
set { SetProperty(ref customArguments, value); }
228279
}
229-
280+
281+
public DebugConfig Debug { get; set; } = new DebugConfig();
282+
230283
public DLLConfig DLL { get; set; } = new DLLConfig();
231284
public InjectConfig Injection { get; set; } = new InjectConfig();
232285
public LoginServerConfig LoginServer { get; set; } = new LoginServerConfig();

ExtensionMethods.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public static class ExtensionMethods
1212

1313
/// <summary>
1414
/// Run a task to 'fire and forget', but to run a delegate on exception
15+
///
16+
/// Because C# is a garbage language
1517
/// </summary>
1618
/// <param name="task">The Task to run</param>
1719
/// <param name="onError">Called if the task raises an exception</param>

MainWindow.xaml

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@
4545
</StackPanel>
4646
<StackPanel Width="86" Margin="0,0,0,-0.4"/>
4747
<StackPanel Width="208" Margin="0,0,0,-0.4">
48-
<ComboBox x:Name="LoginServerModeDropdown" Margin="0,5" VerticalAlignment="Top" ItemsSource="{Binding Source={StaticResource enumLoginServerMode}}" SelectedItem="{Binding LoginServer.LoginServer, Mode=TwoWay}" Height="23" SelectionChanged="LoginServerModeDropdown_SelectionChanged" />
49-
<TextBox x:Name="CustomLoginServerTextBox" Height="23" TextWrapping="Wrap" Text="{Binding LoginServer.CustomLoginServerHost, Mode=TwoWay}" VerticalAlignment="Top" IsEnabled="{Binding LoginServer.IsCustom, Mode=OneWay}"/>
48+
<ComboBox x:Name="LoginServerModeDropdown" Margin="0,5" VerticalAlignment="Top" ItemsSource="{Binding Source={StaticResource enumLoginServerMode}}" SelectedItem="{Binding LauncherConfig.LoginServer.LoginServer, Mode=TwoWay}" Height="23" SelectionChanged="LoginServerModeDropdown_SelectionChanged" />
49+
<TextBox x:Name="CustomLoginServerTextBox" Height="23" TextWrapping="Wrap" Text="{Binding LauncherConfig.LoginServer.CustomLoginServerHost, Mode=TwoWay}" VerticalAlignment="Top" IsEnabled="{Binding LauncherConfig.LoginServer.IsCustom, Mode=OneWay}"/>
5050
</StackPanel>
5151
</StackPanel>
5252
</GroupBox>
5353
<GroupBox Header="Game Path" Height="58" Margin="10,10,10,0" VerticalAlignment="Top" RenderTransformOrigin="0.494,0.765">
5454
<StackPanel Orientation="Horizontal">
55-
<TextBox x:Name="GamePathTextBox" Width="346" Margin="0,3,5,5.4" Height="22" Text="{Binding GamePath, Mode=TwoWay}" MaxLines="1"/>
55+
<TextBox x:Name="GamePathTextBox" Width="346" Margin="0,3,5,5.4" Height="22" Text="{Binding LauncherConfig.GamePath, Mode=TwoWay}" MaxLines="1"/>
5656
<Button x:Name="GamePathChooseButton" Content="Choose" Width="55" Margin="0,5,0,7.2" RenderTransformOrigin="1.333,0.582" Height="22.4" Click="GamePathChooseButton_Click"/>
5757
</StackPanel>
5858
</GroupBox>
@@ -61,8 +61,8 @@
6161
<RadioButton x:Name="InjectionModeManualRadio" Content="Manual" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0" GroupName="InjectionModeRadio" Checked="InjectionModeManualRadio_Checked" />
6262
<StackPanel Height="41" Margin="0,0,0.4,0" Orientation="Horizontal">
6363
<RadioButton x:Name="InjectionModeAutoRadio" Content="Automatic" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" GroupName="InjectionModeRadio" Checked="InjectionModeAutoRadio_Checked" />
64-
<Slider x:Name="InjectionModeAutoSlider" HorizontalAlignment="Left" Height="34" Margin="5,5,0,0" VerticalAlignment="Top" Width="90" TickPlacement="BottomRight" Minimum="5" Maximum="45" TickFrequency="5" Value="{Binding Injection.AutoInjectTimer, Mode=TwoWay}" IsEnabled="{Binding Injection.IsAutomatic, Mode=OneWay}" />
65-
<Label x:Name="InjectionModeAutoLabel" Content="{Binding Injection.AutoInjectTimer}" IsEnabled="{Binding Injection.IsAutomatic, Mode=OneWay}" />
64+
<Slider x:Name="InjectionModeAutoSlider" HorizontalAlignment="Left" Height="34" Margin="5,5,0,0" VerticalAlignment="Top" Width="90" TickPlacement="BottomRight" Minimum="5" Maximum="45" TickFrequency="5" Value="{Binding LauncherConfig.Injection.AutoInjectTimer, Mode=TwoWay}" IsEnabled="{Binding LauncherConfig.Injection.IsAutomatic, Mode=OneWay}" />
65+
<Label x:Name="InjectionModeAutoLabel" Content="{Binding LauncherConfig.Injection.AutoInjectTimer}" IsEnabled="{Binding LauncherConfig.Injection.IsAutomatic, Mode=OneWay}" />
6666
</StackPanel>
6767
</StackPanel>
6868
</GroupBox>
@@ -74,11 +74,11 @@
7474
<StackPanel>
7575
<StackPanel Height="30" Orientation="Horizontal" Margin="0,0,-0.2,0">
7676
<Label Content="Release Channel:" Margin="0,0,0,0.4"/>
77-
<ComboBox x:Name="DLLModeDropdown" Margin="5,3,5,5.4" SelectedIndex="0" ItemsSource="{Binding Source={StaticResource enumDLLMode}}" SelectedItem="{Binding DLL.Channel, Mode=TwoWay}" />
77+
<ComboBox x:Name="DLLModeDropdown" Margin="5,3,5,5.4" SelectedIndex="0" ItemsSource="{Binding Source={StaticResource enumDLLMode}}" SelectedItem="{Binding LauncherConfig.DLL.Channel, Mode=TwoWay}" />
7878
</StackPanel>
7979
<StackPanel Height="52" Orientation="Horizontal" Margin="0,0,-0.2,0">
80-
<TextBox x:Name="CustomDLLPathTextBox" Width="346" Margin="0,0,5,30" IsEnabled="{Binding DLL.IsCustom, Mode=OneWay}" MaxLines="1" Text="{Binding DLL.CustomDLLPath, Mode=TwoWay}" />
81-
<Button x:Name="CustomDLLPathChooseButton" Content="Choose" Width="55" Margin="0,0,0,30" RenderTransformOrigin="1.333,0.582" IsEnabled="{Binding DLL.IsCustom, Mode=OneWay}" Click="CustomDLLPathChooseButton_Click" />
80+
<TextBox x:Name="CustomDLLPathTextBox" Width="346" Margin="0,0,5,30" IsEnabled="{Binding LauncherConfig.DLL.IsCustom, Mode=OneWay}" MaxLines="1" Text="{Binding LauncherConfig.DLL.CustomDLLPath, Mode=TwoWay}" />
81+
<Button x:Name="CustomDLLPathChooseButton" Content="Choose" Width="55" Margin="0,0,0,30" RenderTransformOrigin="1.333,0.582" IsEnabled="{Binding LauncherConfig.DLL.IsCustom, Mode=OneWay}" Click="CustomDLLPathChooseButton_Click" />
8282
</StackPanel>
8383
</StackPanel>
8484
</GroupBox>
@@ -93,13 +93,45 @@
9393
</StackPanel>
9494
</GroupBox>
9595
<GroupBox Header="Extra Command Line Arguments" Height="57" Margin="10,185,10,0" VerticalAlignment="Top">
96-
<TextBox HorizontalAlignment="Left" Margin="0,7,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="408" MaxLines="1" Text="{Binding CustomArguments, Mode=TwoWay}" Height="22.4"/>
96+
<TextBox HorizontalAlignment="Left" Margin="0,7,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="408" MaxLines="1" Text="{Binding LauncherConfig.CustomArguments, Mode=TwoWay}" Height="22.4"/>
9797
</GroupBox>
9898
</Grid>
9999
</TabItem>
100+
<TabItem x:Name="PackagesTab" Header="Packages">
101+
<Grid >
102+
<ListView x:Name="PackageListView" Height="217" Margin="10,26,135.8,0" VerticalAlignment="Top" ItemsSource="{Binding PackageState.LocalPackages}" SelectionChanged="PackageListView_SelectionChanged" SelectionMode="Single">
103+
<ListView.View>
104+
<GridView AllowsColumnReorder="False">
105+
<GridViewColumn Header="Package" Width="210">
106+
<GridViewColumn.CellTemplate>
107+
<DataTemplate>
108+
<TextBlock Text="{Binding Remote.DisplayName}" Foreground="{Binding DisplayColor}"/>
109+
</DataTemplate>
110+
</GridViewColumn.CellTemplate>
111+
</GridViewColumn>
112+
<GridViewColumn Header="Version" Width="75" >
113+
<GridViewColumn.CellTemplate>
114+
<DataTemplate>
115+
<TextBlock Text="{Binding Remote.Version}" Foreground="{Binding DisplayColor}" />
116+
</DataTemplate>
117+
</GridViewColumn.CellTemplate>
118+
</GridViewColumn>
119+
</GridView>
120+
</ListView.View>
121+
</ListView>
122+
<Label x:Name="PackageStatusLabel" Content="Additional Packages" HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Top"/>
123+
<Button x:Name="PackageInstallButton" Content="Install" Margin="0,0,10.8,10.8" VerticalAlignment="Bottom" RenderTransformOrigin="0.5,0.5" Height="27" HorizontalAlignment="Right" Width="120" Click="PackageInstallButton_Click" IsEnabled="False">
124+
</Button>
125+
<TextBox x:Name="PackageDescriptionTextBox" Margin="0,26,9.8,42.8" TextWrapping="Wrap" Text="{Binding SelectedPackage.Remote.Description}" IsReadOnly="True" HorizontalAlignment="Right" Width="121" />
126+
</Grid>
127+
</TabItem>
100128
<TabItem x:Name="InfoTab" Header="Info">
101129
<Grid Margin="0">
102-
<RichTextBox x:Name="InfoRichTextBox" Margin="0" IsReadOnly="True" >
130+
<Grid.ColumnDefinitions>
131+
<ColumnDefinition Width="46*"/>
132+
<ColumnDefinition Width="105*"/>
133+
</Grid.ColumnDefinitions>
134+
<RichTextBox x:Name="InfoRichTextBox" Margin="0,0,-0.2,-0.2" IsReadOnly="True" Grid.ColumnSpan="2" >
103135
<RichTextBox.Resources>
104136
<Style TargetType="Hyperlink">
105137
<Setter Property="Cursor" Value="Hand" />
@@ -113,6 +145,7 @@
113145
</TabControl>
114146
<Button x:Name="LauncherButton" Content="Launch" Margin="346,0,10.4,9.6" Click="LauncherButton_Click" Height="27" VerticalAlignment="Bottom"/>
115147
<ProgressBar x:Name="UpdateProgressBar" HorizontalAlignment="Left" Margin="10,0,0,9.6" Width="331" Height="27" VerticalAlignment="Bottom"/>
148+
<Label x:Name="UpdatePhaseLabel" Content="" HorizontalAlignment="Left" Margin="10,284,0,0" VerticalAlignment="Top" Height="34"/>
116149

117150
</Grid>
118151
</Window>

0 commit comments

Comments
 (0)