Author: wkeil Date: Wed Sep 2 19:22:30 2015 New Revision: 1700878 URL: http://svn.apache.org/r1700878 Log: DMAP-152: Use Log4net to log in .NET clients
Task-Url: https://issues.apache.org/jira/browse/DMAP-152 Modified: devicemap/trunk/clients/1.0/csharp/README Modified: devicemap/trunk/clients/1.0/csharp/README URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/csharp/README?rev=1700878&r1=1700877&r2=1700878&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/csharp/README (original) +++ devicemap/trunk/clients/1.0/csharp/README Wed Sep 2 19:22:30 2015 @@ -2,28 +2,48 @@ DeviceMap .NET C# Client CLS (ISO/IEC 23271:2012) compliant .NET version of Apache DeviceMap Client -# Build +This client is used to classify browser User-Agent strings. -## Edit -You can edit all plain text sources with a text editor of your choice, e.g. Visual Studio Code: https://code.visualstudio.com/ +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 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 +foreach (string device in devices) +{ + Console.WriteLine(device); +} + ## Compile -DeviceMap C# Client and Console require .NET Framework 4.0 or higher. +DeviceMap C# Client and Console have been tested with .NET Framework 4.0 or higher. To compile the sources you may use -- Visual Studio (from VS 2010 upward, Community Edition is sufficient) +- 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 the required files) +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. -It contains the connection string for DeviceMap data: "http://devicemap-vm.apache.org/data/latest/" +DeviceMapConsole comes with a config file DeviceMapConsole.exe.config, the runtime version of App.config in the C# 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 pointint to a different location. +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"/> @@ -31,5 +51,5 @@ You should normally not have to change t ## Logging DeviceMap uses Apache Log4Net (https://logging.apache.org/log4net/) -Regular operation of DeviceMapConsole only produces console output. -Logging is configured to log only errors or exceptional conditions into a file DeviceMap.log. Should this file exceed 500 MB, a RollingAppender will copy it over. See Apache Log4Net documentation for further details. \ No newline at end of file +Regular operation of DeviceMapConsole will just write to the console. +Logging is configured to log only errors or exceptional conditions into a file DeviceMap.log. Should this file exceed 500 MB, a RollingAppender will copy it over. See Apache Log4Net documentation under https://logging.apache.org/log4net/ for further details. \ No newline at end of file
