public IWeapon Create(string typeName, string name, IRarity rarity)
    {
        var type = FactoriesUtility.GetType(typeName + "Weapon");

        if (!typeof(IWeapon).IsAssignableFrom(type))
        {
            throw new ArgumentException("This type is not compatible");
        }

        IWeapon weapon = (IWeapon)Activator.CreateInstance(type, new object[] { rarity, name });

        return(weapon);
    }
    public IRarity Create(string typeName)
    {
        var type = FactoriesUtility.GetType(typeName + "Rarity");

        if (!typeof(IRarity).IsAssignableFrom(type))
        {
            throw new ArgumentException();
        }

        IRarity rarity = (IRarity)Activator.CreateInstance(type);

        return(rarity);
    }
    public IGem Create(IClarity clarity, string typeName)
    {
        Type type = FactoriesUtility.GetType(typeName + "Gem");

        if (!typeof(IGem).IsAssignableFrom(type))
        {
            throw new ArgumentException();
        }

        IGem gem = (IGem)Activator.CreateInstance(type, new object[] { clarity });

        return(gem);
    }
    public void Run(string[] args)
    {
        Type type = FactoriesUtility.GetType(args[0] + "Command");

        if (!typeof(IExecutable).IsAssignableFrom(type))
        {
            throw new ArgumentException();
        }

        IExecutable exec = (IExecutable)Activator.CreateInstance(type, new object[] { weapons });

        InjectCustomFields(exec);
        exec.Execute(args.Skip(1).ToArray());
    }