public string Get() { var agentId = _configManager.Get("AgentId"); // ReSharper disable once InvertIf if (string.IsNullOrEmpty(agentId)) { agentId = _scanAgentIdGenerator.Generate(); _configManager.Set("AgentId", agentId); _log.Info($"New Agent Id generated. Id='{agentId}'"); } return(agentId); }
public string Get() { var filePath = _agentIdFilePathProvider.GetIdFilePath(); string agentId; // ReSharper disable once InvertIf if (!TextFile.TryRead(filePath, out agentId) || string.IsNullOrEmpty(agentId)) { agentId = _scanAgentIdGenerator.Generate(); TextFile.Write(filePath, agentId); _log.Info($"New Agent Id saved. Id='{agentId}', IdFilePath='{filePath}'"); } return(agentId); }