diff --git a/source/VersionHandlerImpl/src/ExecutionEnvironment.cs b/source/VersionHandlerImpl/src/ExecutionEnvironment.cs index 0a69aad1..ed642f76 100644 --- a/source/VersionHandlerImpl/src/ExecutionEnvironment.cs +++ b/source/VersionHandlerImpl/src/ExecutionEnvironment.cs @@ -25,18 +25,35 @@ namespace Google { /// internal class ExecutionEnvironment { + /// + /// Cached lower case CommandLine + /// + private static string Cached_Environment_CommandLine_Lower = null; + + /// + /// Get/Set cached lower case CommandLine + /// + public static string Environment_CommandLine_Lower { + get { + if (Cached_Environment_CommandLine_Lower == null) { + Cached_Environment_CommandLine_Lower = Environment.CommandLine.ToLower(); + } + return Cached_Environment_CommandLine_Lower; + } + } + /// /// Whether the editor was started in batch mode. /// public static bool InBatchMode { - get { return Environment.CommandLine.ToLower().Contains("-batchmode"); } + get { return Environment_CommandLine_Lower.Contains("-batchmode"); } } /// /// Whether the editor was started with a method to executed. /// public static bool ExecuteMethodEnabled { - get { return Environment.CommandLine.ToLower().Contains("-executemethod"); } + get { return Environment_CommandLine_Lower.Contains("-executemethod"); } } /// @@ -44,7 +61,7 @@ public static bool ExecuteMethodEnabled { /// internal static bool InteractiveMode { get { - return !(Environment.CommandLine.ToLower().Contains("-gvh_noninteractive") || + return !(Environment_CommandLine_Lower.Contains("-gvh_noninteractive") || ExecutionEnvironment.InBatchMode); } }