[
  {
    "path": ".gitattributes",
    "content": "###############################################################################\n# Set default behavior to automatically normalize line endings.\n###############################################################################\n* text=auto\n\n###############################################################################\n# Set default behavior for command prompt diff.\n#\n# This is need for earlier builds of msysgit that does not have it on by\n# default for csharp files.\n# Note: This is only used by command line\n###############################################################################\n#*.cs     diff=csharp\n\n###############################################################################\n# Set the merge driver for project and solution files\n#\n# Merging from the command prompt will add diff markers to the files if there\n# are conflicts (Merging from VS is not affected by the settings below, in VS\n# the diff markers are never inserted). Diff markers may cause the following \n# file extensions to fail to load in VS. An alternative would be to treat\n# these files as binary and thus will always conflict and require user\n# intervention with every merge. To do so, just uncomment the entries below\n###############################################################################\n#*.sln       merge=binary\n#*.csproj    merge=binary\n#*.vbproj    merge=binary\n#*.vcxproj   merge=binary\n#*.vcproj    merge=binary\n#*.dbproj    merge=binary\n#*.fsproj    merge=binary\n#*.lsproj    merge=binary\n#*.wixproj   merge=binary\n#*.modelproj merge=binary\n#*.sqlproj   merge=binary\n#*.wwaproj   merge=binary\n\n###############################################################################\n# behavior for image files\n#\n# image files are treated as binary by default.\n###############################################################################\n#*.jpg   binary\n#*.png   binary\n#*.gif   binary\n\n###############################################################################\n# diff behavior for common document formats\n# \n# Convert binary document formats to text before diffing them. This feature\n# is only available from the command line. Turn it on by uncommenting the \n# entries below.\n###############################################################################\n#*.doc   diff=astextplain\n#*.DOC   diff=astextplain\n#*.docx  diff=astextplain\n#*.DOCX  diff=astextplain\n#*.dot   diff=astextplain\n#*.DOT   diff=astextplain\n#*.pdf   diff=astextplain\n#*.PDF   diff=astextplain\n#*.rtf   diff=astextplain\n#*.RTF   diff=astextplain\n"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n\n# Visual Studio 2015 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUNIT\n*.VisualState.xml\nTestResult.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# DNX\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# JustCode is a .NET coding add-in\n.JustCode\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n/SnipeDemo\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# TODO: Comment the next line if you want to checkin your web deploy settings\n# but database connection strings (with potential passwords) will be unencrypted\n#*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# The packages folder can be ignored because of Package Restore\n**/packages/*\n# except build/, which is used as an MSBuild target.\n!**/packages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/packages/repositories.config\n# NuGet v3's project.json files produces more ignoreable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\nnode_modules/\norleans.codegen.cs\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\n*.mdf\n*.ldf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# JetBrains Rider\n.idea/\n*.sln.iml\n\n# CodeRush\n.cr/\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n/SnipeSharp.Demo\n/SnipeSharp/nuget.exe\n"
  },
  {
    "path": "App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n    <startup> \n        <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.6.1\" />\n    </startup>\n  <system.diagnostics>\n    <trace autoflush=\"true\" indentsize=\"4\">\n      <listeners>\n        <add name=\"consoleListener\" type=\"System.Diagnostics.ConsoleTraceListener\"/>\n        <remove name=\"Default\" />\n      </listeners>\n    </trace>\n  </system.diagnostics>\n  <appSettings>\n    <add key=\"API\" value=\"YOUR_API_KEY_HERE\"/>\n    <add key=\"BaseURI\" value=\"http://YOUR_SNIPE_IT_URL_HERE/api/v1\"/>\n    <add key=\"DefaultStatusLabel\" value=\"Ready to Deploy\"/>\n    <add key=\"Company\" value=\"Your Company\"/>\n    <add key=\"Location\" value=\"Your Location\"/>\n    <add key=\"OUEnabled\" value=\"false\"/>\n    <add key=\"OULevel\" value=\"1\"/>\n    <add key=\"Interactive\" value=\"false\"/>\n    <add key=\"WarrantyMonths\" value=\"60\"/>\n    <add key=\"AssetTagPrefix\" value=\"002\"/>\n  </appSettings>\n\n</configuration>"
  },
  {
    "path": "Broker.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing SnipeSharp;\nusing System.Diagnostics;\nusing SnipeSharp.Endpoints.Models;\nusing SnipeSharp.Endpoints.SearchFilters;\nusing SnipeSharp.Common;\nusing System.Net;\n\nnamespace Marksman\n{\n    class Broker\n    {\n        public Broker()\n        {\n\n        }\n\n        public bool IsIdentical(Asset a1, Asset a2)\n        {\n            // We only need to check fields that are being populated by the Marksman agent\n            // i.e.. not ID, since that is managed by DB\n\n            if (a1.AssetTag != a2.AssetTag || a1.Serial != a2.Serial || a1.Name != a2.Name)\n            {\n                return false;\n            }\n\n            if (a1.WarrantyMonths != a2.WarrantyMonths)\n            {\n                return false;\n            }\n\n            if (a1.Location?.Id != a2.Location?.Id)\n            {\n                return false;\n            }\n\n            // Checking sub-object IDs\n            if (a1.Company?.Id != a2.Company?.Id || a1.Model?.Id != a2.Model?.Id ||\n                a1.StatusLabel?.Id != a2.StatusLabel?.Id)\n            {\n                return false;\n            }\n\n            // Should be something for custom fields -> for now leaving blank\n\n            return true;\n        }\n\n        public bool CheckConnection(NameValueCollection appSettings)\n        {\n            // This method might seem overly complicated for what it is doing (simply\n            // checking a connection to the Snipe-IT instance. However, there are a lot\n            // of different ways that the connection can fail (usually related to improperly\n            // set values in the config file).\n\n            // This method allows a set of specific, descriptive error messages to be passed\n            // showing exactly what kind of configuration problem needs to be fixed.\n            \n            string uri = \"\";\n            string query = \"users?limit=0\";\n            string baseUri = appSettings[\"BaseURI\"];\n\n            // Note: The program should be able to handle a BaseURI that has a trailing '/' or not.\n\n            if (baseUri.EndsWith(\"/\")){\n                uri = baseUri + query; \n            } else\n            {\n                uri = baseUri + \"/\" + query;\n            }\n\n            HttpWebRequest request;\n            try\n            {\n                request = (HttpWebRequest)WebRequest.Create(uri);\n                request.Headers[\"Authorization\"] = \"Bearer \" + appSettings[\"API\"];\n                request.Accept = \"application/json\";\n            }\n            catch (System.NotSupportedException e)\n            {\n                Console.WriteLine(e);\n                Console.WriteLine(\"Please double-check the BaseURI key in your <appSettings>\\nblock of the Marksman config file and ensure it points to your instance of Snipe-IT.\");\n                return false;\n            }\n            try\n            {\n                HttpWebResponse response = (HttpWebResponse)request.GetResponse();\n                if (response.StatusCode == HttpStatusCode.OK)\n                {\n                    Console.WriteLine(\"HTTP 200: Connection to Snipe-IT instance succeded.\");\n                    return true;\n                } else {\n                    Console.WriteLine(\"HTTP {0}\", response.StatusCode);\n                    Console.WriteLine(\"Unexpected HTTP response code, could not connect to Snipe-IT instance.\");\n                    return false;\n                }\n            } catch (WebException e)\n            {\n                HttpWebResponse r = (HttpWebResponse)e.Response;\n                if (r == null)\n                {\n                    Console.WriteLine(e);\n                    Console.WriteLine(\"Please double-check the BaseURI key in your <appSettings>\\nblock of the Marksman config file and ensure it points to your instance of Snipe-IT.\");\n                }\n                else if (r.StatusCode == HttpStatusCode.Unauthorized)\n                {\n                    Console.WriteLine(\"HTTP 403: Unauthorized. Please check the API key value in your <appSettings>\\nblock of the Marksman config file and ensure it has been set to a valid key.\");\n                }\n                else if (r.StatusCode == HttpStatusCode.NotFound)\n                {\n                    Console.WriteLine(\"HTTP 404: URL not found. Please double-check the BaseURI key in your <appSettings>\\nblock of the Marksman config file and ensure it points to your instance of Snipe-IT.\");\n                } else\n                {\n                    Console.WriteLine(\"Unexpected error, could not connect to Snipe-IT instance.\");\n                    Console.WriteLine(e);\n                }\n                return false;\n            }\n        }\n\n        public List<IRequestResponse> SyncAll(SnipeItApi snipe, Asset currentAsset, Model currentModel, Manufacturer currentManufacturer,\n            Category currentCategory, Company currentCompany, StatusLabel currentStatusLabel, Location currentLocation)\n        {\n            \n            // Let's try to simplify the logic into a repeatable structure:\n\n            // Each of these categories (Asset, Model, Location, etc.) has a single\n            // value that uniquely specifies it, which must be:\n            // a) Uniquely associated to it in the physical world\n            // b) Not the database unique ID\n\n            // Why can't it be the database unique ID? Because the uniqueID is not something that \n            // is inherently associated to the computer's hardware, it's just a number that SnipeIT\n            // uses internally.\n\n            // By category: Unique identifiers\n\n            // Asset: computer serial (string)\n            // Model: model full name (string)\n            // Category: model types, as given by the WMIC fullnames (string)\n            // Manufacturer: full name (string)\n            // Company: full name (string)\n            // StatusLabel: full name (string)\n            // Location: full name (string)\n\n            // Really, we only need the update functionality for the assets, as the computer name can change,\n            // along with its location, etc.\n\n            // However we are not in change of things like a computer manufacturer changing the name of\n            // its company. So those have a simpler functionality.\n\n\n            List<IRequestResponse> messages = new List<IRequestResponse>();\n\n            messages.Add(snipe.ManufacturerManager.Create(currentManufacturer));\n            SearchFilter manufacturerFilter = new SearchFilter(currentManufacturer.Name);\n            Manufacturer updatedManufacturer = snipe.ManufacturerManager.FindOne(manufacturerFilter);\n\n            messages.Add(snipe.CategoryManager.Create(currentCategory));\n            SearchFilter categoryFilter = new SearchFilter(currentCategory.Name);\n            Category updatedCategory = snipe.CategoryManager.FindOne(categoryFilter);\n\n            currentModel.Manufacturer = updatedManufacturer;\n            currentModel.Category = updatedCategory;\n            messages.Add(snipe.ModelManager.Create(currentModel));\n            SearchFilter modelFilter = new SearchFilter(currentModel.Name);\n            Model updatedModel = snipe.ModelManager.FindOne(modelFilter);\n\n            messages.Add(snipe.CompanyManager.Create(currentCompany));\n            SearchFilter companyFilter = new SearchFilter(currentCompany.Name);\n            Company updatedCompany = snipe.CompanyManager.FindOne(companyFilter);\n\n            messages.Add(snipe.StatusLabelManager.Create(currentStatusLabel));\n            SearchFilter statusLabelFilter = new SearchFilter(currentStatusLabel.Name);\n            StatusLabel updatedStatusLabel = snipe.StatusLabelManager.FindOne(statusLabelFilter);\n\n            messages.Add(snipe.LocationManager.Create(currentLocation));\n            SearchFilter locationFilter = new SearchFilter(currentLocation.Name);\n            Location updatedLocation = snipe.LocationManager.FindOne(locationFilter);\n\n            currentAsset.Model = updatedModel;\n            currentAsset.Company = updatedCompany;\n            currentAsset.StatusLabel = updatedStatusLabel;\n            currentAsset.Location = updatedLocation;\n\n            string currentSerial = currentAsset.Serial;\n\n            Asset dbAsset = snipe.AssetManager.FindBySerial(currentSerial);\n\n            if (dbAsset == null)\n            {\n                Console.WriteLine(\"Asset does not exist in database, creating...\");\n                snipe.AssetManager.Create(currentAsset);\n            } else\n            {\n                Console.WriteLine(\"Asset already exists in db. Checking for consistency.\");\n                bool isIdentical = IsIdentical(currentAsset, dbAsset);\n                if (isIdentical)\n                {\n                    Console.WriteLine(\"No changes required! Asset already exists and is up-to-date.\");\n                } else\n                {\n                    Console.WriteLine(\"Changes in asset detected. Updating:\");\n\n                    // Setting old ID for consistency\n                    currentAsset.Id = dbAsset.Id;\n                    currentAsset.LastCheckout = dbAsset.LastCheckout;\n                    currentAsset.AssignedTo = dbAsset.AssignedTo;\n                    messages.Add(snipe.AssetManager.Update(currentAsset));\n\n                }\n            }\n            \n            return messages;\n        }\n    }\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [2018,2019] [Scope-IT]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "Marksman.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Configuration;\nusing System.Management;\nusing System.Diagnostics;\nusing System.DirectoryServices.AccountManagement;\nusing System.Collections.Specialized;\nusing SnipeSharp;\nusing SnipeSharp.Endpoints.Models;\nusing SnipeSharp.Endpoints.SearchFilters;\n\n\nnamespace Marksman\n{\n\n    public class PCSystemTypes {\n        public Dictionary<string, string> SystemTypes;\n    }\n\n    public class WindowsSystemTypes : PCSystemTypes\n    {\n        public WindowsSystemTypes()\n        {\n            this.SystemTypes = new Dictionary<string, string>();\n            this.SystemTypes.Add(\"0\", \"Undefined\");\n            this.SystemTypes.Add(\"1\", \"Desktop\");\n            this.SystemTypes.Add(\"2\", \"Laptop\");\n            this.SystemTypes.Add(\"3\", \"Workstation\");\n            this.SystemTypes.Add(\"4\", \"Enterprise Server\");\n            this.SystemTypes.Add(\"5\", \"SOHO Server\");\n            this.SystemTypes.Add(\"6\", \"Appliance PC\");\n            this.SystemTypes.Add(\"7\", \"Performance Server\");\n            this.SystemTypes.Add(\"8\", \"Maximum\");\n        }\n    }\n\n    public class Sentry // Data acquissition\n    {\n        private Dictionary<string, List<string>> Queries; // Where key = query type, value = query itself\n        private Dictionary<string, string> Values; // Internal representation of query results\n        private System.Collections.Specialized.NameValueCollection Settings;\n        public  Dictionary<string, string> rawResults // Public representation of query results - raw values. Useful for debug\n        {\n            get { return this.Values;  }\n        }\n\n\n\n        public Sentry(System.Collections.Specialized.NameValueCollection appSettings) // constructor \n        {\n            Queries = new Dictionary<string, List<string>>();\n            Settings = appSettings;\n        }\n\n        public Location GetLocation(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string assetLocation = this.Values[\"Location\"];\n            Location currentLocation = new Location(assetLocation);\n            return currentLocation;\n        }\n\n        public StatusLabel GetStatusLabel(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string defaultLabel = appSettings[\"DefaultStatusLabel\"];\n            StatusLabel defaultStatusLabel = new StatusLabel(defaultLabel);\n            return defaultStatusLabel;\n        }\n\n        public Company GetCompany(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string companyName = appSettings[\"Company\"];\n            Company currentCompany = new Company(companyName);\n            return currentCompany;\n        }\n\n        public Category GetCategory(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string systemType = GetOutputVariable(\"Win32_ComputerSystem.PCSystemType\");\n            // TODO: Place in a separate enum class:\n            WindowsSystemTypes winTypes = new WindowsSystemTypes();\n            string systemTypeFull = \"Undefined\";\n            try\n            {\n                systemTypeFull = winTypes.SystemTypes[systemType];\n            }\n            catch (Exception e)\n            {\n                Trace.WriteLine(\"Exception encountered while processing WinSystemType: \" + e.ToString());\n            }\n            Category currentCategory = new Category(systemTypeFull);\n            return currentCategory;\n        }\n\n        public Manufacturer GetManufacturer(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string manufacturer = GetOutputVariable(\"Win32_ComputerSystem.Manufacturer\");\n            Manufacturer systemManufacturer = new Manufacturer(manufacturer);\n            return systemManufacturer;\n        }\n\n        public Model GetModel(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string modelTotal = GetOutputVariable(\"Win32_ComputerSystem.Model\");\n            // TODO: This only works is in the exact format \"ModelName ModelNumber\"\n            List<String> modelFragments = modelTotal.Split(' ').ToList();\n            string modelNumber = modelFragments[modelFragments.Count() - 1];\n            string modelMake = modelFragments[0];\n\n            Model currentModel = new Model\n            {\n                Name = modelTotal,\n                Manufacturer = null,\n                Category = null,\n                ModelNumber = modelNumber,\n            };\n            return currentModel;\n        }\n\n        public Asset GetAsset(NameValueCollection appSettings, SnipeItApi snipe)\n        {\n            string systemName = GetOutputVariable(\"Win32_ComputerSystem.Name\");\n            string serialNumber = GetOutputVariable(\"Win32_ComputerSystemProduct.IdentifyingNumber\");\n            string macAddress = GetOutputVariable(\"Win32_NetworkAdapter.MACAddress\");\n            Dictionary<string, string> customFields = new Dictionary<string, string>();\n            customFields.Add(\"_snipeit_mac_address_1\", macAddress);\n            string warrantyMonths = appSettings[\"WarrantyMonths\"];\n\n            bool isInteractive = false;\n            bool interactiveParseSuccess = Boolean.TryParse(appSettings[\"Interactive\"], out isInteractive);\n            if (interactiveParseSuccess && isInteractive)\n            {\n                Console.WriteLine(\"Enter the computer name: \");\n                systemName = Console.ReadLine();\n            }\n            \n            Asset currentComputer = new SnipeSharp.Endpoints.Models.Asset\n            {\n                Company = null,\n                AssetTag = appSettings[\"AssetTagPrefix\"] + \"-\" + serialNumber, // <-- to be implemented.. somehow, somewhere\n                Model = null,\n                StatusLabel = null,\n                RtdLocation = null,\n                Name = systemName,\n                Serial = serialNumber,\n                WarrantyMonths = warrantyMonths,\n                CustomFields = customFields,\n            };\n\n            return currentComputer;\n        }\n\n        public void AddQuery(string queryType, string queryString) { // safely addes queries to the queryList monstrocity, built for expandability (c) \n            List<string> queryList = new List<string>();\n\n\n            if (this.Queries.ContainsKey(queryType))\n            {\n                queryList = Queries[queryType];\n                queryList.Add(queryString);\n                this.Queries[queryType] = queryList;\n                return;\n            } else\n            {\n                queryList.Add(queryString);\n                this.Queries.Add(queryType, queryList);\n                return;\n            }\n        }\n\n\n        private void RunWMI() { // runs all WMI queries\n\n            Dictionary<string, string> resultDictionary = new Dictionary<string, string>();\n            ManagementObjectCollection queryCollection;\n\n\n            //Query system for Operating System information\n            foreach (string wmiQuery in this.Queries[\"WMI\"])\n            {\n                int count = 0;\n\n                SelectQuery selectQuery = new SelectQuery(wmiQuery);\n                ManagementObjectSearcher searcher = new ManagementObjectSearcher(selectQuery);\n            \n\n                queryCollection = searcher.Get();\n\n                foreach (ManagementObject m in queryCollection)\n                {\n                    // Display all properties.\n                    foreach (PropertyData property in m.Properties)\n                    {\n                        string propertyValue = \"<undefined>\";\n                        if  (!String.IsNullOrWhiteSpace(property.Value.ToString()))\n                        {\n                            propertyValue = property.Value.ToString().Trim();\n                        }\n                        if (!resultDictionary.ContainsKey(selectQuery.ClassName + \".\" + property.Name))\n                        {\n                            resultDictionary.Add(selectQuery.ClassName + \".\" + property.Name, propertyValue);\n                        }\n                        else\n                        {\n                            resultDictionary.Add(selectQuery.ClassName + \".\" + property.Name + \".\" + count.ToString(), propertyValue);\n                        }\n                    }\n                    count++;\n                }\n            }\n\n            this.Values = resultDictionary;\n        }\n\n\n        private void RunLocation() // Runs all code related to location & location sources\n        {\n            string location_string = \"\";\n            foreach (string locationQuery in this.Queries[\"Location\"])\n            {\n                if (locationQuery == \"OU\")\n                {\n                    try\n                    {\n                        int ouLevel;\n                        bool ouLevelSuccess = int.TryParse(Settings[\"OULevel\"], out ouLevel);\n                        if (!ouLevelSuccess)\n                        {\n                            ouLevel = 1;\n                        }\n                        string[] machineOU;\n                        using (var context = new PrincipalContext(ContextType.Domain))\n                        using (var comp = ComputerPrincipal.FindByIdentity(context, Environment.MachineName))\n                            machineOU = comp.DistinguishedName.Split(',').SkipWhile(s => !s.StartsWith(\"OU=\")).ToArray();\n\n                        location_string = machineOU[0].Split('=')[ouLevel];\n                    }\n                    catch (Exception e)\n                    {\n                        Trace.WriteLine(\"Could not get location from OU\");\n                        Trace.WriteLine(e.ToString());\n                        Trace.WriteLine(\"Getting location from config file instead\");\n                        location_string = Settings[\"Location\"];\n                    }\n                } else\n                {\n                    location_string = Settings[\"Location\"];\n\n                }\n            }\n            this.Values.Add(\"Location\", location_string);\n\n        }\n\n\n\n\n        public string GetOutputVariable(string key)\n        {\n            if (this.Values.ContainsKey(key))\n            {\n                return this.Values[key];\n            } else\n            {\n                return \"\";\n            }\n        }\n\n        public string GetFormattedVariable(string key, string variable = \"\", string format=\"<name>=<var>\") // produces formatted output, supposed to throw exception if no results in raw results\n        {\n            if (String.IsNullOrEmpty(variable))\n            {\n                format = \"<var>\";\n            }\n            if (this.Values.ContainsKey(key))\n            {\n                return format.Replace(\"<var>\", this.Values[key]).Replace(\"<name>\",variable);\n            } else\n            {\n                return \"ERROR: key \\\"\" + key + \"\\\" not found in the results of the query\";\n            }\n        }\n\n\n\n        public void Run() // supposed to run all queries of all types and handle per-type errors\n        {\n            this.RunWMI();\n            this.RunLocation();\n        }\n\n    }\n\n\n\n    class Marksman\n    {\n\n\n\n        static void Main(string[] args)\n        {\n            Trace.WriteLine(DateTime.Now.ToShortDateString() + \" \" + DateTime.Now.ToLongTimeString() + \": Started application.\");\n\n            var debugTimer = new Stopwatch();\n            System.Collections.Specialized.NameValueCollection appSettings = System.Configuration.ConfigurationManager.AppSettings;\n            debugTimer.Start(); \n\n            SnipeItApi snipe = new SnipeItApi();\n            snipe.ApiSettings.ApiToken = appSettings[\"API\"];\n            snipe.ApiSettings.BaseUrl = new Uri(appSettings[\"BaseURI\"]);\n\n            Sentry mySentry = new Sentry(appSettings); // creating new Sentry (we can have multiple for parallel execution at a later point)\n\n            // Adding what we want\n            mySentry.AddQuery(\"WMI\", \"SELECT Name, Manufacturer, Model, PCSystemType FROM Win32_ComputerSystem\");\n            mySentry.AddQuery(\"WMI\", \"SELECT IdentifyingNumber FROM Win32_ComputerSystemProduct\");\n            mySentry.AddQuery(\"WMI\", \"SELECT Name FROM Win32_BIOS\");\n            mySentry.AddQuery(\"WMI\", \"SELECT Manufacturer,Name,MACAddress FROM Win32_NetworkAdapter WHERE NetEnabled=true AND AdapterTypeId=0 AND netConnectionStatus=2\");\n            mySentry.AddQuery(\"WMI\", \"SELECT Manufacturer,Model,SerialNumber FROM Win32_DiskDrive WHERE Index=0\");\n            mySentry.AddQuery(\"WMI\", \"SELECT EndingAddress FROM Win32_MemoryArray\");\n            mySentry.AddQuery(\"WMI\", \"SELECT Name FROM Win32_DesktopMonitor\");\n            mySentry.AddQuery(\"WMI\", \"SELECT Manufacturer,Product,SerialNumber FROM Win32_BaseBoard\");\n            mySentry.AddQuery(\"WMI\", \"SELECT Name,NumberOfCores,NumberOfLogicalProcessors FROM Win32_Processor\");\n\n            bool getOU = false;\n            bool getOUSuccess = Boolean.TryParse(appSettings[\"OUEnabled\"], out getOU);\n            if (getOUSuccess && getOU)\n            {\n                mySentry.AddQuery(\"Location\", \"OU\");\n            } else\n            {\n                mySentry.AddQuery(\"Location\", \"Config\");\n            }\n\n            mySentry.Run();\n\n            Asset currentAsset = mySentry.GetAsset(appSettings, snipe);\n            Model currentModel = mySentry.GetModel(appSettings, snipe);\n            Manufacturer currentManufacturer = mySentry.GetManufacturer(appSettings, snipe);\n            Category currentCategory = mySentry.GetCategory(appSettings, snipe);\n            Company currentCompany = mySentry.GetCompany(appSettings, snipe);\n            StatusLabel currentStatusLabel = mySentry.GetStatusLabel(appSettings, snipe);\n            Location currentLocation = mySentry.GetLocation(appSettings, snipe);\n\n            //Broker.syncAsset(snipe, currentComputer);\n            Broker snipeBroker = new Broker();\n            bool connectionStatus = snipeBroker.CheckConnection(appSettings);\n\n            if (connectionStatus)\n            {\n                snipeBroker.SyncAll(snipe, currentAsset, currentModel, currentManufacturer, currentCategory,\n                                    currentCompany, currentStatusLabel, currentLocation);\n            } else {\n                Console.WriteLine(\"ERROR: Could not connect to SnipeIT database instance.\");\n                // Until a standardized logging framework is set up, quick way to make user see crash message.\n                Console.ReadKey();\n            }\n\n            debugTimer.Stop();\n            Trace.WriteLine(\"Total program execution time \" + debugTimer.ElapsedMilliseconds + \"ms.\");\n            Trace.WriteLine(DateTime.Now.ToShortDateString() + \" \" + DateTime.Now.ToLongTimeString() + \": Exiting application.\");\n            Trace.WriteLine(\" \");\n        }\n    }\n}\n"
  },
  {
    "path": "Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following\n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"Marksman\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Vladimir Rurukin and Daniel Hogg\")]\n[assembly: AssemblyProduct(\"Marksman\")]\n[assembly: AssemblyCopyright(\"Copyright Vladimir Rurukin and Daniel Hogg ©  2018\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible\n// to COM components.  If you need to access a type in this assembly from\n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"f459d03d-c5c4-4942-a437-aa9e99635311\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version\n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers\n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.1\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "README.md",
    "content": "## Marksman - A Windows agent for Snipe-IT\n\n## Installation\n1. Download and install the latest .msi installer from the [releases tab](https://github.com/Scope-IT/marksman/releases/).\n2. By default, the program will be installed in Program Files (x86)/Scope-IT/Marksman. Edit the Marksman.exe.config file to include your API key and BaseURI from the default values to the ones given by your Snipe-IT instance.\n3. Set the Company and Location parameters in Marksman.exe.config, then run the .exe.\n\n## Features\n* The agent creates an asset and fills out the fields:\n  - Asset name (currently machine hostname, unless agent is run in interactive mode)\n  - Asset id (Asset tag prefix + serial number)\n  - Location (from a config file or the Organizational Unit)\n  - Warranty (from config file)\n  - Status label (from config file)\n  - Mac address\n  - Make, model of the machine (as reported to Windows)\n* Ensures that the assets created is unique\n* New locations, makes, models are created as needed\n\n\n## Getting started\nYou will need a working [Snipe-IT](https://snipeitapp.com/) database with API access and an API key. \n*We recommend creating a separate user for the agent with minimal (read + add) permissions.*\n\nYou can run it via a GPO or Scheduled task (recommended way is to run the agent once on boot with a delay of 1+ minute)\n\n## Developer Guide\n\nIf you want to not only use Marksman.exe, but edit the sources and build the project, here are some steps for getting started. Marksman has a dependency on our [specific fork of SnipeSharp](https://github.com/Scope-IT/SnipeSharp), so you will need to build it as well.\n\n1. Create a development folder. Inside this folder, clone the following repos:\n    * git clone https://github.com/Scope-IT/SnipeSharp\n    * git clone https://github.com/Scope-IT/marksman\n2. Open the SnipeSharp project .sln, and build the solution.\n3. Open the marksman project. Check the 'references' under the marksman project, and see if SnipeSharp has been added automatically. Make sure that the path of the SnipeSharp reference points to the repository you just built. If a reference does not exist, you may need to add it manually.\n4. Build the marksman project. It should build correctly - if there are any errors at this stage please file a bug report.\n5. You can now proceed to edit the config file so that your API key and BaseURI correspond to your Snipe-IT instance. Once the config file is set, the program can be run.\n\n## Bug Reports & Feature Requests\nWe welcome community participation in this project. Please submit an issue or pull request to participate in the development. \n\n## License\nThis project is licensed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0)\n\n## Planned features\n- [ ] Component lookup (automatic tracking of connected hard drives, CPU, GPU, etc.)\n- [ ] Automatic update feature (tracking of computer name and other property changes)\n- [ ] Additional query types for location\n- [ ] Warranty lookup APIs\n- [ ] Cross-platform (Windows/MacOS/Linux) agent using Mono\n\n## Acknowledgments\n * The project is based on [SnipeSharp API](https://github.com/cnitschkowski/SnipeSharp) by [barrycarey](https://github.com/barrycarey) and [cnitschkowski](https://github.com/cnitschkowski) with modifications by [velaar](https://github.com/velaar)\n * Snipe-IT 4.0+ is required for proper operation\n"
  },
  {
    "path": "marksman.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{F459D03D-C5C4-4942-A437-AA9E99635311}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <RootNamespace>Marksman</RootNamespace>\n    <AssemblyName>Marksman</AssemblyName>\n    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"SnipeSharp, Version=0.3.1.0, Culture=neutral, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\SnipeSharp\\SnipeSharp\\bin\\Debug\\SnipeSharp.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.DirectoryServices.AccountManagement\" />\n    <Reference Include=\"System.Management\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Broker.cs\" />\n    <Compile Include=\"Marksman.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\">\n      <SubType>Designer</SubType>\n    </None>\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n</Project>"
  },
  {
    "path": "marksman.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27703.2026\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"marksman\", \"marksman.csproj\", \"{F459D03D-C5C4-4942-A437-AA9E99635311}\"\nEndProject\nProject(\"{54435603-DBB4-11D2-8724-00A0C9A8B90C}\") = \"MarksmanSetup\", \"..\\MarksmanSetup\\MarksmanSetup.vdproj\", \"{6CB58217-2239-4887-A1FB-E515ADAFAB69}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{F459D03D-C5C4-4942-A437-AA9E99635311}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F459D03D-C5C4-4942-A437-AA9E99635311}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F459D03D-C5C4-4942-A437-AA9E99635311}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F459D03D-C5C4-4942-A437-AA9E99635311}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{6CB58217-2239-4887-A1FB-E515ADAFAB69}.Debug|Any CPU.ActiveCfg = Debug\n\t\t{6CB58217-2239-4887-A1FB-E515ADAFAB69}.Release|Any CPU.ActiveCfg = Release\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {D05F479D-4C4F-4AE5-9E2A-B384BAA229E0}\n\tEndGlobalSection\nEndGlobal\n"
  }
]