From 7bc77313d6a657fdb6f1d4d982a7231d8aeab87c Mon Sep 17 00:00:00 2001 From: Vatsan Madhavan Date: Wed, 12 Jun 2019 15:36:59 -0700 Subject: [PATCH] IsBrowserHosted == false, IsOnNetworkShareForDeployedApps == false; simplify GetcmdLineArgs() --- .../System/Windows/StartUpEventArgs.cs | 44 ++++--------------- 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/StartUpEventArgs.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/StartUpEventArgs.cs index 9b483f8e5..0287a7c93 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/StartUpEventArgs.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/StartUpEventArgs.cs @@ -59,50 +59,22 @@ internal bool PerformDefaultAction private string[] GetCmdLineArgs() { - string[] retValue = null; + string[] args = Environment.GetCommandLineArgs(); + Invariant.Assert(args.Length >= 1); - if (!BrowserInteropHelper.IsBrowserHosted && - ( ( Application.Current.MimeType != MimeType.Application ) - || ! IsOnNetworkShareForDeployedApps() )) - { - string[] args = Environment.GetCommandLineArgs(); - Invariant.Assert(args.Length >= 1); + int newLength = args.Length - 1; + newLength = (newLength >= 0 ? newLength : 0); - int newLength = args.Length - 1; - newLength = (newLength >=0 ? newLength : 0); - - retValue = new string[newLength]; - - for (int i = 1; i < args.Length; i++) - { - retValue[i-1] = args[i]; - } - } - else + string[] retValue = new string[newLength]; + + for (int i = 1; i < args.Length; i++) { - retValue = new string[0]; + retValue[i - 1] = args[i]; } return retValue; } - // - // Put this into a separate Method to avoid loading of this code at JIT time. - // - - // - // Explicitly tell the compiler that we don't want to be inlined. - // This will prevent loading of system.deployment unless we are a click-once app. - // - [MethodImplAttribute (MethodImplOptions.NoInlining )] - private bool IsOnNetworkShareForDeployedApps() - { -#if NETFX - return System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed ; -#else - return false; -#endif - } private String[] _args; private bool _performDefaultAction; -- GitLab