@@ -28,23 +28,15 @@ string NamedPipeName
2828 public const string TransportArgument = "--ipc-api-transport" ;
2929 public const string TcpPortArgument = "--ipc-api-port" ;
3030 public const string NamedPipeArgument = "--ipc-api-pipe-name" ;
31- public const string LegacyTransportArgument = "--background-api-transport" ;
32- public const string LegacyTcpPortArgument = "--background-api-port" ;
33- public const string LegacyNamedPipeArgument = "--background-api-pipe-name" ;
34-
3531 public const string CliTransportArgument = "--transport" ;
3632 public const string CliTcpPortArgument = "--tcp-port" ;
3733 public const string CliNamedPipeArgument = "--pipe-name" ;
3834
3935 public const string TransportEnvironmentVariable = "UNIGETUI_IPC_API_TRANSPORT" ;
4036 public const string TcpPortEnvironmentVariable = "UNIGETUI_IPC_API_PORT" ;
4137 public const string NamedPipeEnvironmentVariable = "UNIGETUI_IPC_API_PIPE_NAME" ;
42- public const string LegacyTransportEnvironmentVariable = "UNIGETUI_API_TRANSPORT" ;
43- public const string LegacyTcpPortEnvironmentVariable = "UNIGETUI_API_PORT" ;
44- public const string LegacyNamedPipeEnvironmentVariable = "UNIGETUI_API_PIPE_NAME" ;
4538
46- private const string EndpointMetadataDirectoryName = "BackgroundApiEndpoints" ;
47- private const string LegacyEndpointMetadataFileName = "BackgroundApiEndpoint.json" ;
39+ private const string EndpointMetadataDirectoryName = "IpcApiEndpoints" ;
4840
4941 public Uri BaseAddress =>
5042 TransportKind == IpcTransportKind . NamedPipe
@@ -72,9 +64,6 @@ string NamedPipeName
7264 public static string EndpointMetadataDirectoryPath =>
7365 Path . Join ( CoreData . UniGetUIUserConfigurationDirectory , EndpointMetadataDirectoryName ) ;
7466
75- private static string LegacyEndpointMetadataPath =>
76- Path . Join ( CoreData . UniGetUIUserConfigurationDirectory , LegacyEndpointMetadataFileName ) ;
77-
7867 public static IpcTransportOptions LoadForServer ( IReadOnlyList < string > ? args = null )
7968 {
8069 args ??= Environment . GetCommandLineArgs ( ) ;
@@ -104,7 +93,6 @@ public static IpcTransportOptions LoadForClient(IReadOnlyList<string>? args = nu
10493 public void Persist ( string sessionId , string token , string sessionKind , int processId )
10594 {
10695 Directory . CreateDirectory ( EndpointMetadataDirectoryPath ) ;
107- DeleteLegacyPersistedMetadata ( ) ;
10896
10997 var metadata = new IpcEndpointRegistration
11098 {
@@ -141,8 +129,6 @@ public static void DeletePersistedMetadata(string? sessionId = null)
141129 {
142130 Directory . Delete ( EndpointMetadataDirectoryPath , recursive : true ) ;
143131 }
144-
145- DeleteLegacyPersistedMetadata ( ) ;
146132 return ;
147133 }
148134
@@ -191,48 +177,6 @@ internal static IReadOnlyList<IpcEndpointRegistration> LoadPersistedRegistration
191177 Logger . Warn ( ex ) ;
192178 }
193179
194- try
195- {
196- if ( File . Exists ( LegacyEndpointMetadataPath ) )
197- {
198- var legacyMetadata = JsonSerializer . Deserialize < IpcStatus > (
199- File . ReadAllText ( LegacyEndpointMetadataPath ) ,
200- new JsonSerializerOptions ( SerializationHelpers . DefaultOptions )
201- {
202- PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
203- WriteIndented = true ,
204- }
205- ) ;
206-
207- if ( legacyMetadata is not null )
208- {
209- registrations . Add (
210- new IpcEndpointRegistration
211- {
212- SessionId = "legacy" ,
213- SessionKind = GuiSessionKind ,
214- Token = string . Empty ,
215- Transport = ParseTransport (
216- legacyMetadata . Transport ,
217- Default . TransportKind
218- ) ,
219- TcpPort = legacyMetadata . TcpPort > 0
220- ? legacyMetadata . TcpPort
221- : DefaultTcpPort ,
222- NamedPipeName = string . IsNullOrWhiteSpace ( legacyMetadata . NamedPipeName )
223- ? DefaultNamedPipeName
224- : legacyMetadata . NamedPipeName ,
225- }
226- ) ;
227- }
228- }
229- }
230- catch ( Exception ex )
231- {
232- Logger . Warn ( "Could not load legacy IPC API endpoint metadata" ) ;
233- Logger . Warn ( ex ) ;
234- }
235-
236180 return registrations ;
237181 }
238182
@@ -270,21 +214,9 @@ internal static bool HasExplicitClientOverride(IReadOnlyList<string> args)
270214 || args . Contains ( TransportArgument )
271215 || args . Contains ( TcpPortArgument )
272216 || args . Contains ( NamedPipeArgument )
273- || args . Contains ( LegacyTransportArgument )
274- || args . Contains ( LegacyTcpPortArgument )
275- || args . Contains ( LegacyNamedPipeArgument )
276217 || ! string . IsNullOrWhiteSpace ( Environment . GetEnvironmentVariable ( TransportEnvironmentVariable ) )
277218 || ! string . IsNullOrWhiteSpace ( Environment . GetEnvironmentVariable ( TcpPortEnvironmentVariable ) )
278- || ! string . IsNullOrWhiteSpace ( Environment . GetEnvironmentVariable ( NamedPipeEnvironmentVariable ) )
279- || ! string . IsNullOrWhiteSpace (
280- Environment . GetEnvironmentVariable ( LegacyTransportEnvironmentVariable )
281- )
282- || ! string . IsNullOrWhiteSpace (
283- Environment . GetEnvironmentVariable ( LegacyTcpPortEnvironmentVariable )
284- )
285- || ! string . IsNullOrWhiteSpace (
286- Environment . GetEnvironmentVariable ( LegacyNamedPipeEnvironmentVariable )
287- ) ;
219+ || ! string . IsNullOrWhiteSpace ( Environment . GetEnvironmentVariable ( NamedPipeEnvironmentVariable ) ) ;
288220 }
289221
290222 private static string GetEndpointMetadataPath ( string sessionId )
@@ -309,29 +241,26 @@ IpcTransportOptions fallback
309241 string ? transportValue = GetArgumentValue (
310242 args ,
311243 includeCliAliases
312- ? [ CliTransportArgument , TransportArgument , LegacyTransportArgument ]
313- : [ TransportArgument , LegacyTransportArgument ]
244+ ? [ CliTransportArgument , TransportArgument ]
245+ : [ TransportArgument ]
314246 ) ;
315247 transportValue ??= Environment . GetEnvironmentVariable ( TransportEnvironmentVariable ) ;
316- transportValue ??= Environment . GetEnvironmentVariable ( LegacyTransportEnvironmentVariable ) ;
317248
318249 string ? portValue = GetArgumentValue (
319250 args ,
320251 includeCliAliases
321- ? [ CliTcpPortArgument , TcpPortArgument , LegacyTcpPortArgument ]
322- : [ TcpPortArgument , LegacyTcpPortArgument ]
252+ ? [ CliTcpPortArgument , TcpPortArgument ]
253+ : [ TcpPortArgument ]
323254 ) ;
324255 portValue ??= Environment . GetEnvironmentVariable ( TcpPortEnvironmentVariable ) ;
325- portValue ??= Environment . GetEnvironmentVariable ( LegacyTcpPortEnvironmentVariable ) ;
326256
327257 string ? pipeValue = GetArgumentValue (
328258 args ,
329259 includeCliAliases
330- ? [ CliNamedPipeArgument , NamedPipeArgument , LegacyNamedPipeArgument ]
331- : [ NamedPipeArgument , LegacyNamedPipeArgument ]
260+ ? [ CliNamedPipeArgument , NamedPipeArgument ]
261+ : [ NamedPipeArgument ]
332262 ) ;
333263 pipeValue ??= Environment . GetEnvironmentVariable ( NamedPipeEnvironmentVariable ) ;
334- pipeValue ??= Environment . GetEnvironmentVariable ( LegacyNamedPipeEnvironmentVariable ) ;
335264
336265 var transport = ParseTransport ( transportValue , fallback . TransportKind ) ;
337266 int tcpPort = ParseTcpPort ( portValue , fallback . TcpPort ) ;
@@ -340,14 +269,6 @@ IpcTransportOptions fallback
340269 return new IpcTransportOptions ( transport , tcpPort , pipeName ) ;
341270 }
342271
343- private static void DeleteLegacyPersistedMetadata ( )
344- {
345- if ( File . Exists ( LegacyEndpointMetadataPath ) )
346- {
347- File . Delete ( LegacyEndpointMetadataPath ) ;
348- }
349- }
350-
351272 private static IpcTransportKind ParseTransport (
352273 string ? value ,
353274 IpcTransportKind fallback
0 commit comments