From e36782dceb6ed4f3e9184111276df10148ad8dc7 Mon Sep 17 00:00:00 2001 From: Morten Nielsen Date: Fri, 14 Nov 2014 21:19:25 -0800 Subject: [PATCH] Added Xamarin iOS + Android support --- .gitignore | 1 + .../NmeaParser.Android.csproj | 68 +++++++++++++++++++ .../Resources/AboutResources.txt | 50 ++++++++++++++ .../Resources/Resource.Designer.cs | 60 ++++++++++++++++ .../Resources/Values/Strings.xml | 5 ++ .../NmeaParser.Shared.projitems | 4 +- .../Properties/AssemblyInfo.cs | 4 +- .../TypedEventHandler.cs | 2 + .../NmeaParser.WinDesktop.csproj | 1 - src/NmeaParser.iOS/NmeaParser.iOS.csproj | 49 +++++++++++++ src/NmeaParser.sln | 20 +++++- 11 files changed, 256 insertions(+), 8 deletions(-) create mode 100644 src/NmeaParser.Android/NmeaParser.Android.csproj create mode 100644 src/NmeaParser.Android/Resources/AboutResources.txt create mode 100644 src/NmeaParser.Android/Resources/Resource.Designer.cs create mode 100644 src/NmeaParser.Android/Resources/Values/Strings.xml rename src/{NmeaParser.WinDesktop => NmeaParser.Shared}/TypedEventHandler.cs (97%) create mode 100644 src/NmeaParser.iOS/NmeaParser.iOS.csproj diff --git a/.gitignore b/.gitignore index ff58c92..c1746ef 100644 --- a/.gitignore +++ b/.gitignore @@ -108,3 +108,4 @@ Backup*/ UpgradeLog*.XML Tools/Nuget/NmeaParser/lib/ Tools/Nuget/*.nupkg +src/NmeaParser.sln.ide/ diff --git a/src/NmeaParser.Android/NmeaParser.Android.csproj b/src/NmeaParser.Android/NmeaParser.Android.csproj new file mode 100644 index 0000000..2c3f394 --- /dev/null +++ b/src/NmeaParser.Android/NmeaParser.Android.csproj @@ -0,0 +1,68 @@ + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {0DAA6E10-BC77-4B06-8356-BAEE9085D985} + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + Properties + NmeaParser.Android + NmeaParser.Android + 512 + Resources\Resource.Designer.cs + Off + True + True + + + true + full + false + ..\Bin\Debug\ + DEBUG;TRACE + prompt + 4 + ..\Bin\Debug\NmeaParser.Android.xml + + + pdbonly + true + ..\Bin\Release\ + TRACE + prompt + 4 + ..\bin\Release\NmeaParser.Android.xml + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/NmeaParser.Android/Resources/AboutResources.txt b/src/NmeaParser.Android/Resources/AboutResources.txt new file mode 100644 index 0000000..194ae28 --- /dev/null +++ b/src/NmeaParser.Android/Resources/AboutResources.txt @@ -0,0 +1,50 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.xml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable-hdpi/ + icon.png + + drawable-ldpi/ + icon.png + + drawable-mdpi/ + icon.png + + layout/ + main.xml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called +"Resource" that contains the tokens for each one of the resources included. For example, +for the above Resources layout, this is what the Resource class would expose: + +public class Resource { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main +to reference the layout/main.xml file, or Resource.strings.first_string to reference the first +string in the dictionary file values/strings.xml. \ No newline at end of file diff --git a/src/NmeaParser.Android/Resources/Resource.Designer.cs b/src/NmeaParser.Android/Resources/Resource.Designer.cs new file mode 100644 index 0000000..06d1768 --- /dev/null +++ b/src/NmeaParser.Android/Resources/Resource.Designer.cs @@ -0,0 +1,60 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.0 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::Android.Runtime.ResourceDesignerAttribute("NmeaParser.Android.Resource", IsApplication=false)] + +namespace NmeaParser.Android +{ + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] + public partial class Resource + { + + static Resource() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + public partial class Attribute + { + + static Attribute() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private Attribute() + { + } + } + + public partial class String + { + + // aapt resource value: 0x7f020001 + public static int ApplicationName = 2130837505; + + // aapt resource value: 0x7f020000 + public static int Hello = 2130837504; + + static String() + { + global::Android.Runtime.ResourceIdManager.UpdateIdValues(); + } + + private String() + { + } + } + } +} +#pragma warning restore 1591 diff --git a/src/NmeaParser.Android/Resources/Values/Strings.xml b/src/NmeaParser.Android/Resources/Values/Strings.xml new file mode 100644 index 0000000..8fd1763 --- /dev/null +++ b/src/NmeaParser.Android/Resources/Values/Strings.xml @@ -0,0 +1,5 @@ + + + Hello World, Click Me! + $projectname$ + diff --git a/src/NmeaParser.Shared/NmeaParser.Shared.projitems b/src/NmeaParser.Shared/NmeaParser.Shared.projitems index 7ebfe8c..469d167 100644 --- a/src/NmeaParser.Shared/NmeaParser.Shared.projitems +++ b/src/NmeaParser.Shared/NmeaParser.Shared.projitems @@ -31,8 +31,6 @@ - - - + \ No newline at end of file diff --git a/src/NmeaParser.Shared/Properties/AssemblyInfo.cs b/src/NmeaParser.Shared/Properties/AssemblyInfo.cs index 82d3419..5fb8181 100644 --- a/src/NmeaParser.Shared/Properties/AssemblyInfo.cs +++ b/src/NmeaParser.Shared/Properties/AssemblyInfo.cs @@ -24,6 +24,6 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.4.0.0")] -[assembly: AssemblyFileVersion("1.4.0.0")] +[assembly: AssemblyVersion("1.5.0.0")] +[assembly: AssemblyFileVersion("1.5.0.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/src/NmeaParser.WinDesktop/TypedEventHandler.cs b/src/NmeaParser.Shared/TypedEventHandler.cs similarity index 97% rename from src/NmeaParser.WinDesktop/TypedEventHandler.cs rename to src/NmeaParser.Shared/TypedEventHandler.cs index fd6dd29..ab435d5 100644 --- a/src/NmeaParser.WinDesktop/TypedEventHandler.cs +++ b/src/NmeaParser.Shared/TypedEventHandler.cs @@ -14,6 +14,7 @@ // limitations under the License. // +#if !NETFX_CORE using System; using System.Collections.Generic; using System.Linq; @@ -29,3 +30,4 @@ namespace Windows.Foundation /// The type of event data generated by the event. public delegate void TypedEventHandler(TSender sender, TResult args); } +#endif \ No newline at end of file diff --git a/src/NmeaParser.WinDesktop/NmeaParser.WinDesktop.csproj b/src/NmeaParser.WinDesktop/NmeaParser.WinDesktop.csproj index a02fec3..41c53fb 100644 --- a/src/NmeaParser.WinDesktop/NmeaParser.WinDesktop.csproj +++ b/src/NmeaParser.WinDesktop/NmeaParser.WinDesktop.csproj @@ -45,7 +45,6 @@ - diff --git a/src/NmeaParser.iOS/NmeaParser.iOS.csproj b/src/NmeaParser.iOS/NmeaParser.iOS.csproj new file mode 100644 index 0000000..89a4a98 --- /dev/null +++ b/src/NmeaParser.iOS/NmeaParser.iOS.csproj @@ -0,0 +1,49 @@ + + + + Debug + iPhoneSimulator + 8.0.30703 + 2.0 + {507CFE3E-16C1-43EC-BC21-50F901EE223B} + {6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Library + NmeaParser.iOS + Resources + NmeaParseriOS + + + true + full + false + ..\Bin\Debug\ + DEBUG + prompt + 4 + false + true + iPhone Developer + ..\Bin\Debug\NmeaParseriOS.xml + + + none + true + ..\Bin\Release\ + prompt + 4 + false + iPhone Developer + ..\Bin\Release\NmeaParseriOS.xml + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/NmeaParser.sln b/src/NmeaParser.sln index ed57078..65863cb 100644 --- a/src/NmeaParser.sln +++ b/src/NmeaParser.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.22310.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NmeaParser.WinStore", "NmeaParser.WinStore\NmeaParser.WinStore.csproj", "{62A55887-10F5-40D2-9352-96246D1B11D3}" EndProject @@ -39,6 +39,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution GlobalSuppressions.cs = GlobalSuppressions.cs EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NmeaParser.Android", "NmeaParser.Android\NmeaParser.Android.csproj", "{0DAA6E10-BC77-4B06-8356-BAEE9085D985}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NmeaParser.iOS", "NmeaParser.iOS\NmeaParser.iOS.csproj", "{507CFE3E-16C1-43EC-BC21-50F901EE223B}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution NmeaParser.Shared\NmeaParser.Shared.projitems*{df711ab9-f14e-4f1f-b8f2-b6ddc4691554}*SharedItemsImports = 4 @@ -46,7 +50,9 @@ Global NmeaParser.Shared\NmeaParser.Shared.projitems*{62a55887-10f5-40d2-9352-96246d1b11d3}*SharedItemsImports = 4 NmeaParser.Shared\NmeaParser.Shared.projitems*{e15edbd9-0356-422b-8c29-18833787356e}*SharedItemsImports = 13 SampleApp.Store\SampleApp.Store.Shared\SampleApp.Store.Shared.projitems*{c4b3935b-7ed4-40cc-b1d2-bc2b854e319d}*SharedItemsImports = 4 + NmeaParser.Shared\NmeaParser.Shared.projitems*{0daa6e10-bc77-4b06-8356-baee9085d985}*SharedItemsImports = 4 NmeaParser.Shared\NmeaParser.Shared.projitems*{ea42a713-bc6e-4914-b54b-47c0891b7421}*SharedItemsImports = 4 + NmeaParser.Shared\NmeaParser.Shared.projitems*{507cfe3e-16c1-43ec-bc21-50f901ee223b}*SharedItemsImports = 4 SampleApp.Store\SampleApp.Store.Shared\SampleApp.Store.Shared.projitems*{95e812e6-17c2-494f-a446-fde42d75331c}*SharedItemsImports = 13 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -88,6 +94,14 @@ Global {9EE3EA1D-F28C-4CF2-B540-DB0415050D5F}.Release|Any CPU.ActiveCfg = Release|Any CPU {9EE3EA1D-F28C-4CF2-B540-DB0415050D5F}.Release|Any CPU.Build.0 = Release|Any CPU {9EE3EA1D-F28C-4CF2-B540-DB0415050D5F}.Release|Any CPU.Deploy.0 = Release|Any CPU + {0DAA6E10-BC77-4B06-8356-BAEE9085D985}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0DAA6E10-BC77-4B06-8356-BAEE9085D985}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0DAA6E10-BC77-4B06-8356-BAEE9085D985}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0DAA6E10-BC77-4B06-8356-BAEE9085D985}.Release|Any CPU.Build.0 = Release|Any CPU + {507CFE3E-16C1-43EC-BC21-50F901EE223B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {507CFE3E-16C1-43EC-BC21-50F901EE223B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {507CFE3E-16C1-43EC-BC21-50F901EE223B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {507CFE3E-16C1-43EC-BC21-50F901EE223B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -105,5 +119,7 @@ Global {9EE3EA1D-F28C-4CF2-B540-DB0415050D5F} = {71F04187-BE90-47DE-A7BD-4D6CED50D446} {7ABA337E-6748-484E-A0F4-E1715E1C95F1} = {A4B9D59A-C8C6-4199-A7F3-F3AF0C748281} {28B8E327-C504-4E08-B2CE-09D1CBB8B904} = {CF767486-305D-40EE-8845-58EF76C16D85} + {0DAA6E10-BC77-4B06-8356-BAEE9085D985} = {1701F3BA-A09C-4706-A612-24FD9340FC18} + {507CFE3E-16C1-43EC-BC21-50F901EE223B} = {1701F3BA-A09C-4706-A612-24FD9340FC18} EndGlobalSection EndGlobal