Skip to content

Commit b9d71d8

Browse files
committed
Add project files.
1 parent c3e413b commit b9d71d8

20 files changed

+1165
-0
lines changed

App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
5+
</startup>
6+
</configuration>

App.xaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<Application x:Class="PC_Creator_Modloader.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:PC_Creator_Modloader"
5+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
6+
StartupUri="MainWindow.xaml"
7+
>
8+
<Application.Resources>
9+
<ResourceDictionary>
10+
<ResourceDictionary.MergedDictionaries>
11+
<ui:ThemesDictionary Theme="Dark"/>
12+
13+
<ui:ControlsDictionary/>
14+
</ResourceDictionary.MergedDictionaries>
15+
16+
<Style TargetType="ui:Button" x:Key="FluentUIBaseButtonTheme">
17+
<Setter Property="Foreground" Value="Black"/>
18+
19+
<Setter Property="BorderBrush" Value="DimGray"/>
20+
21+
<Setter Property="BorderThickness" Value="2"/>
22+
23+
<Setter Property="Padding" Value="6 6 6 6"/>
24+
25+
<Setter Property="Background" Value="White"/>
26+
</Style>
27+
28+
<Style TargetType="ui:Button" x:Key="FluentUIBaseIconButtonTheme">
29+
<Setter Property="IconForeground" Value="Black"/>
30+
31+
<Setter Property="BorderBrush" Value="DimGray"/>
32+
33+
<Setter Property="BorderThickness" Value="2"/>
34+
35+
<Setter Property="Background" Value="White"/>
36+
37+
<Setter Property="FontSize" Value="16"/>
38+
39+
<Setter Property="Padding" Value="6 6 6 6"/>
40+
</Style>
41+
42+
<Style TargetType="Button" x:Key="BaseButtonTheme">
43+
<Setter Property="Background" Value="White" />
44+
<Setter Property="TextBlock.TextAlignment" Value="Center" />
45+
<Setter Property="Template">
46+
<Setter.Value>
47+
<ControlTemplate TargetType="Button">
48+
<Border CornerRadius="10"
49+
Background="LightGray" BorderBrush="Gray"
50+
BorderThickness="2,2,2,2" >
51+
<ContentPresenter x:Name="contentPresenter"
52+
ContentTemplate="{TemplateBinding ContentTemplate}"
53+
Content="{TemplateBinding Content}"
54+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
55+
Margin="{TemplateBinding Padding}"
56+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
57+
</Border>
58+
</ControlTemplate>
59+
</Setter.Value>
60+
</Setter>
61+
</Style>
62+
</ResourceDictionary>
63+
</Application.Resources>
64+
</Application>

App.xaml.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
9+
namespace PC_Creator_Modloader
10+
{
11+
/// <summary>
12+
/// Interaction logic for App.xaml
13+
/// </summary>
14+
public partial class App : Application
15+
{
16+
}
17+
}

HomePage.xaml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<UserControl x:Class="PC_Creator_Modloader.HomePage"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:PC_Creator_Modloader"
7+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
8+
mc:Ignorable="d"
9+
Height="auto" Width="auto"
10+
FontFamily="Segoe UI" FontWeight="SemiBold"
11+
Loaded="OnHomePageLoaded"
12+
Background="White">
13+
<Grid>
14+
<Grid.ColumnDefinitions>
15+
<ColumnDefinition Width="10"/>
16+
17+
<ColumnDefinition Width="1.4*"/>
18+
19+
<ColumnDefinition Width="10"/>
20+
21+
<ColumnDefinition Width="2*"/>
22+
23+
<ColumnDefinition Width="10"/>
24+
25+
<ColumnDefinition Width="3*"/>
26+
27+
<ColumnDefinition Width="10"/>
28+
</Grid.ColumnDefinitions>
29+
30+
<Grid.RowDefinitions>
31+
<RowDefinition Height="10"/>
32+
33+
<RowDefinition Height="*"/>
34+
35+
<RowDefinition Height="10"/>
36+
</Grid.RowDefinitions>
37+
38+
<Grid Name="SidebarGrid" Grid.Row="1" Grid.Column="1">
39+
<Grid.ColumnDefinitions>
40+
<ColumnDefinition Width="*"/>
41+
</Grid.ColumnDefinitions>
42+
43+
<Grid.RowDefinitions>
44+
<RowDefinition Height="*"/>
45+
46+
<RowDefinition Height="10*"/>
47+
</Grid.RowDefinitions>
48+
49+
<TextBlock Name="SidebarHeaderTextBlock" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" FontWeight="Bold">PC Creator Modloader</TextBlock>
50+
51+
<ListView Name="SidebarButtonsListView" Grid.Row="1" Grid.Column="0" HorizontalContentAlignment="Stretch" Padding="0 0 0 0" BorderThickness="0">
52+
<ui:Button ui:Style="{StaticResource FluentUIBaseButtonTheme}">About</ui:Button>
53+
54+
<ui:Button ui:Style="{StaticResource FluentUIBaseButtonTheme}">Help</ui:Button>
55+
56+
<ui:Button Name="SettingsButton" ui:Style="{StaticResource FluentUIBaseButtonTheme}">Settings</ui:Button>
57+
58+
<ui:Button ui:Style="{StaticResource FluentUIBaseButtonTheme}">Credits</ui:Button>
59+
60+
<ui:Button ui:Style="{StaticResource FluentUIBaseButtonTheme}">Report a bug</ui:Button>
61+
62+
<ui:Button ui:Style="{StaticResource FluentUIBaseButtonTheme}">Request a feature</ui:Button>
63+
64+
<ui:Button ui:Style="{StaticResource FluentUIBaseButtonTheme}">Follow us on Github</ui:Button>
65+
</ListView>
66+
</Grid>
67+
68+
<Grid Name="OfficialPatchNotesGrid" Grid.Row="1" Grid.Column="3" Margin="10,0,10,0">
69+
<Grid.ColumnDefinitions>
70+
<ColumnDefinition Width="*"/>
71+
</Grid.ColumnDefinitions>
72+
73+
<Grid.RowDefinitions>
74+
<RowDefinition Height="*"/>
75+
76+
<RowDefinition Height="10*"/>
77+
</Grid.RowDefinitions>
78+
79+
<TextBlock Name="OfficialPatchNotesHeaderTextBlock" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" FontWeight="Bold">Official Patch Notes</TextBlock>
80+
81+
<ui:DynamicScrollViewer Name="OfficialPatchNotesListViewer" Grid.Row="1" Grid.Column="0" BorderThickness="2" BorderBrush="DimGray" VerticalAlignment="Top">
82+
83+
</ui:DynamicScrollViewer>
84+
</Grid>
85+
86+
<Grid Name="ModListViewerGrid" Grid.Row="1" Grid.Column="5">
87+
<Grid.ColumnDefinitions>
88+
<ColumnDefinition Width="*"/>
89+
</Grid.ColumnDefinitions>
90+
91+
<Grid.RowDefinitions>
92+
<RowDefinition Height="*"/>
93+
94+
<RowDefinition Height="10*"/>
95+
96+
<RowDefinition Height="10"/>
97+
98+
<RowDefinition Height="40"/>
99+
</Grid.RowDefinitions>
100+
101+
<TextBlock Name="ModListHeaderTextBlock" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" FontWeight="Bold">List of currently installed mods</TextBlock>
102+
103+
<ListView Name="ModListView" Grid.Row="1" Grid.Column="0" BorderThickness="0">
104+
105+
</ListView>
106+
107+
<ui:Button Name="AddModButton" Grid.Row="3" Grid.Column="0" MaxWidth="100">Add mods</ui:Button>
108+
</Grid>
109+
</Grid>
110+
</UserControl>

HomePage.xaml.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using System.Windows;
7+
using System.Windows.Controls;
8+
using System.Windows.Data;
9+
using System.Windows.Documents;
10+
using System.Windows.Input;
11+
using System.Windows.Media;
12+
using System.Windows.Media.Imaging;
13+
using System.Windows.Navigation;
14+
using System.Windows.Shapes;
15+
16+
namespace PC_Creator_Modloader
17+
{
18+
/// <summary>
19+
/// Interaction logic for HomePage.xaml
20+
/// </summary>
21+
public partial class HomePage : UserControl
22+
{
23+
private Button settingsButton = null;
24+
25+
private void OnHomePageLoaded(object sender, RoutedEventArgs e)
26+
{
27+
this.settingsButton = (Button)this.FindName("SettingsButton");
28+
29+
this.settingsButton.Click += this.OnSettingsButtonClick;
30+
}
31+
32+
private void OnSettingsButtonClick(object sender, RoutedEventArgs e)
33+
{
34+
MainWindow.instance.mainContentControl.Content = MainWindow.instance.settingsPage;
35+
}
36+
37+
public HomePage()
38+
{
39+
InitializeComponent();
40+
}
41+
}
42+
}

MainConfig.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using System.IO;
3+
using System.Windows;
4+
using Newtonsoft.Json;
5+
6+
namespace PC_Creator_Modloader
7+
{
8+
public class MainConfig
9+
{
10+
private const string defaultMainConfigFileName = "pc_creator_modloader_config.json";
11+
12+
private const string defaultMainConfigFileRelativeFilePath = "/" + defaultMainConfigFileName;
13+
14+
private string mainConfigFileAbsoluteFilePath = "";
15+
16+
public string baseDirectoryPath = "";
17+
18+
public string gameExecutablePath = "";
19+
20+
public MainConfig()
21+
{
22+
this.baseDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
23+
24+
this.mainConfigFileAbsoluteFilePath = this.baseDirectoryPath + defaultMainConfigFileRelativeFilePath;
25+
}
26+
27+
public void Save()
28+
{
29+
string currentProgramDirectoryPath = AppDomain.CurrentDomain.BaseDirectory;
30+
31+
File.WriteAllText(
32+
this.mainConfigFileAbsoluteFilePath,
33+
JsonConvert.SerializeObject(this)
34+
);
35+
}
36+
37+
public void Load()
38+
{
39+
if (File.Exists(this.mainConfigFileAbsoluteFilePath) == true)
40+
{
41+
string mainConfigFileText = File.ReadAllText(this.mainConfigFileAbsoluteFilePath);
42+
43+
MainConfig deserializedMainConfig = JsonConvert.DeserializeObject<MainConfig>(mainConfigFileText);
44+
45+
this.gameExecutablePath = deserializedMainConfig.gameExecutablePath;
46+
}
47+
else
48+
{
49+
File.Create(this.mainConfigFileAbsoluteFilePath);
50+
}
51+
}
52+
}
53+
}

MainWindow.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Window x:Class="PC_Creator_Modloader.MainWindow"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:PC_Creator_Modloader"
7+
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
8+
mc:Ignorable="d"
9+
Title="MainWindow" Height="450" Width="800" Loaded="OnMainWindowLoaded">
10+
<ContentControl Name="MainContentControl">
11+
12+
</ContentControl>
13+
</Window>

MainWindow.xaml.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.ComponentModel;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
using System.Windows.Controls;
9+
using System.Windows.Data;
10+
using System.Windows.Documents;
11+
using System.Windows.Input;
12+
using System.Windows.Media;
13+
using System.Windows.Media.Imaging;
14+
using System.Windows.Shapes;
15+
16+
namespace PC_Creator_Modloader
17+
{
18+
/// <summary>
19+
/// Interaction logic for MainWindow.xaml
20+
/// </summary>
21+
public partial class MainWindow : Window
22+
{
23+
private bool firstLoadCompleted = false;
24+
25+
public static MainWindow instance = null;
26+
27+
public ContentControl mainContentControl = null;
28+
29+
public HomePage homePage = new HomePage();
30+
31+
public SettingsPage settingsPage = new SettingsPage();
32+
33+
public MainConfig mainConfig = new MainConfig();
34+
35+
private void OnMainWindowLoaded(object sender, RoutedEventArgs e)
36+
{
37+
if (this.firstLoadCompleted == false)
38+
{
39+
this.mainContentControl = (ContentControl)this.FindName("MainContentControl");
40+
41+
this.mainContentControl.Content = this.homePage;
42+
43+
this.Closing += this.OnMainWindowClosing;
44+
45+
this.firstLoadCompleted = true;
46+
}
47+
}
48+
49+
private void OnMainWindowClosing(object sender, CancelEventArgs e)
50+
{
51+
this.mainConfig.Save();
52+
}
53+
54+
public MainWindow()
55+
{
56+
instance = this;
57+
58+
InitializeComponent();
59+
60+
this.mainConfig.Load();
61+
}
62+
}
63+
}

0 commit comments

Comments
 (0)