示例#1
0
    public string Check(List <string> arguments)
    {
        StringBuilder sb        = new StringBuilder();
        string        id        = arguments[0];
        IHarvester    harvester = harvesters.FirstOrDefault(h => h.Id == id);

        if (harvester != null)
        {
            sb.AppendLine($"{harvester.GetType().Name.Replace("Harvester", "")} Harvester - {id}")
            .AppendLine($"Ore Output: {harvester.OreOutput}")
            .AppendLine($"Energy Requirement: {harvester.EnergyRequirement}");
        }
        IProvider provider = providers.FirstOrDefault(p => p.Id == id);

        if (provider != null)
        {
            sb.AppendLine($"{provider.GetType().Name.Replace("Provider", "")} Provider - {id}")
            .AppendLine($"Energy Output: {provider.EnergyOutput}");
        }
        if (harvester == null && provider == null)
        {
            sb.AppendLine($"No element found with id - {id}");
        }
        return(sb.ToString().Trim());
    }
示例#2
0
    public string Check(List <string> arguments)
    {
        string id = arguments[0];

        if (providers.ContainsKey(id))
        {
            IProvider provider = providers[id];
            string    type     = provider.GetType().Name.Replace("Provider", "");

            return($"{type} Provider - {id}\r\n" +
                   $"Energy Output: {provider.EnergyOutput}");
        }
        else if (harvesters.ContainsKey(id))
        {
            IHarvester harvester = harvesters[id];
            string     type      = harvester.GetType().Name.Replace("Harvester", "");

            return($"{type} Harvester - {id}\r\n" +
                   $"Ore Output: {harvester.OreOutput}\r\n" +
                   $"Energy Requirement: {harvester.EnergyRequirement}");
        }
        else
        {
            return($"No element found with id - {id}");
        }
    }
示例#3
0
    public string Register(IList <string> args)
    {
        IHarvester harverster = this.factory.GenerateHarvester(args);

        this.hervesters.Add(harverster);
        return(String.Format(Constants.SuccessfullRegistration,
                             harverster.GetType().Name));
    }
    public string Register(IList <string> args)
    {
        IHarvester harvester = this.harvesterFactory.GenerateHarvester(args);

        this.harvesters.Add(harvester);
        return(string.Format(OutputMessages.SuccessfullRegistration,
                             harvester.GetType().Name));
    }
示例#5
0
        private static async Task RunHarvester(IHarvester harvester)
        {
            var name = HarvesterNameAttribute.GetName(harvester.GetType());

            using (var writer = XmlWriter.Create($"{name}.xml", _xmlWriterSettings))
            {
                await harvester.Harvest(writer, new DiskArtifactDirectory(name), _httpClient);
            }
        }
    public string Register(IList <string> args)
    {
        IHarvester harvester = factory.GenerateHarvester(args);

        this.harvesters.Add(harvester);

        string result = string.Format(Constants.SuccessfullyRegisterdHarvester, harvester.GetType().Name, harvester.ID);

        return(result);
    }
示例#7
0
    public string Register(IList <string> args)
    {
        var type              = args[0];
        var id                = args[1];
        var oreOutput         = double.Parse(args[2]);
        var energyRequirement = double.Parse(args[3]);
        var sonicFactor       = 0;

        if (args.Count == 5)
        {
            sonicFactor = int.Parse(args[4]);
        }

        IHarvester harvester = harvesterFactory.GenerateHarvester(args);

        this.harvestes.Add(harvester);

        return(string.Format(Constants.SuccessfullRegistration, harvester.GetType().Name));
    }