Author: wkeil Date: Wed Oct 14 18:02:08 2015 New Revision: 1708666 URL: http://svn.apache.org/viewvc?rev=1708666&view=rev Log: DMAP-181: Release VB.net Client 1.0.1
Task-Url: https://issues.apache.org/jira/browse/DMAP-181 Removed: devicemap/trunk/clients/1.0/vbnet/DeviceMap-ASF.ico Modified: devicemap/trunk/clients/1.0/vbnet/DeviceMap.sln devicemap/trunk/clients/1.0/vbnet/DeviceMap/DeviceMapClient.vb devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/App.config devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/Module1.vb devicemap/trunk/clients/1.0/vbnet/README Modified: devicemap/trunk/clients/1.0/vbnet/DeviceMap.sln URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/vbnet/DeviceMap.sln?rev=1708666&r1=1708665&r2=1708666&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/vbnet/DeviceMap.sln (original) +++ devicemap/trunk/clients/1.0/vbnet/DeviceMap.sln Wed Oct 14 18:02:08 2015 @@ -8,6 +8,11 @@ EndProject Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "DeviceMapConsole", "DeviceMapConsole\DeviceMapConsole.vbproj", "{25243D5B-6173-416D-9ED1-4A6B061517CB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B856D59B-4B20-404D-A98C-AEC2C6F8E162}" + ProjectSection(SolutionItems) = preProject + LICENSE = LICENSE + NOTICE = NOTICE + README = README + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -28,9 +33,9 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - BuildVersion_UseUniversalClock = True - BuildVersion_UseGlobalSettings = True - BuildVersion_UpdateFileVersion = True BuildVersion_UpdateAssemblyVersion = True + BuildVersion_UpdateFileVersion = True + BuildVersion_UseGlobalSettings = True + BuildVersion_UseUniversalClock = True EndGlobalSection EndGlobal Modified: devicemap/trunk/clients/1.0/vbnet/DeviceMap/DeviceMapClient.vb URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/vbnet/DeviceMap/DeviceMapClient.vb?rev=1708666&r1=1708665&r2=1708666&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/vbnet/DeviceMap/DeviceMapClient.vb (original) +++ devicemap/trunk/clients/1.0/vbnet/DeviceMap/DeviceMapClient.vb Wed Oct 14 18:02:08 2015 @@ -22,9 +22,10 @@ Imports System.Text.RegularExpressions ''' <summary> ''' DeviceMap User-Agent Mapper ''' </summary> -''' <author>eberhard speer jr.</author> -''' <remarks>Apache's DeviceMap Project .Net version<br /> -''' ported from Reza Naghibi's DeviceMapClient.java</remarks> +''' <author>Eberhard Speer jr.</author> +''' <author>Werner Keil</author> +''' <remarks>Apache DeviceMap VB.Net version<br /> +''' ported from DeviceMap Java Classifier</remarks> Public Class DeviceMapClient ' Public devices As IDictionary(Of String, Device) Modified: devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/App.config URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/App.config?rev=1708666&r1=1708665&r2=1708666&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/App.config (original) +++ devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/App.config Wed Oct 14 18:02:08 2015 @@ -1,8 +1,9 @@ <?xml version="1.0"?> <configuration> <connectionStrings> + <!-- <add name="_DeviceMap" connectionString="C:\Ddr\Resources"/> - <add name="_DeviceMap2" connectionString="http://svn.apache.org/repos/asf/incubator/devicemap/trunk/data/device-data/src/main/resources/devicedata"/> + --> <add name="DeviceMap" connectionString ="http://devicemap-vm.apache.org/data/latest/"/> </connectionStrings> <startup> Modified: devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/Module1.vb URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/Module1.vb?rev=1708666&r1=1708665&r2=1708666&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/Module1.vb (original) +++ devicemap/trunk/clients/1.0/vbnet/DeviceMapConsole/Module1.vb Wed Oct 14 18:02:08 2015 @@ -41,38 +41,45 @@ Module Module1 End Try stopWatch.Stop() Console.Clear() - Console.WriteLine("Loaded !") - Console.WriteLine(String.Format("DeviceMap Client : {0}", client.Version)) - Console.WriteLine(String.Format("Loaded {0} devices with {1} patterns in {2} ms", client.DeviceCount.ToString, client.PatternCount.ToString, stopWatch.Elapsed.TotalMilliseconds.ToString)) - stopWatch.Restart() - ' cold run - Console.WriteLine("Cold run") - Map(client, "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0") - Map(client, "Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1") - Map(client, "Mozilla/5.0 (BlackBerry; U; BlackBerry 9810; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.261 Mobile Safari/534.11+") - Map(client, "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X; en-us) AppleWebKit/536.26 (KHTML, like Gecko) CriOS/23.0.1271.91 Mobile/10A403 Safari/8536.25") - stopWatch.Stop() - Console.WriteLine(String.Format("End cold run : {0} ms", stopWatch.Elapsed.TotalMilliseconds.ToString)) - ' test data path and file - Dim data As String = String.Format("{0}\{1}", testDataDirectory.TrimEnd(CChar("\")), testDataFile) - Console.WriteLine(String.Format("Press any key to run test file : {0}", data)) - Console.ReadKey() - ' test - If IO.File.Exists(data) Then - Dim lines As New List(Of String)(IO.File.ReadAllLines(data).ToList) - Dim cleanLines As List(Of String) = (From l In lines Select l Where Not String.IsNullOrWhiteSpace(l)).ToList + If Not IsNothing(client) Then + Console.WriteLine("Loaded !") + Console.WriteLine(String.Format("DeviceMap Client : {0}", client.Version)) + Console.WriteLine(String.Format("Loaded {0} devices with {1} patterns in {2} ms", client.DeviceCount.ToString, client.PatternCount.ToString, stopWatch.Elapsed.TotalMilliseconds.ToString)) stopWatch.Restart() - Dim i As Integer = 0 - For Each ua In cleanLines - Map(client, ua.Trim) - i = i + 1 - Next + ' cold run + Console.WriteLine("Cold run") + Map(client, "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0") + Map(client, "Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8L1") + Map(client, "Mozilla/5.0 (BlackBerry; U; BlackBerry 9810; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.261 Mobile Safari/534.11+") + Map(client, "Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X; en-us) AppleWebKit/536.26 (KHTML, like Gecko) CriOS/23.0.1271.91 Mobile/10A403 Safari/8536.25") stopWatch.Stop() - Console.WriteLine(String.Format("Tested {0} User-Agent strings in {1} ms.", i.ToString, stopWatch.Elapsed.TotalMilliseconds.ToString)) + Console.WriteLine(String.Format("End cold run : {0} ms", stopWatch.Elapsed.TotalMilliseconds.ToString)) + ' test data path and file + Dim data As String = String.Format("{0}\{1}", testDataDirectory.TrimEnd(CChar("\")), testDataFile) + Console.WriteLine(String.Format("Press any key to run test file : {0}", data)) + Console.ReadKey() + ' test + If IO.File.Exists(data) Then + Dim lines As New List(Of String)(IO.File.ReadAllLines(data).ToList) + Dim cleanLines As List(Of String) = (From l In lines Select l Where Not String.IsNullOrWhiteSpace(l)).ToList + stopWatch.Restart() + Dim i As Integer = 0 + For Each ua In cleanLines + Map(client, ua.Trim) + i = i + 1 + Next + stopWatch.Stop() + Console.WriteLine(String.Format("Tested {0} User-Agent strings in {1} ms.", i.ToString, stopWatch.Elapsed.TotalMilliseconds.ToString)) + Else + Console.WriteLine(String.Format("Test file {0} not found.", data)) + End If + Console.WriteLine("Press any key to finish") + Console.ReadKey() Else - Console.WriteLine(String.Format("Test file {0} not found.", data)) + Console.WriteLine("DeviceMap Client or Data not found.") + Console.WriteLine() + Console.WriteLine("You may need to check your configuration '" + Process.GetCurrentProcess().ProcessName + ".exe.config'.") End If - Console.ReadKey() End Sub ''' <summary> ''' Maps User-Agent String to Device Modified: devicemap/trunk/clients/1.0/vbnet/README URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/vbnet/README?rev=1708666&r1=1708665&r2=1708666&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/vbnet/README (original) +++ devicemap/trunk/clients/1.0/vbnet/README Wed Oct 14 18:02:08 2015 @@ -1,3 +1,51 @@ -Device Map .Net Client +DeviceMap VB.NET Client -CLS (ISO/IEC 23271:2012) compliant .Net version of Device Map Java Client +CLS (ISO/IEC 23271:2012) compliant .NET version of Apache DeviceMap Client + +This client is used to classify browser User-Agent strings. + +The client requires devicemap-data. Data can be loaded via: + + * URL + * JAR file + * Filesystem + +# Code + +//get client using configured data source +//see "Configuration" below for further details on how to configure the data source +DeviceMapClient client = new DeviceMapClient(); + +String userAgent = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0"; + +//classify the userAgent +IDictionary<string, string> devices = client.Map(userAgent); + +//iterate thru the devices (here we already got a Dictionary of Device model objects) +For Each device As Device In devices.Values() +{ + Console.WriteLine(device); +} + +## Compile +DeviceMap VB.NET Client and Console have been tested with .NET Framework 4.0 or higher. + +To compile the sources you may use + +- Visual Studio (DeviceMap.sln file works with VS 2010 or above, Community Edition is sufficient) +- Mono Project (http://www.mono-project.com/) and MonoDevelop (http://www.monodevelop.com/) + +We currently don't provide a MonoDevelop solution, but the project layout should be compatible with it. And you're more than welcome to contribute solution files if you use MonDevelop (please create a JIRA ticket under https://issues.apache.org/jira/browse/DMAP/component/12323107 ".NET Client" and attach your files) + +# Run + +## Configuration +DeviceMapConsole comes with a config file DeviceMapConsole.exe.config, the runtime version of App.config in the Visual Studio project. +It contains the connection string for the DeviceMap data source: "http://devicemap-vm.apache.org/data/latest/" +This connection URL points to the latest available DeviceMap data version online. +If you prefer a different version or a local copy of the DeviceMap repository, you may override DeviceMapConsole by pointing to a different source. +Either a URL or the location of a folder or JAR file in the file system. + +The config file also contains the supported .NET runtime version. +<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> +You should normally not have to change this. Doing so is at your own risk. DeviceMap VB.NET client does not support .NET below 4.0, but in case you have multiple versions of the .NET Framework installed, you may chose a particular one, e.g. if you face problems running DeviceMapConsole. \ No newline at end of file
