Skip to content

Commit 8dd06f4

Browse files
committed
created basic user settings to store and maintain throughout the application
1 parent 76afd9e commit 8dd06f4

File tree

3 files changed

+60
-23
lines changed

3 files changed

+60
-23
lines changed

src/HyperMC/Program.cs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Hypermc.Settings;
12
using Microsoft.Extensions.DependencyInjection;
23
using System;
34
using System.Collections.Generic;
@@ -7,31 +8,33 @@
78

89
namespace Hypermc
910
{
10-
static class Program
11-
{
12-
private static IServiceProvider Provider;
13-
/// <summary>
14-
/// The main entry point for the application.
15-
/// </summary>
16-
[STAThread]
17-
static void Main()
18-
{
19-
Provider = ConfigureService();
11+
static class Program
12+
{
13+
private static IServiceProvider Provider;
14+
/// <summary>
15+
/// The main entry point for the application.
16+
/// </summary>
17+
[STAThread]
18+
static void Main()
19+
{
20+
Provider = ConfigureService();
21+
Provider.GetRequiredService<IUserSettings>().Initialize();
2022

21-
Application.SetHighDpiMode(HighDpiMode.SystemAware);
22-
Application.EnableVisualStyles();
23-
Application.SetCompatibleTextRenderingDefault(false);
24-
Application.Run(Provider.GetRequiredService<HyperMcView>());
25-
}
23+
Application.SetHighDpiMode(HighDpiMode.SystemAware);
24+
Application.EnableVisualStyles();
25+
Application.SetCompatibleTextRenderingDefault(false);
26+
Application.Run(Provider.GetRequiredService<HyperMcView>());
27+
}
2628

27-
private static IServiceProvider ConfigureService()
28-
{
29-
IServiceCollection services = new ServiceCollection();
29+
private static IServiceProvider ConfigureService()
30+
{
31+
IServiceCollection services = new ServiceCollection();
3032

31-
services.AddSingleton<HyperMcView>();
32-
services.AddForgeClient();
33+
services.AddSingleton<HyperMcView>()
34+
.AddSingleton<IUserSettings, UserSettings>();
35+
services.AddForgeClient();
3336

34-
return services.BuildServiceProvider();
35-
}
36-
}
37+
return services.BuildServiceProvider();
38+
}
39+
}
3740
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Hypermc.Settings
8+
{
9+
public interface IUserSettings
10+
{
11+
string MinecraftPath { get; set; }
12+
13+
void Initialize();
14+
}
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Hypermc.Settings
9+
{
10+
public class UserSettings : IUserSettings
11+
{
12+
public string MinecraftPath { get; set; } = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\.minecraft";
13+
14+
public void Initialize()
15+
{
16+
17+
}
18+
}
19+
}

0 commit comments

Comments
 (0)