-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelperSkin.cs
61 lines (53 loc) · 1.69 KB
/
HelperSkin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.IO;
namespace osu_helper
{
/// <summary>
/// Class used to store the Helper skin information
/// </summary>
/// <remarks>
/// Should only have one object made.
/// </remarks>
public sealed class HelperSkin : Skin
{
private static HelperSkin? instance;
public static HelperSkin Instance
{
get
{
instance ??= new HelperSkin();
return instance;
}
}
private HelperSkin() : base(GetPath()) { }
/// <summary>
/// Gets the path of the helper skin.
/// </summary>
/// <returns>The path of the helper skin.</returns>
private static string GetPath()
{
if (OsuHelper.ManagerFolderName == null)
throw new ArgumentNullException($"{nameof(OsuHelper.ManagerFolderName)} is null.");
return GetPathFromName(OsuHelper.ManagerFolderName);
}
/// <summary>
/// Deletes all files in the helper skin
/// </summary>
public void DeleteSkinElements()
{
DirectoryInfo rootFolder = new(Path);
foreach (FileInfo file in rootFolder.GetFiles())
{
if (OsuHelper.SpamLogs)
MainForm.DebugLog($"Deleting {file.FullName}", false);
file.Delete();
}
foreach (DirectoryInfo folder in rootFolder.GetDirectories())
{
if (OsuHelper.SpamLogs)
MainForm.DebugLog($"Deleting {folder.FullName} (directory)", false);
Directory.Delete(folder.FullName, true);
}
}
}
}