Skip to content

Commit

Permalink
Add installation directory change functionality
Browse files Browse the repository at this point in the history
Introduced a method to change the installation directory dynamically. This includes updating internal procedures that depend on the directory path. Added related property and adjusted constructors and initializations accordingly.
  • Loading branch information
GamerVII-NET committed Jul 14, 2024
1 parent 70ab8a3 commit 3bd755e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Gml.Client/GmlClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,25 @@ public class GmlClientManager : IGmlClientManager
IObservable<int> IGmlClientManager.ProgressChanged => _progressChanged;

public string ProjectName { get; }
public string InstallationDirectory => _installationDirectory;

public event EventHandler<ProgressChangedEventArgs>? ProgressChanged;

private readonly string _installationDirectory;
private string _installationDirectory;
private readonly ApiProcedures _apiProcedures;
private readonly SystemIoProcedures _systemProcedures;
private SystemIoProcedures _systemProcedures;
private ISubject<int> _progressChanged = new Subject<int>();
private SignalRConnect? _launchbackendConnection;
private readonly string _webSocketAddress;
private readonly OsType _osType;

public GmlClientManager(string installationDirectory, string gateWay, string projectName, OsType osType)
{
_installationDirectory = installationDirectory;

var hostUri = new Uri(gateWay);

_osType = osType;
_systemProcedures = new SystemIoProcedures(installationDirectory, osType);
_apiProcedures = new ApiProcedures(new HttpClient
{
Expand Down Expand Up @@ -163,6 +166,12 @@ public async Task OpenServerConnection(IUser user)
await _launchbackendConnection.BuildAndConnect();
}

public void ChangeInstallationFolder(string installationDirectory)
{
_installationDirectory = installationDirectory;
_systemProcedures = new SystemIoProcedures(installationDirectory, _osType);
}

private async void UpdateInfo(long _)
{
if (_launchbackendConnection is not null)
Expand Down
2 changes: 2 additions & 0 deletions src/Gml.Client/IGmlClientManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public interface IGmlClientManager : IDisposable
{
IObservable<int> ProgressChanged { get; }
public string ProjectName { get; }
string InstallationDirectory { get; }
Task<ResponseMessage<List<ProfileReadDto>>> GetProfiles();
Task<ResponseMessage<ProfileReadInfoDto?>?> GetProfileInfo(ProfileCreateInfoDto profileDto);
public Task<Process> GetProcess(ProfileReadInfoDto profileDto, OsType osType);
Expand All @@ -26,4 +27,5 @@ Task UpdateCurrentLauncher((IVersionFile? ActualVersion, bool IsActuallVersion)
string originalFileName);

Task OpenServerConnection(IUser user);
void ChangeInstallationFolder(string installationDirectory);
}

0 comments on commit 3bd755e

Please sign in to comment.