.Net Standard project
- Add UWP test project - Add .NET Standard test project running on .NET 4.5 - Add XamlObjectReaderSettings.IgnoreDefaultValues to ignore properties if they have their default value (when they do not have [DefaultValueAttribute]) - Write-only properties are now returned by XamlType.GetAllMembers()
|
@ -1,10 +1,8 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26403.7
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-tests-pcl259", "Test\Portable.Xaml-tests-pcl259.csproj", "{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-pcl259", "Portable.Xaml\Portable.Xaml-pcl259.csproj", "{179484EC-DB00-451A-AD2D-2E2AB20DE519}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-pcl136", "Portable.Xaml\Portable.Xaml-pcl136.csproj", "{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}"
|
||||
|
@ -15,36 +13,192 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-tests-net_4_5
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml.Benchmark", "Portable.Xaml.Benchmark\Portable.Xaml.Benchmark.csproj", "{AC406459-D324-4ADF-853D-A58B63396591}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-netstandard1.3", "Portable.Xaml\Portable.Xaml-netstandard1.3.csproj", "{CDC8F791-56FC-4B15-AAD2-BC460657CC02}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-tests-pcl259", "Test\Portable.Xaml-tests-pcl259.csproj", "{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-tests-netstandard1.3", "Test\Portable.Xaml-tests-netstandard1.3.csproj", "{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-tests-uwp", "Test\Portable.Xaml-tests-uwp.csproj", "{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Portable.Xaml-tests-core", "Test\Portable.Xaml-tests-core.csproj", "{1E5C8B3A-E196-499C-9849-9876EB621A7C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|x64.Build.0 = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{179484EC-DB00-451A-AD2D-2E2AB20DE519}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}.Release|x86.Build.0 = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|x64.Build.0 = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{307DC911-E3EE-41F9-87BA-D1FD734E04BC}.Release|x86.Build.0 = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|x64.Build.0 = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{F4FA4B21-EF1C-48DE-8F4C-16496005FB94}.Release|x86.Build.0 = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|x64.Build.0 = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{AC406459-D324-4ADF-853D-A58B63396591}.Release|x86.Build.0 = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|x64.Build.0 = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CDC8F791-56FC-4B15-AAD2-BC460657CC02}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FDA04C3E-7386-4F45-A7F2-C69DB33B72FF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{E9DCCDCC-03A8-4BD1-888D-CEE86468A15A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|x64.Build.0 = Debug|x64
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|x86.Build.0 = Debug|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|ARM.Build.0 = Release|ARM
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|x64.ActiveCfg = Release|x64
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|x64.Build.0 = Release|x64
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|x64.Deploy.0 = Release|x64
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|x86.ActiveCfg = Release|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|x86.Build.0 = Release|x86
|
||||
{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}.Release|x86.Deploy.0 = Release|x86
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|x64.Build.0 = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{1E5C8B3A-E196-499C-9849-9876EB621A7C}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -52,9 +206,9 @@ Global
|
|||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $4
|
||||
$4.FileWidth = 120
|
||||
$4.TabsToSpaces = False
|
||||
$4.inheritsSet = VisualStudio
|
||||
$4.inheritsScope = text/plain
|
||||
$4.TabsToSpaces = True
|
||||
$4.FileWidth = 80
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
|
@ -41,19 +41,21 @@ using System.Security.Permissions;
|
|||
|
||||
// General Information about the System.Xaml assembly
|
||||
|
||||
[assembly: AssemblyTitle ("Portable.Xaml.dll")]
|
||||
[assembly: AssemblyDescription ("Portable.Xaml.dll")]
|
||||
[assembly: AssemblyDefaultAlias ("Portable.Xaml.dll")]
|
||||
|
||||
[assembly: NeutralResourcesLanguage ("en-US")]
|
||||
[assembly: CLSCompliant (true)]
|
||||
[assembly: NeutralResourcesLanguage("en-US")]
|
||||
[assembly: CLSCompliant(true)]
|
||||
//[assembly: ComVisible (false)]
|
||||
|
||||
[assembly: AssemblyVersion ("0.15.*")]
|
||||
[assembly: AssemblyInformationalVersion ("0.16.0-alpha")]
|
||||
#if !NETSTANDARD
|
||||
[assembly: AssemblyTitle("Portable.Xaml.dll")]
|
||||
[assembly: AssemblyDescription("Portable.Xaml.dll")]
|
||||
[assembly: AssemblyDefaultAlias("Portable.Xaml.dll")]
|
||||
[assembly: AssemblyVersion("0.15.*")]
|
||||
[assembly: AssemblyInformationalVersion("0.16.0-alpha")]
|
||||
|
||||
[assembly: AssemblyCompany("Mono development team")]
|
||||
[assembly: AssemblyCopyright("(c) Various Mono authors")]
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !PCL
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL259
|
||||
#if PCL259 || NETSTANDARD
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#if NETSTANDARD
|
||||
using System;
|
||||
namespace Portable.Xaml
|
||||
{
|
||||
[System.AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
|
||||
sealed class SerializableAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -28,7 +28,6 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Portable.Xaml.Markup;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard1.3</TargetFramework>
|
||||
<RootNamespace>Portable.Xaml</RootNamespace>
|
||||
<AssemblyName>Portable.Xaml</AssemblyName>
|
||||
<BaseIntermediateOutputPath>..\..\artifacts\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>..\..\artifacts\netstandard1.3\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NETSTANDARD1_3;PCL;NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType></DebugType>
|
||||
<OutputPath>..\..\artifacts\netstandard1.3\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;RELEASE;NETSTANDARD1_3;PCL;NETSTANDARD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
|
||||
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
|
||||
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
|
||||
<PackageReference Include="System.ComponentModel.TypeConverter" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -39,3 +40,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -22,3 +23,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -37,3 +38,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,5 +1,8 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if NETSTANDARD
|
||||
using System.ComponentModel;
|
||||
#endif
|
||||
|
||||
namespace Portable.Xaml.ComponentModel
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
@ -51,3 +52,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -2,6 +2,7 @@
|
|||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.ComponentModel
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -36,3 +37,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Collections.Generic;
|
||||
|
@ -68,4 +68,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
|
||||
bool IsDefined(Type attributeType, bool inherit);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -22,3 +23,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -22,3 +23,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -23,3 +24,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -62,3 +63,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -38,3 +39,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -36,3 +37,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
@ -295,4 +296,5 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#if PCL
|
||||
#if PCL && !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -22,3 +23,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -23,3 +24,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
@ -23,3 +24,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -1,12 +1,14 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
#if NETSTANDARD
|
||||
using System.ComponentModel;
|
||||
#endif
|
||||
|
||||
namespace Portable.Xaml.ComponentModel
|
||||
{
|
||||
|
||||
public class UriTypeConverter : TypeConverter
|
||||
{
|
||||
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
|
||||
|
@ -35,4 +37,4 @@ namespace Portable.Xaml.ComponentModel
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -26,6 +26,7 @@ using System.Collections.Generic;
|
|||
using Portable.Xaml.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Portable.Xaml;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Markup
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -26,6 +26,7 @@ using System.Collections.Generic;
|
|||
using Portable.Xaml.ComponentModel;
|
||||
using System.Globalization;
|
||||
using Portable.Xaml;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Markup
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -25,6 +25,7 @@ using System.Collections.Generic;
|
|||
using Portable.Xaml.ComponentModel;
|
||||
using System.Reflection;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Markup
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -27,6 +27,7 @@ using System.Globalization;
|
|||
using System.Reflection;
|
||||
using Portable.Xaml;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Markup
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -29,64 +29,76 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Portable.Xaml;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Markup
|
||||
{
|
||||
//[System.Runtime.CompilerServices.TypeForwardedFrom (Consts.AssemblyWindowsBase)]
|
||||
public abstract class ValueSerializer
|
||||
{
|
||||
public static ValueSerializer GetSerializerFor (PropertyInfo descriptor)
|
||||
public static ValueSerializer GetSerializerFor(PropertyInfo descriptor)
|
||||
{
|
||||
return GetSerializerFor (descriptor, null);
|
||||
return GetSerializerFor(descriptor, null);
|
||||
}
|
||||
|
||||
public static ValueSerializer GetSerializerFor (Type type)
|
||||
public static ValueSerializer GetSerializerFor(Type type)
|
||||
{
|
||||
return GetSerializerFor (type, null);
|
||||
return GetSerializerFor(type, null);
|
||||
}
|
||||
|
||||
// untested
|
||||
public static ValueSerializer GetSerializerFor (PropertyInfo descriptor, IValueSerializerContext context)
|
||||
public static ValueSerializer GetSerializerFor(PropertyInfo descriptor, IValueSerializerContext context)
|
||||
{
|
||||
if (descriptor == null)
|
||||
throw new ArgumentNullException ("descriptor");
|
||||
throw new ArgumentNullException("descriptor");
|
||||
if (context != null)
|
||||
return context.GetValueSerializerFor (descriptor);
|
||||
return context.GetValueSerializerFor(descriptor);
|
||||
|
||||
var typeConverterInfo = descriptor.GetCustomAttribute<TypeConverterAttribute> ();
|
||||
var typeConverterInfo = descriptor.GetCustomAttribute<TypeConverterAttribute>();
|
||||
var typeConverterName = typeConverterInfo?.ConverterTypeName;
|
||||
if (string.IsNullOrEmpty (typeConverterName))
|
||||
if (string.IsNullOrEmpty(typeConverterName))
|
||||
return null;
|
||||
var tcType = Type.GetType(typeConverterName);
|
||||
var tc = Activator.CreateInstance (tcType) as TypeConverter;
|
||||
if (tc != null && tc.GetType () != typeof (TypeConverter))
|
||||
return new TypeConverterValueSerializer (tc);
|
||||
var tc = Activator.CreateInstance(tcType) as TypeConverter;
|
||||
if (tc != null && tc.GetType() != typeof(TypeConverter))
|
||||
return new TypeConverterValueSerializer(tc);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ValueSerializer GetSerializerFor (Type type, IValueSerializerContext context)
|
||||
public static ValueSerializer GetSerializerFor(Type type, IValueSerializerContext context)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("type");
|
||||
throw new ArgumentNullException("type");
|
||||
if (context != null)
|
||||
return context.GetValueSerializerFor (type);
|
||||
return context.GetValueSerializerFor(type);
|
||||
|
||||
// Standard MarkupExtensions are serialized without ValueSerializer.
|
||||
if (typeof (MarkupExtension).GetTypeInfo().IsAssignableFrom (type.GetTypeInfo()) && XamlLanguage.AllTypes.Any (x => x.UnderlyingType == type))
|
||||
if (typeof(MarkupExtension).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo()) && XamlLanguage.AllTypes.Any(x => x.UnderlyingType == type))
|
||||
return null;
|
||||
|
||||
type = Nullable.GetUnderlyingType(type) ?? type;
|
||||
|
||||
// DateTime is documented as special.
|
||||
if (type == typeof (DateTime))
|
||||
return new DateTimeValueSerializer ();
|
||||
if (type == typeof(DateTime))
|
||||
return new DateTimeValueSerializer();
|
||||
// String too.
|
||||
if (type == typeof (string))
|
||||
return new StringValueSerializer ();
|
||||
if (type == typeof(string))
|
||||
return new StringValueSerializer();
|
||||
|
||||
#if NETSTANDARD
|
||||
if (type == typeof(Array) )
|
||||
//|| type == typeof(MemberDefinition)
|
||||
//|| type == typeof(PropertyDefinition)
|
||||
//|| type == typeof(XData))
|
||||
return null;
|
||||
#endif
|
||||
|
||||
// FIXME: this is hack. The complete condition is fully documented at http://msdn.microsoft.com/en-us/library/ms590363.aspx
|
||||
if (type.GetTypeInfo().GetCustomAttribute<TypeConverterAttribute> (true) != null) {
|
||||
var tc = type.GetTypeConverter ();
|
||||
if (tc != null && tc.GetType () != typeof (TypeConverter))
|
||||
return new TypeConverterValueSerializer (tc);
|
||||
if (type.GetTypeInfo().GetCustomAttribute<TypeConverterAttribute>(true) != null)
|
||||
{
|
||||
var tc = type.GetTypeConverter();
|
||||
if (tc != null && tc.GetType() != typeof(TypeConverter))
|
||||
return new TypeConverterValueSerializer(tc);
|
||||
}
|
||||
|
||||
// Undocumented, but System.Type seems also special. While other MarkupExtension returned types are not handled specially, this method returns a valid instance for System.Type. Note that it doesn't for TypeExtension.
|
||||
|
@ -99,9 +111,12 @@ namespace Portable.Xaml.Markup
|
|||
if (type != typeof(object) || type == typeof(TimeSpan))
|
||||
{
|
||||
var typeConverter = type.GetTypeConverter ();
|
||||
if (typeConverter != null)
|
||||
if (typeConverter != null && typeConverter.GetType() != typeof(TypeConverter))
|
||||
return new TypeConverterValueSerializer (typeConverter);
|
||||
}
|
||||
|
||||
if (type == typeof(Uri))
|
||||
return new TypeConverterValueSerializer(new UriTypeConverter());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -27,6 +27,7 @@ using System.Globalization;
|
|||
using System.Reflection;
|
||||
using Portable.Xaml;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Markup
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#if !PCL && !NETSTANDARD
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
|
@ -26,7 +27,7 @@ using System.ComponentModel;
|
|||
using System.Reflection;
|
||||
using System.Xaml;
|
||||
|
||||
namespace System.Xaml.Permissions
|
||||
namespace Portable.Xaml.Permissions
|
||||
{
|
||||
[SerializableAttribute]
|
||||
public class XamlAccessLevel
|
||||
|
@ -73,3 +74,4 @@ namespace System.Xaml.Permissions
|
|||
public string PrivateAccessToTypeName { get; private set; }
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,3 +1,4 @@
|
|||
#if !NETSTANDARD
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
|
@ -80,3 +81,4 @@ namespace System.Xaml.Permissions
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
// Copyright (C) 2012 Xamarin Inc. http://xamarin.com
|
||||
//
|
||||
|
@ -151,11 +151,14 @@ namespace Portable.Xaml.Schema
|
|||
|
||||
if (mi == null)
|
||||
{
|
||||
if (collectionType.GetTypeInfo().IsGenericType)
|
||||
var baseCollection = collectionType.GetTypeInfo().GetInterfaces()
|
||||
.FirstOrDefault(r => r.GetTypeInfo().IsGenericType
|
||||
&& r.GetTypeInfo().GetGenericTypeDefinition() == typeof(ICollection<>));
|
||||
if (baseCollection != null)
|
||||
{
|
||||
mi = collectionType.GetRuntimeMethod("Add", collectionType.GetTypeInfo().GetGenericArguments());
|
||||
mi = collectionType.GetRuntimeMethod("Add", baseCollection.GetTypeInfo().GetGenericArguments());
|
||||
if (mi == null)
|
||||
mi = LookupAddMethod(collectionType, typeof(ICollection<>).MakeGenericType(collectionType.GetTypeInfo().GetGenericArguments()));
|
||||
mi = LookupAddMethod(collectionType, baseCollection);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -26,6 +26,7 @@ using Portable.Xaml.ComponentModel;
|
|||
using System.Globalization;
|
||||
using Portable.Xaml.Markup;
|
||||
using Portable.Xaml;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Schema
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -25,6 +25,7 @@ using System.Collections.Generic;
|
|||
using Portable.Xaml.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml.Schema
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ This allows you to read/write xaml for desktop, mobile, and .NET Core projects.
|
|||
<file src="../../artifacts/pcl136/$configuration$/Portable.Xaml.dll" target="lib\portable-net40+sl50+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10" />
|
||||
<file src="../../artifacts/pcl259/$configuration$/Portable.Xaml.dll" target="lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10" />
|
||||
<file src="../../artifacts/pcl259/$configuration$/Portable.Xaml.dll" target="lib\Xamarin.Mac" />
|
||||
<file src="../../artifacts/pcl259/$configuration$/Portable.Xaml.dll" target="lib\netstandard1.0" />
|
||||
<file src="../../artifacts/netstandard1.4/$configuration$/Portable.Xaml.dll" target="lib\netstandard1.4" />
|
||||
<file src="../../LICENSE.txt" target="LICENSE.txt" />
|
||||
</files>
|
||||
</package>
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -29,6 +29,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Portable.Xaml.Markup;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml
|
||||
{
|
||||
|
@ -378,23 +379,24 @@ namespace Portable.Xaml
|
|||
|
||||
internal static IComparer<XamlMember> MemberComparer = new InternalMemberComparer();
|
||||
|
||||
internal static int CompareMembers (XamlMember m1, XamlMember m2)
|
||||
internal static int CompareMembers(XamlMember m1, XamlMember m2)
|
||||
{
|
||||
if (m1 == null)
|
||||
return m2 == null ? 0 : 1;
|
||||
if (m2 == null)
|
||||
if (ReferenceEquals(m1, null))
|
||||
return ReferenceEquals(m2, null) ? 0 : 1;
|
||||
if (ReferenceEquals(m2, null))
|
||||
return 0;
|
||||
|
||||
// these come before non-content properties
|
||||
|
||||
// 1. PositionalParameters comes first
|
||||
if (m1 == XamlLanguage.PositionalParameters)
|
||||
return m2 == XamlLanguage.PositionalParameters ? 0 : -1;
|
||||
else if (m2 == XamlLanguage.PositionalParameters)
|
||||
if (ReferenceEquals(m1, XamlLanguage.PositionalParameters))
|
||||
return ReferenceEquals(m2, XamlLanguage.PositionalParameters) ? 0 : -1;
|
||||
if (ReferenceEquals(m2, XamlLanguage.PositionalParameters))
|
||||
return 1;
|
||||
|
||||
// 2. constructor arguments
|
||||
if (m1.IsConstructorArgument) {
|
||||
if (m1.IsConstructorArgument)
|
||||
{
|
||||
if (!m2.IsConstructorArgument)
|
||||
return -1;
|
||||
}
|
||||
|
@ -406,34 +408,45 @@ namespace Portable.Xaml
|
|||
|
||||
// 1. initialization
|
||||
|
||||
if (m1 == XamlLanguage.Initialization)
|
||||
return m2 == XamlLanguage.Initialization ? 0 : 1;
|
||||
else if (m2 == XamlLanguage.Initialization)
|
||||
if (ReferenceEquals(m1, XamlLanguage.Initialization))
|
||||
return ReferenceEquals(m2, XamlLanguage.Initialization) ? 0 : 1;
|
||||
if (ReferenceEquals(m2, XamlLanguage.Initialization))
|
||||
return -1;
|
||||
|
||||
// 2. key
|
||||
if (m1 == XamlLanguage.Key)
|
||||
return m2 == XamlLanguage.Key ? 0 : 1;
|
||||
else if (m2 == XamlLanguage.Key)
|
||||
if (ReferenceEquals(m1, XamlLanguage.Key))
|
||||
return ReferenceEquals(m2, XamlLanguage.Key) ? 0 : 1;
|
||||
if (ReferenceEquals(m2, XamlLanguage.Key))
|
||||
return -1;
|
||||
|
||||
// 3. Name
|
||||
if (m1 == XamlLanguage.Name)
|
||||
return m2 == XamlLanguage.Name ? 0 : 1;
|
||||
else if (m2 == XamlLanguage.Name)
|
||||
if (ReferenceEquals(m1, XamlLanguage.Name))
|
||||
return ReferenceEquals(m2, XamlLanguage.Name) ? 0 : 1;
|
||||
if (ReferenceEquals(m2, XamlLanguage.Name))
|
||||
return -1;
|
||||
|
||||
// 4. ContentProperty is always returned last
|
||||
if (m1.DeclaringType != null && m1.DeclaringType.ContentProperty == m1) {
|
||||
if (!(m2.DeclaringType != null && m2.DeclaringType.ContentProperty == m2))
|
||||
if (m1.DeclaringType?.ContentProperty == m1)
|
||||
{
|
||||
if (m2.DeclaringType?.ContentProperty != m2)
|
||||
return 1;
|
||||
}
|
||||
else if (m2.DeclaringType != null && m2.DeclaringType.ContentProperty == m2)
|
||||
else if (m2.DeclaringType?.ContentProperty == m2)
|
||||
return -1;
|
||||
|
||||
// preoperties that (probably) require a child node should come last so we can
|
||||
// put as many in the start tag as possible.
|
||||
if (m1.RequiresChildNode)
|
||||
{
|
||||
if (!m2.RequiresChildNode)
|
||||
return 1;
|
||||
}
|
||||
else if (m2.RequiresChildNode)
|
||||
return -1;
|
||||
|
||||
|
||||
// then, compare names.
|
||||
return String.CompareOrdinal (m1.Name, m2.Name);
|
||||
return String.CompareOrdinal(m1.Name, m2.Name);
|
||||
}
|
||||
|
||||
internal static string GetInternalXmlName (this XamlMember xm)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -32,12 +32,13 @@ using Portable.Xaml.Markup;
|
|||
using Portable.Xaml;
|
||||
using Portable.Xaml.Schema;
|
||||
using System.Xml;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml
|
||||
{
|
||||
internal class ValueSerializerContext : IValueSerializerContext, IXamlSchemaContextProvider, ITypeDescriptorContext
|
||||
{
|
||||
XamlNameResolver name_resolver = new XamlNameResolver ();
|
||||
XamlNameResolver name_resolver = new XamlNameResolver();
|
||||
XamlTypeResolver type_resolver;
|
||||
NamespaceResolver namespace_resolver;
|
||||
PrefixLookup prefix_lookup;
|
||||
|
@ -48,15 +49,15 @@ namespace Portable.Xaml
|
|||
IDestinationTypeProvider destinationProvider;
|
||||
IXamlObjectWriterFactory objectWriterFactory;
|
||||
|
||||
public ValueSerializerContext (PrefixLookup prefixLookup, XamlSchemaContext schemaContext, IAmbientProvider ambientProvider, IProvideValueTarget provideValue, IRootObjectProvider rootProvider, IDestinationTypeProvider destinationProvider, IXamlObjectWriterFactory objectWriterFactory)
|
||||
public ValueSerializerContext(PrefixLookup prefixLookup, XamlSchemaContext schemaContext, IAmbientProvider ambientProvider, IProvideValueTarget provideValue, IRootObjectProvider rootProvider, IDestinationTypeProvider destinationProvider, IXamlObjectWriterFactory objectWriterFactory)
|
||||
{
|
||||
if (prefixLookup == null)
|
||||
throw new ArgumentNullException ("prefixLookup");
|
||||
throw new ArgumentNullException("prefixLookup");
|
||||
if (schemaContext == null)
|
||||
throw new ArgumentNullException ("schemaContext");
|
||||
throw new ArgumentNullException("schemaContext");
|
||||
prefix_lookup = prefixLookup;
|
||||
namespace_resolver = new NamespaceResolver (prefix_lookup.Namespaces);
|
||||
type_resolver = new XamlTypeResolver (namespace_resolver, schemaContext);
|
||||
namespace_resolver = new NamespaceResolver(prefix_lookup.Namespaces);
|
||||
type_resolver = new XamlTypeResolver(namespace_resolver, schemaContext);
|
||||
sctx = schemaContext;
|
||||
ambient_provider = ambientProvider;
|
||||
this.provideValue = provideValue;
|
||||
|
@ -65,23 +66,23 @@ namespace Portable.Xaml
|
|||
this.objectWriterFactory = objectWriterFactory;
|
||||
}
|
||||
|
||||
public object GetService (Type serviceType)
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
if (serviceType == typeof (INamespacePrefixLookup))
|
||||
if (serviceType == typeof(INamespacePrefixLookup))
|
||||
return prefix_lookup;
|
||||
if (serviceType == typeof (IXamlNamespaceResolver))
|
||||
if (serviceType == typeof(IXamlNamespaceResolver))
|
||||
return namespace_resolver;
|
||||
if (serviceType == typeof (IXamlNameResolver))
|
||||
if (serviceType == typeof(IXamlNameResolver))
|
||||
return name_resolver;
|
||||
if (serviceType == typeof (IXamlNameProvider))
|
||||
if (serviceType == typeof(IXamlNameProvider))
|
||||
return name_resolver;
|
||||
if (serviceType == typeof (IXamlTypeResolver))
|
||||
if (serviceType == typeof(IXamlTypeResolver))
|
||||
return type_resolver;
|
||||
if (serviceType == typeof (IAmbientProvider))
|
||||
if (serviceType == typeof(IAmbientProvider))
|
||||
return ambient_provider;
|
||||
if (serviceType == typeof (IXamlSchemaContextProvider))
|
||||
if (serviceType == typeof(IXamlSchemaContextProvider))
|
||||
return this;
|
||||
if (serviceType == typeof (IProvideValueTarget))
|
||||
if (serviceType == typeof(IProvideValueTarget))
|
||||
return provideValue;
|
||||
if (serviceType == typeof(IRootObjectProvider))
|
||||
return rootProvider;
|
||||
|
@ -91,24 +92,35 @@ namespace Portable.Xaml
|
|||
return objectWriterFactory;
|
||||
return null;
|
||||
}
|
||||
|
||||
XamlSchemaContext IXamlSchemaContextProvider.SchemaContext {
|
||||
|
||||
XamlSchemaContext IXamlSchemaContextProvider.SchemaContext
|
||||
{
|
||||
get { return sctx; }
|
||||
}
|
||||
|
||||
public object Instance
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
#if NETSTANDARD
|
||||
public IContainer Container => throw new NotImplementedException();
|
||||
|
||||
public PropertyDescriptor PropertyDescriptor => throw new NotImplementedException();
|
||||
#else
|
||||
/*
|
||||
public IContainer Container {
|
||||
get { throw new NotImplementedException (); }
|
||||
}*/
|
||||
public object Instance {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
public PropertyInfo PropertyDescriptor {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
public void OnComponentChanged ()
|
||||
public PropertyInfo PropertyDescriptor
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
public void OnComponentChanged()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool OnComponentChanging ()
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -27,6 +27,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using Portable.Xaml.Schema;
|
||||
using Portable.Xaml.Markup;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -50,6 +50,7 @@ namespace Portable.Xaml
|
|||
public const int IsAttachable = 1 << 9;
|
||||
public const int IsDefaultEvent = 1 << 10;
|
||||
public const int IsDirective = 1 << 11;
|
||||
public const int ShouldSerialize = 1 << 12;
|
||||
}
|
||||
XamlType target_type;
|
||||
MemberInfo underlying_member;
|
||||
|
@ -202,14 +203,18 @@ namespace Portable.Xaml
|
|||
|
||||
public string PreferredXamlNamespace => ns.HasValue ? ns.Value : ns.Set(DeclaringType?.PreferredXamlNamespace);
|
||||
|
||||
#if !PCL
|
||||
#if !PCL || NETSTANDARD
|
||||
public DesignerSerializationVisibility SerializationVisibility {
|
||||
get {
|
||||
var c= GetCustomAttributeProvider ();
|
||||
var c = this.CustomAttributeProvider;
|
||||
var a = c == null ? null : c.GetCustomAttribute<DesignerSerializationVisibilityAttribute> (false);
|
||||
return a != null ? a.Visibility : DesignerSerializationVisibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool ShouldSerialize => flags.Get(MemberFlags.ShouldSerialize) ?? flags.Set(MemberFlags.ShouldSerialize, SerializationVisibility != DesignerSerializationVisibility.Hidden);
|
||||
#else
|
||||
internal bool ShouldSerialize => true;
|
||||
#endif
|
||||
|
||||
public bool IsAttachable => flags.Get(MemberFlags.IsAttachable) ?? false;
|
||||
|
@ -266,6 +271,16 @@ namespace Portable.Xaml
|
|||
return Equals(x);
|
||||
}
|
||||
|
||||
bool MemberEquals(MemberInfo member1, MemberInfo member2)
|
||||
{
|
||||
if (ReferenceEquals(member1, null))
|
||||
return ReferenceEquals(member2, null);
|
||||
return !ReferenceEquals(member2, null)
|
||||
&& member1.DeclaringType == member2.DeclaringType
|
||||
&& string.Equals(member1.Name, member2.Name, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
|
||||
public bool Equals(XamlMember other)
|
||||
{
|
||||
// this should be in general correct; XamlMembers are almost not comparable.
|
||||
|
@ -273,9 +288,9 @@ namespace Portable.Xaml
|
|||
return true;
|
||||
// It does not compare XamlSchemaContext.
|
||||
return !ReferenceEquals(other, null) &&
|
||||
underlying_member == other.underlying_member &&
|
||||
underlying_getter == other.underlying_getter &&
|
||||
underlying_setter == other.underlying_setter &&
|
||||
MemberEquals(underlying_member, other.underlying_member) &&
|
||||
MemberEquals(underlying_getter, other.underlying_getter) &&
|
||||
MemberEquals(underlying_setter, other.underlying_setter) &&
|
||||
Name == other.Name &&
|
||||
PreferredXamlNamespace == other.PreferredXamlNamespace &&
|
||||
ns == other.ns &&
|
||||
|
@ -429,10 +444,15 @@ namespace Portable.Xaml
|
|||
if (t == typeof(object)) // it is different from XamlType.LookupTypeConverter().
|
||||
return null;
|
||||
|
||||
|
||||
var a = CustomAttributeProvider;
|
||||
var ca = a != null ? a.GetCustomAttribute<TypeConverterAttribute>(false) : null;
|
||||
if (ca != null)
|
||||
return context.GetValueConverter<TypeConverter>(System.Type.GetType(ca.ConverterTypeName), Type);
|
||||
#if NETSTANDARD
|
||||
if (IsEvent)
|
||||
return context.GetValueConverter<TypeConverter>(typeof(EventConverter), Type);
|
||||
#endif
|
||||
|
||||
return Type.TypeConverter;
|
||||
}
|
||||
|
@ -481,6 +501,8 @@ namespace Portable.Xaml
|
|||
|
||||
internal bool IsConstructorArgument => flags.Get(MemberFlags.IsConstructorArgument) ?? flags.Set(MemberFlags.IsConstructorArgument, LookupIsConstructorArgument());
|
||||
|
||||
internal virtual bool RequiresChildNode => Type.IsCollection || Type.IsDictionary || (IsWritePublic && !Type.CanConvertFrom(XamlLanguage.String));
|
||||
|
||||
bool LookupIsConstructorArgument()
|
||||
{
|
||||
var ap = CustomAttributeProvider;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -51,13 +51,6 @@ namespace Portable.Xaml
|
|||
return this;
|
||||
}
|
||||
|
||||
public XamlNodeInfo Set(XamlNodeInfo node)
|
||||
{
|
||||
NodeType = node.NodeType;
|
||||
Value = node.Value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public XamlNodeInfo(XamlNodeType nodeType, XamlObject value)
|
||||
{
|
||||
NodeType = nodeType;
|
||||
|
@ -90,7 +83,24 @@ namespace Portable.Xaml
|
|||
|
||||
public object Value { get; private set; }
|
||||
|
||||
public XamlNodeInfo Copy() => new XamlNodeInfo().Set(this);
|
||||
public XamlNodeInfo Copy()
|
||||
{
|
||||
var node = new XamlNodeInfo();
|
||||
node.NodeType = NodeType;
|
||||
node.Value = Value;
|
||||
var nm = node.Value as XamlNodeMember;
|
||||
if (nm != null)
|
||||
node.Value = new XamlNodeMember(nm.Owner, nm.Member);
|
||||
var obj = node.Value as XamlObject;
|
||||
if (obj != null)
|
||||
node.Value = new XamlObject(obj.Type, obj.Value);
|
||||
return node;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[XamlNodeInfo: NodeType={NodeType}, Value={Value}]";
|
||||
}
|
||||
}
|
||||
|
||||
struct XamlNodeLineInfo
|
||||
|
@ -221,22 +231,25 @@ namespace Portable.Xaml
|
|||
yield break;
|
||||
}
|
||||
|
||||
foreach (var m in type.GetAllMembers ()) {
|
||||
// do not read constructor arguments twice (they are written inside Arguments).
|
||||
if (args != null && args.Contains (m))
|
||||
continue;
|
||||
// do not return non-public members (of non-collection/xdata). Not sure why .NET filters out them though.
|
||||
if (!m.IsReadPublic)
|
||||
continue;
|
||||
if (!m.IsWritePublic &&
|
||||
!m.Type.IsXData &&
|
||||
!m.Type.IsArray &&
|
||||
!m.Type.IsCollection &&
|
||||
!m.Type.IsDictionary)
|
||||
continue;
|
||||
foreach (var m in type.GetAllMembers())
|
||||
{
|
||||
// do not read constructor arguments twice (they are written inside Arguments).
|
||||
if (args != null && args.Contains(m))
|
||||
continue;
|
||||
// do not return non-public members (of non-collection/xdata). Not sure why .NET filters out them though.
|
||||
if (!m.IsReadPublic
|
||||
|| !m.ShouldSerialize)
|
||||
continue;
|
||||
|
||||
if (!m.IsWritePublic &&
|
||||
!m.Type.IsXData &&
|
||||
!m.Type.IsArray &&
|
||||
!m.Type.IsCollection &&
|
||||
!m.Type.IsDictionary)
|
||||
continue;
|
||||
|
||||
yield return m;
|
||||
}
|
||||
yield return m;
|
||||
}
|
||||
|
||||
if (type.IsCollection)
|
||||
yield return XamlLanguage.Items;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -132,8 +132,21 @@ namespace Portable.Xaml
|
|||
}
|
||||
|
||||
// don't serialize default values if one is explicitly specified using the DefaultValueAttribute
|
||||
if (!partOfPositionalParameters && xm.Invoker.IsDefaultValue(val))
|
||||
yield break;
|
||||
if (!partOfPositionalParameters)
|
||||
{
|
||||
if (xm.Invoker.IsDefaultValue(val))
|
||||
yield break;
|
||||
if (settings.IgnoreDefaultValues && xm.DefaultValue == null)
|
||||
{
|
||||
if (xm.Type?.UnderlyingType?.GetTypeInfo().IsValueType == true)
|
||||
{
|
||||
if (Equals(val, Activator.CreateInstance(xm.Type.UnderlyingType)))
|
||||
yield break;
|
||||
}
|
||||
else if (ReferenceEquals(val, null))
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
// overrideMemberType is (so far) used for XamlLanguage.Key.
|
||||
var xtt = overrideMemberType ?? xm.Type;
|
||||
|
@ -156,7 +169,7 @@ namespace Portable.Xaml
|
|||
}
|
||||
|
||||
// collection items: return GetObject and Items.
|
||||
if (xm.Type.IsCollection && !xm.IsWritePublic)
|
||||
if ((xm.Type.IsCollection || xm.Type.IsDictionary) && !xm.IsWritePublic)
|
||||
{
|
||||
yield return node.Set(XamlNodeType.GetObject, xobj);
|
||||
// Write Items member only when there are items (i.e. do not write it if it is empty).
|
||||
|
@ -352,19 +365,25 @@ namespace Portable.Xaml
|
|||
var xobject = new XamlObject();
|
||||
while (xce.MoveNext ()) {
|
||||
// XamlLanguage.Items does not show up if the content is empty.
|
||||
if (xce.Current.Member == XamlLanguage.Items) {
|
||||
if (ReferenceEquals(xce.Current.Member, XamlLanguage.Items))
|
||||
{
|
||||
// FIXME: this is nasty, but this name resolution is the only side effect of this iteration model. Save-Restore procedure is required.
|
||||
NameResolver.Save ();
|
||||
try {
|
||||
if (!GetNodes (xce.Current.Member, xce.Current.GetValue(xobject)).GetEnumerator ().MoveNext ())
|
||||
NameResolver.Save();
|
||||
try
|
||||
{
|
||||
if (!GetNodes(xce.Current.Member, xce.Current.GetValue(xobject)).GetEnumerator().MoveNext())
|
||||
continue;
|
||||
} finally {
|
||||
NameResolver.Restore ();
|
||||
}
|
||||
finally
|
||||
{
|
||||
NameResolver.Restore();
|
||||
}
|
||||
}
|
||||
|
||||
var member = xce.Current.Member;
|
||||
// Other collections as well, but needs different iteration (as nodes contain GetObject and EndObject).
|
||||
if (!xce.Current.Member.IsWritePublic && xce.Current.Member.Type != null && xce.Current.Member.Type.IsCollection) {
|
||||
if (!member.IsWritePublic && member.Type != null
|
||||
&& (member.Type.IsCollection || member.Type.IsDictionary)) {
|
||||
var e = GetNodes (xce.Current.Member, xce.Current.GetValue(xobject)).GetEnumerator ();
|
||||
// FIXME: this is nasty, but this name resolution is the only side effect of this iteration model. Save-Restore procedure is required.
|
||||
NameResolver.Save ();
|
||||
|
@ -405,21 +424,28 @@ namespace Portable.Xaml
|
|||
if (ikey != null) {
|
||||
|
||||
// TODO: do this without copying the XamlNodeInfo somehow?
|
||||
var en = GetNodes (null, xiobj).Select(r => r.Copy()).ToList ();
|
||||
yield return en [0]; // StartObject
|
||||
var en = GetNodes(null, xiobj).Select(c => c.Copy()).GetEnumerator();
|
||||
en.MoveNext();
|
||||
yield return en.Current; // StartObject
|
||||
|
||||
var xknm = new XamlNodeMember (xobj, XamlLanguage.Key);
|
||||
var nodes1 = en.Skip (1).Take (en.Count - 2);
|
||||
//var nodes1 = en.Skip (1).Take (en.Count - 2);
|
||||
var nodes1 = new List<XamlNodeInfo>();
|
||||
while (en.MoveNext())
|
||||
{
|
||||
nodes1.Add(en.Current);
|
||||
}
|
||||
|
||||
var nodes2 = GetKeyNodes (ikey, xobj.Type.KeyType, xknm);
|
||||
|
||||
// group the members then sort to put the key nodes in the correct order
|
||||
var grouped = GroupMemberNodes (nodes1.Concat (nodes2)).OrderBy (r => r.Item1, TypeExtensionMethods.MemberComparer);
|
||||
var grouped = GroupMemberNodes (nodes1.Take(nodes1.Count - 1).Concat (nodes2)).OrderBy (r => r.Item1, TypeExtensionMethods.MemberComparer);
|
||||
foreach (var item in grouped) {
|
||||
foreach (var node in item.Item2)
|
||||
yield return node;
|
||||
}
|
||||
|
||||
yield return en [en.Count - 1]; // EndObject
|
||||
yield return nodes1[nodes1.Count - 1]; // EndObject
|
||||
}
|
||||
else
|
||||
foreach (var xn in GetNodes (null, xiobj))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -32,6 +32,9 @@ namespace Portable.Xaml
|
|||
public class XamlObjectReaderSettings : XamlReaderSettings
|
||||
{
|
||||
public bool RequireExplicitContentVisibility { get; set; }
|
||||
|
||||
[EnhancedXaml]
|
||||
public bool IgnoreDefaultValues { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -36,59 +36,74 @@ namespace Portable.Xaml
|
|||
public abstract XamlSchemaContext SchemaContext { get; }
|
||||
public abstract XamlType Type { get; }
|
||||
public abstract object Value { get; }
|
||||
|
||||
public void Close ()
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Dispose (true);
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
protected virtual void Dispose (bool disposing)
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
IsDisposed = true;
|
||||
}
|
||||
|
||||
void IDisposable.Dispose ()
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
Dispose (true);
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
public abstract bool Read ();
|
||||
|
||||
public virtual XamlReader ReadSubtree ()
|
||||
|
||||
public abstract bool Read();
|
||||
|
||||
public virtual XamlReader ReadSubtree()
|
||||
{
|
||||
return new XamlSubtreeReader (this);
|
||||
return new XamlSubtreeReader(this);
|
||||
}
|
||||
|
||||
public virtual void Skip ()
|
||||
|
||||
#if NETSTANDARD
|
||||
/* For debugging */
|
||||
public void Dump()
|
||||
{
|
||||
while (Read())
|
||||
{
|
||||
Console.WriteLine($"{NodeType}: Type: {Type}, Member: {Member}, Value: {Value}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual void Skip()
|
||||
{
|
||||
int count = 0;
|
||||
switch (NodeType) {
|
||||
case XamlNodeType.StartMember:
|
||||
case XamlNodeType.StartObject:
|
||||
case XamlNodeType.GetObject:
|
||||
count++;
|
||||
while (Read ()) {
|
||||
switch (NodeType) {
|
||||
case XamlNodeType.StartMember:
|
||||
case XamlNodeType.GetObject:
|
||||
case XamlNodeType.StartObject:
|
||||
count++;
|
||||
continue;
|
||||
case XamlNodeType.EndMember:
|
||||
case XamlNodeType.EndObject:
|
||||
count--;
|
||||
if (count == 0) {
|
||||
Read ();
|
||||
return;
|
||||
switch (NodeType)
|
||||
{
|
||||
case XamlNodeType.StartMember:
|
||||
case XamlNodeType.StartObject:
|
||||
case XamlNodeType.GetObject:
|
||||
count++;
|
||||
while (Read())
|
||||
{
|
||||
switch (NodeType)
|
||||
{
|
||||
case XamlNodeType.StartMember:
|
||||
case XamlNodeType.GetObject:
|
||||
case XamlNodeType.StartObject:
|
||||
count++;
|
||||
continue;
|
||||
case XamlNodeType.EndMember:
|
||||
case XamlNodeType.EndObject:
|
||||
count--;
|
||||
if (count == 0)
|
||||
{
|
||||
Read();
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return;
|
||||
return;
|
||||
|
||||
default:
|
||||
Read ();
|
||||
return;
|
||||
default:
|
||||
Read();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -28,8 +28,10 @@ using System.Reflection;
|
|||
using Portable.Xaml.Markup;
|
||||
using Portable.Xaml.Schema;
|
||||
|
||||
using Pair = System.Collections.Generic.KeyValuePair<string,string>;
|
||||
using Pair = System.Collections.Generic.KeyValuePair<string, string>;
|
||||
using System.Diagnostics;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
namespace Portable.Xaml
|
||||
{
|
||||
|
@ -84,7 +86,7 @@ namespace Portable.Xaml
|
|||
Dictionary<Type, XamlType> run_time_types = new Dictionary<Type, XamlType>();
|
||||
Dictionary<Tuple<string, string>, XamlType> type_lookup = new Dictionary<Tuple<string, string>, XamlType>();
|
||||
Dictionary<Pair, XamlDirective> xaml_directives = new Dictionary<Pair, XamlDirective>();
|
||||
Dictionary<Tuple<MemberInfo, MemberInfo>, XamlMember> member_cache = new Dictionary<Tuple<MemberInfo, MemberInfo>, XamlMember>();
|
||||
Dictionary<object, XamlMember> member_cache = new Dictionary<object, XamlMember>();
|
||||
Dictionary<ParameterInfo, XamlMember> parameter_cache = new Dictionary<ParameterInfo, XamlMember>();
|
||||
|
||||
[EnhancedXaml]
|
||||
|
@ -111,13 +113,34 @@ namespace Portable.Xaml
|
|||
{
|
||||
if (assembliesInScope != null)
|
||||
return assembliesInScope;
|
||||
var assemblies = reference_assemblies ?? GetAppDomainAssemblies() ?? Enumerable.Empty<Assembly>();
|
||||
var assemblies = reference_assemblies ?? LookupAssembliesInScope();
|
||||
|
||||
assembliesInScope = assemblies.Select(r => new AssemblyInfo { Assembly = r }).ToList();
|
||||
return assembliesInScope;
|
||||
}
|
||||
}
|
||||
|
||||
Assembly[] GetAppDomainAssemblies()
|
||||
static List<Assembly> cachedAssembliesInScope;
|
||||
static IEnumerable<Assembly> LookupAssembliesInScope()
|
||||
{
|
||||
if (cachedAssembliesInScope != null)
|
||||
return cachedAssembliesInScope;
|
||||
|
||||
var assemblies =
|
||||
GetAppDomainAssemblies()
|
||||
#if NETSTANDARD
|
||||
?? GetBaseDirectoryAssemblies()
|
||||
#endif
|
||||
#if !PCL136
|
||||
?? GetUwpAssemblies()
|
||||
#endif
|
||||
?? Enumerable.Empty<Assembly>();
|
||||
|
||||
cachedAssembliesInScope = assemblies.ToList();
|
||||
return cachedAssembliesInScope;
|
||||
}
|
||||
|
||||
static IEnumerable<Assembly> GetAppDomainAssemblies()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -143,6 +166,95 @@ namespace Portable.Xaml
|
|||
}
|
||||
}
|
||||
|
||||
#if NETSTANDARD
|
||||
static IEnumerable<Assembly> GetBaseDirectoryAssemblies()
|
||||
{
|
||||
try
|
||||
{
|
||||
// .NET Core, we get the assemblies in the base directory.
|
||||
var assemblyType = typeof(Assembly);
|
||||
if (assemblyType == null)
|
||||
return null;
|
||||
var getEntryAssembly = assemblyType.GetRuntimeMethod("GetEntryAssembly", new Type[0]);
|
||||
if (getEntryAssembly == null)
|
||||
return null;
|
||||
var entryAssembly = getEntryAssembly.Invoke(null, null) as Assembly;
|
||||
if (entryAssembly == null)
|
||||
return null;
|
||||
|
||||
var assemblies = new List<Assembly>();
|
||||
assemblies.Add(entryAssembly);
|
||||
foreach (var file in Directory.EnumerateFiles(AppContext.BaseDirectory, "*.dll"))
|
||||
{
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.Load(new AssemblyName(Path.GetFileNameWithoutExtension(file)));
|
||||
if (assembly != entryAssembly)
|
||||
assemblies.Add(assembly);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
return assemblies;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PCL136
|
||||
static IEnumerable<Assembly> GetUwpAssemblies()
|
||||
{
|
||||
try
|
||||
{
|
||||
// if we're running in UWP, get all assemblies in installed locationF
|
||||
// an ugly hack, but there's no other option until maybe netstandard 2.0.
|
||||
var packageType = Type.GetType("Windows.ApplicationModel.Package,Windows.Foundation.UniversalApiContract,ContentType=WindowsRuntime");
|
||||
if (packageType == null)
|
||||
return null;
|
||||
var current = packageType.GetRuntimeProperty("Current")?.GetValue(null);
|
||||
if (current == null)
|
||||
return null;
|
||||
var installedLocation = current.GetType().GetRuntimeProperty("InstalledLocation")?.GetValue(current);
|
||||
if (installedLocation == null)
|
||||
return null;
|
||||
var getFilesAsync = installedLocation.GetType().GetRuntimeMethod("GetFilesAsync", new Type[0])?.Invoke(installedLocation, null);
|
||||
if (getFilesAsync == null)
|
||||
return null;
|
||||
|
||||
var awaiterExtensions = Type.GetType("System.WindowsRuntimeSystemExtensions,System.Runtime.WindowsRuntime");
|
||||
var interfaceType = Type.GetType("Windows.Foundation.IAsyncOperation`1,Windows.Foundation.UniversalApiContract,ContentType=WindowsRuntime");
|
||||
var storageType = Type.GetType("Windows.Storage.StorageFile,Windows.Foundation.UniversalApiContract,ContentType=WindowsRuntime");
|
||||
var resultType = typeof(IReadOnlyList<>).MakeGenericType(storageType);
|
||||
var interfaceResultType = interfaceType?.MakeGenericType(resultType);
|
||||
var getAwaiterMethod = awaiterExtensions.GetRuntimeMethods().First(m => m.Name == "GetAwaiter" && m.IsGenericMethod && m.ReturnType.GetTypeInfo().IsGenericType);
|
||||
var awaiter = getAwaiterMethod.MakeGenericMethod(resultType).Invoke(null, new object[] { getFilesAsync });
|
||||
var results = awaiter?.GetType().GetRuntimeMethod("GetResult", new Type[0])?.Invoke(awaiter, null);
|
||||
var nameProperty = storageType.GetRuntimeProperty("Name");
|
||||
|
||||
var assemblies = new List<Assembly>();
|
||||
foreach (var result in (results as IEnumerable))
|
||||
{
|
||||
var name = (string)nameProperty.GetValue(result);
|
||||
if (string.Equals(Path.GetExtension(name), ".dll", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(Path.GetExtension(name), ".exe", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
try
|
||||
{
|
||||
assemblies.Add(Assembly.Load(new AssemblyName(Path.GetFileNameWithoutExtension(name))));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
return assemblies;
|
||||
}
|
||||
catch { }
|
||||
return null;
|
||||
}
|
||||
#endif
|
||||
|
||||
internal string GetXamlNamespace(string clrNamespace)
|
||||
{
|
||||
if (clrNamespace == null) // could happen on nested generic type (see bug #680385-comment#4). Not sure if null is correct though.
|
||||
|
@ -508,7 +620,7 @@ namespace Portable.Xaml
|
|||
[EnhancedXaml]
|
||||
protected internal virtual XamlMember GetProperty(PropertyInfo propertyInfo)
|
||||
{
|
||||
var key = new Tuple<MemberInfo, MemberInfo>(propertyInfo, null);
|
||||
var key = Tuple.Create(propertyInfo.DeclaringType, propertyInfo.Name);
|
||||
XamlMember member;
|
||||
if (member_cache.TryGetValue(key, out member))
|
||||
return member;
|
||||
|
@ -518,7 +630,7 @@ namespace Portable.Xaml
|
|||
[EnhancedXaml]
|
||||
protected internal virtual XamlMember GetEvent(EventInfo eventInfo)
|
||||
{
|
||||
var key = new Tuple<MemberInfo, MemberInfo>(eventInfo, null);
|
||||
var key = Tuple.Create(eventInfo.DeclaringType, eventInfo.Name);
|
||||
XamlMember member;
|
||||
if (member_cache.TryGetValue(key, out member))
|
||||
return member;
|
||||
|
@ -528,7 +640,7 @@ namespace Portable.Xaml
|
|||
[EnhancedXaml]
|
||||
protected internal virtual XamlMember GetAttachableProperty(string attachablePropertyName, MethodInfo getter, MethodInfo setter)
|
||||
{
|
||||
var key = new Tuple<MemberInfo, MemberInfo>(getter, setter);
|
||||
var key = Tuple.Create(getter?.DeclaringType ?? setter.DeclaringType, getter?.Name, setter?.Name);
|
||||
XamlMember member;
|
||||
if (member_cache.TryGetValue(key, out member))
|
||||
return member;
|
||||
|
@ -538,7 +650,7 @@ namespace Portable.Xaml
|
|||
[EnhancedXaml]
|
||||
protected internal virtual XamlMember GetAttachableEvent(string attachablePropertyName, MethodInfo adder)
|
||||
{
|
||||
var key = new Tuple<MemberInfo, MemberInfo>(adder, null);
|
||||
var key = Tuple.Create(adder.DeclaringType, adder.Name);
|
||||
XamlMember member;
|
||||
if (member_cache.TryGetValue(key, out member))
|
||||
return member;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -31,6 +31,7 @@ using Portable.Xaml.Schema;
|
|||
using System.Xml.Serialization;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Portable.Xaml
|
||||
{
|
||||
|
@ -79,83 +80,97 @@ namespace Portable.Xaml
|
|||
IList<XamlMember> constructorArguments;
|
||||
Dictionary<string, XamlMember> memberLookup;
|
||||
|
||||
public XamlType (Type underlyingType, XamlSchemaContext schemaContext)
|
||||
: this (underlyingType, schemaContext, null)
|
||||
public XamlType(Type underlyingType, XamlSchemaContext schemaContext)
|
||||
: this(underlyingType, schemaContext, null)
|
||||
{
|
||||
}
|
||||
|
||||
// static readonly Type [] predefined_types = {
|
||||
// typeof (XData), typeof (Uri), typeof (TimeSpan), typeof (PropertyDefinition), typeof (MemberDefinition), typeof (Reference)
|
||||
// };
|
||||
// static readonly Type [] predefined_types = {
|
||||
// typeof (XData), typeof (Uri), typeof (TimeSpan), typeof (PropertyDefinition), typeof (MemberDefinition), typeof (Reference)
|
||||
// };
|
||||
|
||||
public XamlType (Type underlyingType, XamlSchemaContext schemaContext, XamlTypeInvoker invoker)
|
||||
: this (schemaContext, invoker)
|
||||
public XamlType(Type underlyingType, XamlSchemaContext schemaContext, XamlTypeInvoker invoker)
|
||||
: this(schemaContext, invoker)
|
||||
{
|
||||
if (underlyingType == null)
|
||||
throw new ArgumentNullException ("underlyingType");
|
||||
throw new ArgumentNullException("underlyingType");
|
||||
type = underlyingType;
|
||||
underlying_type = type;
|
||||
|
||||
XamlType xt;
|
||||
if (XamlLanguage.InitializingTypes) {
|
||||
if (XamlLanguage.InitializingTypes)
|
||||
{
|
||||
// These are special. Only XamlLanguage members are with shorthand name.
|
||||
if (type == typeof (PropertyDefinition))
|
||||
if (type == typeof(PropertyDefinition))
|
||||
Name = "Property";
|
||||
else if (type == typeof (MemberDefinition))
|
||||
else if (type == typeof(MemberDefinition))
|
||||
Name = "Member";
|
||||
else
|
||||
Name = GetXamlName (type);
|
||||
Name = GetXamlName(type);
|
||||
PreferredXamlNamespace = XamlLanguage.Xaml2006Namespace;
|
||||
} else if ((xt = XamlLanguage.AllTypes.FirstOrDefault (t => t.UnderlyingType == type)) != null) {
|
||||
}
|
||||
else if ((xt = XamlLanguage.AllTypes.FirstOrDefault(t => t.UnderlyingType == type)) != null)
|
||||
{
|
||||
Name = xt.Name;
|
||||
PreferredXamlNamespace = XamlLanguage.Xaml2006Namespace;
|
||||
} else {
|
||||
Name = GetXamlName (type);
|
||||
PreferredXamlNamespace = schemaContext.GetXamlNamespace (type.Namespace) ?? String.Format ("clr-namespace:{0};assembly={1}", type.Namespace, type.GetTypeInfo().Assembly.GetName ().Name);
|
||||
}
|
||||
if (type.GetTypeInfo().IsGenericType) {
|
||||
else
|
||||
{
|
||||
Name = GetXamlName(type);
|
||||
var assembly = type.GetTypeInfo().Assembly;
|
||||
string assemblyName;
|
||||
if (assembly == typeof(bool).GetTypeInfo().Assembly)
|
||||
assemblyName = "mscorlib"; // .net Core
|
||||
else
|
||||
assemblyName = assembly.GetName().Name;
|
||||
PreferredXamlNamespace = schemaContext.GetXamlNamespace(type.Namespace) ?? String.Format("clr-namespace:{0};assembly={1}", type.Namespace, assemblyName);
|
||||
}
|
||||
if (type.GetTypeInfo().IsGenericType)
|
||||
{
|
||||
TypeArguments = type.GetTypeInfo().GetGenericArguments().Select(r => schemaContext.GetXamlType(r)).ToReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
public XamlType (string unknownTypeNamespace, string unknownTypeName, IList<XamlType> typeArguments, XamlSchemaContext schemaContext)
|
||||
: this (schemaContext, null)
|
||||
public XamlType(string unknownTypeNamespace, string unknownTypeName, IList<XamlType> typeArguments, XamlSchemaContext schemaContext)
|
||||
: this(schemaContext, null)
|
||||
{
|
||||
if (unknownTypeNamespace == null)
|
||||
throw new ArgumentNullException ("unknownTypeNamespace");
|
||||
throw new ArgumentNullException("unknownTypeNamespace");
|
||||
if (unknownTypeName == null)
|
||||
throw new ArgumentNullException ("unknownTypeName");
|
||||
throw new ArgumentNullException("unknownTypeName");
|
||||
if (schemaContext == null)
|
||||
throw new ArgumentNullException ("schemaContext");
|
||||
throw new ArgumentNullException("schemaContext");
|
||||
|
||||
type = typeof (object);
|
||||
type = typeof(object);
|
||||
Name = unknownTypeName;
|
||||
PreferredXamlNamespace = unknownTypeNamespace;
|
||||
TypeArguments = typeArguments == null || typeArguments.Count == 0 ? null : typeArguments.ToReadOnly();
|
||||
explicit_ns = unknownTypeNamespace;
|
||||
}
|
||||
|
||||
protected XamlType (string typeName, IList<XamlType> typeArguments, XamlSchemaContext schemaContext)
|
||||
: this (String.Empty, typeName, typeArguments, schemaContext)
|
||||
protected XamlType(string typeName, IList<XamlType> typeArguments, XamlSchemaContext schemaContext)
|
||||
: this(String.Empty, typeName, typeArguments, schemaContext)
|
||||
{
|
||||
}
|
||||
|
||||
XamlType (XamlSchemaContext schemaContext, XamlTypeInvoker invoker)
|
||||
XamlType(XamlSchemaContext schemaContext, XamlTypeInvoker invoker)
|
||||
{
|
||||
if (schemaContext == null)
|
||||
throw new ArgumentNullException ("schemaContext");
|
||||
throw new ArgumentNullException("schemaContext");
|
||||
SchemaContext = schemaContext;
|
||||
this.invoker = invoker;
|
||||
}
|
||||
|
||||
// populated properties
|
||||
|
||||
internal EventHandler<XamlSetMarkupExtensionEventArgs> SetMarkupExtensionHandler {
|
||||
get { return LookupSetMarkupExtensionHandler (); }
|
||||
internal EventHandler<XamlSetMarkupExtensionEventArgs> SetMarkupExtensionHandler
|
||||
{
|
||||
get { return LookupSetMarkupExtensionHandler(); }
|
||||
}
|
||||
|
||||
internal EventHandler<XamlSetTypeConverterEventArgs> SetTypeConverterHandler {
|
||||
get { return LookupSetTypeConverterHandler (); }
|
||||
internal EventHandler<XamlSetTypeConverterEventArgs> SetTypeConverterHandler
|
||||
{
|
||||
get { return LookupSetTypeConverterHandler(); }
|
||||
}
|
||||
|
||||
public IList<XamlType> AllowedContentTypes => allowedContentTypes.HasValue ? allowedContentTypes.Value : allowedContentTypes.Set(LookupAllowedContentTypes());
|
||||
|
@ -172,7 +187,7 @@ namespace Portable.Xaml
|
|||
|
||||
public XamlTypeInvoker Invoker => invoker ?? (invoker = LookupInvoker());
|
||||
|
||||
internal XamlCollectionKind CollectionKind => collectionKind ?? (collectionKind = LookupCollectionKind()).Value;
|
||||
internal XamlCollectionKind CollectionKind => collectionKind ?? (collectionKind = LookupCollectionKind()).Value;
|
||||
|
||||
public bool IsAmbient => flags.Get(TypeFlags.IsAmbient) ?? flags.Set(TypeFlags.IsAmbient, LookupIsAmbient());
|
||||
|
||||
|
@ -191,7 +206,7 @@ namespace Portable.Xaml
|
|||
|
||||
public bool IsNameScope => flags.Get(TypeFlags.IsNameScope) ?? flags.Set(TypeFlags.IsNameScope, LookupIsNameScope());
|
||||
|
||||
public bool IsNameValid => flags.Get(TypeFlags.IsNameValid) ?? flags.Set(TypeFlags.IsNameValid, XamlLanguage.IsValidXamlName (Name));
|
||||
public bool IsNameValid => flags.Get(TypeFlags.IsNameValid) ?? flags.Set(TypeFlags.IsNameValid, XamlLanguage.IsValidXamlName(Name));
|
||||
|
||||
public bool IsNullable => flags.Get(TypeFlags.IsNullable) ?? flags.Set(TypeFlags.IsNullable, LookupIsNullable());
|
||||
|
||||
|
@ -240,64 +255,65 @@ namespace Portable.Xaml
|
|||
}
|
||||
}
|
||||
|
||||
public static bool operator == (XamlType left, XamlType right)
|
||||
public static bool operator ==(XamlType left, XamlType right)
|
||||
{
|
||||
return ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.Equals (right);
|
||||
return ReferenceEquals(left, null) ? ReferenceEquals(right, null) : left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator != (XamlType left, XamlType right)
|
||||
public static bool operator !=(XamlType left, XamlType right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public bool Equals (XamlType other)
|
||||
|
||||
public bool Equals(XamlType other)
|
||||
{
|
||||
// It does not compare XamlSchemaContext.
|
||||
return !ReferenceEquals(other, null) &&
|
||||
UnderlyingType == other.UnderlyingType &&
|
||||
Name == other.Name &&
|
||||
PreferredXamlNamespace == other.PreferredXamlNamespace && TypeArguments.ListEquals (other.TypeArguments);
|
||||
PreferredXamlNamespace == other.PreferredXamlNamespace && TypeArguments.ListEquals(other.TypeArguments);
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
var a = obj as XamlType;
|
||||
return Equals (a);
|
||||
return Equals(a);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
if (UnderlyingType != null)
|
||||
return UnderlyingType.GetHashCode ();
|
||||
int x = Name.GetHashCode () << 7 + PreferredXamlNamespace.GetHashCode ();
|
||||
return UnderlyingType.GetHashCode();
|
||||
int x = Name.GetHashCode() << 7 + PreferredXamlNamespace.GetHashCode();
|
||||
if (TypeArguments != null)
|
||||
foreach (var t in TypeArguments)
|
||||
x = t.GetHashCode () + x << 5;
|
||||
x = t.GetHashCode() + x << 5;
|
||||
return x;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
public override string ToString()
|
||||
{
|
||||
return new XamlTypeName (this).ToString ();
|
||||
return new XamlTypeName(this).ToString();
|
||||
//return String.IsNullOrEmpty (PreferredXamlNamespace) ? Name : String.Concat ("{", PreferredXamlNamespace, "}", Name);
|
||||
}
|
||||
|
||||
internal bool CanConvertFrom (XamlType inputType)
|
||||
internal bool CanConvertFrom(XamlType inputType)
|
||||
{
|
||||
if (CanAssignFrom (inputType))
|
||||
if (CanAssignFrom(inputType))
|
||||
return true;
|
||||
|
||||
var tc = TypeConverter;
|
||||
if (tc != null) {
|
||||
return tc.ConverterInstance.CanConvertFrom (inputType?.UnderlyingType ?? typeof(object));
|
||||
if (tc != null)
|
||||
{
|
||||
return tc.ConverterInstance.CanConvertFrom(inputType?.UnderlyingType ?? typeof(object));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
internal bool CanAssignFrom (XamlType inputType)
|
||||
internal bool CanAssignFrom(XamlType inputType)
|
||||
{
|
||||
return inputType.CanAssignTo (this);
|
||||
return inputType.CanAssignTo(this);
|
||||
}
|
||||
|
||||
[EnhancedXaml]
|
||||
|
@ -328,7 +344,7 @@ namespace Portable.Xaml
|
|||
return name.EndsWith("`1", StringComparison.Ordinal) || name.EndsWith("`2", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public virtual bool CanAssignTo (XamlType xamlType)
|
||||
public virtual bool CanAssignTo(XamlType xamlType)
|
||||
{
|
||||
if (xamlType == null)
|
||||
return false;
|
||||
|
@ -337,26 +353,26 @@ namespace Portable.Xaml
|
|||
|
||||
if (UnderlyingType == null)
|
||||
return xamlType == XamlLanguage.Object;
|
||||
var ut = (xamlType.UnderlyingType ?? typeof (object)).GetTypeInfo();
|
||||
var ut = (xamlType.UnderlyingType ?? typeof(object)).GetTypeInfo();
|
||||
|
||||
// if we are assigning to a nullable type, we allow null
|
||||
if (ut.IsValueType
|
||||
if (ut.IsValueType
|
||||
&& ut.IsGenericType
|
||||
&& ut.GetGenericTypeDefinition () == typeof(Nullable<>)
|
||||
&& ut.GetGenericTypeDefinition() == typeof(Nullable<>)
|
||||
&& this == XamlLanguage.Null)
|
||||
return true;
|
||||
|
||||
if (xamlType.IsImmutableCollection && (IsCollection || IsDictionary))
|
||||
return true;
|
||||
|
||||
return ut.IsAssignableFrom (UnderlyingType.GetTypeInfo());
|
||||
return ut.IsAssignableFrom(UnderlyingType.GetTypeInfo());
|
||||
}
|
||||
|
||||
public XamlMember GetAliasedProperty (XamlDirective directive)
|
||||
public XamlMember GetAliasedProperty(XamlDirective directive)
|
||||
{
|
||||
XamlMember member;
|
||||
if (aliased_property_cache == null)
|
||||
aliased_property_cache = new Dictionary<XamlDirective, XamlMember> ();
|
||||
aliased_property_cache = new Dictionary<XamlDirective, XamlMember>();
|
||||
else if (aliased_property_cache.TryGetValue(directive, out member))
|
||||
return member;
|
||||
member = LookupAliasedProperty(directive);
|
||||
|
@ -364,12 +380,12 @@ namespace Portable.Xaml
|
|||
return member;
|
||||
}
|
||||
|
||||
public ICollection<XamlMember> GetAllAttachableMembers ()
|
||||
public ICollection<XamlMember> GetAllAttachableMembers()
|
||||
{
|
||||
return attachableMembers ?? (attachableMembers = LookupAllAttachableMembers().ToReadOnly());
|
||||
}
|
||||
|
||||
public ICollection<XamlMember> GetAllMembers ()
|
||||
public ICollection<XamlMember> GetAllMembers()
|
||||
{
|
||||
if (allMembers != null)
|
||||
return allMembers;
|
||||
|
@ -381,27 +397,27 @@ namespace Portable.Xaml
|
|||
return allMembers;
|
||||
}
|
||||
|
||||
public XamlMember GetAttachableMember (string name)
|
||||
public XamlMember GetAttachableMember(string name)
|
||||
{
|
||||
return LookupAttachableMember (name);
|
||||
return LookupAttachableMember(name);
|
||||
}
|
||||
|
||||
public XamlMember GetMember (string name)
|
||||
public XamlMember GetMember(string name)
|
||||
{
|
||||
XamlMember member;
|
||||
if (memberLookup == null)
|
||||
memberLookup = new Dictionary<string, XamlMember>();
|
||||
else if (memberLookup.TryGetValue(name, out member))
|
||||
return member;
|
||||
return memberLookup[name] = LookupMember (name, true);
|
||||
return memberLookup[name] = LookupMember(name, true);
|
||||
}
|
||||
|
||||
public IList<XamlType> GetPositionalParameters (int parameterCount)
|
||||
public IList<XamlType> GetPositionalParameters(int parameterCount)
|
||||
{
|
||||
return LookupPositionalParameters (parameterCount);
|
||||
return LookupPositionalParameters(parameterCount);
|
||||
}
|
||||
|
||||
public virtual IList<string> GetXamlNamespaces ()
|
||||
public virtual IList<string> GetXamlNamespaces()
|
||||
{
|
||||
if (xamlNamespaces != null)
|
||||
return xamlNamespaces;
|
||||
|
@ -439,92 +455,104 @@ namespace Portable.Xaml
|
|||
|
||||
// lookups
|
||||
|
||||
protected virtual XamlMember LookupAliasedProperty (XamlDirective directive)
|
||||
protected virtual XamlMember LookupAliasedProperty(XamlDirective directive)
|
||||
{
|
||||
XamlMember member = null;
|
||||
|
||||
if (directive == XamlLanguage.Key) {
|
||||
var a = this.GetCustomAttribute<DictionaryKeyPropertyAttribute> ();
|
||||
member = a != null ? GetMember (a.Name) : null;
|
||||
if (directive == XamlLanguage.Key)
|
||||
{
|
||||
var a = this.GetCustomAttribute<DictionaryKeyPropertyAttribute>();
|
||||
member = a != null ? GetMember(a.Name) : null;
|
||||
}
|
||||
else if (directive == XamlLanguage.Name) {
|
||||
var a = this.GetCustomAttribute<RuntimeNamePropertyAttribute> ();
|
||||
member = a != null ? GetMember (a.Name) : null;
|
||||
else if (directive == XamlLanguage.Name)
|
||||
{
|
||||
var a = this.GetCustomAttribute<RuntimeNamePropertyAttribute>();
|
||||
member = a != null ? GetMember(a.Name) : null;
|
||||
}
|
||||
else if (directive == XamlLanguage.Uid) {
|
||||
var a = this.GetCustomAttribute<UidPropertyAttribute> ();
|
||||
member = a != null ? GetMember (a.Name) : null;
|
||||
else if (directive == XamlLanguage.Uid)
|
||||
{
|
||||
var a = this.GetCustomAttribute<UidPropertyAttribute>();
|
||||
member = a != null ? GetMember(a.Name) : null;
|
||||
}
|
||||
else if (directive == XamlLanguage.Lang) {
|
||||
var a = this.GetCustomAttribute<XmlLangPropertyAttribute> ();
|
||||
member = a != null ? GetMember (a.Name) : null;
|
||||
else if (directive == XamlLanguage.Lang)
|
||||
{
|
||||
var a = this.GetCustomAttribute<XmlLangPropertyAttribute>();
|
||||
member = a != null ? GetMember(a.Name) : null;
|
||||
}
|
||||
return member;
|
||||
}
|
||||
|
||||
protected virtual IEnumerable<XamlMember> LookupAllAttachableMembers ()
|
||||
protected virtual IEnumerable<XamlMember> LookupAllAttachableMembers()
|
||||
{
|
||||
if (UnderlyingType == null)
|
||||
return BaseType != null ? BaseType.GetAllAttachableMembers() : Enumerable.Empty<XamlMember>();
|
||||
return DoLookupAllAttachableMembers().OrderBy(r => r, TypeExtensionMethods.MemberComparer);
|
||||
}
|
||||
|
||||
IEnumerable<XamlMember> DoLookupAllAttachableMembers ()
|
||||
IEnumerable<XamlMember> DoLookupAllAttachableMembers()
|
||||
{
|
||||
// based on http://msdn.microsoft.com/en-us/library/ff184560.aspx
|
||||
|
||||
var gl = new Dictionary<string,MethodInfo> ();
|
||||
var sl = new Dictionary<string,MethodInfo> ();
|
||||
var al = new Dictionary<string,MethodInfo> ();
|
||||
var gl = new Dictionary<string, MethodInfo>();
|
||||
var sl = new Dictionary<string, MethodInfo>();
|
||||
var al = new Dictionary<string, MethodInfo>();
|
||||
//var rl = new Dictionary<string,MethodInfo> ();
|
||||
var nl = new List<string> ();
|
||||
foreach (var mi in UnderlyingType.GetRuntimeMethods()) {
|
||||
var nl = new List<string>();
|
||||
foreach (var mi in UnderlyingType.GetRuntimeMethods())
|
||||
{
|
||||
if (!mi.IsStatic)
|
||||
continue;
|
||||
string name = null;
|
||||
if (mi.Name.StartsWith ("Get", StringComparison.Ordinal)) {
|
||||
if (mi.ReturnType == typeof (void))
|
||||
if (mi.Name.StartsWith("Get", StringComparison.Ordinal))
|
||||
{
|
||||
if (mi.ReturnType == typeof(void))
|
||||
continue;
|
||||
var args = mi.GetParameters ();
|
||||
var args = mi.GetParameters();
|
||||
if (args.Length != 1)
|
||||
continue;
|
||||
name = mi.Name.Substring (3);
|
||||
gl.Add (name, mi);
|
||||
} else if (mi.Name.StartsWith ("Set", StringComparison.Ordinal)) {
|
||||
name = mi.Name.Substring(3);
|
||||
gl.Add(name, mi);
|
||||
}
|
||||
else if (mi.Name.StartsWith("Set", StringComparison.Ordinal))
|
||||
{
|
||||
// looks like the return type is *ignored*
|
||||
//if (mi.ReturnType != typeof (void))
|
||||
// continue;
|
||||
var args = mi.GetParameters ();
|
||||
var args = mi.GetParameters();
|
||||
if (args.Length != 2)
|
||||
continue;
|
||||
name = mi.Name.Substring (3);
|
||||
sl.Add (name, mi);
|
||||
} else if (mi.Name.EndsWith ("Handler", StringComparison.Ordinal)) {
|
||||
var args = mi.GetParameters ();
|
||||
name = mi.Name.Substring(3);
|
||||
sl.Add(name, mi);
|
||||
}
|
||||
else if (mi.Name.EndsWith("Handler", StringComparison.Ordinal))
|
||||
{
|
||||
var args = mi.GetParameters();
|
||||
if (args.Length != 2)
|
||||
continue;
|
||||
if (mi.Name.StartsWith ("Add", StringComparison.Ordinal)) {
|
||||
name = mi.Name.Substring (3, mi.Name.Length - 3 - 7);
|
||||
al.Add (name, mi);
|
||||
if (mi.Name.StartsWith("Add", StringComparison.Ordinal))
|
||||
{
|
||||
name = mi.Name.Substring(3, mi.Name.Length - 3 - 7);
|
||||
al.Add(name, mi);
|
||||
}/* else if (mi.Name.StartsWith ("Remove", StringComparison.Ordinal)) {
|
||||
name = mi.Name.Substring (6, mi.Name.Length - 6 - 7);
|
||||
rl.Add (name, mi);
|
||||
}*/
|
||||
}
|
||||
if (name != null && !nl.Contains (name))
|
||||
nl.Add (name);
|
||||
if (name != null && !nl.Contains(name))
|
||||
nl.Add(name);
|
||||
}
|
||||
|
||||
foreach (var name in nl) {
|
||||
foreach (var name in nl)
|
||||
{
|
||||
MethodInfo m;
|
||||
var g = gl.TryGetValue (name, out m) ? m : null;
|
||||
var s = sl.TryGetValue (name, out m) ? m : null;
|
||||
var g = gl.TryGetValue(name, out m) ? m : null;
|
||||
var s = sl.TryGetValue(name, out m) ? m : null;
|
||||
if (g != null || s != null)
|
||||
yield return SchemaContext.GetAttachableProperty (name, g, s);
|
||||
var a = al.TryGetValue (name, out m) ? m : null;
|
||||
yield return SchemaContext.GetAttachableProperty(name, g, s);
|
||||
var a = al.TryGetValue(name, out m) ? m : null;
|
||||
//var r = rl.TryGetValue (name, out m) ? m : null;
|
||||
if (a != null)
|
||||
yield return SchemaContext.GetAttachableEvent (name, a);
|
||||
yield return SchemaContext.GetAttachableEvent(name, a);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,47 +563,48 @@ namespace Portable.Xaml
|
|||
return DoLookupAllMembers();
|
||||
}
|
||||
|
||||
IEnumerable<XamlMember> DoLookupAllMembers ()
|
||||
IEnumerable<XamlMember> DoLookupAllMembers()
|
||||
{
|
||||
// This is a hack that is likely required due to internal implementation difference in System.Uri. Our Uri has two readonly collection properties
|
||||
if (this == XamlLanguage.Uri)
|
||||
if (ReferenceEquals(this, XamlLanguage.Uri))
|
||||
yield break;
|
||||
|
||||
//var bf = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
|
||||
|
||||
foreach (var pi in UnderlyingType.GetRuntimeProperties()) {
|
||||
foreach (var pi in UnderlyingType.GetRuntimeProperties())
|
||||
{
|
||||
if (pi.GetPrivateGetMethod()?.IsStatic ?? pi.GetPrivateSetMethod()?.IsStatic ?? false)
|
||||
continue;
|
||||
if (pi.Name.Contains (".")) // exclude explicit interface implementations.
|
||||
if (pi.Name.Contains(".")) // exclude explicit interface implementations.
|
||||
continue;
|
||||
if (pi.CanRead &&
|
||||
if (/*pi.CanRead &&*/
|
||||
(
|
||||
pi.CanWrite
|
||||
|| IsCollectionType (pi.PropertyType)
|
||||
|| typeof (IXmlSerializable).GetTypeInfo().IsAssignableFrom (pi.PropertyType.GetTypeInfo())
|
||||
pi.CanWrite
|
||||
|| IsCollectionType(pi.PropertyType)
|
||||
|| typeof(IXmlSerializable).GetTypeInfo().IsAssignableFrom(pi.PropertyType.GetTypeInfo())
|
||||
|| pi.GetCustomAttribute<ConstructorArgumentAttribute>() != null
|
||||
)
|
||||
&& pi.GetIndexParameters ().Length == 0)
|
||||
yield return SchemaContext.GetProperty (pi);
|
||||
)
|
||||
&& pi.GetIndexParameters().Length == 0)
|
||||
yield return SchemaContext.GetProperty(pi);
|
||||
}
|
||||
foreach (var ei in UnderlyingType.GetRuntimeEvents())
|
||||
yield return SchemaContext.GetEvent (ei);
|
||||
yield return SchemaContext.GetEvent(ei);
|
||||
}
|
||||
|
||||
static bool IsPublicAccessor (MethodInfo mi)
|
||||
|
||||
static bool IsPublicAccessor(MethodInfo mi)
|
||||
{
|
||||
return mi != null && mi.IsPublic;
|
||||
}
|
||||
|
||||
bool IsCollectionType (Type type)
|
||||
bool IsCollectionType(Type type)
|
||||
{
|
||||
if (type == null)
|
||||
return false;
|
||||
var xt = SchemaContext.GetXamlType (type);
|
||||
var xt = SchemaContext.GetXamlType(type);
|
||||
return xt.CollectionKind != XamlCollectionKind.None;
|
||||
}
|
||||
|
||||
protected virtual IList<XamlType> LookupAllowedContentTypes ()
|
||||
protected virtual IList<XamlType> LookupAllowedContentTypes()
|
||||
{
|
||||
// the actual implementation is very different from what is documented :(
|
||||
return null;
|
||||
|
@ -592,31 +621,31 @@ namespace Portable.Xaml
|
|||
*/
|
||||
}
|
||||
|
||||
protected virtual XamlMember LookupAttachableMember (string name)
|
||||
protected virtual XamlMember LookupAttachableMember(string name)
|
||||
{
|
||||
return GetAllAttachableMembers().FirstOrDefault (m => m.Name == name);
|
||||
return GetAllAttachableMembers().FirstOrDefault(m => m.Name == name);
|
||||
}
|
||||
|
||||
protected virtual XamlType LookupBaseType ()
|
||||
protected virtual XamlType LookupBaseType()
|
||||
{
|
||||
if (UnderlyingType == null)
|
||||
return SchemaContext.GetXamlType (typeof (object));
|
||||
return SchemaContext.GetXamlType(typeof(object));
|
||||
else
|
||||
return type.GetTypeInfo().BaseType == null || type.GetTypeInfo().BaseType == typeof (object) ? null : SchemaContext.GetXamlType (type.GetTypeInfo().BaseType);
|
||||
return type.GetTypeInfo().BaseType == null || type.GetTypeInfo().BaseType == typeof(object) ? null : SchemaContext.GetXamlType(type.GetTypeInfo().BaseType);
|
||||
}
|
||||
|
||||
// This implementation is not verified. (No place to use.)
|
||||
protected virtual XamlCollectionKind LookupCollectionKind ()
|
||||
protected virtual XamlCollectionKind LookupCollectionKind()
|
||||
{
|
||||
if (UnderlyingType == null)
|
||||
return BaseType != null ? BaseType.CollectionKind : XamlCollectionKind.None;
|
||||
else if (type.IsArray)
|
||||
return XamlCollectionKind.Array;
|
||||
|
||||
else if (type.ImplementsAnyInterfacesOf (typeof (IDictionary), typeof (IDictionary<,>)))
|
||||
else if (type.ImplementsAnyInterfacesOf(typeof(IDictionary), typeof(IDictionary<,>)))
|
||||
return XamlCollectionKind.Dictionary;
|
||||
|
||||
else if (type.ImplementsAnyInterfacesOf (typeof (IList), typeof (ICollection<>)))
|
||||
else if (type.ImplementsAnyInterfacesOf(typeof(IList), typeof(ICollection<>)))
|
||||
return XamlCollectionKind.Collection;
|
||||
else if (IsImmutableCollection && type.ImplementsAnyInterfacesOf(typeof(IEnumerable))) // stack/queue
|
||||
return XamlCollectionKind.Collection;
|
||||
|
@ -624,12 +653,12 @@ namespace Portable.Xaml
|
|||
return XamlCollectionKind.None;
|
||||
}
|
||||
|
||||
protected virtual bool LookupConstructionRequiresArguments ()
|
||||
protected virtual bool LookupConstructionRequiresArguments()
|
||||
{
|
||||
if (UnderlyingType == null)
|
||||
return false;
|
||||
|
||||
var typeInfo = UnderlyingType.GetTypeInfo ();
|
||||
var typeInfo = UnderlyingType.GetTypeInfo();
|
||||
|
||||
if (typeInfo.IsValueType)
|
||||
return false;
|
||||
|
@ -648,34 +677,34 @@ namespace Portable.Xaml
|
|||
return typeInfo.GetConstructors().Where(r => r.IsPublic).All(r => r.GetParameters().Length > 0);
|
||||
}
|
||||
|
||||
protected virtual XamlMember LookupContentProperty ()
|
||||
protected virtual XamlMember LookupContentProperty()
|
||||
{
|
||||
var a = this.GetCustomAttribute<ContentPropertyAttribute> ();
|
||||
return a != null && a.Name != null ? GetMember (a.Name) : null;
|
||||
var a = this.GetCustomAttribute<ContentPropertyAttribute>();
|
||||
return a != null && a.Name != null ? GetMember(a.Name) : null;
|
||||
}
|
||||
|
||||
protected virtual IList<XamlType> LookupContentWrappers ()
|
||||
protected virtual IList<XamlType> LookupContentWrappers()
|
||||
{
|
||||
if (CustomAttributeProvider == null)
|
||||
return null;
|
||||
|
||||
var arr = CustomAttributeProvider.GetCustomAttributes (typeof (ContentWrapperAttribute), false);
|
||||
var arr = CustomAttributeProvider.GetCustomAttributes(typeof(ContentWrapperAttribute), false);
|
||||
if (arr == null || arr.Length == 0)
|
||||
return null;
|
||||
var l = new XamlType [arr.Length];
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
l [i] = SchemaContext.GetXamlType (((ContentWrapperAttribute) arr [i]).ContentWrapper);
|
||||
var l = new XamlType[arr.Length];
|
||||
for (int i = 0; i < l.Length; i++)
|
||||
l[i] = SchemaContext.GetXamlType(((ContentWrapperAttribute)arr[i]).ContentWrapper);
|
||||
return l;
|
||||
}
|
||||
|
||||
internal ICustomAttributeProvider CustomAttributeProvider => attributeProvider.HasValue ? attributeProvider.Value : attributeProvider.Set(LookupCustomAttributeProvider());
|
||||
|
||||
protected virtual ICustomAttributeProvider LookupCustomAttributeProvider ()
|
||||
protected virtual ICustomAttributeProvider LookupCustomAttributeProvider()
|
||||
{
|
||||
return UnderlyingType != null ? SchemaContext.GetCustomAttributeProvider(UnderlyingType) : null;
|
||||
}
|
||||
|
||||
protected virtual XamlValueConverter<XamlDeferringLoader> LookupDeferringLoader ()
|
||||
|
||||
protected virtual XamlValueConverter<XamlDeferringLoader> LookupDeferringLoader()
|
||||
{
|
||||
if (UnderlyingType == null)
|
||||
return null;
|
||||
|
@ -689,12 +718,12 @@ namespace Portable.Xaml
|
|||
return new XamlValueConverter<XamlDeferringLoader>(loaderType, null); // Why is the targetType null in System.Xaml?
|
||||
}
|
||||
|
||||
protected virtual XamlTypeInvoker LookupInvoker ()
|
||||
protected virtual XamlTypeInvoker LookupInvoker()
|
||||
{
|
||||
return new XamlTypeInvoker (this);
|
||||
return new XamlTypeInvoker(this);
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsAmbient ()
|
||||
protected virtual bool LookupIsAmbient()
|
||||
{
|
||||
return this.GetCustomAttribute<AmbientAttribute>() != null;
|
||||
}
|
||||
|
@ -702,7 +731,7 @@ namespace Portable.Xaml
|
|||
// It is documented as if it were to reflect spec. section 5.2,
|
||||
// but the actual behavior shows it is *totally* wrong.
|
||||
// Here I have implemented this based on the nunit test results. sigh.
|
||||
protected virtual bool LookupIsConstructible ()
|
||||
protected virtual bool LookupIsConstructible()
|
||||
{
|
||||
if (UnderlyingType == null)
|
||||
return true;
|
||||
|
@ -715,50 +744,51 @@ namespace Portable.Xaml
|
|||
return true;
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsMarkupExtension ()
|
||||
protected virtual bool LookupIsMarkupExtension()
|
||||
{
|
||||
return UnderlyingType != null && typeof (MarkupExtension).GetTypeInfo().IsAssignableFrom (UnderlyingType.GetTypeInfo());
|
||||
return UnderlyingType != null && typeof(MarkupExtension).GetTypeInfo().IsAssignableFrom(UnderlyingType.GetTypeInfo());
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsNameScope ()
|
||||
protected virtual bool LookupIsNameScope()
|
||||
{
|
||||
return UnderlyingType != null && typeof (INameScope).GetTypeInfo().IsAssignableFrom (UnderlyingType.GetTypeInfo());
|
||||
return UnderlyingType != null && typeof(INameScope).GetTypeInfo().IsAssignableFrom(UnderlyingType.GetTypeInfo());
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsNullable ()
|
||||
protected virtual bool LookupIsNullable()
|
||||
{
|
||||
return !type.GetTypeInfo().IsValueType || type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition () == typeof (Nullable<>);
|
||||
return !type.GetTypeInfo().IsValueType || type.GetTypeInfo().IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsPublic ()
|
||||
protected virtual bool LookupIsPublic()
|
||||
{
|
||||
return underlying_type == null || underlying_type.GetTypeInfo().IsPublic || underlying_type.GetTypeInfo().IsNestedPublic;
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsUnknown ()
|
||||
protected virtual bool LookupIsUnknown()
|
||||
{
|
||||
return UnderlyingType == null;
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsWhitespaceSignificantCollection ()
|
||||
protected virtual bool LookupIsWhitespaceSignificantCollection()
|
||||
{
|
||||
// probably for unknown types, it should preserve whitespaces.
|
||||
return IsUnknown || this.GetCustomAttribute<WhitespaceSignificantCollectionAttribute> () != null;
|
||||
return IsUnknown || this.GetCustomAttribute<WhitespaceSignificantCollectionAttribute>() != null;
|
||||
}
|
||||
|
||||
protected virtual bool LookupIsXData ()
|
||||
protected virtual bool LookupIsXData()
|
||||
{
|
||||
return CanAssignTo (SchemaContext.GetXamlType (typeof (IXmlSerializable)));
|
||||
return CanAssignTo(SchemaContext.GetXamlType(typeof(IXmlSerializable)));
|
||||
}
|
||||
|
||||
protected virtual XamlType LookupItemType ()
|
||||
protected virtual XamlType LookupItemType()
|
||||
{
|
||||
XamlType itemType;
|
||||
|
||||
var kind = CollectionKind;
|
||||
if (kind == XamlCollectionKind.Array)
|
||||
itemType = SchemaContext.GetXamlType(type.GetElementType());
|
||||
else if (kind == XamlCollectionKind.Dictionary) {
|
||||
else if (kind == XamlCollectionKind.Dictionary)
|
||||
{
|
||||
if (!IsGeneric)
|
||||
itemType = SchemaContext.GetXamlType(typeof(object));
|
||||
else
|
||||
|
@ -766,95 +796,97 @@ namespace Portable.Xaml
|
|||
}
|
||||
else if (kind != XamlCollectionKind.Collection)
|
||||
return null;
|
||||
else if (!IsGeneric)
|
||||
{
|
||||
// support custom collections that inherit ICollection<T>
|
||||
var collectionType = type.GetTypeInfo().GetInterfaces().FirstOrDefault(r => r.GetTypeInfo().IsGenericType && r.GetGenericTypeDefinition() == typeof(ICollection<>));
|
||||
if (collectionType != null)
|
||||
else if (!IsGeneric)
|
||||
{
|
||||
// support custom collections that inherit ICollection<T>
|
||||
var collectionType = type.GetTypeInfo().GetInterfaces().FirstOrDefault(r => r.GetTypeInfo().IsGenericType && r.GetGenericTypeDefinition() == typeof(ICollection<>));
|
||||
if (collectionType != null)
|
||||
itemType = SchemaContext.GetXamlType(collectionType.GetTypeInfo().GetGenericArguments()[0]);
|
||||
else
|
||||
itemType = SchemaContext.GetXamlType(typeof(object));
|
||||
}
|
||||
}
|
||||
else
|
||||
itemType = SchemaContext.GetXamlType(type.GetTypeInfo().GetGenericArguments()[0]);
|
||||
return itemType;
|
||||
}
|
||||
|
||||
protected virtual XamlType LookupKeyType ()
|
||||
protected virtual XamlType LookupKeyType()
|
||||
{
|
||||
if (!IsDictionary)
|
||||
return null;
|
||||
if (!IsGeneric)
|
||||
return SchemaContext.GetXamlType(typeof (object));
|
||||
return SchemaContext.GetXamlType (type.GetTypeInfo().GetGenericArguments() [0]);
|
||||
return SchemaContext.GetXamlType(typeof(object));
|
||||
return SchemaContext.GetXamlType(type.GetTypeInfo().GetGenericArguments()[0]);
|
||||
}
|
||||
|
||||
protected virtual XamlType LookupMarkupExtensionReturnType ()
|
||||
protected virtual XamlType LookupMarkupExtensionReturnType()
|
||||
{
|
||||
var a = this.GetCustomAttribute<MarkupExtensionReturnTypeAttribute> ();
|
||||
return a != null ? SchemaContext.GetXamlType (a.ReturnType) : null;
|
||||
var a = this.GetCustomAttribute<MarkupExtensionReturnTypeAttribute>();
|
||||
return a != null ? SchemaContext.GetXamlType(a.ReturnType) : null;
|
||||
}
|
||||
|
||||
protected virtual XamlMember LookupMember (string name, bool skipReadOnlyCheck)
|
||||
protected virtual XamlMember LookupMember(string name, bool skipReadOnlyCheck)
|
||||
{
|
||||
// FIXME: verify if this does not filter out events.
|
||||
return GetAllMembers().FirstOrDefault (m => m.Name == name && (skipReadOnlyCheck || !m.IsReadOnly || m.Type.IsCollection || m.Type.IsDictionary || m.Type.IsArray));
|
||||
return GetAllMembers().FirstOrDefault(m => m.Name == name && (skipReadOnlyCheck || !m.IsReadOnly || m.Type.IsCollection || m.Type.IsDictionary || m.Type.IsArray));
|
||||
}
|
||||
|
||||
protected virtual IList<XamlType> LookupPositionalParameters (int parameterCount)
|
||||
protected virtual IList<XamlType> LookupPositionalParameters(int parameterCount)
|
||||
{
|
||||
if (UnderlyingType == null/* || !IsMarkupExtension*/) // see nunit tests...
|
||||
return null;
|
||||
|
||||
// check if there is applicable ConstructorArgumentAttribute.
|
||||
// If there is, then return its type.
|
||||
if (parameterCount == 1) {
|
||||
foreach (var xm in GetAllMembers()) {
|
||||
var ca = xm.CustomAttributeProvider.GetCustomAttribute<ConstructorArgumentAttribute> (false);
|
||||
if (parameterCount == 1)
|
||||
{
|
||||
foreach (var xm in GetAllMembers())
|
||||
{
|
||||
var ca = xm.CustomAttributeProvider.GetCustomAttribute<ConstructorArgumentAttribute>(false);
|
||||
if (ca != null)
|
||||
return new XamlType [] {xm.Type};
|
||||
return new XamlType[] { xm.Type };
|
||||
}
|
||||
}
|
||||
|
||||
var methods = (from m in UnderlyingType.GetTypeInfo().GetConstructors() where m.GetParameters ().Length == parameterCount select m).ToList();
|
||||
var methods = (from m in UnderlyingType.GetTypeInfo().GetConstructors() where m.GetParameters().Length == parameterCount select m).ToList();
|
||||
if (methods.Count == 1)
|
||||
return (from p in methods [0].GetParameters () select SchemaContext.GetXamlType (p.ParameterType)).ToList();
|
||||
return (from p in methods[0].GetParameters() select SchemaContext.GetXamlType(p.ParameterType)).ToList();
|
||||
|
||||
if (SchemaContext.SupportMarkupExtensionsWithDuplicateArity)
|
||||
throw new NotSupportedException ("The default LookupPositionalParameters implementation does not allow duplicate arity of markup extensions");
|
||||
throw new NotSupportedException("The default LookupPositionalParameters implementation does not allow duplicate arity of markup extensions");
|
||||
return null;
|
||||
}
|
||||
|
||||
//static readonly BindingFlags flags_get_static = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
|
||||
|
||||
protected virtual EventHandler<XamlSetMarkupExtensionEventArgs> LookupSetMarkupExtensionHandler ()
|
||||
protected virtual EventHandler<XamlSetMarkupExtensionEventArgs> LookupSetMarkupExtensionHandler()
|
||||
{
|
||||
var a = this.GetCustomAttribute<XamlSetMarkupExtensionAttribute> ();
|
||||
var a = this.GetCustomAttribute<XamlSetMarkupExtensionAttribute>();
|
||||
if (a == null)
|
||||
return null;
|
||||
var mi = type.GetRuntimeMethods().FirstOrDefault(r => r.Name == a.XamlSetMarkupExtensionHandler && r.IsStatic);
|
||||
if (mi == null)
|
||||
throw new ArgumentException ("Binding to XamlSetMarkupExtensionHandler failed");
|
||||
return (EventHandler<XamlSetMarkupExtensionEventArgs>) mi.CreateDelegate(typeof (EventHandler<XamlSetMarkupExtensionEventArgs>));
|
||||
throw new ArgumentException("Binding to XamlSetMarkupExtensionHandler failed");
|
||||
return (EventHandler<XamlSetMarkupExtensionEventArgs>)mi.CreateDelegate(typeof(EventHandler<XamlSetMarkupExtensionEventArgs>));
|
||||
}
|
||||
|
||||
protected virtual EventHandler<XamlSetTypeConverterEventArgs> LookupSetTypeConverterHandler ()
|
||||
protected virtual EventHandler<XamlSetTypeConverterEventArgs> LookupSetTypeConverterHandler()
|
||||
{
|
||||
var a = this.GetCustomAttribute<XamlSetTypeConverterAttribute> ();
|
||||
var a = this.GetCustomAttribute<XamlSetTypeConverterAttribute>();
|
||||
if (a == null)
|
||||
return null;
|
||||
var mi = type.GetRuntimeMethods().FirstOrDefault(r => r.Name == a.XamlSetTypeConverterHandler && r.IsStatic);
|
||||
if (mi == null)
|
||||
throw new ArgumentException ("Binding to XamlSetTypeConverterHandler failed");
|
||||
return (EventHandler<XamlSetTypeConverterEventArgs>) mi.CreateDelegate (typeof (EventHandler<XamlSetTypeConverterEventArgs>));
|
||||
throw new ArgumentException("Binding to XamlSetTypeConverterHandler failed");
|
||||
return (EventHandler<XamlSetTypeConverterEventArgs>)mi.CreateDelegate(typeof(EventHandler<XamlSetTypeConverterEventArgs>));
|
||||
}
|
||||
|
||||
protected virtual bool LookupTrimSurroundingWhitespace ()
|
||||
protected virtual bool LookupTrimSurroundingWhitespace()
|
||||
{
|
||||
return this.GetCustomAttribute<TrimSurroundingWhitespaceAttribute> () != null;
|
||||
return this.GetCustomAttribute<TrimSurroundingWhitespaceAttribute>() != null;
|
||||
}
|
||||
|
||||
protected virtual XamlValueConverter<TypeConverter> LookupTypeConverter ()
|
||||
protected virtual XamlValueConverter<TypeConverter> LookupTypeConverter()
|
||||
{
|
||||
var t = UnderlyingType;
|
||||
if (t == null)
|
||||
|
@ -862,21 +894,33 @@ namespace Portable.Xaml
|
|||
|
||||
// equivalent to TypeExtension.
|
||||
// FIXME: not sure if it should be specially handled here.
|
||||
if (t == typeof (Type))
|
||||
t = typeof (TypeExtension);
|
||||
if (t == typeof(Type))
|
||||
t = typeof(TypeExtension);
|
||||
|
||||
var a = CustomAttributeProvider;
|
||||
var ca = a?.GetCustomAttribute<TypeConverterAttribute>(false);
|
||||
if (ca != null)
|
||||
return SchemaContext.GetValueConverter<TypeConverter> (Type.GetType (ca.ConverterTypeName), this);
|
||||
return SchemaContext.GetValueConverter<TypeConverter>(Type.GetType(ca.ConverterTypeName), this);
|
||||
|
||||
if (t == typeof (object)) // This is a special case. ConverterType is null.
|
||||
return SchemaContext.GetValueConverter<TypeConverter> (null, this);
|
||||
if (t == typeof(object)) // This is a special case. ConverterType is null.
|
||||
return SchemaContext.GetValueConverter<TypeConverter>(null, this);
|
||||
|
||||
if ((Nullable.GetUnderlyingType(t) ?? t) == typeof(DateTime))
|
||||
return SchemaContext.GetValueConverter<TypeConverter>(typeof(ComponentModel.DateTimeConverter), this);
|
||||
|
||||
// It's still not decent to check CollectionConverter.
|
||||
var tct = t.GetTypeConverter ()?.GetType ();
|
||||
if (tct != null && tct != typeof (TypeConverter)) //*PCL && tct != typeof (CollectionConverter)) //*PCL && tct != typeof (ReferenceConverter))
|
||||
return SchemaContext.GetValueConverter<TypeConverter> (tct, this);
|
||||
var tct = t.GetTypeConverter()?.GetType();
|
||||
if (tct != null && tct != typeof(TypeConverter)
|
||||
#if NETSTANDARD
|
||||
&& tct != typeof(CollectionConverter) //*PCL && tct != typeof (ReferenceConverter))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
return SchemaContext.GetValueConverter<TypeConverter>(tct, this);
|
||||
}
|
||||
if (type == typeof(Uri))
|
||||
return SchemaContext.GetValueConverter<TypeConverter>(typeof(UriTypeConverter), this);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2011 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -347,31 +347,29 @@ namespace Portable.Xaml
|
|||
// creates name-only XamlType. Also, it does not seem that it does not store this XamlType to XamlSchemaContext (Try GetXamlType(xtn) after reading such xaml node, it will return null).
|
||||
xt = new XamlType (sti.Namespace, sti.Name, sti.TypeName.TypeArguments == null ? null : sti.TypeName.TypeArguments.Select<XamlTypeName,XamlType> (xxtn => sctx.GetXamlType (xxtn)).ToArray (), sctx);
|
||||
}
|
||||
|
||||
bool isGetObject = false;
|
||||
if (currentMember != null && !xt.CanAssignTo (currentMember.Type)) {
|
||||
if (currentMember.DeclaringType != null && currentMember.DeclaringType.ContentProperty == currentMember)
|
||||
isGetObject = true;
|
||||
|
||||
// It could still be GetObject if current_member
|
||||
// is not a directive and current type is not
|
||||
// a markup extension.
|
||||
// (I'm not very sure about the condition;
|
||||
// it could be more complex.)
|
||||
// seealso: bug #682131
|
||||
else if (!(currentMember is XamlDirective) &&
|
||||
!xt.IsMarkupExtension)
|
||||
isGetObject = true;
|
||||
}
|
||||
|
||||
if (isGetObject) {
|
||||
yield return Node (XamlNodeType.GetObject, currentMember.Type);
|
||||
foreach (var ni in ReadMembers (parentType, currentMember.Type))
|
||||
// It could still be GetObject if current_member
|
||||
// is not a directive and current type is not
|
||||
// a markup extension.
|
||||
// (I'm not very sure about the condition;
|
||||
// it could be more complex.)
|
||||
// seealso: bug #682131
|
||||
if (currentMember != null
|
||||
&& !xt.CanAssignTo(currentMember.Type)
|
||||
&& xt != XamlLanguage.Reference
|
||||
&& (
|
||||
currentMember.DeclaringType?.ContentProperty == currentMember
|
||||
|| (!currentMember.IsDirective && !xt.IsMarkupExtension)
|
||||
)
|
||||
)
|
||||
{
|
||||
yield return Node(XamlNodeType.GetObject, currentMember.Type);
|
||||
foreach (var ni in ReadMembers(parentType, currentMember.Type))
|
||||
yield return ni;
|
||||
yield return Node (XamlNodeType.EndObject, currentMember.Type);
|
||||
yield return Node(XamlNodeType.EndObject, currentMember.Type);
|
||||
yield break;
|
||||
}
|
||||
// else
|
||||
|
||||
|
||||
yield return Node (XamlNodeType.StartObject, xt);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -214,13 +214,11 @@ namespace Portable.Xaml
|
|||
WritePendingStartMember (XamlNodeType.EndMember);
|
||||
|
||||
var member = CurrentMember;
|
||||
if (member == XamlLanguage.Initialization)
|
||||
if (ReferenceEquals(member, XamlLanguage.Initialization))
|
||||
return;
|
||||
if (member == XamlLanguage.Items)
|
||||
if (ReferenceEquals(member, XamlLanguage.Items))
|
||||
return;
|
||||
if (member.Type.IsCollection && member.IsReadOnly)
|
||||
return;
|
||||
if (member.DeclaringType != null && member == member.DeclaringType.ContentProperty)
|
||||
if (member == member.TargetType?.ContentProperty)
|
||||
return;
|
||||
|
||||
if (inside_toplevel_positional_parameter) {
|
||||
|
@ -287,18 +285,23 @@ namespace Portable.Xaml
|
|||
|
||||
protected override void OnWriteGetObject ()
|
||||
{
|
||||
if (object_states.Count > 1) {
|
||||
var state = object_states.Pop ();
|
||||
|
||||
if (!CurrentMember.Type.IsCollection)
|
||||
throw new InvalidOperationException (String.Format ("WriteGetObject method can be invoked only when current member '{0}' is of collection type", CurrentMember));
|
||||
if (object_states.Count > 1)
|
||||
{
|
||||
var state = object_states.Pop();
|
||||
|
||||
WritePendingStartMember (XamlNodeType.GetObject);
|
||||
var member = CurrentMember;
|
||||
if (!member.Type.IsCollection && !member.Type.IsDictionary)
|
||||
throw new InvalidOperationException(String.Format("WriteGetObject method can be invoked only when current member '{0}' is of collection or dictionary type", CurrentMember));
|
||||
WritePendingStartMember(XamlNodeType.GetObject);
|
||||
|
||||
object_states.Push (state);
|
||||
object_states.Push(state);
|
||||
}
|
||||
else
|
||||
WritePendingStartMember (XamlNodeType.GetObject);
|
||||
{
|
||||
var member = CurrentMember;
|
||||
WritePendingStartMember(XamlNodeType.GetObject);
|
||||
}
|
||||
}
|
||||
|
||||
void WritePendingStartMember (XamlNodeType nodeType)
|
||||
|
@ -316,13 +319,11 @@ namespace Portable.Xaml
|
|||
|
||||
protected override void OnWriteStartMember (XamlMember member)
|
||||
{
|
||||
if (member == XamlLanguage.Initialization)
|
||||
if (ReferenceEquals(member, XamlLanguage.Initialization))
|
||||
return;
|
||||
if (member == XamlLanguage.Items)
|
||||
if (ReferenceEquals(member, XamlLanguage.Items))
|
||||
return;
|
||||
if (member.Type.IsCollection && member.IsReadOnly)
|
||||
return;
|
||||
if (member.DeclaringType != null && member == member.DeclaringType.ContentProperty)
|
||||
if (member == member.TargetType?.ContentProperty)
|
||||
return;
|
||||
|
||||
WritePendingValue (XamlNodeType.Value);
|
||||
|
@ -335,7 +336,7 @@ namespace Portable.Xaml
|
|||
// the second constructor argument.
|
||||
// (Here "top-level" means an object that involves
|
||||
// StartObject i.e. the root or a collection item.)
|
||||
var posprms = member == XamlLanguage.PositionalParameters && IsAtTopLevelObject () && object_states.Peek ().Type.HasPositionalParameters (service_provider) ? state.Type.GetSortedConstructorArguments ().GetEnumerator () : null;
|
||||
var posprms = ReferenceEquals(member, XamlLanguage.PositionalParameters) && IsAtTopLevelObject () && object_states.Peek ().Type.HasPositionalParameters (service_provider) ? state.Type.GetSortedConstructorArguments ().GetEnumerator () : null;
|
||||
if (posprms != null) {
|
||||
posprms.MoveNext ();
|
||||
var arg = posprms.Current;
|
||||
|
@ -352,7 +353,7 @@ namespace Portable.Xaml
|
|||
w.WriteString ("=");
|
||||
}
|
||||
}
|
||||
else if (member == XamlLanguage.PositionalParameters && posprms == null && state.Type.GetSortedConstructorArguments ().All (m => m == state.Type.ContentProperty)) // PositionalParameters and ContentProperty, excluding such cases that it is already processed above (as attribute).
|
||||
else if (ReferenceEquals(member, XamlLanguage.PositionalParameters) && posprms == null && state.Type.GetSortedConstructorArguments ().All (m => m == state.Type.ContentProperty)) // PositionalParameters and ContentProperty, excluding such cases that it is already processed above (as attribute).
|
||||
OnWriteStartMemberContent (state.Type, member);
|
||||
else {
|
||||
switch (IsAttribute (state.Type, member)) {
|
||||
|
@ -377,26 +378,26 @@ namespace Portable.Xaml
|
|||
var parentMember = object_states.Peek().CurrentMemberState?.Member;
|
||||
object_states.Push (tmp);
|
||||
|
||||
return parentMember == XamlLanguage.Items;
|
||||
return ReferenceEquals(parentMember, XamlLanguage.Items);
|
||||
}
|
||||
|
||||
AllowedMemberLocations IsAttribute (XamlType ownerType, XamlMember xm)
|
||||
{
|
||||
var xt = ownerType;
|
||||
var mt = xm.Type;
|
||||
if (xm == XamlLanguage.Key) {
|
||||
if (ReferenceEquals(xm, XamlLanguage.Key)) {
|
||||
var tmp = object_states.Pop ();
|
||||
mt = object_states.Peek ().Type.KeyType;
|
||||
object_states.Push (tmp);
|
||||
}
|
||||
|
||||
if (xm == XamlLanguage.Initialization)
|
||||
if (ReferenceEquals(xm, XamlLanguage.Initialization))
|
||||
return AllowedMemberLocations.MemberElement;
|
||||
if (mt.HasPositionalParameters (service_provider))
|
||||
return AllowedMemberLocations.Attribute;
|
||||
if (w.WriteState == WriteState.Content)
|
||||
return AllowedMemberLocations.MemberElement;
|
||||
if (xt.IsDictionary && xm != XamlLanguage.Key)
|
||||
if (xt.IsDictionary && !ReferenceEquals(xm, XamlLanguage.Key))
|
||||
return AllowedMemberLocations.MemberElement; // as each item holds a key.
|
||||
|
||||
var xd = xm as XamlDirective;
|
||||
|
@ -465,7 +466,7 @@ namespace Portable.Xaml
|
|||
// indent around XData, I assume they do this, instead
|
||||
// of examining valid Text value by creating XmlReader
|
||||
// and call XmlWriter.WriteNode().
|
||||
if (xm.DeclaringType == XamlLanguage.XData && xm == XamlLanguage.XData.GetMember ("Text")) {
|
||||
if (ReferenceEquals(xm.DeclaringType, XamlLanguage.XData) && xm == XamlLanguage.XData.GetMember ("Text")) {
|
||||
w.WriteRaw (s);
|
||||
hasPendingValue = false;
|
||||
pendingValue = null;
|
||||
|
|
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 22 KiB |
После Ширина: | Высота: | Размер: 26 KiB |
После Ширина: | Высота: | Размер: 3.2 KiB |
После Ширина: | Высота: | Размер: 548 B |
После Ширина: | Высота: | Размер: 1.4 KiB |
После Ширина: | Высота: | Размер: 23 KiB |
|
@ -7,23 +7,29 @@ namespace MonoTests.Portable.Xaml
|
|||
static class Compat
|
||||
{
|
||||
|
||||
#if PCL
|
||||
#if PCL
|
||||
|
||||
#if PCL136
|
||||
#if CORE
|
||||
public const string Version = "core";
|
||||
#elif WINDOWS_UWP
|
||||
public const string Version = "uwp";
|
||||
#elif NETSTANDARD
|
||||
public const string Version = "netstandard";
|
||||
#elif PCL136
|
||||
public const string Version = "pcl136";
|
||||
#elif PCL259
|
||||
#elif PCL259
|
||||
public const string Version = "pcl259";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
public const string Namespace = "Portable.Xaml";
|
||||
public const string Prefix = "px";
|
||||
public static bool IsPortableXaml = true;
|
||||
#else
|
||||
#else
|
||||
public const string Version = "net_4_5";
|
||||
public const string Namespace = "System.Xaml";
|
||||
public const string Prefix = "sx";
|
||||
public static bool IsPortableXaml = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
public const string TestAssemblyName = "Portable.Xaml_test_" + Version;
|
||||
|
||||
|
@ -32,23 +38,27 @@ namespace MonoTests.Portable.Xaml
|
|||
|
||||
public static string Fixup(this string str)
|
||||
{
|
||||
#if PCL
|
||||
#if PCL
|
||||
return str;
|
||||
#else
|
||||
#else
|
||||
return str
|
||||
.Replace ("Portable.Xaml.Markup", "System.Windows.Markup")
|
||||
.Replace ("Portable.Xaml", Namespace);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !NETSTANDARD
|
||||
public static Type GetTypeInfo(this Type type) => type;
|
||||
#endif
|
||||
|
||||
public static string UpdateXml(this string str)
|
||||
{
|
||||
return str.Replace ("net_4_0", Compat.Version)
|
||||
return str.Replace("net_4_0", Compat.Version)
|
||||
.Replace("net_4_5", Compat.Version)
|
||||
.Replace ("clr-namespace:Portable.Xaml;assembly=Portable.Xaml", $"clr-namespace:{Compat.Namespace};assembly={Compat.Namespace}")
|
||||
.Replace ($" px:", $" {Compat.Prefix}:")
|
||||
.Replace ($"xmlns:px", $"xmlns:{Compat.Prefix}")
|
||||
.Replace ("\r", "")
|
||||
.Replace("clr-namespace:Portable.Xaml;assembly=Portable.Xaml", $"clr-namespace:{Compat.Namespace};assembly={Compat.Namespace}")
|
||||
.Replace($" px:", $" {Compat.Prefix}:")
|
||||
.Replace($"xmlns:px", $"xmlns:{Compat.Prefix}")
|
||||
.Replace("\r", "")
|
||||
.Replace("\n", Environment.NewLine);
|
||||
}
|
||||
|
||||
|
@ -60,7 +70,9 @@ namespace MonoTests.Portable.Xaml
|
|||
public static string GetTestFile (string fileName)
|
||||
{
|
||||
return Path.Combine (
|
||||
//Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location),
|
||||
#if !WINDOWS_UWP
|
||||
Path.GetDirectoryName (typeof(Compat).GetTypeInfo().Assembly.Location),
|
||||
#endif
|
||||
"XmlFiles",
|
||||
fileName);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<forms:WindowsPage
|
||||
x:Class="MonoTests.Portable.Xaml.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:MonoTests.Portable.Xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:forms="using:Xamarin.Forms.Platform.UWP"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
</Grid>
|
||||
</forms:WindowsPage>
|
|
@ -0,0 +1,67 @@
|
|||
// Copyright (c) 2017 Charlie Poole
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ***********************************************************************
|
||||
|
||||
using System.Reflection;
|
||||
using NUnit.Runner.Services;
|
||||
|
||||
namespace MonoTests.Portable.Xaml
|
||||
{
|
||||
public sealed partial class MainPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Windows Universal will not load all tests within the current project,
|
||||
// you must do it explicitly below
|
||||
var nunit = new NUnit.Runner.App();
|
||||
|
||||
// If you want to add tests in another assembly, add a reference and
|
||||
// duplicate the following line with a type from the referenced assembly
|
||||
nunit.AddTestAssembly(typeof(MainPage).GetTypeInfo().Assembly);
|
||||
|
||||
// Available options for testing
|
||||
nunit.Options = new TestOptions
|
||||
{
|
||||
// If True, the tests will run automatically when the app starts
|
||||
// otherwise you must run them manually.
|
||||
AutoRun = true,
|
||||
|
||||
// If True, the application will terminate automatically after running the tests.
|
||||
//TerminateAfterExecution = true,
|
||||
|
||||
// Information about the tcp listener host and port.
|
||||
// For now, send result as XML to the listening server.
|
||||
// NOTE: Your UWP App must have Private Networks capability enabled
|
||||
//TcpWriterParameters = new TcpWriterInfo("192.168.0.108", 13000),
|
||||
|
||||
// Creates a NUnit Xml result file on the host file system using PCLStorage library.
|
||||
CreateXmlResultFile = false,
|
||||
|
||||
// Choose a different path for the xml result file
|
||||
// ResultFilePath = System.IO.Path.Combine(Windows.Storage.ApplicationData.Current.TemporaryFolder.Path, "Nunit", "Results.xml")
|
||||
};
|
||||
|
||||
LoadApplication(nunit);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Identity Name="89e49d26-a6df-4746-af3f-0a8faa4ad383" Publisher="CN=curti" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="89e49d26-a6df-4746-af3f-0a8faa4ad383" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>Portable.Xaml.Tests.UWP</DisplayName>
|
||||
<PublisherDisplayName>curti</PublisherDisplayName>
|
||||
<Logo>Assets\NUnitStoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="vstest.executionengine.universal.App" Executable="$targetnametoken$.exe" EntryPoint="MonoTest.Portable.Xaml.App">
|
||||
<uap:VisualElements DisplayName="Portable.Xaml UWP Tests" Square150x150Logo="Assets\NUnitSquare150x150Logo.png" Square44x44Logo="Assets\NUnitSquare44x44Logo.png" Description="Tests for Portable.Xaml" BackgroundColor="transparent">
|
||||
<uap:DefaultTile Wide310x150Logo="Assets\NUnitWide310x150Logo.png">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="Assets\NUnitSplashScreen.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClientServer" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
||||
<RootNamespace>MonoTests.Portable.Xaml</RootNamespace>
|
||||
<AssemblyName>Portable.Xaml_test_core</AssemblyName>
|
||||
<BaseIntermediateOutputPath>..\..\artifacts\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>..\..\artifacts\netcoreapp1.1\Debug</OutputPath>
|
||||
<DefineConstants>TRACE;NETSTANDARD;PCL;CORE;DEBUG;NETCOREAPP1_1</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>
|
||||
</DebugType>
|
||||
<OutputPath>..\..\artifacts\netcoreapp1.1\Release</OutputPath>
|
||||
<DefineConstants>TRACE;RELEASE;NETCOREAPP1_1;NETSTANDARD;PCL;CORE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NUnit" Version="3.6.1" />
|
||||
<PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Portable.Xaml\Portable.Xaml-netstandard1.3.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="MainTestPage.*" />
|
||||
<Compile Remove="UnitTestApp.*" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="XmlFiles\*.*" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -109,17 +109,17 @@
|
|||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable">
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Collections.Immutable">
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{e9dccdcc-03a8-4bd1-888d-cee86468a15a}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<NoWarn>1699</NoWarn>
|
||||
<NoStdLib>True</NoStdLib>
|
||||
<NoConfig>False</NoConfig>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<AssemblyName>Portable.Xaml_test_netstandard</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<BaseIntermediateOutputPath>..\..\artifacts\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<DefineConstants>DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;PCL259;PCL;NETSTANDARD</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<OutputPath>..\..\artifacts\netstandard1.3\Debug</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_3_0;NET_3_5;NET_4_0;NET_4_5;PCL259;PCL;NETSTANDARD</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<OutputPath>..\..\artifacts\netstandard1.3\Release</OutputPath>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
|
||||
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
|
||||
is a problem to compile the Mono mscorlib.dll -->
|
||||
<PropertyGroup>
|
||||
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Compile Include="Categories.cs" />
|
||||
<Compile Include="System.Windows.Markup\ArrayExtensionTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\ReferenceTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\StaticExtensionTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\TypeExtensionConverterTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\TypeExtensionTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\ValueSerializerAttributeTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\ValueSerializerTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\XDataTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlMemberInvokerTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlTypeInvokerTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlTypeNameTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlTypeTypeConverterTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlValueConverterTest.cs" />
|
||||
<Compile Include="System.Xaml\AmbientPropertyValueTest.cs" />
|
||||
<Compile Include="System.Xaml\AttachableMemberIdentifierTest.cs" />
|
||||
<Compile Include="System.Xaml\AttachablePropertyServicesTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectWriterCollectionTests.cs" />
|
||||
<Compile Include="System.Xaml\DummyValueSerializerContext.cs" />
|
||||
<Compile Include="System.Xaml\NamespaceDeclarationTest.cs" />
|
||||
<Compile Include="System.Xaml\TestedTypes.cs" />
|
||||
<Compile Include="System.Xaml\ValueSerializerContextTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlBackgroundReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlDirectiveTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlDuplicateMemberExceptionTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlLanguageTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlMemberTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlNodeQueueTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectEventArgsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectReaderSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectWriterSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectWriterTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlReaderSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlReaderTestBase.cs" />
|
||||
<Compile Include="System.Xaml\XamlSchemaContextSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlSchemaContextTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlTypeTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlReaderSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlWriterSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlWriterTest.cs" />
|
||||
<Compile Include="Compat.cs" />
|
||||
<Compile Include="System.Xaml\XamlNodeListTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\XamlDeferLoadTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlDeferringLoaderTest.cs" />
|
||||
</ItemGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.Immutable">
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Collections.NonGeneric">
|
||||
<HintPath>..\packages\System.Collections.NonGeneric.4.3.0\lib\net46\System.Collections.NonGeneric.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System.ComponentModel.Primitives">
|
||||
<HintPath>..\packages\System.ComponentModel.Primitives.4.3.0\lib\net45\System.ComponentModel.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.TypeConverter">
|
||||
<HintPath>..\packages\System.ComponentModel.TypeConverter.4.3.0\lib\net462\System.ComponentModel.TypeConverter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="XmlFiles\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Portable.Xaml\Portable.Xaml-netstandard1.3.csproj">
|
||||
<Project>{CDC8F791-56FC-4B15-AAD2-BC460657CC02}</Project>
|
||||
<Name>Portable.Xaml-netstandard1.3</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -109,12 +109,12 @@
|
|||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.6.1\lib\net40\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
|
@ -125,13 +125,13 @@
|
|||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Portable.Xaml\Portable.Xaml-pcl136.csproj">
|
||||
<Project>{A283EEF5-D2BF-47DD-AFD6-A1DB3DF7CDA0}</Project>
|
||||
<Project>{a283eef5-d2bf-47dd-afd6-a1db3df7cda0}</Project>
|
||||
<Name>Portable.Xaml-pcl136</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -109,14 +109,14 @@
|
|||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=3.6.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Collections.Immutable">
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.2.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<HintPath>..\packages\System.Collections.Immutable.1.3.1\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -0,0 +1,383 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{1B4909D0-ECFB-4E32-8C02-B164DB1D64C6}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>MonoTests.Portable.Xaml</RootNamespace>
|
||||
<AssemblyName>Portable.Xaml_test_uwp</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.15063.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>UnitTestProject2_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion>
|
||||
<BaseIntermediateOutputPath>..\..\artifacts\obj\Portable.Xaml-tests-uwp</BaseIntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\artifacts\uwp\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;PCL;NETSTANDARD</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\..\artifacts\uwp\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;PCL;NETSTANDARD</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\artifacts\uwp\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;PCL;NETSTANDARD</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>..\..\artifacts\uwp\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;PCL;NETSTANDARD</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\..\artifacts\uwp\x64\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS;PCL;NETSTANDARD</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>..\..\artifacts\uwp\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;PCL;NETSTANDARD</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<SDKReference Include="TestPlatform.Universal, Version=$(UnitTestPlatformVersion)" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Categories.cs" />
|
||||
<Compile Include="Compat.cs" />
|
||||
<Compile Include="MainTestPage.xaml.cs">
|
||||
<DependentUpon>MainTestPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="System.Windows.Markup\ArrayExtensionTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\ReferenceTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\StaticExtensionTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\TypeExtensionConverterTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\TypeExtensionTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\ValueSerializerAttributeTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\ValueSerializerTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\XamlDeferLoadTest.cs" />
|
||||
<Compile Include="System.Windows.Markup\XDataTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlMemberInvokerTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlTypeInvokerTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlTypeNameTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlTypeTypeConverterTest.cs" />
|
||||
<Compile Include="System.Xaml.Schema\XamlValueConverterTest.cs" />
|
||||
<Compile Include="System.Xaml\AmbientPropertyValueTest.cs" />
|
||||
<Compile Include="System.Xaml\AttachableMemberIdentifierTest.cs" />
|
||||
<Compile Include="System.Xaml\AttachablePropertyServicesTest.cs" />
|
||||
<Compile Include="System.Xaml\DummyValueSerializerContext.cs" />
|
||||
<Compile Include="System.Xaml\NamespaceDeclarationTest.cs" />
|
||||
<Compile Include="System.Xaml\TestedTypes.cs" />
|
||||
<Compile Include="System.Xaml\ValueSerializerContextTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlBackgroundReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlDeferringLoaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlDirectiveTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlDuplicateMemberExceptionTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlLanguageTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlMemberTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlNodeListTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlNodeQueueTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectEventArgsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectReaderSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectWriterCollectionTests.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectWriterSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlObjectWriterTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlReaderSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlReaderTestBase.cs" />
|
||||
<Compile Include="System.Xaml\XamlSchemaContextSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlSchemaContextTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlTypeTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlReaderSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlReaderTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlWriterSettingsTest.cs" />
|
||||
<Compile Include="System.Xaml\XamlXmlWriterTest.cs" />
|
||||
<Compile Include="UnitTestApp.xaml.cs">
|
||||
<DependentUpon>UnitTestApp.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="UnitTestApp.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="System.Windows.Markup\ChangeLog" />
|
||||
<None Include="System.Xaml.Schema\ChangeLog" />
|
||||
<None Include="System.Xaml\ChangeLog" />
|
||||
<None Include="UnitTestProject2_TemporaryKey.pfx" />
|
||||
<None Include="XmlFiles\ChangeLog" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\NUnitLockScreenLogo.scale-200.png" />
|
||||
<Content Include="Assets\NUnitSplashScreen.scale-200.png" />
|
||||
<Content Include="Assets\NUnitSquare150x150Logo.scale-200.png" />
|
||||
<Content Include="Assets\NUnitSquare44x44Logo.scale-200.png" />
|
||||
<Content Include="Assets\NUnitSquare44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="Assets\NUnitStoreLogo.png" />
|
||||
<Content Include="Assets\NUnitWide310x150Logo.scale-200.png" />
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
<Content Include="XmlFiles\AbstractContainer.xml" />
|
||||
<Content Include="XmlFiles\AbstractWrapper.xml" />
|
||||
<Content Include="XmlFiles\AmbientPropertyContainer.xml" />
|
||||
<Content Include="XmlFiles\AmbientPropertyContainer2.xml" />
|
||||
<Content Include="XmlFiles\AmbientPropertyContainer3.xml" />
|
||||
<Content Include="XmlFiles\AmbientPropertyContainer4.xml" />
|
||||
<Content Include="XmlFiles\ArgumentAttributed.xml" />
|
||||
<Content Include="XmlFiles\ArgumentMultipleTypesFromAttribute.xml" />
|
||||
<Content Include="XmlFiles\ArgumentMultipleTypesFromInt.xml" />
|
||||
<Content Include="XmlFiles\ArgumentMultipleTypesFromString.xml" />
|
||||
<Content Include="XmlFiles\ArgumentNonAttributed.xml" />
|
||||
<Content Include="XmlFiles\ArgumentWithIntConstructorFromAttribute.xml" />
|
||||
<Content Include="XmlFiles\ArgumentWithIntConstructorFromInt.xml" />
|
||||
<Content Include="XmlFiles\ArgumentWithIntConstructorFromString.xml" />
|
||||
<Content Include="XmlFiles\ArrayExtension.xml" />
|
||||
<Content Include="XmlFiles\ArrayExtension2.xml" />
|
||||
<Content Include="XmlFiles\ArrayList.xml" />
|
||||
<Content Include="XmlFiles\Array_Int32.xml" />
|
||||
<Content Include="XmlFiles\AttachedProperty.xml" />
|
||||
<Content Include="XmlFiles\CollectionContentProperty.xml" />
|
||||
<Content Include="XmlFiles\CollectionContentProperty2.xml" />
|
||||
<Content Include="XmlFiles\CollectionContentPropertyX.xml" />
|
||||
<Content Include="XmlFiles\CollectionContentPropertyX2.xml" />
|
||||
<Content Include="XmlFiles\ComplexPositionalParameterWrapper.xml" />
|
||||
<Content Include="XmlFiles\ComplexPositionalParameterWrapper2.xml" />
|
||||
<Content Include="XmlFiles\ContentIncluded.xml" />
|
||||
<Content Include="XmlFiles\ContentPropertyContainer.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithChild.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithChildExtensionAndNamedProperty.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithCommasInNamedValue.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithCommasInPositionalValue.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithEscapeChars.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithPositionalAndNamed.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithPositionalChild.xml" />
|
||||
<Content Include="XmlFiles\CustomExtensionWithPositonalAfterExplicitProperty.xml" />
|
||||
<Content Include="XmlFiles\DateTime.xml" />
|
||||
<Content Include="XmlFiles\DateTime2.xml" />
|
||||
<Content Include="XmlFiles\DateTime3.xml" />
|
||||
<Content Include="XmlFiles\DateTime4.xml" />
|
||||
<Content Include="XmlFiles\DateTime5.xml" />
|
||||
<Content Include="XmlFiles\DateTime6.xml" />
|
||||
<Content Include="XmlFiles\DefaultNamespaces.xml" />
|
||||
<Content Include="XmlFiles\DefaultNamespaces_WithDefinedNamespace.xml" />
|
||||
<Content Include="XmlFiles\DeferredLoadingCollectionContainer.xml" />
|
||||
<Content Include="XmlFiles\DeferredLoadingContainerMember.xml" />
|
||||
<Content Include="XmlFiles\DeferredLoadingContainerMemberStringType.xml" />
|
||||
<Content Include="XmlFiles\DeferredLoadingContainerType.xml" />
|
||||
<Content Include="XmlFiles\DeferredLoadingWithInvalidType.xml" />
|
||||
<Content Include="XmlFiles\Dictionary_Int32_String.xml" />
|
||||
<Content Include="XmlFiles\Dictionary_String_Double.xml" />
|
||||
<Content Include="XmlFiles\Dictionary_String_Type.xml" />
|
||||
<Content Include="XmlFiles\Dictionary_String_Type_2.xml" />
|
||||
<Content Include="XmlFiles\DirectDictionaryContainer.xml" />
|
||||
<Content Include="XmlFiles\DirectDictionaryContainer2.xml" />
|
||||
<Content Include="XmlFiles\DirectListContainer.xml" />
|
||||
<Content Include="XmlFiles\EnumContainer.xml" />
|
||||
<Content Include="XmlFiles\EventContainer.xml" />
|
||||
<Content Include="XmlFiles\EventStore.xml" />
|
||||
<Content Include="XmlFiles\EventStore2.xml" />
|
||||
<Content Include="XmlFiles\EventStore3.xml" />
|
||||
<Content Include="XmlFiles\EventStore4.xml" />
|
||||
<Content Include="XmlFiles\ExplicitKeyDictionary.xml" />
|
||||
<Content Include="XmlFiles\GenericTypeWithClrNamespace.xml" />
|
||||
<Content Include="XmlFiles\GenericTypeWithXamlNamespace.xml" />
|
||||
<Content Include="XmlFiles\Guid.xml" />
|
||||
<Content Include="XmlFiles\GuidFactoryMethod.xml" />
|
||||
<Content Include="XmlFiles\ImmutableCollectionContainer.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeMultipleArguments.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeMultipleConstructors1.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeMultipleConstructors2.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeMultipleConstructors3.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeMultipleConstructors4.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeOptionalParameters1.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeOptionalParameters2.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeSingleArgument.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeWithCollectionProperty.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeWithNames.xml" />
|
||||
<Content Include="XmlFiles\ImmutableTypeWithWritableProperty.xml" />
|
||||
<Content Include="XmlFiles\Int32.xml" />
|
||||
<Content Include="XmlFiles\ListWrapper.xml" />
|
||||
<Content Include="XmlFiles\ListWrapper2.xml" />
|
||||
<Content Include="XmlFiles\List_Array.xml" />
|
||||
<Content Include="XmlFiles\List_Int32.xml" />
|
||||
<Content Include="XmlFiles\List_Int32_2.xml" />
|
||||
<Content Include="XmlFiles\List_Type.px.xml" />
|
||||
<Content Include="XmlFiles\List_Type.sx.xml" />
|
||||
<Content Include="XmlFiles\List_Type.xml" />
|
||||
<Content Include="XmlFiles\List_XmlSerializable.xml" />
|
||||
<Content Include="XmlFiles\LocalAssembly.xml" />
|
||||
<Content Include="XmlFiles\LookupCorrectEvent.xml" />
|
||||
<Content Include="XmlFiles\LookupCorrectEvent2.xml" />
|
||||
<Content Include="XmlFiles\LookupCorrectEvent3.xml" />
|
||||
<Content Include="XmlFiles\MyArrayExtension.xml" />
|
||||
<Content Include="XmlFiles\MyArrayExtensionA.xml" />
|
||||
<Content Include="XmlFiles\MyExtension.xml" />
|
||||
<Content Include="XmlFiles\MyExtension2.xml" />
|
||||
<Content Include="XmlFiles\MyExtension3.xml" />
|
||||
<Content Include="XmlFiles\MyExtension4.xml" />
|
||||
<Content Include="XmlFiles\MyExtension6.xml" />
|
||||
<Content Include="XmlFiles\NamedItems.xml" />
|
||||
<Content Include="XmlFiles\NamedItems2.xml" />
|
||||
<Content Include="XmlFiles\NamedItems3.xml" />
|
||||
<Content Include="XmlFiles\NamedItems4.xml" />
|
||||
<Content Include="XmlFiles\NonPrimitive.xml" />
|
||||
<Content Include="XmlFiles\NullableContainer.xml" />
|
||||
<Content Include="XmlFiles\NullableWithConverter.xml" />
|
||||
<Content Include="XmlFiles\NullExtension.xml" />
|
||||
<Content Include="XmlFiles\NumericValues.xml" />
|
||||
<Content Include="XmlFiles\NumericValues_Max.xml" />
|
||||
<Content Include="XmlFiles\NumericValues_NaN.xml" />
|
||||
<Content Include="XmlFiles\NumericValues_NegativeInfinity.xml" />
|
||||
<Content Include="XmlFiles\NumericValues_PositiveInfinity.xml" />
|
||||
<Content Include="XmlFiles\NumericValues_StandardTypes.xml" />
|
||||
<Content Include="XmlFiles\PositionalParametersWrapper.xml" />
|
||||
<Content Include="XmlFiles\PropertyDefinition.xml" />
|
||||
<Content Include="XmlFiles\ReadOnlyPropertyContainer.xml" />
|
||||
<Content Include="XmlFiles\Reference.xml" />
|
||||
<Content Include="XmlFiles\StaticExtension.xml" />
|
||||
<Content Include="XmlFiles\StaticExtensionWrapper.xml" />
|
||||
<Content Include="XmlFiles\StaticExtensionWrapper2.xml" />
|
||||
<Content Include="XmlFiles\StaticMember.xml" />
|
||||
<Content Include="XmlFiles\String.xml" />
|
||||
<Content Include="XmlFiles\TestClass4.xml" />
|
||||
<Content Include="XmlFiles\TestClass5.xml" />
|
||||
<Content Include="XmlFiles\TimeSpan.xml" />
|
||||
<Content Include="XmlFiles\Type.xml" />
|
||||
<Content Include="XmlFiles\Type2.xml" />
|
||||
<Content Include="XmlFiles\TypeConverterOnListMember.xml" />
|
||||
<Content Include="XmlFiles\TypeExtensionWrapper.xml" />
|
||||
<Content Include="XmlFiles\TypeExtensionWrapper2.xml" />
|
||||
<Content Include="XmlFiles\Uri.xml" />
|
||||
<Content Include="XmlFiles\XmlDocument.xml" />
|
||||
<Content Include="XmlFiles\XmlSerializable.xml" />
|
||||
<Content Include="XmlFiles\XmlSerializableWrapper.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>5.3.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MSTest.TestAdapter">
|
||||
<Version>1.1.14</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MSTest.TestFramework">
|
||||
<Version>1.1.14</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NUnit">
|
||||
<Version>3.6.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nunit.xamarin">
|
||||
<Version>3.6.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PCLStorage">
|
||||
<Version>1.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.AppDomain">
|
||||
<Version>2.0.11</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Reflection">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Xml.ReaderWriter">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Xml.XmlDocument">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Xml.XmlSerializer">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Forms">
|
||||
<Version>2.3.4.231</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Portable.Xaml\Portable.Xaml-netstandard1.3.csproj">
|
||||
<Project>{cdc8f791-56fc-4b15-aad2-bc460657cc02}</Project>
|
||||
<Name>Portable.Xaml-netstandard1.3</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="XmlFiles\CurrentVersion.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Page Include="MainTestPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Content Include="XmlFiles\SilverlightApp1.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,72 @@
|
|||
using System;
|
||||
using NUnit.Framework.Internal;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework.Api;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework.Interfaces;
|
||||
using NUnit.Framework;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Portable.Xaml_tests_core2
|
||||
{
|
||||
public class TestListener : ITestListener
|
||||
{
|
||||
public Action<string> Log { get; set; }
|
||||
public void TestFinished(ITestResult result)
|
||||
{
|
||||
if (!result.HasChildren)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(result.Output))
|
||||
Log(result.Output);
|
||||
if (result.FailCount > 0)
|
||||
{
|
||||
Log($"Failed: {result.Message}\n{result.StackTrace}");
|
||||
}
|
||||
if (result.InconclusiveCount > 0)
|
||||
Log($"Inconclusive: {result.Message}\n{result.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
public void TestOutput(TestOutput output)
|
||||
{
|
||||
}
|
||||
|
||||
public void TestStarted(ITest test)
|
||||
{
|
||||
if (!test.HasChildren)
|
||||
Log(test.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var builder = new DefaultTestAssemblyBuilder();
|
||||
var runner = new NUnitTestAssemblyRunner(builder);
|
||||
var settings = new Dictionary<string, object>();
|
||||
var assembly = Assembly.GetEntryAssembly();
|
||||
var messages = new List<string>();
|
||||
var listener = new TestListener
|
||||
{
|
||||
Log = message => messages.Add(message) // writing directly to console doesn't work for some reason
|
||||
};
|
||||
runner.Load(assembly, settings);
|
||||
var result = runner.Run(listener, TestFilter.Empty);
|
||||
|
||||
foreach (var msg in messages)
|
||||
{
|
||||
Console.WriteLine(msg);
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(result.FailCount > 0 ? "FAILED" : "PASSED");
|
||||
Console.WriteLine($"Pass: {result.PassCount}, Fail: {result.FailCount}, Skipped: {result.SkipCount}, Inconclusive: {result.InconclusiveCount}");
|
||||
Console.WriteLine($"Duration: {result.Duration}");
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Console.Write("Press any key to continue...");
|
||||
Console.ReadKey(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<!--
|
||||
This file contains Runtime Directives used by .NET Native. The defaults here are suitable for most
|
||||
developers. However, you can modify these parameters to modify the behavior of the .NET Native
|
||||
optimizer.
|
||||
|
||||
Runtime Directives are documented at http://go.microsoft.com/fwlink/?LinkID=391919
|
||||
|
||||
To fully enable reflection for App1.MyClass and all of its public/private members
|
||||
<Type Name="App1.MyClass" Dynamic="Required All"/>
|
||||
|
||||
To enable dynamic creation of the specific instantiation of AppClass<T> over System.Int32
|
||||
<TypeInstantiation Name="App1.AppClass" Arguments="System.Int32" Activate="Required Public" />
|
||||
|
||||
Using the Namespace directive to apply reflection policy to all the types in a particular namespace
|
||||
<Namespace Name="DataClasses.ViewModels" Seralize="All" />
|
||||
-->
|
||||
|
||||
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
|
||||
<Application>
|
||||
<!--
|
||||
An Assembly element with Name="*Application*" applies to all assemblies in
|
||||
the application package. The asterisks are not wildcards.
|
||||
-->
|
||||
<Assembly Name="*Application*" Dynamic="Required All" />
|
||||
<!-- Add your application specific runtime directives here. -->
|
||||
|
||||
|
||||
</Application>
|
||||
</Directives>
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -23,10 +23,12 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using MonoTests.Portable.Xaml;
|
||||
#if NETSTANDARD
|
||||
using System.ComponentModel;
|
||||
#endif
|
||||
#if PCL
|
||||
using Portable.Xaml.Markup;
|
||||
using Portable.Xaml.ComponentModel;
|
||||
|
@ -74,10 +76,10 @@ namespace MonoTests.Portable.Xaml.Markup
|
|||
|
||||
public object Instance { get; set; }
|
||||
|
||||
#if !PCL
|
||||
#if !PCL || NETSTANDARD
|
||||
public IContainer Container { get; set; }
|
||||
public PropertyDescriptor PropertyDescriptor { get; set; }
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -47,64 +47,70 @@ namespace MonoTests.Portable.Xaml.Markup
|
|||
[TestFixture]
|
||||
public class ValueSerializerTest
|
||||
{
|
||||
static ValueSerializerTest ()
|
||||
static ValueSerializerTest()
|
||||
{
|
||||
std_types = new List<XamlType> (XamlLanguage.AllTypes);
|
||||
std_types.Sort ((t1, t2) => String.CompareOrdinal (t1.Name, t2.Name));
|
||||
std_types = new List<XamlType>(XamlLanguage.AllTypes);
|
||||
std_types.Sort((t1, t2) => String.CompareOrdinal(t1.Name, t2.Name));
|
||||
}
|
||||
|
||||
static readonly List<XamlType> std_types;
|
||||
object [] test_values = {null, true, "test", 3, 'x', 5.5, -1.414m, (byte) 255, new Uri ("urn:foo"), new NullExtension (), new object (), new PropertyDefinition (), new Reference ("Foo"), new StaticExtension (), TimeSpan.FromMinutes (5), new TypeExtension ("TypeExt"), new XData () { Text = "test xdata"} }; // can we instantiate MemberDefinition?
|
||||
string [] test_strings = {String.Empty, "True", "test", "3", "x", "5.5", "-1.414", "255", "urn:foo", "Portable.Xaml.Markup.NullExtension", "System.Object", "Portable.Xaml.Markup.PropertyDefinition", "Portable.Xaml.Markup.Reference", "Portable.Xaml.Markup.StaticExtension", "00:05:00", "Portable.Xaml.Markup.TypeExtension", "Portable.Xaml.Markup.XData"};
|
||||
object[] test_values = { null, true, "test", 3, 'x', 5.5, -1.414m, (byte)255, new Uri("urn:foo"), new NullExtension(), new object(), new PropertyDefinition(), new Reference("Foo"), new StaticExtension(), TimeSpan.FromMinutes(5), new TypeExtension("TypeExt"), new XData() { Text = "test xdata" } }; // can we instantiate MemberDefinition?
|
||||
string[] test_strings = { String.Empty, "True", "test", "3", "x", "5.5", "-1.414", "255", "urn:foo", "Portable.Xaml.Markup.NullExtension", "System.Object", "Portable.Xaml.Markup.PropertyDefinition", "Portable.Xaml.Markup.Reference", "Portable.Xaml.Markup.StaticExtension", "00:05:00", "Portable.Xaml.Markup.TypeExtension", "Portable.Xaml.Markup.XData" };
|
||||
|
||||
[Test]
|
||||
public void SerializerInAllTypes ()
|
||||
public void SerializerInAllTypes()
|
||||
{
|
||||
// var sctx = new XamlSchemaContext (new Assembly [] { typeof (XamlType).Assembly });
|
||||
foreach (var t in std_types) {
|
||||
if (t != XamlLanguage.String) {
|
||||
Assert.IsNull (t.ValueSerializer, "IsNull? " + t.Name);
|
||||
foreach (var t in std_types)
|
||||
{
|
||||
if (t != XamlLanguage.String)
|
||||
{
|
||||
Assert.IsNull(t.ValueSerializer, "IsNull? " + t.Name);
|
||||
continue;
|
||||
}
|
||||
var v = t.ValueSerializer.ConverterInstance;
|
||||
foreach (var val in test_values)
|
||||
Assert.IsTrue (v.CanConvertToString (val, null), t.Name + "_" + (val != null ? val.GetType () : null));
|
||||
Assert.IsTrue(v.CanConvertToString(val, null), t.Name + "_" + (val != null ? val.GetType() : null));
|
||||
}
|
||||
}
|
||||
|
||||
static readonly Type [] no_ser_types = {typeof (object), typeof (ArrayExtension), typeof (MemberDefinition), typeof (NullExtension), typeof (PropertyDefinition), typeof (Reference), typeof (StaticExtension), typeof (TypeExtension), typeof (XData)};
|
||||
static readonly Type[] no_ser_types = { typeof(object), typeof(ArrayExtension), typeof(MemberDefinition), typeof(NullExtension), typeof(PropertyDefinition), typeof(Reference), typeof(StaticExtension), typeof(TypeExtension), typeof(XData) };
|
||||
|
||||
[Test]
|
||||
public void GetSerializerForAllTypes ()
|
||||
public void GetSerializerForAllTypes()
|
||||
{
|
||||
// Serializers from GetSerializerFor() returns very
|
||||
// different results from predefined ValueSerializer.
|
||||
foreach (var t in std_types) {
|
||||
var v = ValueSerializer.GetSerializerFor (t.UnderlyingType, null);
|
||||
if (no_ser_types.Any (ti => ti == t.UnderlyingType)) {
|
||||
Assert.IsNull (v, "NoSerializer_" + t.Name);
|
||||
foreach (var t in std_types)
|
||||
{
|
||||
var v = ValueSerializer.GetSerializerFor(t.UnderlyingType, null);
|
||||
if (no_ser_types.Any(ti => ti == t.UnderlyingType))
|
||||
{
|
||||
Assert.IsNull(v, "NoSerializer_" + t.Name);
|
||||
continue;
|
||||
}
|
||||
else if (v == null)
|
||||
Assert.Fail ("Missing serializer for " + t.Name);
|
||||
Assert.Fail("Missing serializer for " + t.Name);
|
||||
|
||||
// String ValueSerializer is the only exceptional one that mostly fails ConvertToString().
|
||||
// For remaining types, ConvertToString() should succeed.
|
||||
// What is funny or annoying here is, that always return true for CanConvertToString() while everything fails at ConvertToString() on .NET.
|
||||
if (t.UnderlyingType == typeof (string))
|
||||
if (t.UnderlyingType == typeof(string))
|
||||
continue;
|
||||
|
||||
int i = 0;
|
||||
foreach (var val in test_values) {
|
||||
Assert.IsTrue (v.CanConvertToString (val, null), t.Name + "_" + (val != null ? val.GetType () : null));
|
||||
Assert.AreEqual (test_strings [i++].Fixup(), v.ConvertToString (val, null), "value-" + t.Name + "_" + val);
|
||||
foreach (var val in test_values)
|
||||
{
|
||||
Assert.IsTrue(v.CanConvertToString(val, null), t.Name + "_" + (val != null ? val.GetType() : null));
|
||||
Assert.AreEqual(test_strings[i++].Fixup(), v.ConvertToString(val, null), "value-" + t.Name + "_" + val);
|
||||
}
|
||||
|
||||
// The funny thing also applies to CanConvertToString() and ConvertToString().
|
||||
|
||||
i = 0;
|
||||
foreach (var str in test_strings) {
|
||||
Assert.IsTrue (v.CanConvertFromString (str.Fixup(), null), t.Name + "_" + str);
|
||||
foreach (var str in test_strings)
|
||||
{
|
||||
Assert.IsTrue(v.CanConvertFromString(str.Fixup(), null), t.Name + "_" + str);
|
||||
// FIXME: add tests for this large matrix someday.
|
||||
//Assert.AreEqual (test_values [i++], v.ConvertFromString (str, null), "value-" + t.Name + "_" + str);
|
||||
}
|
||||
|
@ -112,20 +118,25 @@ namespace MonoTests.Portable.Xaml.Markup
|
|||
}
|
||||
|
||||
[Test]
|
||||
public void GetSerializerFor ()
|
||||
public void GetSerializerFor()
|
||||
{
|
||||
Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (Array)), "#1");
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (Uri)), "#2");
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (Type)), "#3"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (string)), "#4"); // documented as special
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (DateTime)), "#5"); // documented as special
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (bool)), "#6"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (byte)), "#7"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (char)), "#8"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (DBNull)), "#9"); // TypeCode.DBNull
|
||||
Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (object)), "#10");
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (TimeSpan)), "#11"); // has no TypeConverter (undocumented behavior), TypeCode.Object -> unexpectedly has non-null serializer!
|
||||
Assert.IsNull(ValueSerializer.GetSerializerFor(typeof(Array)), "#1");
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(Uri)), "#2");
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(Type)), "#3"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(string)), "#4"); // documented as special
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(DateTime)), "#5"); // documented as special
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(bool)), "#6"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(byte)), "#7"); // has no TypeConverter (undocumented behavior)
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(char)), "#8"); // has no TypeConverter (undocumented behavior)
|
||||
#if !CORE
|
||||
Assert.IsNull(ValueSerializer.GetSerializerFor(typeof(DBNull)), "#9"); // TypeCode.DBNull
|
||||
#endif
|
||||
Assert.IsNull(ValueSerializer.GetSerializerFor(typeof(object)), "#10");
|
||||
Assert.IsNotNull(ValueSerializer.GetSerializerFor(typeof(TimeSpan)), "#11"); // has no TypeConverter (undocumented behavior), TypeCode.Object -> unexpectedly has non-null serializer!
|
||||
#if !NETSTANDARD
|
||||
Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (DateTimeOffset)), "#12"); // has no TypeConverter (undocumented behavior), TypeCode.Object -> expected
|
||||
#endif
|
||||
|
||||
Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (MyExtension)), "#13");
|
||||
Assert.IsNotNull (ValueSerializer.GetSerializerFor (typeof (MyExtension4)), "#14"); // has TypeConverter.
|
||||
Assert.IsNull (ValueSerializer.GetSerializerFor (typeof (XamlType)), "#15"); // While there is XamlTypeTypeConverter, it is not used on XamlType.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -47,8 +47,9 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
XamlSchemaContext sctx = new XamlSchemaContext (new XamlSchemaContextSettings ());
|
||||
PropertyInfo str_len = typeof (string).GetProperty ("Length");
|
||||
PropertyInfo sb_len = typeof (StringBuilder).GetProperty ("Length");
|
||||
PropertyInfo xr_resolver = typeof (XmlResolver).GetProperty ("Credentials");
|
||||
EventInfo ass_load = typeof (AppDomain).GetEvent ("AssemblyLoad");
|
||||
EventInfo eventStore_Event1 = typeof(EventStore).GetEvent("Event1");
|
||||
PropertyInfo testClass5_WriteOnly = typeof(TestClass5).GetProperty("WriteOnly");
|
||||
PropertyInfo testClass5_Baz = typeof(TestClass5).GetProperty("Baz");
|
||||
|
||||
[Test]
|
||||
public void ConstructorNull ()
|
||||
|
@ -87,9 +88,18 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
[Test]
|
||||
public void GetValueOnWriteOnlyProperty ()
|
||||
{
|
||||
var pi = xr_resolver;
|
||||
var pi = testClass5_WriteOnly;
|
||||
var i = new XamlMemberInvoker (new XamlMember (pi, sctx));
|
||||
Assert.Throws<NotSupportedException> (() => i.GetValue (new XmlUrlResolver ()));
|
||||
Assert.Throws<NotSupportedException> (() => i.GetValue (new TestClass5 ()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetValueOnWriteInternalProperty()
|
||||
{
|
||||
var pi = testClass5_Baz;
|
||||
var i = new XamlMemberInvoker(new XamlMember(pi, sctx));
|
||||
var val = i.GetValue(new TestClass5 { Baz = "hello" });
|
||||
Assert.AreEqual("hello", val);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -115,7 +125,19 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
{
|
||||
var pi = str_len;
|
||||
var i = new XamlMemberInvoker (new XamlMember (pi, sctx));
|
||||
#if WINDOWS_UWP
|
||||
try
|
||||
{
|
||||
i.GetValue(new StringBuilder());
|
||||
Assert.Fail("Expected TargetException");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Assert.AreEqual("TargetException", e.GetType().Name);
|
||||
}
|
||||
#else
|
||||
Assert.Throws<TargetException> (() => i.GetValue (new StringBuilder ()));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -159,7 +181,19 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
{
|
||||
var pi = sb_len;
|
||||
var i = new XamlMemberInvoker (new XamlMember (pi, sctx));
|
||||
#if WINDOWS_UWP
|
||||
try
|
||||
{
|
||||
i.SetValue("hello", 5);
|
||||
Assert.Fail("Expected TargetException");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Assert.AreEqual("TargetException", e.GetType().Name);
|
||||
}
|
||||
#else
|
||||
Assert.Throws<TargetException> (() => i.SetValue ("hello", 5));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Event
|
||||
|
@ -167,7 +201,7 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
[Test]
|
||||
public void FromEvent ()
|
||||
{
|
||||
var ei = ass_load;
|
||||
var ei = eventStore_Event1;
|
||||
var i = new XamlMemberInvoker (new XamlMember (ei, sctx));
|
||||
Assert.IsNull (i.UnderlyingGetter, "#1");
|
||||
Assert.AreEqual (ei.GetAddMethod (), i.UnderlyingSetter, "#2");
|
||||
|
@ -176,37 +210,37 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
[Test]
|
||||
public void GetValueOnEvent ()
|
||||
{
|
||||
var ei = ass_load;
|
||||
var ei = eventStore_Event1;
|
||||
var i = new XamlMemberInvoker (new XamlMember (ei, sctx));
|
||||
Assert.Throws<NotSupportedException> (() => i.GetValue (AppDomain.CurrentDomain));
|
||||
Assert.Throws<NotSupportedException> (() => i.GetValue (new EventStore()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetValueOnEventNull ()
|
||||
{
|
||||
var ei = ass_load;
|
||||
var ei = eventStore_Event1;
|
||||
var i = new XamlMemberInvoker (new XamlMember (ei, sctx));
|
||||
i.SetValue (AppDomain.CurrentDomain, null);
|
||||
i.SetValue (new EventStore(), null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetValueOnEventValueMismatch ()
|
||||
{
|
||||
var ei = ass_load;
|
||||
var ei = eventStore_Event1;
|
||||
var i = new XamlMemberInvoker (new XamlMember (ei, sctx));
|
||||
Assert.Throws<ArgumentException> (() => i.SetValue (AppDomain.CurrentDomain, 5));
|
||||
Assert.Throws<ArgumentException> (() => i.SetValue (new EventStore(), 5));
|
||||
}
|
||||
|
||||
void DummyAssemblyLoad (object o, AssemblyLoadEventArgs e)
|
||||
void DummyEvent1 (object o, EventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetValueOnEvent ()
|
||||
{
|
||||
var ei = ass_load;
|
||||
var ei = eventStore_Event1;
|
||||
var i = new XamlMemberInvoker (new XamlMember (ei, sctx));
|
||||
i.SetValue (AppDomain.CurrentDomain, new AssemblyLoadEventHandler (DummyAssemblyLoad));
|
||||
i.SetValue (new EventStore(), new EventHandler<EventArgs> (DummyEvent1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -218,7 +218,9 @@ namespace MonoTests.Portable.Xaml.Schema
|
|||
i.AddToCollection (new ArrayExtension (), 5);
|
||||
Assert.Fail ("not supported operation.");
|
||||
} catch (NotSupportedException) {
|
||||
#if !WINDOWS_UWP
|
||||
} catch (TargetException) {
|
||||
#endif
|
||||
// .NET throws this, but the difference should not really matter.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -38,6 +38,10 @@ using System.Xaml;
|
|||
using System.Xaml.Schema;
|
||||
#endif
|
||||
|
||||
#if NETSTANDARD
|
||||
using System.ComponentModel;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.Portable.Xaml.Schema
|
||||
{
|
||||
[TestFixture]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -43,42 +43,53 @@ namespace MonoTests.Portable.Xaml
|
|||
{
|
||||
public class DummyValueSerializerContext : IValueSerializerContext
|
||||
{
|
||||
public DummyValueSerializerContext ()
|
||||
public DummyValueSerializerContext()
|
||||
{
|
||||
}
|
||||
|
||||
public object GetService (Type serviceType)
|
||||
public object GetService(Type serviceType)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public IContainer Container {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
public object Instance {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
public void OnComponentChanged ()
|
||||
public IContainer Container
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
public bool OnComponentChanging ()
|
||||
public object Instance
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
public ValueSerializer GetValueSerializerFor (Type type)
|
||||
public void OnComponentChanged()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public bool OnComponentChanging()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public ValueSerializer GetValueSerializerFor(Type type)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#if PCL
|
||||
public PropertyInfo PropertyDescriptor {
|
||||
get { throw new NotImplementedException (); }
|
||||
#if NETSTANDARD
|
||||
public PropertyDescriptor PropertyDescriptor {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
public ValueSerializer GetValueSerializerFor (PropertyInfo descriptor)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#else
|
||||
#elif PCL
|
||||
public PropertyInfo PropertyDescriptor
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
public ValueSerializer GetValueSerializerFor(PropertyInfo descriptor)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#else
|
||||
public PropertyDescriptor PropertyDescriptor {
|
||||
get { throw new NotImplementedException (); }
|
||||
}
|
||||
|
@ -86,6 +97,6 @@ namespace MonoTests.Portable.Xaml
|
|||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -38,6 +38,13 @@ using sc = System.ComponentModel;
|
|||
using System.Collections.Immutable;
|
||||
#endif
|
||||
|
||||
#if NETSTANDARD
|
||||
using ISupportInitialize = Portable.Xaml.ComponentModel.ISupportInitialize;
|
||||
using System.ComponentModel;
|
||||
using DateTimeConverter = System.ComponentModel.DateTimeConverter;
|
||||
#elif PCL
|
||||
using DateTimeConverter = Portable.Xaml.ComponentModel.DateTimeConverter;
|
||||
#endif
|
||||
|
||||
#if PCL
|
||||
using Portable.Xaml.Markup;
|
||||
|
@ -323,6 +330,11 @@ namespace MonoTests.Portable.Xaml
|
|||
|
||||
public string Baz { internal get; set; }
|
||||
|
||||
public string WriteOnly
|
||||
{
|
||||
set { Baz = value; }
|
||||
}
|
||||
|
||||
public string ReadOnly
|
||||
{
|
||||
get { return Foo; }
|
||||
|
@ -890,7 +902,7 @@ namespace MonoTests.Portable.Xaml
|
|||
AttachablePropertyServices.SetProperty(target, ProtectedIdentifier, value);
|
||||
}
|
||||
|
||||
static Dictionary<object,List<EventHandler>> handlers = new Dictionary<object,List<EventHandler>>();
|
||||
static Dictionary<object, List<EventHandler>> handlers = new Dictionary<object, List<EventHandler>>();
|
||||
|
||||
public static void AddXHandler(object target, EventHandler handler)
|
||||
{
|
||||
|
@ -915,7 +927,7 @@ namespace MonoTests.Portable.Xaml
|
|||
{
|
||||
}
|
||||
|
||||
Dictionary<AttachableMemberIdentifier,object> props = new Dictionary<AttachableMemberIdentifier,object>();
|
||||
Dictionary<AttachableMemberIdentifier, object> props = new Dictionary<AttachableMemberIdentifier, object>();
|
||||
|
||||
public int PropertyCount
|
||||
{
|
||||
|
@ -1000,6 +1012,10 @@ namespace MonoTests.Portable.Xaml
|
|||
}
|
||||
}
|
||||
|
||||
public class CustomEventArgs : EventArgs
|
||||
{
|
||||
}
|
||||
|
||||
public class EventStore
|
||||
{
|
||||
public bool Method1Invoked;
|
||||
|
@ -1007,6 +1023,8 @@ namespace MonoTests.Portable.Xaml
|
|||
public event EventHandler<EventArgs> Event1;
|
||||
public event Func<object> Event2;
|
||||
|
||||
public event EventHandler<CustomEventArgs> Event3;
|
||||
|
||||
public object Examine()
|
||||
{
|
||||
if (Event1 != null)
|
||||
|
@ -1043,7 +1061,7 @@ namespace MonoTests.Portable.Xaml
|
|||
public object Examine()
|
||||
{
|
||||
if (Event1 != null)
|
||||
Event1(this, default (TEventArgs));
|
||||
Event1(this, default(TEventArgs));
|
||||
if (Event2 != null)
|
||||
return Event2();
|
||||
else
|
||||
|
@ -1194,11 +1212,11 @@ namespace MonoTests.Portable.Xaml
|
|||
|
||||
public class DirectDictionaryContainer // for such xml that directly contains items in <*.Items> element.
|
||||
{
|
||||
public IDictionary<EnumValueType,int> Items { get; set; }
|
||||
public IDictionary<EnumValueType, int> Items { get; set; }
|
||||
|
||||
public DirectDictionaryContainer()
|
||||
{
|
||||
this.Items = new Dictionary<EnumValueType,int>();
|
||||
this.Items = new Dictionary<EnumValueType, int>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1515,7 @@ namespace MonoTests.Portable.Xaml
|
|||
}
|
||||
}
|
||||
|
||||
#if !PCL136
|
||||
#if !PCL136
|
||||
|
||||
public class ImmutableCollectionContainer
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -43,6 +43,9 @@ using System.Xaml.Schema;
|
|||
|
||||
using CategoryAttribute = NUnit.Framework.CategoryAttribute;
|
||||
using System.Globalization;
|
||||
#if NETSTANDARD
|
||||
using System.ComponentModel;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.Portable.Xaml
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -334,7 +334,7 @@ namespace MonoTests.Portable.Xaml
|
|||
{
|
||||
//Assert.IsNull (d.TypeConverter, "#12")
|
||||
}
|
||||
else if (type.IsGenericType || name == "_Initialization" || name == "_UnknownContent")
|
||||
else if (type.GetTypeInfo().IsGenericType || name == "_Initialization" || name == "_UnknownContent")
|
||||
Assert.IsNull (d.TypeConverter, "#12");
|
||||
else
|
||||
Assert.IsNotNull (d.TypeConverter, "#12");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -49,7 +49,7 @@ namespace MonoTests.Portable.Xaml
|
|||
public class XamlMemberTest
|
||||
{
|
||||
XamlSchemaContext sctx = new XamlSchemaContext (new XamlSchemaContextSettings ());
|
||||
EventInfo ass_load = typeof (AppDomain).GetEvent ("AssemblyLoad");
|
||||
EventInfo eventStore_Event3 = typeof (EventStore).GetEvent ("Event3");
|
||||
PropertyInfo str_len = typeof (string).GetProperty ("Length");
|
||||
PropertyInfo sb_len = typeof (StringBuilder).GetProperty ("Length");
|
||||
MethodInfo dummy_add = typeof (XamlMemberTest).GetMethod ("DummyAddMethod");
|
||||
|
@ -66,7 +66,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void ConstructorEventInfoNullSchemaContext ()
|
||||
{
|
||||
Assert.Throws<ArgumentNullException> (() => new XamlMember (ass_load, null));
|
||||
Assert.Throws<ArgumentNullException> (() => new XamlMember (eventStore_Event3, null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -146,7 +146,7 @@ namespace MonoTests.Portable.Xaml
|
|||
{
|
||||
// It is not of expected kind of member here:
|
||||
// "Attached property setter and attached event adder methods must have two parameters."
|
||||
Assert.Throws<ArgumentException> (() => new XamlMember ("AssemblyLoad", ass_load.GetAddMethod (), sctx));
|
||||
Assert.Throws<ArgumentException> (() => new XamlMember ("Event3", eventStore_Event3.GetAddMethod (), sctx));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -180,26 +180,26 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void EventInfoDefaultValues ()
|
||||
{
|
||||
var m = new XamlMember (typeof (AppDomain).GetEvent ("AssemblyLoad"), sctx);
|
||||
var m = new XamlMember (typeof (EventStore).GetEvent ("Event3"), sctx);
|
||||
|
||||
Assert.IsNotNull (m.DeclaringType, "#2");
|
||||
Assert.AreEqual (typeof (AppDomain), m.DeclaringType.UnderlyingType, "#2-2");
|
||||
Assert.AreEqual (typeof (EventStore), m.DeclaringType.UnderlyingType, "#2-2");
|
||||
Assert.IsNotNull (m.Invoker, "#3");
|
||||
Assert.IsNull (m.Invoker.UnderlyingGetter, "#3-2");
|
||||
Assert.AreEqual (ass_load.GetAddMethod (), m.Invoker.UnderlyingSetter, "#3-3");
|
||||
Assert.AreEqual (eventStore_Event3.GetAddMethod (), m.Invoker.UnderlyingSetter, "#3-3");
|
||||
Assert.IsFalse (m.IsUnknown, "#4");
|
||||
Assert.IsFalse (m.IsReadPublic, "#5");
|
||||
Assert.IsTrue (m.IsWritePublic, "#6");
|
||||
Assert.AreEqual ("AssemblyLoad", m.Name, "#7");
|
||||
Assert.AreEqual ("Event3", m.Name, "#7");
|
||||
Assert.IsTrue (m.IsNameValid, "#8");
|
||||
Assert.AreEqual ("clr-namespace:System;assembly=mscorlib", m.PreferredXamlNamespace, "#9");
|
||||
Assert.AreEqual (new XamlType (typeof (AppDomain), sctx), m.TargetType, "#10");
|
||||
Assert.AreEqual ($"clr-namespace:MonoTests.Portable.Xaml;assembly={Compat.TestAssemblyName}", m.PreferredXamlNamespace, "#9");
|
||||
Assert.AreEqual (new XamlType (typeof (EventStore), sctx), m.TargetType, "#10");
|
||||
Assert.IsNotNull (m.Type, "#11");
|
||||
Assert.AreEqual (typeof (AssemblyLoadEventHandler), m.Type.UnderlyingType, "#11-2");
|
||||
// Assert.IsNotNull (m.TypeConverter, "#12"); // EventConverter
|
||||
Assert.AreEqual (typeof (EventHandler<CustomEventArgs>), m.Type.UnderlyingType, "#11-2");
|
||||
Assert.IsNotNull (m.TypeConverter, "#12"); // EventConverter
|
||||
Assert.IsNull (m.ValueSerializer, "#13");
|
||||
Assert.IsNull (m.DeferringLoader, "#14");
|
||||
Assert.AreEqual (ass_load, m.UnderlyingMember, "#15");
|
||||
Assert.AreEqual (eventStore_Event3, m.UnderlyingMember, "#15");
|
||||
Assert.IsFalse (m.IsReadOnly, "#16");
|
||||
Assert.IsTrue (m.IsWriteOnly, "#17");
|
||||
Assert.IsFalse (m.IsAttachable, "#18");
|
||||
|
@ -243,7 +243,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsFalse (m.IsAmbient, "#22");
|
||||
}
|
||||
|
||||
public void DummyAddMethod (object o, AssemblyLoadEventHandler h)
|
||||
public void DummyAddMethod (object o, CustomEventArgs h)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -283,12 +283,12 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (m.IsWritePublic, "#6");
|
||||
Assert.AreEqual ("DummyAddMethod", m.Name, "#7");
|
||||
Assert.IsTrue (m.IsNameValid, "#8");
|
||||
var ns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var ns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (ns, m.PreferredXamlNamespace, "#9");
|
||||
// since it is unknown.
|
||||
Assert.AreEqual (new XamlType (typeof (object), sctx), m.TargetType, "#10");
|
||||
Assert.IsNotNull (m.Type, "#11");
|
||||
Assert.AreEqual (typeof (AssemblyLoadEventHandler), m.Type.UnderlyingType, "#11-2");
|
||||
Assert.AreEqual (typeof (CustomEventArgs), m.Type.UnderlyingType, "#11-2");
|
||||
// Assert.IsNotNull (m.TypeConverter, "#12");
|
||||
Assert.IsNull (m.ValueSerializer, "#13");
|
||||
Assert.IsNull (m.DeferringLoader, "#14");
|
||||
|
@ -318,7 +318,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (m.IsWritePublic, "#6");
|
||||
Assert.AreEqual ("DummyProp", m.Name, "#7");
|
||||
Assert.IsTrue (m.IsNameValid, "#8");
|
||||
var ns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var ns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (ns, m.PreferredXamlNamespace, "#9");
|
||||
// since it is unknown.
|
||||
Assert.AreEqual (new XamlType (typeof (object), sctx), m.TargetType, "#10");
|
||||
|
@ -374,7 +374,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void UnderlyingMember ()
|
||||
{
|
||||
Assert.IsTrue (new XamlMember (ass_load, sctx).UnderlyingMember is EventInfo, "#1");
|
||||
Assert.IsTrue (new XamlMember (eventStore_Event3, sctx).UnderlyingMember is EventInfo, "#1");
|
||||
Assert.IsTrue (new XamlMember (str_len, sctx).UnderlyingMember is PropertyInfo, "#2");
|
||||
Assert.AreEqual (dummy_get, new XamlMember ("DummyProp", dummy_get, dummy_set, sctx).UnderlyingMember, "#3");
|
||||
Assert.AreEqual (dummy_add, new XamlMember ("DummyAddMethod", dummy_add, sctx).UnderlyingMember, "#4");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -71,7 +71,7 @@ namespace MonoTests.Portable.Xaml
|
|||
|
||||
var rsettings = new XamlXmlReaderSettings ();
|
||||
|
||||
var xml = String.Format (@"<RootObjectInstanceTestClass Property=""Test"" xmlns=""clr-namespace:MonoTests.Portable.Xaml;assembly={0}""></RootObjectInstanceTestClass>", GetType ().Assembly.GetName ().Name);
|
||||
var xml = String.Format (@"<RootObjectInstanceTestClass Property=""Test"" xmlns=""clr-namespace:MonoTests.Portable.Xaml;assembly={0}""></RootObjectInstanceTestClass>", GetType ().GetTypeInfo().Assembly.GetName ().Name);
|
||||
using (var reader = new XamlXmlReader (new StringReader (xml), rsettings)) {
|
||||
var wsettings = new XamlObjectWriterSettings ();
|
||||
wsettings.RootObjectInstance = obj;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -697,7 +697,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Attached2 result = null;
|
||||
|
||||
var rsettings = new XamlXmlReaderSettings();
|
||||
using (var reader = new XamlXmlReader(new StringReader(String.Format(@"<Attached2 AttachedWrapper3.Property=""Test"" xmlns=""clr-namespace:MonoTests.Portable.Xaml;assembly={0}""></Attached2>", typeof(AttachedWrapper3).Assembly.GetName().Name)), rsettings))
|
||||
using (var reader = new XamlXmlReader(new StringReader(String.Format(@"<Attached2 AttachedWrapper3.Property=""Test"" xmlns=""clr-namespace:MonoTests.Portable.Xaml;assembly={0}""></Attached2>", typeof(AttachedWrapper3).GetTypeInfo().Assembly.GetName().Name)), rsettings))
|
||||
{
|
||||
var wsettings = new XamlObjectWriterSettings();
|
||||
using (var writer = new XamlObjectWriter(reader.SchemaContext, wsettings))
|
||||
|
@ -746,7 +746,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test] // bug #3003 repro
|
||||
public void EventsAndProcessingOrder()
|
||||
{
|
||||
var asm = Assembly.GetExecutingAssembly();
|
||||
var asm = GetType().GetTypeInfo().Assembly;
|
||||
var context = new XamlSchemaContext(new Assembly[] { asm });
|
||||
var output = XamarinBug3003.TestContext.Writer;
|
||||
output.WriteLine();
|
||||
|
@ -1502,7 +1502,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void Write_XmlSerializableWrapper()
|
||||
{
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType().Assembly.GetName().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType().GetTypeInfo().Assembly.GetName().Name;
|
||||
using (var xr = GetReader("XmlSerializableWrapper.xml"))
|
||||
{
|
||||
var des = (XmlSerializableWrapper)XamlServices.Load(xr);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -69,14 +69,14 @@ namespace MonoTests.Portable.Xaml
|
|||
s.ProvideLineInfo = true;
|
||||
s.ValuesMustBeString = true;
|
||||
s.BaseUri = new Uri ("urn:foo");
|
||||
s.LocalAssembly = typeof (object).Assembly;
|
||||
s.LocalAssembly = typeof (object).GetTypeInfo().Assembly;
|
||||
|
||||
s = new XamlReaderSettings (s);
|
||||
|
||||
Assert.IsTrue (s.AllowProtectedMembersOnRoot, "#1");
|
||||
Assert.IsTrue (s.BaseUri.Equals (new Uri ("urn:foo")), "#2");
|
||||
Assert.IsTrue (s.IgnoreUidsOnPropertyElements, "#3");
|
||||
Assert.AreEqual (typeof (int).Assembly, s.LocalAssembly, "#4");
|
||||
Assert.AreEqual (typeof (int).GetTypeInfo().Assembly, s.LocalAssembly, "#4");
|
||||
Assert.IsTrue (s.ProvideLineInfo, "#5");
|
||||
Assert.IsTrue (s.ValuesMustBeString, "#6");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -108,7 +108,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (r.Read (), "#6");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");
|
||||
|
||||
Assert.IsTrue (r.Read (), "#11");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
|
||||
|
@ -170,7 +170,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (r.Read (), "#6");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");
|
||||
|
||||
Assert.IsTrue (r.Read (), "#11");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
|
||||
|
@ -182,7 +182,7 @@ namespace MonoTests.Portable.Xaml
|
|||
var xt = new XamlType (typeof (TestClass5), r.SchemaContext);
|
||||
Assert.AreEqual (xt, r.Type, "#17-2");
|
||||
// Assert.IsTrue (r.Instance is TestClass5, "#17-3");
|
||||
Assert.AreEqual (2, xt.GetAllMembers ().Count, "#17-4");
|
||||
Assert.AreEqual (3, xt.GetAllMembers ().Count, "#17-4");
|
||||
Assert.IsTrue (xt.GetAllMembers ().Any (xm => xm.Name == "Bar"), "#17-5");
|
||||
Assert.IsTrue (xt.GetAllMembers ().Any (xm => xm.Name == "Baz"), "#17-6");
|
||||
|
||||
|
@ -271,7 +271,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (r.Read (), "#6");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#7");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#7-2");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "#7-3");
|
||||
|
||||
Assert.IsTrue (r.Read (), "#11");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
|
||||
|
@ -362,7 +362,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (r.Read (), "#11");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "#12");
|
||||
|
||||
var defns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var defns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "#13-2");
|
||||
Assert.AreEqual (defns, r.Namespace.Namespace, "#13-3:" + r.Namespace.Prefix);
|
||||
|
@ -1658,7 +1658,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "so#1-1");
|
||||
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
|
||||
|
@ -1698,7 +1698,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "so#1-1");
|
||||
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
|
||||
|
@ -1752,7 +1752,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
|
@ -1976,7 +1976,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "so#1-1");
|
||||
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
|
||||
|
@ -2064,7 +2064,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
|
@ -2118,7 +2118,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
|
@ -2172,7 +2172,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "so#1-1");
|
||||
Assert.AreEqual (XamlNodeType.StartObject, r.NodeType, "so#1-2");
|
||||
|
@ -2194,7 +2194,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
|
@ -2344,7 +2344,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
|
@ -2520,7 +2520,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
|
@ -2581,7 +2581,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
// t:XmlSerializable
|
||||
|
@ -2667,7 +2667,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
// t:EnumContainer
|
||||
|
@ -2706,14 +2706,14 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#2-3");
|
||||
Assert.AreEqual ("scg", r.Namespace.Prefix, "ns#2-4");
|
||||
assns = "clr-namespace:System.Collections.Generic;assembly=" + typeof (IList<>).Assembly.GetName ().Name;
|
||||
assns = "clr-namespace:System.Collections.Generic;assembly=mscorlib";// + typeof (IList<>).GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#2-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#3-1");
|
||||
|
@ -2799,21 +2799,21 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#2-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#2-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#2-3");
|
||||
Assert.AreEqual ("sc", r.Namespace.Prefix, "ns#2-4");
|
||||
assns = "clr-namespace:System.Collections;assembly=" + typeof (IList<>).Assembly.GetName ().Name;
|
||||
assns = "clr-namespace:System.Collections;assembly=mscorlib";// + typeof (IList<>).GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#2-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#x-1");
|
||||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#x-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#x-3");
|
||||
Assert.AreEqual ("scg", r.Namespace.Prefix, "ns#x-4");
|
||||
assns = "clr-namespace:System.Collections.Generic;assembly=" + typeof (IList<>).Assembly.GetName ().Name;
|
||||
assns = "clr-namespace:System.Collections.Generic;assembly=mscorlib";// + typeof (IList<>).GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#x-5");
|
||||
|
||||
Assert.IsTrue (r.Read (), "ns#3-1");
|
||||
|
@ -3173,7 +3173,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
// t:NullableContainer
|
||||
|
@ -3212,7 +3212,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.AreEqual(XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull(r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType().Assembly.GetName().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType().GetTypeInfo().Assembly.GetName().Name;
|
||||
Assert.AreEqual(assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
// t:DeferredLoadingContainerMember
|
||||
|
@ -3258,8 +3258,8 @@ namespace MonoTests.Portable.Xaml
|
|||
|
||||
protected void Read_DirectListContainer (XamlReader r)
|
||||
{
|
||||
var assns1 = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns2 = "clr-namespace:System.Collections.Generic;assembly=" + typeof (IList<>).Assembly.GetName ().Name;
|
||||
var assns1 = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
var assns2 = "clr-namespace:System.Collections.Generic;assembly=mscorlib";// + typeof (IList<>).GetTypeInfo().Assembly.GetName ().Name;
|
||||
ReadNamespace (r, String.Empty, assns1, "ns#1");
|
||||
ReadNamespace (r, "scg", assns2, "ns#2");
|
||||
ReadNamespace (r, "x", XamlLanguage.Xaml2006Namespace, "ns#3");
|
||||
|
@ -3334,7 +3334,7 @@ namespace MonoTests.Portable.Xaml
|
|||
|
||||
protected void Read_DirectDictionaryContainer (XamlReader r)
|
||||
{
|
||||
var assns1 = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns1 = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
ReadNamespace (r, String.Empty, assns1, "ns#1");
|
||||
ReadNamespace (r, "x", XamlLanguage.Xaml2006Namespace, "ns#2");
|
||||
|
||||
|
@ -3632,7 +3632,7 @@ if (i == 0) {
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ns#1-2");
|
||||
Assert.IsNotNull (r.Namespace, "ns#1-3");
|
||||
Assert.AreEqual ("", r.Namespace.Prefix, "ns#1-4");
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name;
|
||||
var assns = "clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name;
|
||||
Assert.AreEqual (assns, r.Namespace.Namespace, "ns#1-5");
|
||||
|
||||
// t:AttachedWrapper
|
||||
|
@ -3770,7 +3770,7 @@ if (i == 0) {
|
|||
Assert.AreEqual (XamlNodeType.NamespaceDeclaration, r.NodeType, "ct#2");
|
||||
Assert.IsNotNull (r.Namespace, "ct#3");
|
||||
Assert.AreEqual (String.Empty, r.Namespace.Prefix, "ct#3-2");
|
||||
Assert.AreEqual ("clr-namespace:" + obj.GetType ().Namespace + ";assembly=" + obj.GetType ().Assembly.GetName ().Name, r.Namespace.Namespace, "ct#3-3");
|
||||
Assert.AreEqual ("clr-namespace:" + obj.GetType ().Namespace + ";assembly=" + obj.GetType ().GetTypeInfo().Assembly.GetName ().Name, r.Namespace.Namespace, "ct#3-3");
|
||||
|
||||
foreach (var kvp in additionalNamespaces) {
|
||||
Assert.IsTrue (r.Read (), "ct#4." + kvp.Key);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -43,12 +43,12 @@ namespace MonoTests.Portable.Xaml
|
|||
{
|
||||
XamlSchemaContext NewStandardContext ()
|
||||
{
|
||||
return new XamlSchemaContext (new Assembly [] {typeof (XamlSchemaContext).Assembly });
|
||||
return new XamlSchemaContext (new Assembly [] {typeof (XamlSchemaContext).GetTypeInfo().Assembly });
|
||||
}
|
||||
|
||||
XamlSchemaContext NewThisAssemblyContext ()
|
||||
{
|
||||
return new XamlSchemaContext (new Assembly [] {GetType ().Assembly });
|
||||
return new XamlSchemaContext (new Assembly [] {GetType ().GetTypeInfo().Assembly });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -77,7 +77,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
var ctx = new XamlSchemaContext (new Assembly [] {typeof (XamlSchemaContext).Assembly });
|
||||
var ctx = new XamlSchemaContext (new Assembly [] {typeof (XamlSchemaContext).GetTypeInfo().Assembly });
|
||||
Assert.AreEqual (1, ctx.ReferenceAssemblies.Count, "#1");
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void GetXamlTypeAndAllXamlTypes ()
|
||||
{
|
||||
var ctx = new XamlSchemaContext (new Assembly [] {typeof (string).Assembly}); // build with corlib.
|
||||
var ctx = new XamlSchemaContext (new Assembly [] {typeof (string).GetTypeInfo().Assembly }); // build with corlib.
|
||||
Assert.AreEqual (0, ctx.GetAllXamlTypes (XamlLanguage.Xaml2006Namespace).Count (), "#0"); // premise
|
||||
|
||||
var xt = ctx.GetXamlType (typeof (string));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -31,7 +31,6 @@ using Portable.Xaml.Markup;
|
|||
using Portable.Xaml.ComponentModel;
|
||||
using Portable.Xaml;
|
||||
using Portable.Xaml.Schema;
|
||||
using UriTypeConverter = Portable.Xaml.ComponentModel.UriTypeConverter;
|
||||
#else
|
||||
using System.Windows.Markup;
|
||||
using System.ComponentModel;
|
||||
|
@ -40,6 +39,10 @@ using System.Xaml.Schema;
|
|||
#endif
|
||||
|
||||
using CategoryAttribute = NUnit.Framework.CategoryAttribute;
|
||||
#if NETSTANDARD
|
||||
using ISupportInitialize = Portable.Xaml.ComponentModel.ISupportInitialize;
|
||||
using System.ComponentModel;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.Portable.Xaml
|
||||
{
|
||||
|
@ -484,7 +487,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsFalse (t.IsNameValid, "#2"); // see #4
|
||||
Assert.IsFalse (t.IsUnknown, "#3");
|
||||
Assert.AreEqual ("XamlTypeTest+TestClass3", t.Name, "#4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, t.PreferredXamlNamespace, "#5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, t.PreferredXamlNamespace, "#5");
|
||||
Assert.IsNull (t.TypeArguments, "#6");
|
||||
Assert.AreEqual (typeof (TestClass3), t.UnderlyingType, "#7");
|
||||
Assert.IsTrue (t.ConstructionRequiresArguments, "#8");
|
||||
|
@ -521,7 +524,7 @@ namespace MonoTests.Portable.Xaml
|
|||
Assert.IsTrue (t.IsNameValid, "#2");
|
||||
Assert.IsFalse (t.IsUnknown, "#3");
|
||||
Assert.AreEqual ("ArgumentAttributed", t.Name, "#4");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().Assembly.GetName ().Name, t.PreferredXamlNamespace, "#5");
|
||||
Assert.AreEqual ("clr-namespace:MonoTests.Portable.Xaml;assembly=" + GetType ().GetTypeInfo().Assembly.GetName ().Name, t.PreferredXamlNamespace, "#5");
|
||||
Assert.IsNull (t.TypeArguments, "#6");
|
||||
Assert.AreEqual (typeof (ArgumentAttributed), t.UnderlyingType, "#7");
|
||||
Assert.IsTrue (t.ConstructionRequiresArguments, "#8");
|
||||
|
@ -559,8 +562,11 @@ namespace MonoTests.Portable.Xaml
|
|||
public void TypeConverter ()
|
||||
{
|
||||
Assert.IsNull (new XamlType (typeof (List<object>), sctx).TypeConverter, "#1");
|
||||
Assert.IsNull (new XamlType (typeof (Dictionary<object, object>), sctx).TypeConverter, "#1");
|
||||
Assert.IsNotNull (new XamlType (typeof (object), sctx).TypeConverter, "#2");
|
||||
Assert.IsTrue (new XamlType (typeof (Uri), sctx).TypeConverter.ConverterInstance is UriTypeConverter, "#3");
|
||||
#if !WINDOWS_UWP
|
||||
Assert.IsTrue (new XamlType (typeof (Uri), sctx).TypeConverter.ConverterInstance.GetType().Name == "UriTypeConverter", "#3");
|
||||
#endif
|
||||
Assert.IsTrue (new XamlType (typeof (TimeSpan), sctx).TypeConverter.ConverterInstance is TimeSpanConverter, "#4");
|
||||
Assert.IsNull (new XamlType (typeof (XamlType), sctx).TypeConverter, "#5");
|
||||
Assert.IsTrue (new XamlType (typeof (char), sctx).TypeConverter.ConverterInstance is CharConverter, "#6");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -877,7 +877,7 @@ namespace MonoTests.Portable.Xaml
|
|||
public void LocalAssemblyShouldApplyToNamespace()
|
||||
{
|
||||
var settings = new XamlXmlReaderSettings();
|
||||
settings.LocalAssembly = typeof(TestClass1).Assembly;
|
||||
settings.LocalAssembly = typeof(TestClass1).GetTypeInfo().Assembly;
|
||||
string xml = File.ReadAllText(Compat.GetTestFile ("LocalAssembly.xml")).UpdateXml();
|
||||
var obj = XamlServices.Load(new XamlXmlReader(new StringReader(xml), settings));
|
||||
Assert.IsNotNull(obj, "#1");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//
|
||||
//
|
||||
// Copyright (C) 2010 Novell Inc. http://novell.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
|
@ -595,7 +595,7 @@ namespace MonoTests.Portable.Xaml
|
|||
[Test]
|
||||
public void ConstructorArguments ()
|
||||
{
|
||||
string xml = String.Format (@"<?xml version='1.0' encoding='utf-16'?><ArgumentAttributed xmlns='clr-namespace:MonoTests.Portable.Xaml;assembly={0}' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'><x:Arguments><x:String>xxx</x:String><x:String>yyy</x:String></x:Arguments></ArgumentAttributed>", GetType ().Assembly.GetName ().Name);
|
||||
string xml = String.Format (@"<?xml version='1.0' encoding='utf-16'?><ArgumentAttributed xmlns='clr-namespace:MonoTests.Portable.Xaml;assembly={0}' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'><x:Arguments><x:String>xxx</x:String><x:String>yyy</x:String></x:Arguments></ArgumentAttributed>", GetType ().GetTypeInfo().Assembly.GetName ().Name);
|
||||
Assert.IsFalse (sctx.FullyQualifyAssemblyNamesInClrNamespaces, "premise0");
|
||||
var r = new XamlObjectReader (new ArgumentAttributed ("xxx", "yyy"), sctx);
|
||||
var sw = new StringWriter ();
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<Application
|
||||
x:Class="MonoTests.Portable.Xaml.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:MonoTests.Portable.Xaml"
|
||||
RequestedTheme="Light">
|
||||
|
||||
</Application>
|
|
@ -0,0 +1,123 @@
|
|||
// Copyright (c) 2017 Charlie Poole
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace MonoTests.Portable.Xaml
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
|
||||
#if DEBUG
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
this.DebugSettings.EnableFrameRateCounter = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == null)
|
||||
{
|
||||
// Create a Frame to act as the navigation context and navigate to the first page
|
||||
rootFrame = new Frame();
|
||||
rootFrame.Width = double.NaN;
|
||||
rootFrame.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||
rootFrame.Height = double.NaN;
|
||||
rootFrame.VerticalAlignment = VerticalAlignment.Stretch;
|
||||
|
||||
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||
|
||||
Xamarin.Forms.Forms.Init(e);
|
||||
|
||||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
//TODO: Load state from previously suspended application
|
||||
}
|
||||
|
||||
// Place the frame in the current Window
|
||||
Window.Current.Content = rootFrame;
|
||||
}
|
||||
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
||||
}
|
||||
// Ensure the current window is active
|
||||
Window.Current.Activate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when Navigation to a certain page fails
|
||||
/// </summary>
|
||||
/// <param name="sender">The Frame which failed navigation</param>
|
||||
/// <param name="e">Details about the navigation failure</param>
|
||||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when application execution is being suspended. Application state is saved
|
||||
/// without knowing whether the application will be terminated or resumed with the contents
|
||||
/// of memory still intact.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//TODO: Save application state and stop any background activity
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||
<package id="System.Collections.Immutable" version="1.2.0" targetFramework="net45" />
|
||||
<package id="NUnit" version="3.6.1" targetFramework="net45" />
|
||||
<package id="System.Collections.Immutable" version="1.3.1" targetFramework="net462" />
|
||||
<package id="System.Collections.NonGeneric" version="4.3.0" targetFramework="net462" />
|
||||
<package id="System.ComponentModel.Primitives" version="4.3.0" targetFramework="net462" />
|
||||
<package id="System.ComponentModel.TypeConverter" version="4.3.0" targetFramework="net462" />
|
||||
</packages>
|