A game about forced loneliness, made by TACStudios
1using Codice.Client.Common;
2using Codice.Client.Common.Servers;
3using Codice.CM.Common;
4using Codice.Utils;
5using PlasticGui;
6using PlasticGui.Configuration.TeamEdition;
7using PlasticGui.WorkspaceWindow.Home;
8
9namespace Unity.PlasticSCM.Editor.Configuration
10{
11 internal static class ClientConfiguration
12 {
13 internal static void Save(
14 string server,
15 SEIDWorkingMode workingMode,
16 string user,
17 string accessToken
18 )
19 {
20 SetupUnityEditionToken.CreateCloudEditionTokenIfNeeded();
21
22 // We observed that UserAccounts.SaveAccount skips the client.conf update when there is auth info saved.
23 // However, we want to make sure the configuration is always updated, so we add the skipped saving.
24 if (ClientConfig.HasAuthInfoConfigured())
25 {
26 ConfigurationActions.SaveClientConfig(
27 server,
28 workingMode,
29 user,
30 accessToken,
31 null);
32 }
33
34 // This creates the client.conf if needed but doesn't overwrite it if it exists already,
35 // and it also updates the profiles.conf and tokens.conf with the new AccessToken
36 UserAccounts.SaveAccount(
37 server,
38 user,
39 accessToken,
40 workingMode,
41 null,
42 null,
43 null);
44
45 SaveDefaultCloudServer(server);
46 }
47
48 // Save the Default Server in the config files of all clients, so they are already configured.
49 // Avoids having the Desktop application asking the user again later.
50 static void SaveDefaultCloudServer(string cloudServer)
51 {
52 SaveCloudServer.ToPlasticGuiConfig(cloudServer);
53 SaveCloudServer.ToPlasticGuiConfigFile(
54 cloudServer, GetPlasticConfigFileToSaveOrganization());
55 SaveCloudServer.ToPlasticGuiConfigFile(
56 cloudServer, GetGluonConfigFileToSaveOrganization());
57
58 KnownServers.ServersFromCloud.InitializeForWindows(
59 PlasticGuiConfig.Get().Configuration.DefaultCloudServer);
60 }
61
62 static string GetPlasticConfigFileToSaveOrganization()
63 {
64 if (PlatformIdentifier.IsMac())
65 {
66 return "macgui.conf";
67 }
68
69 return "plasticgui.conf";
70 }
71
72 static string GetGluonConfigFileToSaveOrganization()
73 {
74 if (PlatformIdentifier.IsMac())
75 {
76 return "gluon.conf";
77 }
78
79 return "gameui.conf";
80 }
81 }
82}