private static string GetMachineNameDisplayText(EventLogsSection eventLogsConfig) { bool isLocalMachine = IsLocalMachine(eventLogsConfig); string machineNameDisplayText = ""; if (isLocalMachine) { machineNameDisplayText = "local machine"; } else { machineNameDisplayText = "machine " + eventLogsConfig.MachineName; } return(machineNameDisplayText); }
private static bool IsLocalMachine(EventLogsSection eventLogsConfig) { if (eventLogsConfig.MachineName == null || eventLogsConfig.MachineName.Trim().Length == 0) { return(true); } string lowerCaseMachineName = eventLogsConfig.MachineName.Trim().ToLower(); if (lowerCaseMachineName == "." || lowerCaseMachineName == "localhost" || lowerCaseMachineName == "(localhost)" || lowerCaseMachineName == "[localhost]" || lowerCaseMachineName == "{localhost}") { return(true); } return(false); }