-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClearCache.cs
More file actions
52 lines (47 loc) · 1.84 KB
/
ClearCache.cs
File metadata and controls
52 lines (47 loc) · 1.84 KB
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
using System;
using System.IO;
namespace ClearFivem
{
internal class ClearCache
{
static public void Clear()
{
string defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "FiveM\\FiveM.app");
if (Utilities.IsProcessRunning("FiveM"))
{
Console.WriteLine("FiveM is currently running. Please close the application before cleaning the cache.");
return;
}
// Validar si la ruta por defecto existe
string pathToUse = string.Empty;
if (Directory.Exists(defaultPath))
{
pathToUse = defaultPath;
}
else
{
// Solicitar al usuario la ruta de instalación
Console.WriteLine("The default installation path for FiveM does not exist.");
Console.WriteLine("Please enter the path where FiveM is installed (e.g., C:\\Path\\To\\FiveM\\FiveM.app):");
pathToUse = Console.ReadLine() ?? string.Empty;
// Validar si la ruta proporcionada por el usuario es válida
if (!Directory.Exists(pathToUse))
{
Console.WriteLine("The provided path does not exist. Please make sure the path is correct.");
return;
}
}
// Proceder con la limpieza de la caché
var dataPath = Path.Combine(pathToUse, "data");
if (Directory.Exists(dataPath))
{
Utilities.DeleteDirectory(dataPath);
Console.WriteLine("Cache cleaned successfully.");
}
else
{
Console.WriteLine("Data directory does not exist in the provided path.");
}
}
}
}