Skip to content

Commit f291da1

Browse files
committed
fix #94
1 parent 972c59b commit f291da1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

DeviceDetector.NET/DeviceDetector.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public class DeviceDetector
109109
new MobileParser()
110110
};
111111

112-
protected List<IBotParserAbstract> botParsers = new List<IBotParserAbstract>
112+
protected IReadOnlyList<IBotParserAbstract> botParsers = new List<IBotParserAbstract>
113113
{
114114
new BotParser()
115115
};
@@ -228,11 +228,24 @@ public void SkipBotDetection(bool skip = true)
228228
public bool IsBot()
229229
{
230230
if (!IsParsed())
231-
throw new AccessViolationException("You need to call Parse method before use IsMobile method.");
231+
throw new AccessViolationException("You need to call Parse method before use IsBot method.");
232232

233233
return bot.Success;
234234
}
235235

236+
/// <summary>
237+
/// Returns if the parsed UA was identified as a Device Console
238+
/// @see consoles.yml for a list of detected consoles
239+
/// </summary>
240+
/// <returns></returns>
241+
public bool IsConsole()
242+
{
243+
if (!IsParsed())
244+
throw new AccessViolationException("You need to call Parse method before use IsConsole method.");
245+
246+
return device.HasValue && device.Value == DeviceType.DEVICE_TYPE_CONSOLE;
247+
}
248+
236249
/// <summary>
237250
/// Returns if the parsed UA was identified as a touch enabled device
238251
/// Note: That only applies to windows 8 tablets

0 commit comments

Comments
 (0)